diff options
author | Magesh GV <mageshgv@gmail.com> | 2019-09-26 18:12:10 -0700 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2019-10-01 08:28:26 +0900 |
commit | 22193807af57c4919ead94bc4c3c3ae022c2e99e (patch) | |
tree | 162fbe71467f9647c857f07641392aed5609afed /pkg/server/server.go | |
parent | 74266996792c5abc598251334ad40eaf72565044 (diff) |
Fix crash on nonexistent vrf delete
Diffstat (limited to 'pkg/server/server.go')
-rw-r--r-- | pkg/server/server.go | 8 |
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 { |