From: Bert Hubert Date: Mon, 14 Feb 2011 14:57:11 +0000 (+0000) Subject: fix up printing of %eth0 scope in ComboAddress::toStringWithPort X-Git-Tag: auth-3.0~230 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=506a9050f0de15d99fa338cc2819b1918a805f0c;p=thirdparty%2Fpdns.git fix up printing of %eth0 scope in ComboAddress::toStringWithPort git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@2018 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/iputils.hh b/pdns/iputils.hh index 3af1dacda2..8e840c2730 100644 --- a/pdns/iputils.hh +++ b/pdns/iputils.hh @@ -32,6 +32,9 @@ #include #include "ahuexception.hh" #include "misc.hh" +#include +#include + #include #include #include @@ -158,14 +161,10 @@ union ComboAddress { string toString() const { - char tmp[128]; - if(sin4.sin_family==AF_INET && !Utility::inet_ntop(AF_INET, ( const char * ) &sin4.sin_addr, tmp, sizeof(tmp))) - return tmp; - - if(sin4.sin_family==AF_INET6 && !Utility::inet_ntop(AF_INET6, ( const char * ) &sin6.sin6_addr, tmp, sizeof(tmp))) - return tmp; + char host[1024]; + getnameinfo((struct sockaddr*) this, getSocklen(), host, sizeof(host),0, 0, NI_NUMERICHOST); - return tmp; + return host; } string toStringWithPort() const diff --git a/pdns/nameserver.cc b/pdns/nameserver.cc index d6c3203f12..5c71b52e63 100644 --- a/pdns/nameserver.cc +++ b/pdns/nameserver.cc @@ -156,7 +156,7 @@ void UDPNameserver::bindIPv6() } d_highfd=max(s,d_highfd); d_sockets.push_back(s); - L<