diff options
author | Sergey Kandaurov <pluknet@nginx.com> | 2024-03-22 14:53:19 +0400 |
---|---|---|
committer | Sergey Kandaurov <pluknet@nginx.com> | 2024-03-22 14:53:19 +0400 |
commit | bd190d825ceeacf105a2392d88734f21df35d89a (patch) | |
tree | 730fc775cbc1730fbbfe35cf632ff76ca7981b9d /src | |
parent | 04b9bfe55d414bfed8a7aefa3162d81af26532b4 (diff) | |
download | nginx-bd190d825ceeacf105a2392d88734f21df35d89a.tar.gz nginx-bd190d825ceeacf105a2392d88734f21df35d89a.zip |
Stream: the "setfib" parameter of the "listen" directive.
The FreeBSD SO_SETFIB support.
Diffstat (limited to 'src')
-rw-r--r-- | src/stream/ngx_stream.c | 4 | ||||
-rw-r--r-- | src/stream/ngx_stream.h | 3 | ||||
-rw-r--r-- | src/stream/ngx_stream_core_module.c | 19 |
3 files changed, 26 insertions, 0 deletions
diff --git a/src/stream/ngx_stream.c b/src/stream/ngx_stream.c index e0879d092..b6eeb23af 100644 --- a/src/stream/ngx_stream.c +++ b/src/stream/ngx_stream.c @@ -1033,6 +1033,10 @@ ngx_stream_add_listening(ngx_conf_t *cf, ngx_stream_conf_addr_t *addr) ls->ipv6only = addr->opt.ipv6only; #endif +#if (NGX_HAVE_SETFIB) + ls->setfib = addr->opt.setfib; +#endif + #if (NGX_HAVE_TCP_FASTOPEN) ls->fastopen = addr->opt.fastopen; #endif diff --git a/src/stream/ngx_stream.h b/src/stream/ngx_stream.h index 888715888..dc05dc5ba 100644 --- a/src/stream/ngx_stream.h +++ b/src/stream/ngx_stream.h @@ -62,6 +62,9 @@ typedef struct { int rcvbuf; int sndbuf; int type; +#if (NGX_HAVE_SETFIB) + int setfib; +#endif #if (NGX_HAVE_TCP_FASTOPEN) int fastopen; #endif diff --git a/src/stream/ngx_stream_core_module.c b/src/stream/ngx_stream_core_module.c index df08208a7..576a2fb16 100644 --- a/src/stream/ngx_stream_core_module.c +++ b/src/stream/ngx_stream_core_module.c @@ -920,6 +920,9 @@ ngx_stream_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) lsopt.type = SOCK_STREAM; lsopt.rcvbuf = -1; lsopt.sndbuf = -1; +#if (NGX_HAVE_SETFIB) + lsopt.setfib = -1; +#endif #if (NGX_HAVE_TCP_FASTOPEN) lsopt.fastopen = -1; #endif @@ -949,6 +952,22 @@ ngx_stream_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) continue; } +#if (NGX_HAVE_SETFIB) + if (ngx_strncmp(value[i].data, "setfib=", 7) == 0) { + lsopt.setfib = ngx_atoi(value[i].data + 7, value[i].len - 7); + lsopt.set = 1; + lsopt.bind = 1; + + if (lsopt.setfib == NGX_ERROR) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "invalid setfib \"%V\"", &value[i]); + return NGX_CONF_ERROR; + } + + continue; + } +#endif + #if (NGX_HAVE_TCP_FASTOPEN) if (ngx_strncmp(value[i].data, "fastopen=", 9) == 0) { lsopt.fastopen = ngx_atoi(value[i].data + 9, value[i].len - 9); |