diff options
author | Juanli Shen <aspirinsjl@gmail.com> | 2018-08-23 13:29:48 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-23 13:29:48 -0700 |
commit | f9eeae77f32fe8fe4e2c5939ace0aa9e6531da38 (patch) | |
tree | e88e0447674082a7269853c51ef8d8aedb491f87 /src/core | |
parent | 77b713324494e183da2bb458f072b0b5f0fb45a5 (diff) | |
parent | 32a8a860459370c540f1150767a0a703c3c433e0 (diff) |
Merge pull request #16437 from AspirinSJL/fix_lrs_filter_build
Fix build issue
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/ext/filters/load_reporting/server_load_reporting_filter.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc b/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc index 6529046a5e..8ac34c629f 100644 --- a/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc +++ b/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc @@ -162,9 +162,10 @@ void ServerLoadReportingCallData::GetCensusSafeClientIpString( } else if (addr->sa_family == GRPC_AF_INET6) { grpc_sockaddr_in6* addr6 = reinterpret_cast<grpc_sockaddr_in6*>(addr); *client_ip_string = static_cast<char*>(gpr_malloc(32 + 1)); - for (size_t i = 0; i < 16; ++i) { - snprintf(*client_ip_string + i * 2, 2 + 1, "%02x", - addr6->sin6_addr.__in6_u.__u6_addr8[i]); + uint32_t* addr6_next_long = reinterpret_cast<uint32_t*>(&addr6->sin6_addr); + for (size_t i = 0; i < 4; ++i) { + snprintf(*client_ip_string + 8 * i, 8 + 1, "%08x", + grpc_ntohl(*addr6_next_long++)); } *size = 32; } else { |