comparison src/event/ngx_event_connect.c @ 6658:7fd6b93face8

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.
author Ruslan Ermilov <ru@nginx.com>
date Mon, 22 Aug 2016 11:40:10 +0300
parents e778fe9a4463
children 56fc55e32f23
comparison
equal deleted inserted replaced
6657:3d5202c71f94 6658:7fd6b93face8
89 } 89 }
90 } 90 }
91 #endif 91 #endif
92 92
93 #if (NGX_HAVE_IP_BIND_ADDRESS_NO_PORT || NGX_LINUX) 93 #if (NGX_HAVE_IP_BIND_ADDRESS_NO_PORT || NGX_LINUX)
94 port = ngx_inet_get_port(pc->sockaddr); 94 port = ngx_inet_get_port(pc->local->sockaddr);
95 #endif 95 #endif
96 96
97 #if (NGX_HAVE_IP_BIND_ADDRESS_NO_PORT) 97 #if (NGX_HAVE_IP_BIND_ADDRESS_NO_PORT)
98 98
99 if (pc->sockaddr->sa_family != AF_UNIX && port == 0) { 99 if (pc->sockaddr->sa_family != AF_UNIX && port == 0) {