An IPv4 address is bigendian...
@@ -17,7 +17,7 @@ private:
uint32_t l;
};
static constexpr uint32_t hostmask(unsigned int n) {
- return n >= 32 ? 0 : ((uint32_t)1 << n)-1;
+ return n >= 32 ? 0 : htonl(((uint32_t)1 << n)-1);
}
public:
constexpr IP4() : l{0} { }