Skip to content

Commit

Permalink
Merge pull request #2925 from spidernet-io/robot/cherrypick/pr2919/re…
Browse files Browse the repository at this point in the history
…lease-v0.8

coordinator: improve determining the default route for IPv6
  • Loading branch information
cyclinder authored Dec 15, 2023
2 parents 8fd7b13 + 3fa80a5 commit 2d10678
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/networking/networking/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func MoveRouteTable(logger *zap.Logger, iface string, srcRuleTable, dstRuleTable

if route.LinkIndex == link.Attrs().Index {
// only delete default route
if route.Dst == nil || route.Dst.IP.Equal(net.IPv4zero) {
if route.Dst == nil || route.Dst.IP.Equal(net.IPv4zero) || route.Dst.IP.Equal(net.IPv6zero) {
if err = netlink.RouteDel(&route); err != nil {
logger.Error("failed to RouteDel in main", zap.String("route", route.String()), zap.Error(err))
return fmt.Errorf("failed to RouteDel %s in main table: %+v", route.String(), err)
Expand All @@ -196,7 +196,13 @@ func MoveRouteTable(logger *zap.Logger, iface string, srcRuleTable, dstRuleTable
}
logger.Debug("MoveRoute to new table successfully", zap.String("Route", route.String()))
} else {
// especially for ipv6 default route
// in high kernel, if pod has multi ipv6 default routes, all default routes
// will be put in MultiPath
/*
{
Gw: [{Ifindex: 3 Weight: 1 Gw: fd00:10:7::103 Flags: []} {Ifindex: 5 Weight: 1 Gw: fd00:10:6::100 Flags: []}]}"
}
*/
if len(route.MultiPath) == 0 {
continue
}
Expand Down

0 comments on commit 2d10678

Please sign in to comment.