[nginx] svn commit: r4772 - in trunk/src: core http mail

ru at nginx.com ru at nginx.com
Mon Jul 30 12:27:06 UTC 2012


Author: ru
Date: 2012-07-30 12:27:06 +0000 (Mon, 30 Jul 2012)
New Revision: 4772
URL: http://trac.nginx.org/nginx/changeset/4772/nginx

Log:
Core: ipv6only is now on by default.

There is a general consensus that this change results in better
consistency between different operating systems and differently
tuned operating systems.

Note: this changes the width and meaning of the ipv6only field
of the ngx_listening_t structure.  3rd party modules that create
their own listening sockets might need fixing.


Modified:
   trunk/src/core/ngx_connection.c
   trunk/src/core/ngx_connection.h
   trunk/src/http/ngx_http_core_module.c
   trunk/src/http/ngx_http_core_module.h
   trunk/src/mail/ngx_mail.h
   trunk/src/mail/ngx_mail_core_module.c

Modified: trunk/src/core/ngx_connection.c
===================================================================
--- trunk/src/core/ngx_connection.c	2012-07-30 11:42:03 UTC (rev 4771)
+++ trunk/src/core/ngx_connection.c	2012-07-30 12:27:06 UTC (rev 4772)
@@ -336,10 +336,10 @@
 
 #if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
 
-            if (ls[i].sockaddr->sa_family == AF_INET6 && ls[i].ipv6only) {
+            if (ls[i].sockaddr->sa_family == AF_INET6) {
                 int  ipv6only;
 
-                ipv6only = (ls[i].ipv6only == 1);
+                ipv6only = ls[i].ipv6only;
 
                 if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY,
                                (const void *) &ipv6only, sizeof(int))

Modified: trunk/src/core/ngx_connection.h
===================================================================
--- trunk/src/core/ngx_connection.h	2012-07-30 11:42:03 UTC (rev 4771)
+++ trunk/src/core/ngx_connection.h	2012-07-30 12:27:06 UTC (rev 4772)
@@ -64,7 +64,7 @@
     unsigned            addr_ntop:1;
 
 #if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
-    unsigned            ipv6only:2;
+    unsigned            ipv6only:1;
 #endif
     unsigned            keepalive:2;
 

Modified: trunk/src/http/ngx_http_core_module.c
===================================================================
--- trunk/src/http/ngx_http_core_module.c	2012-07-30 11:42:03 UTC (rev 4771)
+++ trunk/src/http/ngx_http_core_module.c	2012-07-30 12:27:06 UTC (rev 4772)
@@ -3912,6 +3912,9 @@
     lsopt.setfib = -1;
 #endif
     lsopt.wildcard = u.wildcard;
+#if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
+    lsopt.ipv6only = 1;
+#endif
 
     (void) ngx_sock_ntop(&lsopt.u.sockaddr, lsopt.addr,
                          NGX_SOCKADDR_STRLEN, 1);
@@ -4031,7 +4034,7 @@
                     lsopt.ipv6only = 1;
 
                 } else if (ngx_strcmp(&value[n].data[10], "ff") == 0) {
-                    lsopt.ipv6only = 2;
+                    lsopt.ipv6only = 0;
 
                 } else {
                     ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,

Modified: trunk/src/http/ngx_http_core_module.h
===================================================================
--- trunk/src/http/ngx_http_core_module.h	2012-07-30 11:42:03 UTC (rev 4771)
+++ trunk/src/http/ngx_http_core_module.h	2012-07-30 12:27:06 UTC (rev 4772)
@@ -76,7 +76,7 @@
     unsigned                   ssl:1;
 #endif
 #if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
-    unsigned                   ipv6only:2;
+    unsigned                   ipv6only:1;
 #endif
     unsigned                   so_keepalive:2;
 

Modified: trunk/src/mail/ngx_mail.h
===================================================================
--- trunk/src/mail/ngx_mail.h	2012-07-30 11:42:03 UTC (rev 4771)
+++ trunk/src/mail/ngx_mail.h	2012-07-30 12:27:06 UTC (rev 4772)
@@ -39,7 +39,7 @@
     unsigned                ssl:1;
 #endif
 #if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
-    unsigned                ipv6only:2;
+    unsigned                ipv6only:1;
 #endif
     unsigned                so_keepalive:2;
 #if (NGX_HAVE_KEEPALIVE_TUNABLE)
@@ -100,7 +100,7 @@
     unsigned                ssl:1;
 #endif
 #if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
-    unsigned                ipv6only:2;
+    unsigned                ipv6only:1;
 #endif
     unsigned                so_keepalive:2;
 #if (NGX_HAVE_KEEPALIVE_TUNABLE)

Modified: trunk/src/mail/ngx_mail_core_module.c
===================================================================
--- trunk/src/mail/ngx_mail_core_module.c	2012-07-30 11:42:03 UTC (rev 4771)
+++ trunk/src/mail/ngx_mail_core_module.c	2012-07-30 12:27:06 UTC (rev 4772)
@@ -374,6 +374,10 @@
     ls->wildcard = u.wildcard;
     ls->ctx = cf->ctx;
 
+#if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
+    ls->ipv6only = 1;
+#endif
+
     for (m = 0; ngx_modules[m]; m++) {
         if (ngx_modules[m]->type != NGX_MAIL_MODULE) {
             continue;
@@ -413,7 +417,7 @@
                     ls->ipv6only = 1;
 
                 } else if (ngx_strcmp(&value[i].data[10], "ff") == 0) {
-                    ls->ipv6only = 2;
+                    ls->ipv6only = 0;
 
                 } else {
                     ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,



More information about the nginx-devel mailing list