]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
iputils.hh: Netmask: Add getSuper()
authorStephan Bosch <stephan.bosch@open-xchange.com>
Wed, 9 Oct 2019 00:23:30 +0000 (02:23 +0200)
committerStephan Bosch <stephan.bosch@open-xchange.com>
Tue, 11 Feb 2020 01:01:47 +0000 (02:01 +0100)
pdns/iputils.hh

index 09134e2ad4457a19daf4b7042a261d8a5b13e510..9d09df18299904b772734956fd0ddb6297d6a23e 100644 (file)
@@ -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;