From 17a59a7506077fe1732945163d15ae57fcebf9be Mon Sep 17 00:00:00 2001 From: Rob Murray Date: Fri, 14 Jun 2024 15:22:38 +0100 Subject: [PATCH] Don't log an error about route-add for IPv6 bridge setupBridgeIPv6 attempts to add a route to a new network while the bridge device is 'down', so it always fails (and the route is added anyway when the bridge is set 'up'). I'm almost sure the RouteAdd can be removed but, this close to the moby 27.0 release, only sure-enough to demote the log message from error to debug. Signed-off-by: Rob Murray --- libnetwork/drivers/bridge/setup_ipv6_linux.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libnetwork/drivers/bridge/setup_ipv6_linux.go b/libnetwork/drivers/bridge/setup_ipv6_linux.go index b0f3b0035d..4a07f72a11 100644 --- a/libnetwork/drivers/bridge/setup_ipv6_linux.go +++ b/libnetwork/drivers/bridge/setup_ipv6_linux.go @@ -2,9 +2,11 @@ package bridge import ( "context" + "errors" "fmt" "net/netip" "os" + "syscall" "github.com/containerd/log" "github.com/vishvananda/netlink" @@ -39,6 +41,8 @@ func setupBridgeIPv6(config *networkConfiguration, i *bridgeInterface) error { } // Setting route to global IPv6 subnet + // TODO(robmry) - remove this? The bridge is 'down' at this point so I think it + // always fails, and the route is added anyway when the bridge is set 'up'. log.G(context.TODO()).Debugf("Adding route to IPv6 network %s via device %s", config.AddressIPv6.String(), config.BridgeName) err = i.nlh.RouteAdd(&netlink.Route{ Scope: netlink.SCOPE_UNIVERSE, @@ -46,7 +50,11 @@ func setupBridgeIPv6(config *networkConfiguration, i *bridgeInterface) error { Dst: config.AddressIPv6, }) if err != nil && !os.IsExist(err) { - log.G(context.TODO()).Errorf("Could not add route to IPv6 network %s via device %s: %s", config.AddressIPv6.String(), config.BridgeName, err) + if errors.Is(err, syscall.ENETDOWN) { + log.G(context.TODO()).Debugf("Could not add route to IPv6 network %s via device %s: %s", config.AddressIPv6.String(), config.BridgeName, err) + } else { + log.G(context.TODO()).Errorf("Could not add route to IPv6 network %s via device %s: %s", config.AddressIPv6.String(), config.BridgeName, err) + } } return nil