Opened 7 years ago

Last modified 10 months ago

#1279 new enhancement

Implement FIB selection for upstream connections in proxy and stream modules.

Reported by: Sergey Akhmatov Owned by:
Priority: minor Milestone:
Component: nginx-module Version: 1.11.x
Keywords: setfib Cc:
uname -a:
nginx -V: nginx version: nginx/1.12.0
built with OpenSSL 1.0.1s-freebsd 1 Mar 2016
TLS SNI support enabled
configure arguments: --prefix=/usr/local/etc/nginx --with-cc-opt='-I /usr/local/include' --with-ld-opt='-L /usr/local/lib' --conf-path=/usr/local/etc/nginx/nginx.conf --sbin-path=/usr/local/sbin/nginx --pid-path=/var/run/nginx.pid --error-log-path=/var/log/nginx/error.log --user=www --group=www --modules-path=/usr/local/libexec/nginx --with-file-aio --http-client-body-temp-path=/var/
tmp/nginx/client_body_temp --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi_temp --http-proxy-temp-path=/var/tmp/nginx/proxy_temp --http-scgi-temp-path=/var/tmp/nginx/scgi_temp --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi_temp --http-log-path=/var/log/nginx/access.log --with-http_addition_module --add-dynamic-module=/wrkdirs/usr/ports/www/nginx/work/nginx-auth-ldap-dbcef31 --with-http_
auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gzip_static_module --with-http_gunzip_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_stub_status_module --with-http_sub_module --with-pcre --with-http_v2_module --with-stream=dynamic --with-stream_ss
l_module --with-stream_ssl_preread_module --with-threads --with-mail=dynamic --without-mail_imap_module --without-mail_pop3_module --without-mail_smtp_module --with-mail_ssl_module --with-http_ssl_module

Description

It is possible to set alternative fib for listening sockets via "setfib" option in "listen" directives.
It would be convenient to have similar functionality for outgoing connections in ngx_http_proxy_module and ngx_stream_proxy_module.

Change History (2)

comment:1 by maxim, 6 years ago

Milestone: 1.13

Ticket retargeted after milestone closed

comment:2 by Yury Pavlov, 10 months ago

I'm about to implement this per-socket FIB selection on FreeBSD for upstream connections and for stream and, possibly, mail listening sockets.

For upstream connections I'm going to add proxy_socket_setfib directive.

Example config snippet:

location /proxy-site/ {
    proxy_pass http://...;
    proxy_socket_setfib 2;
}

Possible SETFIB values are non-negative numbers, incl. 0, less than 16 (on current FreeBSD versions)

But I'm not sure how to represent default value for this directive. The default value designates no SETFIB socket option is applied, default fib for the process is used.

There are two variants:

Syntax: proxy_socket_setfib number;
Default: proxy_socket_setfib -1;

Syntax: proxy_socket_setfib default | number;
Default: proxy_socket_setfib default;

First one with -1 is simpler, but -1 is not usual default value for nginx directives, moreover it's equal to NGX_CONF_UNSET

Note: See TracTickets for help on using tickets.