Welcome! Log In Create A New Profile

Advanced

[nginx] Core: guard use of AI_ADDRCONFIG.

Ruslan Ermilov
August 05, 2013 05:48AM
details: http://hg.nginx.org/nginx/rev/0300d97c6084
branches:
changeset: 5314:0300d97c6084
user: Ruslan Ermilov <ru@nginx.com>
date: Mon Aug 05 13:44:56 2013 +0400
description:
Core: guard use of AI_ADDRCONFIG.

Some systems (notably NetBSD and OpenBSD) lack AI_ADDRCONFIG support.

Reported by Piotr Sikora.

diffstat:

auto/unix | 8 ++------
src/core/ngx_inet.c | 2 ++
2 files changed, 4 insertions(+), 6 deletions(-)

diffs (30 lines):

diff -r 1fe5f7fb6ced -r 0300d97c6084 auto/unix
--- a/auto/unix Mon Aug 05 11:40:33 2013 +0400
+++ b/auto/unix Mon Aug 05 13:44:56 2013 +0400
@@ -788,11 +788,7 @@ ngx_feature_incs="#include <sys/types.h>
#include <netdb.h>"
ngx_feature_path=
ngx_feature_libs=
-ngx_feature_test='struct addrinfo hints, *res;
- hints.ai_family = AF_UNSPEC;
- hints.ai_socktype = SOCK_STREAM;
- hints.ai_flags = AI_ADDRCONFIG;
- if (getaddrinfo("localhost", NULL, &hints, &res) != 0)
- return 1;
+ngx_feature_test='struct addrinfo *res;
+ if (getaddrinfo("localhost", NULL, NULL, &res) != 0) return 1;
freeaddrinfo(res)'
. auto/feature
diff -r 1fe5f7fb6ced -r 0300d97c6084 src/core/ngx_inet.c
--- a/src/core/ngx_inet.c Mon Aug 05 11:40:33 2013 +0400
+++ b/src/core/ngx_inet.c Mon Aug 05 13:44:56 2013 +0400
@@ -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

[nginx] Core: guard use of AI_ADDRCONFIG.

Ruslan Ermilov 715 August 05, 2013 05:48AM



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

Online Users

Guests: 157
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