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(
293
293
// Each intermediate proxy is supposed to add the client's IP address to front
294
294
// of the list. We are effectively adding the IP we got from the socket to the
295
295
// 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 ( ) ;
297
303
298
304
// We'll fallback to the first IP in the list if all the IPs we got are trusted
299
305
let fallback = peer_list. first ( ) . copied ( ) ;
You can’t perform that action at this time.
0 commit comments