pimd: Fix for crash during networking restart

During vrf delete, the vxlan_info.work_list
linked list was deleted which is a global list
containing the SGs for all the VRFs.

If two vrfs are configured, vrf a and vrf b and
both has SGs assocaited with them which are
inserted in the vxlan_info.work_list. Now if
vrf a is deleted, it deletes the work_list also.
Due to this when any SG add or del comes for vrf b
it tries to access the work_list and crashes.

Fix
Delete the vxlan_info.work_list only when all the
VRFs are terminated and unset the vxlan_info.flags
so if new add cmd comes it re-allocates the work_list.

Signed-off-by: usrivastava-nvidia <usrivastava@nvidia.com>
This commit is contained in:
Utkarsh Srivastava 2025-04-09 22:49:34 -07:00 committed by usrivastava-nvidia
parent 42d31854a1
commit b88cce2330
3 changed files with 9 additions and 1 deletions

View file

@ -271,6 +271,8 @@ void pim_vrf_terminate(void)
} }
vrf_terminate(); vrf_terminate();
/* Delete the vxlan_info.work_list as all the VRFs are deleted*/
pim_vxlan_work_list_delete();
} }
bool pim_msdp_log_neighbor_events(const struct pim_instance *pim) bool pim_msdp_log_neighbor_events(const struct pim_instance *pim)

View file

@ -1249,9 +1249,14 @@ void pim_vxlan_exit(struct pim_instance *pim)
{ {
hash_clean_and_free(&pim->vxlan.sg_hash, hash_clean_and_free(&pim->vxlan.sg_hash,
(void (*)(void *))pim_vxlan_sg_del_item); (void (*)(void *))pim_vxlan_sg_del_item);
}
if (vxlan_info.work_list) void pim_vxlan_work_list_delete(void)
{
if (vxlan_info.work_list) {
list_delete(&vxlan_info.work_list); list_delete(&vxlan_info.work_list);
UNSET_FLAG(vxlan_info.flags, PIM_VXLANF_WORK_INITED);
}
} }
void pim_vxlan_terminate(void) void pim_vxlan_terminate(void)

View file

@ -33,5 +33,6 @@ struct pim_vxlan_instance {
extern void pim_vxlan_init(struct pim_instance *pim); extern void pim_vxlan_init(struct pim_instance *pim);
extern void pim_vxlan_exit(struct pim_instance *pim); extern void pim_vxlan_exit(struct pim_instance *pim);
void pim_vxlan_work_list_delete(void);
#endif /* PIM_VXLAN_INSTANCE_H */ #endif /* PIM_VXLAN_INSTANCE_H */