From 3100cc1e5ee7d6523cc02e1c874a271713c13395 Mon Sep 17 00:00:00 2001 From: Quentin McGaw Date: Mon, 22 May 2023 08:03:52 +0000 Subject: [PATCH] hotfix(routing): unmap ipv4-in-ipv6 when converting --- internal/routing/conversion.go | 2 +- internal/routing/ip.go | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/internal/routing/conversion.go b/internal/routing/conversion.go index 6e2f77ccd..1cb0fd4d2 100644 --- a/internal/routing/conversion.go +++ b/internal/routing/conversion.go @@ -39,5 +39,5 @@ func netIPToNetipAddress(ip net.IP) (address netip.Addr) { if !ok { panic(fmt.Sprintf("converting %#v to netip.Addr failed", ip)) } - return address + return address.Unmap() } diff --git a/internal/routing/ip.go b/internal/routing/ip.go index 1d8c36b52..4fc96376b 100644 --- a/internal/routing/ip.go +++ b/internal/routing/ip.go @@ -46,10 +46,7 @@ func (r *Routing) assignedIP(interfaceName string, family int) (ip netip.Addr, e continue } - // Ensure we don't return an IPv6-wrapped IPv4 address - // since netip.Address String method works differently than - // net.IP String method for this kind of addresses. - return ip.Unmap(), nil + return ip, nil } return ip, fmt.Errorf("%w: interface %s in %d addresses", errInterfaceIPNotFound, interfaceName, len(addresses))