From cc934f5c68452e6160abe244e965ea9eeeaa2854 Mon Sep 17 00:00:00 2001 From: Quentin McGaw Date: Fri, 2 Dec 2022 11:39:37 +0000 Subject: [PATCH] hotfix(netlink): ipv6 detection for nil src/dst in routes --- internal/netlink/ipv6.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/netlink/ipv6.go b/internal/netlink/ipv6.go index 5280a21a0..58f308c97 100644 --- a/internal/netlink/ipv6.go +++ b/internal/netlink/ipv6.go @@ -23,8 +23,9 @@ func (n *NetLink) IsIPv6Supported() (supported bool, err error) { // as IPv6 routes at container start, see: // https://github.com/qdm12/gluetun/issues/1241#issuecomment-1333405949 for _, route := range routes { - if route.Dst.IP.To4() == nil || - route.Src.To4() == nil { // Destination or source IP is IPv6 + sourceIsIPv6 := route.Src != nil && route.Src.To4() == nil + destinationIsIPv6 := route.Dst != nil && route.Dst.IP.To4() == nil + if sourceIsIPv6 || destinationIsIPv6 { return true, nil } }