where it is otherwise always disabled.
* include/ap_listen.h: Define AP_LISTEN_V6ONLY.
* server/listen.c (make_sock): Set v6only_setting to 1 if
AP_LISTEN_V6ONLY flag is set for the listener.
(parse_listen_flags): Parse "v6only" flag.
PR: 54878
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@
1879106 13f79535-47bb-0310-9956-
ffa450edef68
the connection inside mod_ssl. [Joe Orton]
*) core: Add optional "options=" argument to Listen. Supported
- keywords are "freebind" and "reuseport". PR 61865.
+ keywords are "freebind", "reuseport" and "v6only". PR 61865.
[Jan Kaluza, Lubos Uhliarik <luhliari redhat.com>, Joe Orton]
*) config: Allow for environment variable substitution with default value,
<li><code>reuseport</code>: The <code>SO_REUSEPORT</code> socket
option is enabled, allowing a Listen directive to bind to a port
which may already be in use by another process.</li>
+
+ <li><code>v6only</code>: The <code>IPV6_V6ONLY</code> socket
+ option is enabled, allowing a Listen directive to bind to an
+ IPv6 address without also accepting connections via IPv4, or
+ conflicting with a Listen directive using an IPv4 address bound
+ to the same port. (If the server is built with IPv4-mapped
+ addresses <em>disabled</em>, this is the default behaviour and
+ this option has no effect.)</li>
</ul>
<note><title>Error condition</title>
#define AP_LISTEN_SPECIFIC_ERRORS (0x0001)
#define AP_LISTEN_FREEBIND (0x0002)
#define AP_LISTEN_REUSEPORT (0x0004)
+#define AP_LISTEN_V6ONLY (0x0008)
/**
* @brief Apache's listeners record.
int one = 1;
#if APR_HAVE_IPV6
#ifdef AP_ENABLE_V4_MAPPED
- int v6only_setting = 0;
+ int v6only_setting = (server->flags & AP_LISTEN_V6ONLY) ? 1 : 0;
#else
int v6only_setting = 1;
#endif
flags |= AP_LISTEN_FREEBIND;
else if (ap_cstr_casecmp(token, "reuseport") == 0)
flags |= AP_LISTEN_REUSEPORT;
+ else if (ap_cstr_casecmp(token, "v6only") == 0)
+ flags |= AP_LISTEN_V6ONLY;
else
return apr_psprintf(temp_pool, "Unknown Listen option '%s' in '%s'",
token, arg);