Skip to content

Commit

Permalink
Remove IPv6 bridge RouteAdd() that always fails
Browse files Browse the repository at this point in the history
The netlink.RouteAdd in setupBridgeIPv6 always failed, because
the bridge is always 'down' when it's called.

Signed-off-by: Rob Murray <rob.murray@docker.com>
  • Loading branch information
robmry committed Jul 4, 2024
1 parent d91ae49 commit 4776e6d
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions libnetwork/drivers/bridge/setup_ipv6_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@ package bridge

import (
"context"
"errors"
"fmt"
"net/netip"
"os"
"syscall"

"github.com/containerd/log"
"github.com/vishvananda/netlink"
)

// Standard link local prefix
Expand Down Expand Up @@ -39,24 +36,6 @@ func setupBridgeIPv6(config *networkConfiguration, i *bridgeInterface) error {
if err := i.programIPv6Addresses(config); err != nil {
return err
}

// 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,
LinkIndex: i.Link.Attrs().Index,
Dst: config.AddressIPv6,
})
if err != nil && !os.IsExist(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
}

Expand Down

0 comments on commit 4776e6d

Please sign in to comment.