From 1006598dfe8682020aa0974f57381b1e976a6528 Mon Sep 17 00:00:00 2001 From: Mobashshera Rasool Date: Mon, 1 Aug 2022 05:44:55 -0700 Subject: [PATCH] pim6d: PR 10559 Signed-off-by: Mobashshera Rasool --- pimd/pim6_mld.c | 16 ++++++++++++++++ pimd/pim6_mld.h | 1 + pimd/pim_cmd_common.c | 7 +++++++ 3 files changed, 24 insertions(+) diff --git a/pimd/pim6_mld.c b/pimd/pim6_mld.c index c89e0d160618..138da04cfba3 100644 --- a/pimd/pim6_mld.c +++ b/pimd/pim6_mld.c @@ -2280,6 +2280,22 @@ void gm_ifp_update(struct interface *ifp) } } +void gm_group_delete(struct gm_if *gm_ifp) +{ + struct gm_sg *sg, *sg_start; + + sg_start = gm_sgs_first(gm_ifp->sgs); + + /* clean up all mld groups */ + frr_each_from (gm_sgs, gm_ifp->sgs, sg, sg_start) { + THREAD_OFF(sg->t_sg_expire); + if (sg->oil) + pim_channel_oil_del(sg->oil, __func__); + gm_sgs_del(gm_ifp->sgs, sg); + gm_sg_free(sg); + } +} + /* * CLI (show commands only) */ diff --git a/pimd/pim6_mld.h b/pimd/pim6_mld.h index 9c7a6370072e..95523c2922b6 100644 --- a/pimd/pim6_mld.h +++ b/pimd/pim6_mld.h @@ -352,6 +352,7 @@ struct gm_if { #if PIM_IPV == 6 extern void gm_ifp_update(struct interface *ifp); extern void gm_ifp_teardown(struct interface *ifp); +extern void gm_group_delete(struct gm_if *gm_ifp); #else static inline void gm_ifp_update(struct interface *ifp) { diff --git a/pimd/pim_cmd_common.c b/pimd/pim_cmd_common.c index b7bd7375c595..08634b603a88 100644 --- a/pimd/pim_cmd_common.c +++ b/pimd/pim_cmd_common.c @@ -55,6 +55,7 @@ #include "pim_static.h" #include "pim_addr.h" #include "pim_static.h" +#include "pim6_mld.h" #include "pim_util.h" /** @@ -3994,6 +3995,12 @@ void clear_mroute(struct pim_instance *pim) igmp_group_delete(grp); } } +#else + struct gm_if *gm_ifp; + + gm_ifp = pim_ifp->mld; + if (gm_ifp) + gm_group_delete(gm_ifp); #endif }