Merge pull request #9943 from idryzhov/crash-fixes

a couple of crash fixes after recent interface/vrf rework
This commit is contained in:
Donald Sharp 2021-11-04 20:29:23 -04:00 committed by GitHub
commit 95d2bed34b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -256,10 +256,8 @@ void vrf_delete(struct vrf *vrf)
* the ID mapping. Interfaces assigned to this VRF should've been * the ID mapping. Interfaces assigned to this VRF should've been
* removed already as part of the VRF going down. * removed already as part of the VRF going down.
*/ */
if (vrf_is_user_cfged(vrf)) { if (vrf_is_user_cfged(vrf))
vrf->ns_ctxt = NULL;
return; return;
}
/* Do not delete the VRF if it has interfaces configured in it. */ /* Do not delete the VRF if it has interfaces configured in it. */
if (!RB_EMPTY(if_name_head, &vrf->ifaces_by_name)) 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) static void vrf_terminate_single(struct vrf *vrf)
{ {
int enabled = vrf_is_enabled(vrf);
/* Clear configured flag and invoke delete. */ /* Clear configured flag and invoke delete. */
UNSET_FLAG(vrf->status, VRF_CONFIGURED); UNSET_FLAG(vrf->status, VRF_CONFIGURED);
if_terminate(vrf); if_terminate(vrf);
vrf_delete(vrf); if (enabled)
vrf_delete(vrf);
} }
/* Terminate VRF module. */ /* Terminate VRF module. */

View File

@ -165,6 +165,7 @@ static int zebra_ns_delete(char *name)
/* the deletion order is the same /* the deletion order is the same
* as the one used when siging signal is received * as the one used when siging signal is received
*/ */
vrf->ns_ctxt = NULL;
vrf_delete(vrf); vrf_delete(vrf);
if (ns) if (ns)
ns_delete(ns); ns_delete(ns);