diff --git a/routingtable/locRIB/loc_rib.go b/routingtable/locRIB/loc_rib.go index 584954a954e394bf7f859693b87ec827529a4b05..a1701743b1b5d946f958f47e1b163285427a57b0 100644 --- a/routingtable/locRIB/loc_rib.go +++ b/routingtable/locRIB/loc_rib.go @@ -74,6 +74,8 @@ func (a *LocRIB) RemovePath(pfx net.Prefix, p *route.Path) bool { r := a.rt.Get(pfx) if r != nil { oldRoute = r.Copy() + } else { + return true } a.rt.RemovePath(pfx, p) diff --git a/routingtable/locRIB/loc_rib_test.go b/routingtable/locRIB/loc_rib_test.go index 6493991c9c30a4df8352b4496f3fd953ad60a926..ea4d9c6c30e5596f4b0685d92a20b86eb182bf16 100644 --- a/routingtable/locRIB/loc_rib_test.go +++ b/routingtable/locRIB/loc_rib_test.go @@ -84,3 +84,14 @@ func TestContainsPfxPath(t *testing.T) { assert.Equal(t, tc.expected, contains, "mismatch in testcase %v", i) } } + +func TestLocRIB_RemovePathUnknown(t *testing.T) { + rib := New() + assert.True(t, rib.RemovePath(net.NewPfx(1, 32), + &route.Path{ + Type: route.StaticPathType, + StaticPath: &route.StaticPath{ + NextHop: 2, + }, + })) +}