From c889adcb263f8126ffe34f5def48e73f2defc92f Mon Sep 17 00:00:00 2001 From: Sai Gomathi N Date: Tue, 18 Jan 2022 07:24:11 -0800 Subject: [PATCH] pim6d: Adding ipv6 mld last-member-query-count CLI Adding the Interface level config command ipv6 mld last-member-query-count (1-255) This command can be use to tune the number of Multicast-Address- Specific Queries sent before the router assumes there are no remaining listeners for an address on a link. Signed-off-by: Sai Gomathi N --- pimd/pim6_cmd.c | 27 +++++++++++++++++++++++++++ pimd/pim_cmd.c | 31 ++++--------------------------- pimd/pim_cmd_common.c | 30 ++++++++++++++++++++++++++++++ pimd/pim_cmd_common.h | 3 +++ pimd/pim_nb_config.c | 4 ++++ 5 files changed, 68 insertions(+), 27 deletions(-) diff --git a/pimd/pim6_cmd.c b/pimd/pim6_cmd.c index 132ac59354..68d9239e5d 100644 --- a/pimd/pim6_cmd.c +++ b/pimd/pim6_cmd.c @@ -648,6 +648,29 @@ DEFPY (interface_no_ipv6_mld_query_max_response_time, return gm_process_no_query_max_response_time_cmd(vty); } +DEFPY (interface_ipv6_mld_last_member_query_count, + interface_ipv6_mld_last_member_query_count_cmd, + "ipv6 mld last-member-query-count (1-255)$lmqc", + IPV6_STR + IFACE_MLD_STR + IFACE_MLD_LAST_MEMBER_QUERY_COUNT_STR + "Last member query count\n") +{ + return gm_process_last_member_query_count_cmd(vty, lmqc_str); +} + +DEFPY (interface_no_ipv6_mld_last_member_query_count, + interface_no_ipv6_mld_last_member_query_count_cmd, + "no ipv6 mld last-member-query-count [(1-255)]", + NO_STR + IPV6_STR + IFACE_MLD_STR + IFACE_MLD_LAST_MEMBER_QUERY_COUNT_STR + IGNORED_IN_NO_STR) +{ + return gm_process_no_last_member_query_count_cmd(vty); +} + DEFPY (show_ipv6_pim_rp, show_ipv6_pim_rp_cmd, "show ipv6 pim [vrf NAME] rp-info [X:X::X:X/M$group] [json$json]", @@ -1528,6 +1551,10 @@ void pim_cmd_init(void) &interface_ipv6_mld_query_max_response_time_cmd); install_element(INTERFACE_NODE, &interface_no_ipv6_mld_query_max_response_time_cmd); + install_element(INTERFACE_NODE, + &interface_ipv6_mld_last_member_query_count_cmd); + install_element(INTERFACE_NODE, + &interface_no_ipv6_mld_last_member_query_count_cmd); install_element(VIEW_NODE, &show_ipv6_pim_rp_cmd); install_element(VIEW_NODE, &show_ipv6_pim_rp_vrf_all_cmd); diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index dfa4780d02..b892955741 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -5733,34 +5733,15 @@ DEFUN_HIDDEN (interface_no_ip_igmp_query_max_response_time_dsec, "frr-routing:ipv4"); } -DEFUN (interface_ip_igmp_last_member_query_count, +DEFPY (interface_ip_igmp_last_member_query_count, interface_ip_igmp_last_member_query_count_cmd, - "ip igmp last-member-query-count (1-255)", + "ip igmp last-member-query-count (1-255)$lmqc", IP_STR IFACE_IGMP_STR IFACE_IGMP_LAST_MEMBER_QUERY_COUNT_STR "Last member query count\n") { - const struct lyd_node *pim_enable_dnode; - - pim_enable_dnode = - yang_dnode_getf(vty->candidate_config->dnode, - FRR_PIM_ENABLE_XPATH, VTY_CURR_XPATH, - "frr-routing:ipv4"); - if (!pim_enable_dnode) { - nb_cli_enqueue_change(vty, "./enable", NB_OP_MODIFY, - "true"); - } else { - if (!yang_dnode_get_bool(pim_enable_dnode, ".")) - nb_cli_enqueue_change(vty, "./enable", - NB_OP_MODIFY, "true"); - } - - nb_cli_enqueue_change(vty, "./robustness-variable", NB_OP_MODIFY, - argv[3]->arg); - - return nb_cli_apply_changes(vty, FRR_GMP_INTERFACE_XPATH, - "frr-routing:ipv4"); + return gm_process_last_member_query_count_cmd(vty, lmqc_str); } DEFUN (interface_no_ip_igmp_last_member_query_count, @@ -5772,11 +5753,7 @@ DEFUN (interface_no_ip_igmp_last_member_query_count, IFACE_IGMP_LAST_MEMBER_QUERY_COUNT_STR IGNORED_IN_NO_STR) { - nb_cli_enqueue_change(vty, "./robustness-variable", NB_OP_DESTROY, - NULL); - - return nb_cli_apply_changes(vty, FRR_GMP_INTERFACE_XPATH, - "frr-routing:ipv4"); + return gm_process_no_last_member_query_count_cmd(vty); } DEFUN (interface_ip_igmp_last_member_query_interval, diff --git a/pimd/pim_cmd_common.c b/pimd/pim_cmd_common.c index 087448ab16..86e750a943 100644 --- a/pimd/pim_cmd_common.c +++ b/pimd/pim_cmd_common.c @@ -2780,3 +2780,33 @@ int gm_process_no_query_max_response_time_cmd(struct vty *vty) return nb_cli_apply_changes(vty, FRR_GMP_INTERFACE_XPATH, FRR_PIM_AF_XPATH_VAL); } + +int gm_process_last_member_query_count_cmd(struct vty *vty, + const char *lmqc_str) +{ + const struct lyd_node *pim_enable_dnode; + + pim_enable_dnode = yang_dnode_getf(vty->candidate_config->dnode, + FRR_PIM_ENABLE_XPATH, VTY_CURR_XPATH, + FRR_PIM_AF_XPATH_VAL); + if (!pim_enable_dnode) { + nb_cli_enqueue_change(vty, "./enable", NB_OP_MODIFY, "true"); + } else { + if (!yang_dnode_get_bool(pim_enable_dnode, ".")) + nb_cli_enqueue_change(vty, "./enable", NB_OP_MODIFY, + "true"); + } + + nb_cli_enqueue_change(vty, "./robustness-variable", NB_OP_MODIFY, + lmqc_str); + return nb_cli_apply_changes(vty, FRR_GMP_INTERFACE_XPATH, + FRR_PIM_AF_XPATH_VAL); +} + +int gm_process_no_last_member_query_count_cmd(struct vty *vty) +{ + nb_cli_enqueue_change(vty, "./robustness-variable", NB_OP_DESTROY, + NULL); + return nb_cli_apply_changes(vty, FRR_GMP_INTERFACE_XPATH, + FRR_PIM_AF_XPATH_VAL); +} diff --git a/pimd/pim_cmd_common.h b/pimd/pim_cmd_common.h index 9f562d43b4..5bd8869ce4 100644 --- a/pimd/pim_cmd_common.h +++ b/pimd/pim_cmd_common.h @@ -96,6 +96,9 @@ void pim_show_neighbors(struct pim_instance *pim, struct vty *vty, int gm_process_query_max_response_time_cmd(struct vty *vty, const char *qmrt_str); int gm_process_no_query_max_response_time_cmd(struct vty *vty); +int gm_process_last_member_query_count_cmd(struct vty *vty, + const char *lmqc_str); +int gm_process_no_last_member_query_count_cmd(struct vty *vty); /* * Special Macro to allow us to get the correct pim_instance */ diff --git a/pimd/pim_nb_config.c b/pimd/pim_nb_config.c index 97d307d14c..5ea8ebc6d5 100644 --- a/pimd/pim_nb_config.c +++ b/pimd/pim_nb_config.c @@ -2794,6 +2794,7 @@ int lib_interface_gmp_address_family_last_member_query_interval_modify( int lib_interface_gmp_address_family_robustness_variable_modify( struct nb_cb_modify_args *args) { +#if PIM_IPV == 4 struct interface *ifp; struct pim_interface *pim_ifp; int last_member_query_count; @@ -2812,6 +2813,9 @@ int lib_interface_gmp_address_family_robustness_variable_modify( break; } +#else + /* TBD Depends on MLD data structure changes */ +#endif return NB_OK; } -- 2.39.5