From: bert hubert Date: Tue, 11 Jun 2013 18:47:37 +0000 (+0200) Subject: remove the last gethostbyname() call that is in use. No need to merge into rel/auth... X-Git-Tag: rec-3.6.0-rc1~677 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f929cdb2b5378aca0cecae477151ed631cd2a85c;p=thirdparty%2Fpdns.git remove the last gethostbyname() call that is in use. No need to merge into rel/auth-3.3. --- diff --git a/pdns/nameserver.cc b/pdns/nameserver.cc index a343dfd02d..95dbd3f7dd 100644 --- a/pdns/nameserver.cc +++ b/pdns/nameserver.cc @@ -114,26 +114,18 @@ void UDPNameserver::bindIPv4() if(localname=="0.0.0.0") { int val=1; setsockopt(s, IPPROTO_IP, GEN_IP_PKTINFO, &val, sizeof(val)); - locala.sin4.sin_addr.s_addr = INADDR_ANY; - } - else - { - struct hostent *h=0; - h=gethostbyname(localname.c_str()); - if(!h) - throw AhuException("Unable to resolve local address"); - - locala.sin4.sin_addr.s_addr=*(int*)h->h_addr; } + locala=ComboAddress(localname, ::arg().asNum("local-port")); + if(locala.sin4.sin_family != AF_INET) + throw AhuException("Attempting to bind IPv4 socket to IPv6 address"); - locala.sin4.sin_port=htons(::arg().asNum("local-port")); g_localaddresses.push_back(locala); if(::bind(s, (sockaddr*)&locala, locala.getSocklen()) < 0) { - L<(ntohs(locala.sin4.sin_port))+": "<