summaryrefslogtreecommitdiff
path: root/lib/vrf.c
diff options
context:
space:
mode:
authorDonald Sharp <donaldsharp72@gmail.com>2021-11-04 20:29:23 -0400
committerGitHub <noreply@github.com>2021-11-04 20:29:23 -0400
commit95d2bed34b8037d33cbf23fd1bf215f98c4fb9d4 (patch)
tree2d36ec05462362f135a9143c206fe10527df7825 /lib/vrf.c
parentc60f71713ccfd4c98304d7f3ecf7b963fab251f9 (diff)
parentd2dbaf3b5e57051b56efd1a38d69f552a5d56c41 (diff)
Merge pull request #9943 from idryzhov/crash-fixes
a couple of crash fixes after recent interface/vrf rework
Diffstat (limited to 'lib/vrf.c')
-rw-r--r--lib/vrf.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/vrf.c b/lib/vrf.c
index 847899f0ba..aaedb63800 100644
--- a/lib/vrf.c
+++ b/lib/vrf.c
@@ -256,10 +256,8 @@ void vrf_delete(struct vrf *vrf)
* the ID mapping. Interfaces assigned to this VRF should've been
* removed already as part of the VRF going down.
*/
- if (vrf_is_user_cfged(vrf)) {
- vrf->ns_ctxt = NULL;
+ if (vrf_is_user_cfged(vrf))
return;
- }
/* Do not delete the VRF if it has interfaces configured in it. */
if (!RB_EMPTY(if_name_head, &vrf->ifaces_by_name))
@@ -541,10 +539,13 @@ void vrf_init(int (*create)(struct vrf *), int (*enable)(struct vrf *),
static void vrf_terminate_single(struct vrf *vrf)
{
+ int enabled = vrf_is_enabled(vrf);
+
/* Clear configured flag and invoke delete. */
UNSET_FLAG(vrf->status, VRF_CONFIGURED);
if_terminate(vrf);
- vrf_delete(vrf);
+ if (enabled)
+ vrf_delete(vrf);
}
/* Terminate VRF module. */