diff options
Diffstat (limited to 'src/netbase.cpp')
-rw-r--r-- | src/netbase.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/netbase.cpp b/src/netbase.cpp index b765b35eec..41cc18d3cd 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -1260,7 +1260,7 @@ CSubNet::CSubNet(const std::string &strSubnet, bool fAllowLookup) n += astartofs*8; // Clear bits [n..127] for (; n < 128; ++n) - netmask[n>>3] &= ~(1<<(n&7)); + netmask[n>>3] &= ~(1<<(7-(n&7))); } else { @@ -1287,6 +1287,10 @@ CSubNet::CSubNet(const std::string &strSubnet, bool fAllowLookup) { valid = false; } + + // Normalize network according to netmask + for(int x=0; x<16; ++x) + network.ip[x] &= netmask[x]; } bool CSubNet::Match(const CNetAddr &addr) const |