From 664140b58da0856d602f3c7bfcaf0ca4839b59e9 Mon Sep 17 00:00:00 2001 From: Stephan Bosch Date: Wed, 9 Oct 2019 02:23:30 +0200 Subject: [PATCH] iputils.hh: Netmask: Add getSuper() --- pdns/iputils.hh | 4 ++++ 1 file changed, 4 insertions(+) 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; -- 2.47.2