net/dnscache: fix v4addrs to return only v4 addrs

Update the v4addrs function to filter out IPv6 addresses.

Fixes regression from 8725b14056.

Signed-off-by: Kris Brandow <kris.brandow@gmail.com>
This commit is contained in:
Kris Brandow 2022-08-16 15:22:57 -04:00
parent 03f7e4e577
commit 9ae1161e85

View File

@ -614,7 +614,7 @@ func v4addrs(aa []net.IPAddr) (ret []netip.Addr) {
for _, a := range aa {
ip, ok := netip.AddrFromSlice(a.IP)
ip = ip.Unmap()
if ok {
if ok && ip.Is4() {
ret = append(ret, ip)
}
}