]> git.proxmox.com Git - mirror_frr.git/commitdiff
pimd: Moving the common functions from pim_cmd.c file
authorSai Gomathi N <nsaigomathi@vmware.com>
Tue, 12 Apr 2022 11:36:35 +0000 (04:36 -0700)
committerSai Gomathi N <nsaigomathi@vmware.com>
Tue, 17 May 2022 05:47:04 +0000 (22:47 -0700)
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>
pimd/pim6_cmd.h
pimd/pim_cmd.c
pimd/pim_cmd_common.c
pimd/pim_cmd_common.h

index d6853a7410cb527353cca70d250082ad1419adc0..b7804c0db279f7b4282ed5a4369a1cdfde0364f6 100644 (file)
@@ -39,6 +39,7 @@
 #define IFACE_PIM_HELLO_TIME_STR "Time in seconds for Hello Interval\n"
 #define IFACE_PIM_HELLO_HOLD_STR "Time in seconds for Hold Interval\n"
 #define MROUTE_STR "IP multicast routing table\n"
+#define CLEAR_IP_PIM_STR "PIM clear commands\n"
 #define DEBUG_MLD_STR "MLD protocol activity\n"
 #define DEBUG_MLD_EVENTS_STR "MLD protocol events\n"
 #define DEBUG_MLD_PACKETS_STR "MLD protocol packets\n"
index 7e9ce5f933773fbd3c54ed53cb0c904ff12af1b6..bdf015642fd806922b68a406af519d1a5b41acef 100644 (file)
@@ -1303,27 +1303,6 @@ static void pim_show_group_rp_mappings_info(struct pim_instance *pim,
                vty_json(vty, json);
 }
 
-static 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;
-       }
-}
-
 static void igmp_show_groups(struct pim_instance *pim, struct vty *vty, bool uj)
 {
        struct interface *ifp;
@@ -1861,45 +1840,6 @@ DEFUN (clear_ip_pim_statistics,
        return CMD_SUCCESS;
 }
 
-static 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__);
-
-}
-
 DEFUN (clear_ip_mroute,
        clear_ip_mroute_cmd,
        "clear ip mroute [vrf NAME]",
index 6cff3a077e16e8bb9462ac5d2b223a9beaeb3b3f..f4479abfab6bf08cdc5421cd07a789b2e853f53c 100644 (file)
@@ -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;
+       }
+}
index 4457ea57a97b232c003b4df6cf3b5d7b077810e8..1431ce32e12eb8ef2fe3135466ded20bc36453fe 100644 (file)
@@ -121,6 +121,8 @@ void show_mroute_count(struct pim_instance *pim, struct vty *vty,
                       json_object *json);
 void show_mroute_summary(struct pim_instance *pim, struct vty *vty,
                         json_object *json);
+void clear_mroute(struct pim_instance *pim);
+void clear_pim_statistics(struct pim_instance *pim);
 
 /*
  * Special Macro to allow us to get the correct pim_instance;