Skip to content

Commit

Permalink
hotfix(routing): unmap ipv4-in-ipv6 when converting
Browse files Browse the repository at this point in the history
  • Loading branch information
qdm12 committed May 22, 2023
1 parent eed62fd commit 3100cc1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion internal/routing/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
5 changes: 1 addition & 4 deletions internal/routing/ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 3100cc1

Please sign in to comment.