Skip to content
Snippets Groups Projects
Unverified Commit 1e819039 authored by takt's avatar takt Committed by GitHub
Browse files

Merge pull request #19 from hikhvar/fix/return-early-in-remove-routes

Return early if route is not present.
parents 392543c6 2b3a355b
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
......@@ -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,
},
}))
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment