diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2016-08-15 18:49:50 -0700 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2016-08-15 18:49:50 -0700 |
commit | bd15262e5459c6003e54bcfd1d98966ff6bd1f97 (patch) | |
tree | 0394061608856c2597622e75e3c55a2a0eb615a9 /node | |
parent | 3cb2e1197ff7ba1371ae69a09e631a7b87a880bc (diff) | |
download | infinitytier-bd15262e5459c6003e54bcfd1d98966ff6bd1f97.tar.gz infinitytier-bd15262e5459c6003e54bcfd1d98966ff6bd1f97.zip |
Bunch of rule JSON stuff.
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 |