From 0da72f1f59bc241062d24127598852f8334e464a Mon Sep 17 00:00:00 2001 From: Mobashshera Rasool Date: Wed, 19 Jan 2022 05:21:20 -0800 Subject: [PATCH] pim6d: Adding ipv6 pim packet CLI Adding below CLI for pim6d daemon: [no] ipv6 pim packet (1-255) Signed-off-by: Mobashshera Rasool --- pimd/pim6_cmd.c | 25 +++++++++++++++++++++++++ pimd/pim_cmd.c | 22 +++------------------- pimd/pim_cmd_common.c | 26 ++++++++++++++++++++++++++ pimd/pim_cmd_common.h | 2 ++ 4 files changed, 56 insertions(+), 19 deletions(-) diff --git a/pimd/pim6_cmd.c b/pimd/pim6_cmd.c index 617120316b..c87e92a91f 100644 --- a/pimd/pim6_cmd.c +++ b/pimd/pim6_cmd.c @@ -116,6 +116,29 @@ DEFPY (no_ipv6_pim_spt_switchover_infinity_plist, return pim_process_no_spt_switchover_cmd(vty); } +DEFPY (ipv6_pim_packets, + ipv6_pim_packets_cmd, + "ipv6 pim packets (1-255)", + IPV6_STR + PIM_STR + "packets to process at one time per fd\n" + "Number of packets\n") +{ + return pim_process_pim_packet_cmd(vty, packets_str); +} + +DEFPY (no_ipv6_pim_packets, + no_ipv6_pim_packets_cmd, + "no ipv6 pim packets [(1-255)]", + NO_STR + IPV6_STR + PIM_STR + "packets to process at one time per fd\n" + IGNORED_IN_NO_STR) +{ + return pim_process_no_pim_packet_cmd(vty); +} + void pim_cmd_init(void) { if_cmd_init(pim_interface_config_write); @@ -126,4 +149,6 @@ void pim_cmd_init(void) install_element(CONFIG_NODE, &ipv6_pim_spt_switchover_infinity_plist_cmd); install_element(CONFIG_NODE, &no_ipv6_pim_spt_switchover_infinity_cmd); install_element(CONFIG_NODE, &no_ipv6_pim_spt_switchover_infinity_plist_cmd); + install_element(CONFIG_NODE, &ipv6_pim_packets_cmd); + install_element(CONFIG_NODE, &no_ipv6_pim_packets_cmd); } diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 27e0036a50..a20fcaeef7 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -6983,7 +6983,7 @@ DEFUN (no_ip_pim_keep_alive, return nb_cli_apply_changes(vty, NULL); } -DEFUN (ip_pim_packets, +DEFPY (ip_pim_packets, ip_pim_packets_cmd, "ip pim packets (1-255)", IP_STR @@ -6991,15 +6991,7 @@ DEFUN (ip_pim_packets, "packets to process at one time per fd\n" "Number of packets\n") { - char xpath[XPATH_MAXLEN]; - - snprintf(xpath, sizeof(xpath), FRR_PIM_ROUTER_XPATH, - "frr-routing:ipv4"); - strlcat(xpath, "/packets", sizeof(xpath)); - - nb_cli_enqueue_change(vty, xpath, NB_OP_MODIFY, argv[3]->arg); - - return nb_cli_apply_changes(vty, NULL); + return pim_process_pim_packet_cmd(vty, packets_str); } DEFUN (no_ip_pim_packets, @@ -7011,15 +7003,7 @@ DEFUN (no_ip_pim_packets, "packets to process at one time per fd\n" IGNORED_IN_NO_STR) { - char xpath[XPATH_MAXLEN]; - - snprintf(xpath, sizeof(xpath), FRR_PIM_ROUTER_XPATH, - "frr-routing:ipv4"); - strlcat(xpath, "/packets", sizeof(xpath)); - - nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL); - - return nb_cli_apply_changes(vty, NULL); + return pim_process_no_pim_packet_cmd(vty); } DEFPY (igmp_group_watermark, diff --git a/pimd/pim_cmd_common.c b/pimd/pim_cmd_common.c index 250151562b..c3385db0c2 100644 --- a/pimd/pim_cmd_common.c +++ b/pimd/pim_cmd_common.c @@ -179,3 +179,29 @@ int pim_process_no_spt_switchover_cmd(struct vty *vty) return nb_cli_apply_changes(vty, NULL); } + +int pim_process_pim_packet_cmd(struct vty *vty, const char *packet) +{ + char xpath[XPATH_MAXLEN]; + + snprintf(xpath, sizeof(xpath), FRR_PIM_ROUTER_XPATH, + FRR_PIM_AF_XPATH_VAL); + strlcat(xpath, "/packets", sizeof(xpath)); + + nb_cli_enqueue_change(vty, xpath, NB_OP_MODIFY, packet); + + return nb_cli_apply_changes(vty, NULL); +} + +int pim_process_no_pim_packet_cmd(struct vty *vty) +{ + char xpath[XPATH_MAXLEN]; + + snprintf(xpath, sizeof(xpath), FRR_PIM_ROUTER_XPATH, + FRR_PIM_AF_XPATH_VAL); + strlcat(xpath, "/packets", sizeof(xpath)); + + nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL); + + return nb_cli_apply_changes(vty, NULL); +} diff --git a/pimd/pim_cmd_common.h b/pimd/pim_cmd_common.h index 322811a159..0905a89d8a 100644 --- a/pimd/pim_cmd_common.h +++ b/pimd/pim_cmd_common.h @@ -27,5 +27,7 @@ int pim_process_spt_switchover_infinity_cmd(struct vty *vty); int pim_process_spt_switchover_prefixlist_cmd(struct vty *vty, const char *plist); int pim_process_no_spt_switchover_cmd(struct vty *vty); +int pim_process_pim_packet_cmd(struct vty *vty, const char *packet); +int pim_process_no_pim_packet_cmd(struct vty *vty); #endif /* PIM_CMD_COMMON_H */ -- 2.39.5