Index: runtime/bin/socket_macos.cc |
diff --git a/runtime/bin/socket_macos.cc b/runtime/bin/socket_macos.cc |
index 4b6ead679101ec4dcb397fa0c340f5a688224f48..656837912d1abff72f67ccdd552a1cb4e28d8394 100644 |
--- a/runtime/bin/socket_macos.cc |
+++ b/runtime/bin/socket_macos.cc |
@@ -244,6 +244,18 @@ bool Socket::ReverseLookup(RawAddr addr, |
} |
+bool Socket::ParseAddress(int type, const char* address, RawAddr* addr) { |
+ int result; |
+ if (type == SocketAddress::TYPE_IPV4) { |
+ result = inet_pton(AF_INET, address, &addr->in.sin_addr); |
+ } else { |
+ ASSERT(type == SocketAddress::TYPE_IPV6); |
+ result = inet_pton(AF_INET6, address, &addr->in6.sin6_addr); |
+ } |
+ return result == 1; |
+} |
+ |
+ |
static bool ShouldIncludeIfaAddrs(struct ifaddrs* ifa, int lookup_family) { |
if (ifa->ifa_addr == NULL) { |
// OpenVPN's virtual device tun0. |