feat(wireguard): add debug logs for IPv6 detection

- To debug issue #998
- Enable with `LOG_LEVEL=debug`
This commit is contained in:
Quentin McGaw
2022-05-27 16:56:20 +00:00
parent eb71cfb144
commit 7fd45cf17f
6 changed files with 55 additions and 16 deletions

View File

@@ -12,16 +12,23 @@ func (w *Wireguard) isIPv6Supported() (supported bool, err error) {
return false, fmt.Errorf("cannot list links: %w", err)
}
w.logger.Debug("Checking for IPv6 support...")
for _, link := range links {
linkName := link.Attrs().Name
routes, err := w.netlink.RouteList(link, netlink.FAMILY_V6)
if err != nil {
return false, fmt.Errorf("cannot list routes: %w", err)
return false, fmt.Errorf("cannot list routes for link %s: %w", linkName, err)
}
if len(routes) > 0 {
return true, nil
if len(routes) == 0 {
w.logger.Debugf("Link %s has no IPv6 route", linkName)
continue
}
w.logger.Debugf("Link %s has IPv6 routes: %#v",
linkName, routes)
supported = true
}
return false, nil
return supported, nil
}