| 1080 | } |
| 1081 | |
| 1082 | bool CSubNet::Match(const CNetAddr& addr) const { |
| 1083 | if (!valid || !addr.IsValid()) |
| 1084 | return false; |
| 1085 | for (int x = 0; x < 16; ++x) |
| 1086 | if ((addr.ip[x] & netmask[x]) != network.ip[x]) |
| 1087 | return false; |
| 1088 | return true; |
| 1089 | } |
| 1090 | |
| 1091 | static inline int32_t NetmaskBits(uint8_t x) { |
| 1092 | switch (x) { |