summaryrefslogtreecommitdiffhomepage
path: root/pkg/server/server.go
diff options
context:
space:
mode:
authorMagesh GV <mageshgv@gmail.com>2019-09-26 18:12:10 -0700
committerFUJITA Tomonori <fujita.tomonori@gmail.com>2019-10-01 08:28:26 +0900
commit22193807af57c4919ead94bc4c3c3ae022c2e99e (patch)
tree162fbe71467f9647c857f07641392aed5609afed /pkg/server/server.go
parent74266996792c5abc598251334ad40eaf72565044 (diff)
Fix crash on nonexistent vrf delete
Diffstat (limited to 'pkg/server/server.go')
-rw-r--r--pkg/server/server.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/pkg/server/server.go b/pkg/server/server.go
index d1257cda..d6c54e10 100644
--- a/pkg/server/server.go
+++ b/pkg/server/server.go
@@ -2206,9 +2206,11 @@ func (s *BgpServer) DeleteVrf(ctx context.Context, r *api.DeleteVrfRequest) erro
return fmt.Errorf("failed to delete VRF %s: neighbor %s is in use", name, n.ID())
}
}
- vrfMplsLabel := s.globalRib.Vrfs[name].MplsLabel
- if vrfMplsLabel > 0 {
- s.zclient.releaseMplsLabel(vrfMplsLabel)
+
+ if vrf, ok := s.globalRib.Vrfs[name]; ok {
+ if vrf.MplsLabel > 0 {
+ s.zclient.releaseMplsLabel(vrf.MplsLabel)
+ }
}
pathList, err := s.globalRib.DeleteVrf(name)
if err != nil {