File tree 2 files changed +10
-3
lines changed
2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 1
1
version https://git-lfs.github.com/spec/v1
2
- oid sha256:f98cac284d8591db1636e5957bbb5610b45f1b7919075a7a394241c9b9b3c1f1
3
- size 2881181
2
+ oid sha256:0301590777a402912287b0f89601ed60d10856de3d6cc6b3cb687ecd83a7a9af
3
+ size 2891573
Original file line number Diff line number Diff line change @@ -259,14 +259,21 @@ func delIfDefault(r *netlink.Route) {
259
259
// Checks if route is default
260
260
func isDefault (r * netlink.Route ) bool {
261
261
var isDefault bool
262
- if r .Src == nil && r .Dst == nil && r .Gw .IsPrivate () {
262
+ if r .Src == nil && r .Dst == nil && ( r .Gw .IsPrivate () || r . Gw == nil ) {
263
263
isDefault = true
264
+ } else {
265
+ log .Debugf ("%+v is not default route" , r )
264
266
}
265
267
return isDefault
266
268
}
267
269
268
270
// Deletes a route
269
271
func delRoute (r * netlink.Route ) {
272
+ // Can't delete a route with no dest net, so explicitly set to all if nil
273
+ if isDefault (r ) && r .Dst == nil {
274
+ _ , defaultDest , _ := net .ParseCIDR ("0.0.0.0/0" )
275
+ r .Dst = defaultDest
276
+ }
270
277
err := netlink .RouteDel (r )
271
278
if err != nil {
272
279
log .Errorf ("Failed to delete route on %s: %+v" , linkName , err )
You can’t perform that action at this time.
0 commit comments