diff options
author | Ruslan Ermilov <ru@nginx.com> | 2013-08-05 10:55:59 +0400 |
---|---|---|
committer | Ruslan Ermilov <ru@nginx.com> | 2013-08-05 10:55:59 +0400 |
commit | 7c6971cff3de85e50c9fcda45eaa50d788dc86e5 (patch) | |
tree | f8d6a64cfb7ef1becad73a1ed4d991b6037b8fd5 /src/core/ngx_inet.c | |
parent | 3086ab2996403fbb4cf6525986e00e4a521ada1e (diff) | |
download | nginx-7c6971cff3de85e50c9fcda45eaa50d788dc86e5.tar.gz nginx-7c6971cff3de85e50c9fcda45eaa50d788dc86e5.zip |
Core: only resolve address families configured on the local system.
This is done by passing AI_ADDRCONFIG to getaddrinfo().
On Linux, setting net.ipv6.conf.all.disable_ipv6 to 1 will now be
respected.
On FreeBSD, AI_ADDRCONFIG filtering is currently implemented by
attempting to create a datagram socket for the corresponding family,
which succeeds even if the system doesn't in fact have any addresses
of that family configured. That is, if the system with IPv6 support
in the kernel doesn't have IPv6 addresses configured, AI_ADDRCONFIG
will filter out IPv6 only inside a jail without IPv6 addresses or
with IPv6 disabled.
Diffstat (limited to 'src/core/ngx_inet.c')
-rw-r--r-- | src/core/ngx_inet.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/core/ngx_inet.c b/src/core/ngx_inet.c index 5dca72bc2..2b5c94c00 100644 --- a/src/core/ngx_inet.c +++ b/src/core/ngx_inet.c @@ -963,6 +963,7 @@ ngx_inet_resolve_host(ngx_pool_t *pool, ngx_url_t *u) ngx_memzero(&hints, sizeof(struct addrinfo)); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; + hints.ai_flags = AI_ADDRCONFIG; if (getaddrinfo((char *) host, NULL, &hints, &res) != 0) { u->err = "host not found"; |