From: Stephan Bosch Date: Wed, 9 Oct 2019 00:23:30 +0000 (+0200) Subject: iputils.hh: Netmask: Add getSuper() X-Git-Tag: auth-4.3.0-beta2~20^2~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=664140b58da0856d602f3c7bfcaf0ca4839b59e9;p=thirdparty%2Fpdns.git iputils.hh: Netmask: Add getSuper() --- diff --git a/pdns/iputils.hh b/pdns/iputils.hh index 09134e2ad4..9d09df1829 100644 --- a/pdns/iputils.hh +++ b/pdns/iputils.hh @@ -541,6 +541,10 @@ public: Netmask getNormalized() const { return Netmask(getMaskedNetwork(), d_bits); } + //! Get Netmask for super network of this one (i.e. with fewer network bits) + Netmask getSuper(uint8_t bits) const { + return Netmask(d_network, std::min(d_bits, bits)); + } private: ComboAddress d_network; uint32_t d_mask;