Skip to content

Commit 6186106

Browse files
committed
need to unmap the Addr in AddrFromSlice due to that there may be an IPv4-mapped IPv6 address
1 parent 55eaae4 commit 6186106

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/net/netip/netip.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,9 @@ func AddrFromSlice(slice []byte) (ip Addr, ok bool) {
354354
case 4:
355355
return AddrFrom4(*(*[4]byte)(slice)), true
356356
case 16:
357-
return ipv6Slice(slice), true
357+
ipAddr := ipv6Slice(slice)
358+
unwrapAddr := ipAddr.Unmap()
359+
return unwrapAddr, true
358360
}
359361
return Addr{}, false
360362
}

0 commit comments

Comments
 (0)