diff options
author | Simo Sorce <idra@samba.org> | 2011-05-11 17:50:07 -0400 |
---|---|---|
committer | Andreas Schneider <asn@samba.org> | 2011-08-10 18:14:02 +0200 |
commit | 185cd4c79492a7de5988f9407d764cdb3a0e2e10 (patch) | |
tree | 11a50fb6796c1b4412d0e51ce8e48a7e4fde411d /lib | |
parent | e0dc3aa5b61a779b51d4444101e79aefd6b8026e (diff) | |
download | samba-185cd4c79492a7de5988f9407d764cdb3a0e2e10.tar.gz samba-185cd4c79492a7de5988f9407d764cdb3a0e2e10.tar.bz2 samba-185cd4c79492a7de5988f9407d764cdb3a0e2e10.zip |
libutil: use AI_ADDRCONFIG only when AI_NUMERIC is not defined
This flag prevents startup w/o ip addresses assigned to any interface.
If AI_NUMERIC is passed it should be safe to avoid it.
Signed-off-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/util/util_net.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/util/util_net.c b/lib/util/util_net.c index 566bf56e8f..23d25acab9 100644 --- a/lib/util/util_net.c +++ b/lib/util/util_net.c @@ -73,10 +73,9 @@ bool interpret_string_addr_internal(struct addrinfo **ppres, ppres); if (ret) { - DEBUG(3,("interpret_string_addr_internal: getaddrinfo failed " - "for name %s [%s]\n", - str, - gai_strerror(ret) )); + DEBUG(3, ("interpret_string_addr_internal: " + "getaddrinfo failed for name %s (flags %d) [%s]\n", + str, flags, gai_strerror(ret))); return false; } return true; @@ -97,6 +96,7 @@ static bool interpret_string_addr_pref(struct sockaddr_storage *pss, #if defined(HAVE_IPV6) char addr[INET6_ADDRSTRLEN]; unsigned int scope_id = 0; + int int_flags; if (strchr_m(str, ':')) { char *p = strchr_m(str, '%'); @@ -117,7 +117,13 @@ static bool interpret_string_addr_pref(struct sockaddr_storage *pss, zero_sockaddr(pss); - if (!interpret_string_addr_internal(&res, str, flags|AI_ADDRCONFIG)) { + if (flags & AI_NUMERICHOST) { + int_flags = flags; + } else { + int_flags = flags|AI_ADDRCONFIG; + } + + if (!interpret_string_addr_internal(&res, str, int_flags)) { return false; } if (!res) { |