Skip to content

Commit afd2d3e

Browse files
committed
Pull request 306: 6510-mapped-addr
Updates AdguardTeam/AdGuardHome#6510. Squashed commit of the following: commit 9dae89e Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Dec 8 19:08:32 2023 +0300 netutil: unmap v4-in-v6 addrs
1 parent d6ebaac commit afd2d3e

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

internal/netutil/udp_unix.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ func udpSetOptions(c *net.UDPConn) (err error) {
4444
func udpGetDstFromOOB(oob []byte) (dst netip.Addr, err error) {
4545
cm6 := &ipv6.ControlMessage{}
4646
if cm6.Parse(oob) == nil && cm6.Dst != nil {
47-
return netutil.IPToAddr(cm6.Dst, netutil.AddrFamilyIPv6)
47+
// Linux maps IPv4 addresses to IPv6 ones by default, so we can get an
48+
// IPv4 dst from an IPv6 control-message.
49+
return netutil.IPToAddrNoMapped(cm6.Dst)
4850
}
4951

5052
cm4 := &ipv4.ControlMessage{}

0 commit comments

Comments
 (0)