File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -2145,6 +2145,7 @@ static int net_address_ip_str(flb_sockfd_t fd,
21452145 size_t * output_data_size )
21462146{
21472147 void * address_data ;
2148+ int family ;
21482149 int result ;
21492150
21502151 errno = 0 ;
@@ -2184,7 +2185,22 @@ static int net_address_ip_str(flb_sockfd_t fd,
21842185 return -1 ;
21852186 }
21862187
2187- if ((inet_ntop (address -> ss_family ,
2188+ family = address -> ss_family ;
2189+
2190+ /*
2191+ * For IPv4-mapped IPv6 addresses (e.g. ::ffff:127.0.0.1),
2192+ * emit a plain IPv4 literal instead.
2193+ */
2194+ if (address -> ss_family == AF_INET6 ) {
2195+ struct in6_addr * addr6 = (struct in6_addr * ) address_data ;
2196+
2197+ if (IN6_IS_ADDR_V4MAPPED (addr6 )) {
2198+ family = AF_INET ;
2199+ address_data = & addr6 -> s6_addr [12 ];
2200+ }
2201+ }
2202+
2203+ if ((inet_ntop (family ,
21882204 address_data ,
21892205 output_buffer ,
21902206 output_buffer_size )) == NULL ) {
You can’t perform that action at this time.
0 commit comments