From: Remi Gacogne Date: Wed, 22 Mar 2017 22:50:38 +0000 (+0100) Subject: dnsdist: Fix destination port reporting on "any" binds X-Git-Tag: rec-4.1.0-alpha1~185^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0c909af839d8891df2f8efd6c1884466c3f79e82;p=pdns dnsdist: Fix destination port reporting on "any" binds 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. --- diff --git a/pdns/dnsdist.cc b/pdns/dnsdist.cc index 9e10eea90..a74b8b25c 100644 --- a/pdns/dnsdist.cc +++ b/pdns/dnsdist.cc @@ -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; }