Events: fixed setting of IP_BIND_ADDRESS_NO_PORT/SO_REUSEADDR.

The IP_BIND_ADDRESS_NO_PORT option is set on upstream sockets
if proxy_bind does not specify a port.  The SO_REUSEADDR option
is set on UDP upstream sockets if proxy_bind specifies a port.

Due to checking of the wrong port, IP_BIND_ADDRESS_NO_PORT was
never set, and SO_REUSEPORT was always set.
This commit is contained in:
Ruslan Ermilov 2016-08-22 11:40:10 +03:00
parent b83431f900
commit d40e8e1625

View file

@ -91,7 +91,7 @@ ngx_event_connect_peer(ngx_peer_connection_t *pc)
#endif
#if (NGX_HAVE_IP_BIND_ADDRESS_NO_PORT || NGX_LINUX)
port = ngx_inet_get_port(pc->sockaddr);
port = ngx_inet_get_port(pc->local->sockaddr);
#endif
#if (NGX_HAVE_IP_BIND_ADDRESS_NO_PORT)