Index: runtime/bin/socket_linux.cc |
diff --git a/runtime/bin/socket_linux.cc b/runtime/bin/socket_linux.cc |
index c7bc9bfe4d71b0d424f4594bb3884d3fd4699fbe..c36a66e3e26ff76e49bed10a17dba9f4e60dca59 100644 |
--- a/runtime/bin/socket_linux.cc |
+++ b/runtime/bin/socket_linux.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. |