aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Paul Marks <pmarks@google.com>2015-08-04 15:05:00 -0700
committerGravatar Paul Marks <pmarks@google.com>2015-08-04 15:05:00 -0700
commit63541a1de15736df2a0e428f5c427581296f9773 (patch)
treeb3b3224b41a03211734c8187c0268413aa79a5ef /src/core
parent8956e606fbf30846ff07ac732cfb02d8d85b5e25 (diff)
Return normalized IPv4 addresses from grpc_sockaddr_to_uri().
Users of the high-level API should not care whether we're using AF_INET or AF_INET6 sockets internally.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/iomgr/sockaddr_utils.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/core/iomgr/sockaddr_utils.c b/src/core/iomgr/sockaddr_utils.c
index 71ac12e87b..65ec1f94ac 100644
--- a/src/core/iomgr/sockaddr_utils.c
+++ b/src/core/iomgr/sockaddr_utils.c
@@ -170,6 +170,11 @@ int grpc_sockaddr_to_string(char **out, const struct sockaddr *addr,
char *grpc_sockaddr_to_uri(const struct sockaddr *addr) {
char *temp;
char *result;
+ struct sockaddr_in addr_normalized;
+
+ if (grpc_sockaddr_is_v4mapped(addr, &addr_normalized)) {
+ addr = (const struct sockaddr *)&addr_normalized;
+ }
switch (addr->sa_family) {
case AF_INET: