]> granicus.if.org Git - pdns/commitdiff
Add configuration option to disable IP_BIND_ADDRESS_NO_PORT.
authorDan McCombs <dmccombs@dyn.com>
Mon, 30 Oct 2017 22:50:55 +0000 (18:50 -0400)
committerDan McCombs <dmccombs@dyn.com>
Mon, 30 Oct 2017 22:50:55 +0000 (18:50 -0400)
pdns/dnsdist-lua.cc
pdns/dnsdist-tcp.cc
pdns/dnsdist.hh
pdns/dnsdistdist/docs/reference/config.rst

index 64f9e54a5e38299153c9ac79700afddfb976635e..9ddb588e62b38585c3a364b07cfa48936702979a 100644 (file)
@@ -477,6 +477,10 @@ vector<std::function<void(void)>> setupLua(bool client, const std::string& confi
                          ret->useECS=boost::get<bool>(vars["useClientSubnet"]);
                        }
 
+                       if(vars.count("ipBindAddrNoPort")) {
+                         ret->ipBindAddrNoPort=boost::get<bool>(vars["ipBindAddrNoPort"]);
+                       }
+
                        if(vars.count("maxCheckFailures")) {
                          ret->maxCheckFailures=std::stoi(boost::get<string>(vars["maxCheckFailures"]));
                        }
index 6c3d3e02b9c193211506936eda509d2fdce5ed73..e74ac4a398763d99b4fa14e85a6ca2993eaf7b3b 100644 (file)
@@ -56,7 +56,9 @@ static int setupTCPDownstream(shared_ptr<DownstreamState> ds, uint16_t& downstre
       if (!IsAnyAddress(ds->sourceAddr)) {
         SSetsockopt(sock, SOL_SOCKET, SO_REUSEADDR, 1);
 #ifdef IP_BIND_ADDRESS_NO_PORT
-        SSetsockopt(sock, SOL_IP, IP_BIND_ADDRESS_NO_PORT, 1);
+        if (ds->ipBindAddrNoPort) {
+          SSetsockopt(sock, SOL_IP, IP_BIND_ADDRESS_NO_PORT, 1);
+        }
 #endif
         SBind(sock, ds->sourceAddr);
       }
index f745904b24906c92cf3c68a2b166d2c956f99e26..c9ff9bb5a6fd54801eea0a4e7a03151e1af018d9 100644 (file)
@@ -631,6 +631,7 @@ struct DownstreamState
   bool setCD{false};
   std::atomic<bool> connected{false};
   bool tcpFastOpen{false};
+  bool ipBindAddrNoPort{true};
   bool isUp() const
   {
     if(availability == Availability::Down)
index 049788874ddedfa5d7005e7e793533239005c048..cb167e78c017953a8ab4106cf7b0ca35abf9bff6 100644 (file)
@@ -224,6 +224,7 @@ Servers
       tcpSendTimeout=NUM,    -- The timeout (in seconds) of a TCP write attempt
       tcpRecvTimeout=NUM,    -- The timeout (in seconds) of a TCP read attempt
       tcpFastOpen=BOOL,      -- Whether to enable TCP Fast Open
+      ipBindAddrNoPort=BOOL, -- Whether to enable IP Bind Address No Port
       name=STRING,           -- The name associated to this backend, for display purpose
       checkName=STRING,      -- Use STRING as QNAME in the health-check query, default: "a.root-servers.net."
       checkType=STRING,      -- Use STRING as QTYPE in the health-check query, default: "A"