From: Fred Morcos Date: Thu, 18 Jul 2024 12:12:20 +0000 (+0200) Subject: Add DNSPacket::setRealRemote: accepts an EDNS Subnet Options Netmask X-Git-Tag: rec-5.2.0-alpha1~156^2~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4d61a4fe9f80e2f7f7ec07d7ee55e2792d11ef66;p=thirdparty%2Fpdns.git Add DNSPacket::setRealRemote: accepts an EDNS Subnet Options Netmask --- diff --git a/pdns/dnspacket.cc b/pdns/dnspacket.cc index 471af2a46e..499fa999f1 100644 --- a/pdns/dnspacket.cc +++ b/pdns/dnspacket.cc @@ -704,6 +704,11 @@ bool DNSPacket::hasValidEDNSCookie() const return d_ednscookievalid; } +void DNSPacket::setRealRemote(const Netmask& netmask) { + d_eso.source = netmask; + d_haveednssubnet = true; +} + Netmask DNSPacket::getRealRemote() const { return d_haveednssubnet ? d_eso.source : Netmask{getInnerRemote()}; diff --git a/pdns/dnspacket.hh b/pdns/dnspacket.hh index 4d2271b80a..a9bd010048 100644 --- a/pdns/dnspacket.hh +++ b/pdns/dnspacket.hh @@ -65,6 +65,7 @@ public: ComboAddress getRemote() const; ComboAddress getInnerRemote() const; // for proxy protocol Netmask getRealRemote() const; + void setRealRemote(const Netmask& netmask); ComboAddress getLocal() const { ComboAddress ca;