[nginx] Events: fixed setting of IP_BIND_ADDRESS_NO_PORT/SO_REUSEADDR.

Ruslan Ermilov ru at nginx.com
Mon Aug 22 10:18:15 UTC 2016


details:   http://hg.nginx.org/nginx/rev/7fd6b93face8
branches:  
changeset: 6658:7fd6b93face8
user:      Ruslan Ermilov <ru at nginx.com>
date:      Mon Aug 22 11:40:10 2016 +0300
description:
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.

diffstat:

 src/event/ngx_event_connect.c |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 3d5202c71f94 -r 7fd6b93face8 src/event/ngx_event_connect.c
--- a/src/event/ngx_event_connect.c	Wed Aug 17 11:26:51 2016 +0300
+++ b/src/event/ngx_event_connect.c	Mon Aug 22 11:40:10 2016 +0300
@@ -91,7 +91,7 @@ ngx_event_connect_peer(ngx_peer_connecti
 #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)



More information about the nginx-devel mailing list