File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -293,7 +293,13 @@ fn infer_client_ip(
293293 // Each intermediate proxy is supposed to add the client's IP address to front
294294 // of the list. We are effectively adding the IP we got from the socket to the
295295 // front of the list.
296- let peer_list: Vec < IpAddr > = peer. into_iter ( ) . chain ( peers_from_header) . collect ( ) ;
296+ // We also call `to_canonical` so that IPv6-mapped IPv4 addresses
297+ // (::ffff:A.B.C.D) are converted to IPv4.
298+ let peer_list: Vec < IpAddr > = peer
299+ . into_iter ( )
300+ . chain ( peers_from_header)
301+ . map ( |ip| ip. to_canonical ( ) )
302+ . collect ( ) ;
297303
298304 // We'll fallback to the first IP in the list if all the IPs we got are trusted
299305 let fallback = peer_list. first ( ) . copied ( ) ;
You can’t perform that action at this time.
0 commit comments