]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: Fix for crash during networking restart 18672/head
authorUtkarsh Srivastava <usrivastava@nvidia.com>
Thu, 10 Apr 2025 05:49:34 +0000 (22:49 -0700)
committerusrivastava-nvidia <usrivastava@nvidia.com>
Wed, 23 Apr 2025 14:03:02 +0000 (14:03 +0000)
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>
pimd/pim_instance.c
pimd/pim_vxlan.c
pimd/pim_vxlan_instance.h

index f64b02e44dc9f98f98aed7549861448884ecd27c..e8f1a4e2d47914891a36d5301e9e15eed7d2311c 100644 (file)
@@ -271,6 +271,8 @@ void pim_vrf_terminate(void)
        }
 
        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)
index 511d35bf76ef47345f3a9fce6915a877cc714e64..7c8d71a86c3d145ad352b4f40874d7051e24cf61 100644 (file)
@@ -1249,9 +1249,14 @@ void pim_vxlan_exit(struct pim_instance *pim)
 {
        hash_clean_and_free(&pim->vxlan.sg_hash,
                            (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);
+               UNSET_FLAG(vxlan_info.flags, PIM_VXLANF_WORK_INITED);
+       }
 }
 
 void pim_vxlan_terminate(void)
index 65a5955851f632a2cabc63ecb32d3c72e9734c16..839397b1b744c85a45ecb83630818d15b3254a70 100644 (file)
@@ -33,5 +33,6 @@ struct pim_vxlan_instance {
 
 extern void pim_vxlan_init(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 */