fix(ipv6): detect ignoring loopback route destinations
This commit is contained in:
@@ -14,16 +14,21 @@ func (n *NetLink) IsIPv6Supported() (supported bool, err error) {
|
|||||||
// as IPv6 routes at container start, see:
|
// as IPv6 routes at container start, see:
|
||||||
// https://github.com/qdm12/gluetun/issues/1241#issuecomment-1333405949
|
// https://github.com/qdm12/gluetun/issues/1241#issuecomment-1333405949
|
||||||
for _, route := range routes {
|
for _, route := range routes {
|
||||||
|
link, err := n.LinkByIndex(route.LinkIndex)
|
||||||
|
if err != nil {
|
||||||
|
return false, fmt.Errorf("finding link corresponding to route: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
sourceIsIPv6 := route.Src.IsValid() && route.Src.Is6()
|
sourceIsIPv6 := route.Src.IsValid() && route.Src.Is6()
|
||||||
destinationIsIPv6 := route.Dst.IsValid() && route.Dst.Addr().Is6()
|
destinationIsIPv6 := route.Dst.IsValid() && route.Dst.Addr().Is6()
|
||||||
if sourceIsIPv6 || destinationIsIPv6 {
|
switch {
|
||||||
link, err := n.LinkByIndex(route.LinkIndex)
|
case !sourceIsIPv6 && !destinationIsIPv6,
|
||||||
if err != nil {
|
destinationIsIPv6 && route.Dst.Addr().IsLoopback():
|
||||||
return false, fmt.Errorf("finding IPv6 supported link: %w", err)
|
continue
|
||||||
}
|
|
||||||
n.debugLogger.Debugf("IPv6 is supported by link %s", link.Name)
|
|
||||||
return true, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
n.debugLogger.Debugf("IPv6 is supported by link %s", link.Name)
|
||||||
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
n.debugLogger.Debugf("IPv6 is not supported after searching %d routes",
|
n.debugLogger.Debugf("IPv6 is not supported after searching %d routes",
|
||||||
|
|||||||
Reference in New Issue
Block a user