diff options
author | Sai Gomathi N <nsaigomathi@vmware.com> | 2022-04-12 13:36:35 +0200 |
---|---|---|
committer | Sai Gomathi N <nsaigomathi@vmware.com> | 2022-05-17 07:47:04 +0200 |
commit | 58d5712048f2a5518dd315648ae8b3d60abf62d6 (patch) | |
tree | 677e0e59501725022aefd01bdedf917ab536bb37 /pimd/pim_cmd_common.c | |
parent | Merge pull request #11152 from donaldsharp/dscp (diff) | |
download | frr-58d5712048f2a5518dd315648ae8b3d60abf62d6.tar.xz frr-58d5712048f2a5518dd315648ae8b3d60abf62d6.zip |
pimd: Moving the common functions from pim_cmd.c file
Moving the functions that are used by both IPV4 and IPV6 to a
common file pim_cmd_common.c file.
Signed-off-by: Sai Gomathi N <nsaigomathi@vmware.com>
Diffstat (limited to 'pimd/pim_cmd_common.c')
-rw-r--r-- | pimd/pim_cmd_common.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/pimd/pim_cmd_common.c b/pimd/pim_cmd_common.c index 6cff3a077..f4479abfa 100644 --- a/pimd/pim_cmd_common.c +++ b/pimd/pim_cmd_common.c @@ -3563,3 +3563,62 @@ void show_mroute_summary(struct pim_instance *pim, struct vty *vty, sg_hw_mroute_cnt); } } + +void clear_mroute(struct pim_instance *pim) +{ + struct pim_upstream *up; + struct interface *ifp; + + /* scan interfaces */ + FOR_ALL_INTERFACES (pim->vrf, ifp) { + struct pim_interface *pim_ifp = ifp->info; + struct pim_ifchannel *ch; + + if (!pim_ifp) + continue; + + /* deleting all ifchannels */ + while (!RB_EMPTY(pim_ifchannel_rb, &pim_ifp->ifchannel_rb)) { + ch = RB_ROOT(pim_ifchannel_rb, &pim_ifp->ifchannel_rb); + + pim_ifchannel_delete(ch); + } + +#if PIM_IPV == 4 + /* clean up all igmp groups */ + struct gm_group *grp; + + if (pim_ifp->gm_group_list) { + while (pim_ifp->gm_group_list->count) { + grp = listnode_head(pim_ifp->gm_group_list); + igmp_group_delete(grp); + } + } +#endif + } + + /* clean up all upstreams*/ + while ((up = rb_pim_upstream_first(&pim->upstream_head))) + pim_upstream_del(pim, up, __func__); +} + +void clear_pim_statistics(struct pim_instance *pim) +{ + struct interface *ifp; + + pim->bsm_rcvd = 0; + pim->bsm_sent = 0; + pim->bsm_dropped = 0; + + /* scan interfaces */ + FOR_ALL_INTERFACES (pim->vrf, ifp) { + struct pim_interface *pim_ifp = ifp->info; + + if (!pim_ifp) + continue; + + pim_ifp->pim_ifstat_bsm_cfg_miss = 0; + pim_ifp->pim_ifstat_ucast_bsm_cfg_miss = 0; + pim_ifp->pim_ifstat_bsm_invalid_sz = 0; + } +} |