[nginx] Generate error for unsupported IPv6 transparent proxy.

Roman Arutyunyan arut at nginx.com
Thu Feb 22 17:06:41 UTC 2018


details:   http://hg.nginx.org/nginx/rev/8b70d4caa505
branches:  
changeset: 7217:8b70d4caa505
user:      Roman Arutyunyan <arut at nginx.com>
date:      Thu Feb 22 13:16:21 2018 +0300
description:
Generate error for unsupported IPv6 transparent proxy.

On some platforms (for example, Linux with glibc 2.12-2.25) IPv4 transparent
proxying is available, but IPv6 transparent proxying is not.  The entire feature
is enabled in this case and NGX_HAVE_TRANSPARENT_PROXY macro is set to 1.
Previously, an attempt to enable transparency for an IPv6 socket was silently
ignored in this case and was usually followed by a bind(2) EADDRNOTAVAIL error
(ticket #1487).  Now the error is generated for unavailable IPv6 transparent
proxy.

diffstat:

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

diffs (20 lines):

diff -r aa60f5799a4c -r 8b70d4caa505 src/event/ngx_event_connect.c
--- a/src/event/ngx_event_connect.c	Thu Feb 22 12:42:29 2018 +0300
+++ b/src/event/ngx_event_connect.c	Thu Feb 22 13:16:21 2018 +0300
@@ -388,7 +388,16 @@ ngx_event_connect_set_transparent(ngx_pe
             return NGX_ERROR;
         }
 
+#else
+
+        ngx_log_error(NGX_LOG_ALERT, pc->log, 0,
+                      "could not enable transparent proxying for IPv6 "
+                      "on this platform");
+
+        return NGX_ERROR;
+
 #endif
+
         break;
 
 #endif /* NGX_HAVE_INET6 */


More information about the nginx-devel mailing list