Welcome! Log In Create A New Profile

Advanced

[PATCH] Core: guard use of AI_ADDRCONFIG

Piotr Sikora
August 05, 2013 03:46AM
# HG changeset patch
# User Piotr Sikora <piotr@cloudflare.com>
# Date 1375688648 0
# Mon Aug 05 07:44:08 2013 +0000
# Node ID c9e0a2f54810335ba91b86fdb92ef63571680dae
# Parent ec8594b9bf11de3599af15de8e73e41bf7a8b42c
Core: guard use of AI_ADDRCONFIG.

AI_ADDRCONFIG is not available on all operating systems (e.g. OpenBSD)
and using it without a guard results in dropped getaddrinfo() support.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>

diff -r ec8594b9bf11 -r c9e0a2f54810 auto/unix
--- a/auto/unix Mon Aug 05 10:55:59 2013 +0400
+++ b/auto/unix Mon Aug 05 07:44:08 2013 +0000
@@ -791,7 +791,9 @@ ngx_feature_libs=
ngx_feature_test='struct addrinfo hints, *res;
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
+ #ifdef AI_ADDRCONFIG
hints.ai_flags = AI_ADDRCONFIG;
+ #endif
if (getaddrinfo("localhost", NULL, &hints, &res) != 0)
return 1;
freeaddrinfo(res)'
diff -r ec8594b9bf11 -r c9e0a2f54810 src/core/ngx_inet.c
--- a/src/core/ngx_inet.c Mon Aug 05 10:55:59 2013 +0400
+++ b/src/core/ngx_inet.c Mon Aug 05 07:44:08 2013 +0000
@@ -963,7 +963,9 @@ ngx_inet_resolve_host(ngx_pool_t *pool,
ngx_memzero(&hints, sizeof(struct addrinfo));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
+#ifdef AI_ADDRCONFIG
hints.ai_flags = AI_ADDRCONFIG;
+#endif

if (getaddrinfo((char *) host, NULL, &hints, &res) != 0) {
u->err = "host not found";

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] Core: guard use of AI_ADDRCONFIG

Piotr Sikora 1009 August 05, 2013 03:46AM

Re: [PATCH] Core: guard use of AI_ADDRCONFIG

Ruslan Ermilov 449 August 05, 2013 05:30AM

Re: [PATCH] Core: guard use of AI_ADDRCONFIG

Piotr Sikora 465 August 05, 2013 05:40AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 174
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready