summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgpd.h15
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;
}