diff options
author | Max Kellermann <max@musicpd.org> | 2018-08-21 10:46:20 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-08-21 10:46:20 +0200 |
commit | 94092f1f9050576aa1326fcae97e3da1d5e6a0ed (patch) | |
tree | 89249d7e39f310b27bf9bba7b3cd1cf2ddd483eb /src/net/SocketAddress.cxx | |
parent | a84b83f20f0bb5ee69a06e6e94d266fd85ac6a94 (diff) |
net/SocketAddress: reimplement IsV6Any() using IPv6Address::IsAny()
Diffstat (limited to 'src/net/SocketAddress.cxx')
-rw-r--r-- | src/net/SocketAddress.cxx | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/net/SocketAddress.cxx b/src/net/SocketAddress.cxx index 70175a29f..357cbb8dd 100644 --- a/src/net/SocketAddress.cxx +++ b/src/net/SocketAddress.cxx @@ -29,6 +29,7 @@ #include "config.h" #include "SocketAddress.hxx" +#include "IPv6Address.hxx" #include "util/StringView.hxx" #include <string.h> @@ -78,9 +79,7 @@ SocketAddress::GetLocalRaw() const noexcept bool SocketAddress::IsV6Any() const noexcept { - return GetFamily() == AF_INET6 && - memcmp(&((const struct sockaddr_in6 *)(const void *)GetAddress())->sin6_addr, - &in6addr_any, sizeof(in6addr_any)) == 0; + return GetFamily() == AF_INET6 && IPv6Address(*this).IsAny(); } unsigned @@ -94,7 +93,7 @@ SocketAddress::GetPort() const noexcept return ntohs(((const struct sockaddr_in *)(const void *)address)->sin_port); case AF_INET6: - return ntohs(((const struct sockaddr_in6 *)(const void *)address)->sin6_port); + return IPv6Address(*this).GetPort(); default: return 0; |