Make IPAddress's operator!= compare values, not memory addresses. (#5537)

Co-authored-by: Ben Winslow <rain@bluecherry.net>
This commit is contained in:
raineth 2023-10-16 02:42:18 -04:00 committed by Jesse Hills
parent 261c271d60
commit 52e8a2e9e4
No known key found for this signature in database
GPG key ID: BEAAE804EFD8E83A

View file

@ -87,7 +87,7 @@ struct IPAddress {
bool is_ip6() { return IP_IS_V6(&ip_addr_); } bool is_ip6() { return IP_IS_V6(&ip_addr_); }
std::string str() const { return ipaddr_ntoa(&ip_addr_); } std::string str() const { return ipaddr_ntoa(&ip_addr_); }
bool operator==(const IPAddress &other) const { return ip_addr_cmp(&ip_addr_, &other.ip_addr_); } bool operator==(const IPAddress &other) const { return ip_addr_cmp(&ip_addr_, &other.ip_addr_); }
bool operator!=(const IPAddress &other) const { return !(&ip_addr_ == &other.ip_addr_); } bool operator!=(const IPAddress &other) const { return !ip_addr_cmp(&ip_addr_, &other.ip_addr_); }
IPAddress &operator+=(uint8_t increase) { IPAddress &operator+=(uint8_t increase) {
if (IP_IS_V4(&ip_addr_)) { if (IP_IS_V4(&ip_addr_)) {
#if LWIP_IPV6 #if LWIP_IPV6