From: Mark Zealey Date: Mon, 2 Dec 2013 08:02:28 +0000 (+0200) Subject: This patch allows user to specify that socket binding can fail. On IPv4 there X-Git-Tag: rec-3.6.0-rc1~265^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ecb288571079792e8fc7a85101c9605365eb087;p=thirdparty%2Fpdns.git This patch allows user to specify that socket binding can fail. On IPv4 there is a ip_nonlocal_bind sysctl that can be set, however for IPv6 there is not this call and it is unlikely to be implemented kernel-side. Fixes PowerDNS/pdns#344 --- diff --git a/pdns/common_startup.cc b/pdns/common_startup.cc index eb75054918..ad9e26b33f 100644 --- a/pdns/common_startup.cc +++ b/pdns/common_startup.cc @@ -53,7 +53,9 @@ void declareArguments() ::arg().set("urlredirector","Where we send hosts to that need to be url redirected")="127.0.0.1"; ::arg().set("smtpredirector","Our smtpredir MX host")="a.misconfigured.powerdns.smtp.server"; ::arg().set("local-address","Local IP addresses to which we bind")="0.0.0.0"; + ::arg().setSwitch("local-address-nonexist-fail","Fail to start if one or more of the local-address's do not exist on this server")="yes"; ::arg().set("local-ipv6","Local IP address to which we bind")=""; + ::arg().setSwitch("local-ipv6-nonexist-fail","Fail to start if one or more of the local-ipv6 addresses do not exist on this server")="yes"; ::arg().set("query-local-address","Source IP address for sending queries")="0.0.0.0"; ::arg().set("query-local-address6","Source IPv6 address for sending queries")="::"; ::arg().set("overload-queue-length","Maximum queuelength moving to packetcache only")="0"; diff --git a/pdns/nameserver.cc b/pdns/nameserver.cc index c5b0bb0365..7905576952 100644 --- a/pdns/nameserver.cc +++ b/pdns/nameserver.cc @@ -126,8 +126,13 @@ void UDPNameserver::bindIPv4() g_localaddresses.push_back(locala); if(::bind(s, (sockaddr*)&locala, locala.getSocklen()) < 0) { - L<