]> granicus.if.org Git - pdns/commitdiff
dnsdist: Fix destination port reporting on "any" binds
authorRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 22 Mar 2017 22:50:38 +0000 (23:50 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 22 Mar 2017 22:50:38 +0000 (23:50 +0100)
Over UDP we call `HarvestDestinationAddress()` to get the real
destination address via `IP_PKTINFO`., but this only sets the destination
address, not the destination port. Therefore since
7cea4e39a78ef981ee461b49bbc193fa9903f56dit the destination port was always
0 when bound to an "any" address.

pdns/dnsdist.cc

index 9e10eea9048dadf9082e7a92251df600c50ddac3..a74b8b25c8825686da3aa82f0082cddfb8076e61 100644 (file)
@@ -1072,7 +1072,11 @@ try
 
       uint16_t len = (uint16_t) ret;
       ComboAddress dest;
-      if (!HarvestDestinationAddress(&msgh, &dest)) {
+      if (HarvestDestinationAddress(&msgh, &dest)) {
+        /* we don't get the port, only the address */
+        dest.sin4.sin_port = cs->local.sin4.sin_port;
+      }
+      else {
         dest.sin4.sin_family = 0;
       }