Modules compatibility: removed unneeded IPV6_V6ONLY checks.

The IPV6_V6ONLY macro is now checked only while parsing appropriate flag
and when using the macro.

The ipv6only field in listen structures is always initialized to 1,
even if not supported on a given platform.  This is expected to prevent
a module compiled without IPV6_V6ONLY from accidentally creating dual
sockets if loaded into main binary with proper IPV6_V6ONLY support.
This commit is contained in:
Maxim Dounin 2016-10-03 15:58:25 +03:00
parent a7f80ec354
commit 0a961a0917
11 changed files with 10 additions and 14 deletions

View File

@ -66,7 +66,7 @@ struct ngx_listening_s {
unsigned addr_ntop:1;
unsigned wildcard:1;
#if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
#if (NGX_HAVE_INET6)
unsigned ipv6only:1;
#endif
#if (NGX_HAVE_REUSEPORT)

View File

@ -71,11 +71,7 @@
#define NGX_MODULE_SIGNATURE_8 "0"
#endif
#if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
#define NGX_MODULE_SIGNATURE_9 "1"
#else
#define NGX_MODULE_SIGNATURE_9 "0"
#endif
#if (NGX_HAVE_REUSEPORT)
#define NGX_MODULE_SIGNATURE_10 "1"

View File

@ -1756,7 +1756,7 @@ ngx_http_add_listening(ngx_conf_t *cf, ngx_http_conf_addr_t *addr)
ls->deferred_accept = addr->opt.deferred_accept;
#endif
#if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
#if (NGX_HAVE_INET6)
ls->ipv6only = addr->opt.ipv6only;
#endif

View File

@ -3939,7 +3939,7 @@ ngx_http_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
lsopt.fastopen = -1;
#endif
lsopt.wildcard = u.wildcard;
#if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
#if (NGX_HAVE_INET6)
lsopt.ipv6only = 1;
#endif

View File

@ -69,7 +69,7 @@ typedef struct {
unsigned ssl:1;
#endif
unsigned http2:1;
#if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
#if (NGX_HAVE_INET6)
unsigned ipv6only:1;
#endif
#if (NGX_HAVE_REUSEPORT)

View File

@ -341,7 +341,7 @@ ngx_mail_optimize_servers(ngx_conf_t *cf, ngx_array_t *ports)
ls->keepcnt = addr[i].opt.tcp_keepcnt;
#endif
#if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
#if (NGX_HAVE_INET6)
ls->ipv6only = addr[i].opt.ipv6only;
#endif

View File

@ -38,7 +38,7 @@ typedef struct {
#if (NGX_MAIL_SSL)
unsigned ssl:1;
#endif
#if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
#if (NGX_HAVE_INET6)
unsigned ipv6only:1;
#endif
unsigned so_keepalive:2;

View File

@ -353,7 +353,7 @@ ngx_mail_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
ls->wildcard = u.wildcard;
ls->ctx = cf->ctx;
#if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
#if (NGX_HAVE_INET6)
ls->ipv6only = 1;
#endif

View File

@ -506,7 +506,7 @@ ngx_stream_optimize_servers(ngx_conf_t *cf, ngx_array_t *ports)
ls->keepcnt = addr[i].opt.tcp_keepcnt;
#endif
#if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
#if (NGX_HAVE_INET6)
ls->ipv6only = addr[i].opt.ipv6only;
#endif

View File

@ -52,7 +52,7 @@ typedef struct {
#if (NGX_STREAM_SSL)
unsigned ssl:1;
#endif
#if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
#if (NGX_HAVE_INET6)
unsigned ipv6only:1;
#endif
#if (NGX_HAVE_REUSEPORT)

View File

@ -624,7 +624,7 @@ ngx_stream_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
ls->wildcard = u.wildcard;
ls->ctx = cf->ctx;
#if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
#if (NGX_HAVE_INET6)
ls->ipv6only = 1;
#endif