Skip to content

Commit

Permalink
Merge pull request #627 from Nordix/fix-ipv6-policy-route
Browse files Browse the repository at this point in the history
Fix Deletion of IPv6 default policy routes
  • Loading branch information
denis-tingaikin authored Nov 18, 2023
2 parents ba96cf9 + 840c44a commit f8971e7
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,11 @@ func flushTable(ctx context.Context, handle *netlink.Handle, tableID, linkIndex
for i := 0; i < len(routes); i++ {
// This conditions means the default route. We should delete it properly
if routes[i].Dst == nil {
routes[i].Dst = &net.IPNet{IP: net.IPv4zero, Mask: net.CIDRMask(0, 32)}
if routes[i].Family == netlink.FAMILY_V4 {
routes[i].Dst = &net.IPNet{IP: net.IPv4zero, Mask: net.CIDRMask(0, 32)}
} else if routes[i].Family == netlink.FAMILY_V6 {
routes[i].Dst = &net.IPNet{IP: net.IPv6zero, Mask: net.CIDRMask(0, 128)}
}
}
err := handle.RouteDel(&routes[i])
if err != nil {
Expand Down

0 comments on commit f8971e7

Please sign in to comment.