diff options
| author | vivek <vivek@cumulusnetworks.com> | 2016-03-16 20:38:31 +0000 |
|---|---|---|
| committer | vivek <vivek@cumulusnetworks.com> | 2016-03-16 20:38:31 +0000 |
| commit | 59ecefe2db1a69b0a5a5169d0ad88a5701762e64 (patch) | |
| tree | 3bdec04f44553b1ebe4f8b1298a20f605a1fc318 | |
| parent | a3cb01d89c5c741b4fa3a0f4f46264eafa0184cf (diff) | |
BGP: Fix linkage between BGP instance and VRF structure
The issue here has to do with the fact that VRFs (like interfaces) are not
actually getting deleted when they are removed - they remain present. This
leads to situations in which BGP may try to unlink more than once, which
messes up the reference count (lock) in the BGP instance.
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Ticket: CM-9419
Reviewed By: CCR-4302
Testing Done: Manual, also verified by Atul
<DETAILED DESCRIPTION (REPLACE)>
| -rw-r--r-- | bgpd/bgpd.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index 3a0a679d6f..240694bb6d 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -1458,17 +1458,22 @@ static inline void bgp_vrf_link (struct bgp *bgp, struct vrf *vrf) { bgp->vrf_id = vrf->vrf_id; - bgp_lock (bgp); - vrf->info = (void *)bgp; - + if (vrf->info != (void *)bgp) + { + bgp_lock (bgp); + vrf->info = (void *)bgp; + } } /* Unlink BGP instance from VRF. */ static inline void bgp_vrf_unlink (struct bgp *bgp, struct vrf *vrf) { - vrf->info = NULL; - bgp_unlock (bgp); + if (vrf->info == (void *)bgp) + { + vrf->info = NULL; + bgp_unlock (bgp); + } bgp->vrf_id = VRF_DEFAULT; } |
