From 5d7557e313c6d3060d4d3b26f9ef653a9544923e Mon Sep 17 00:00:00 2001 From: Stephan Bosch Date: Mon, 30 Sep 2019 10:30:24 +0200 Subject: [PATCH] iputils.hh: Netmask: Add getAddressBits() --- pdns/iputils.hh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pdns/iputils.hh b/pdns/iputils.hh index 245beccab7..f85355e397 100644 --- a/pdns/iputils.hh +++ b/pdns/iputils.hh @@ -590,6 +590,12 @@ public: Netmask getSuper(uint8_t bits) const { return Netmask(d_network, std::min(d_bits, bits)); } + + //! Get the total number of address bits for this netmask (either 32 or 128 depending on IP version) + uint8_t getAddressBits() const + { + return d_network.getBits(); + } private: ComboAddress d_network; uint32_t d_mask; -- 2.47.2