From a70419b49f9f9e197b45e948ed03349213d36747 Mon Sep 17 00:00:00 2001 From: Thijs van Dien Date: Tue, 5 Mar 2024 10:45:53 +0100 Subject: [PATCH] unmap IPv4-mapped IPv6 addresses (#4309) --- sys_conn_oob.go | 2 +- sys_conn_oob_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys_conn_oob.go b/sys_conn_oob.go index 71a037d5..64d581c0 100644 --- a/sys_conn_oob.go +++ b/sys_conn_oob.go @@ -221,7 +221,7 @@ func (c *oobConn) ReadPacket() (receivedPacket, error) { // unsigned int ipi6_ifindex; /* send/recv interface index */ // }; if len(body) == 20 { - p.info.addr = netip.AddrFrom16(*(*[16]byte)(body[:16])) + p.info.addr = netip.AddrFrom16(*(*[16]byte)(body[:16])).Unmap() p.info.ifIndex = binary.LittleEndian.Uint32(body[16:]) } else { invalidCmsgOnceV6.Do(func() { diff --git a/sys_conn_oob_test.go b/sys_conn_oob_test.go index 40596421..a24480ab 100644 --- a/sys_conn_oob_test.go +++ b/sys_conn_oob_test.go @@ -235,7 +235,7 @@ var _ = Describe("OOB Conn Test", func() { Eventually(packetChan).Should(Receive(&p)) Expect(utils.IsIPv4(p.remoteAddr.(*net.UDPAddr).IP)).To(BeTrue()) Expect(p.info).To(Not(BeNil())) - Expect(p.info.addr.Is4In6() || p.info.addr.Is4()).To(BeTrue()) + Expect(p.info.addr.Is4()).To(BeTrue()) ip := p.info.addr.As4() Expect(net.IP(ip[:])).To(Equal(ip4.To4()))