diff options
Diffstat (limited to 'node')
-rw-r--r-- | node/InetAddress.hpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/node/InetAddress.hpp b/node/InetAddress.hpp index b97e2ca6..2cd4dbd3 100644 --- a/node/InetAddress.hpp +++ b/node/InetAddress.hpp @@ -301,6 +301,19 @@ struct InetAddress : public sockaddr_storage inline unsigned int netmaskBits() const throw() { return port(); } /** + * @return True if netmask bits is valid for the address type + */ + inline bool netmaskBitsValid() const + { + const unsigned int n = port(); + switch(ss_family) { + case AF_INET: return (n <= 32); + case AF_INET6: return (n <= 128); + } + return false; + } + + /** * Alias for port() * * This just aliases port() because for gateways we use this field to |