From cc463a53829e4567ef2da20ccfc8af6a7b0079be Mon Sep 17 00:00:00 2001 From: Mobashshera Rasool Date: Sun, 28 Aug 2022 23:12:01 -0700 Subject: [PATCH] pim6d: Completing mld config commands. #11581 --- pimd/pim6_mld.c | 29 +++++++++++++++++++++++------ pimd/pim6_mld.h | 1 + pimd/pim_nb_config.c | 31 ++++++++++++------------------- pimd/pim_vty.c | 20 ++++++++++++++++++++ 4 files changed, 56 insertions(+), 25 deletions(-) diff --git a/pimd/pim6_mld.c b/pimd/pim6_mld.c index fa2b05200e08..fbed55ee8d8d 100644 --- a/pimd/pim6_mld.c +++ b/pimd/pim6_mld.c @@ -418,7 +418,7 @@ static void gm_sg_update(struct gm_sg *sg, bool has_expired) gm_sg_timer_start(gm_ifp, sg, timers.expire_wait); THREAD_OFF(sg->t_sg_query); - sg->n_query = gm_ifp->cur_qrv; + sg->n_query = gm_ifp->cur_lmqc; sg->query_sbit = false; gm_trigger_specific(sg); } @@ -2091,11 +2091,12 @@ static void gm_start(struct interface *ifp) else gm_ifp->cur_version = GM_MLDV2; - /* hardcoded for dev without CLI */ - gm_ifp->cur_qrv = 2; + gm_ifp->cur_qrv = pim_ifp->gm_default_robustness_variable; gm_ifp->cur_query_intv = pim_ifp->gm_default_query_interval * 1000; - gm_ifp->cur_query_intv_trig = gm_ifp->cur_query_intv; - gm_ifp->cur_max_resp = 250; + gm_ifp->cur_query_intv_trig = + pim_ifp->gm_specific_query_max_response_time_dsec * 100; + gm_ifp->cur_max_resp = pim_ifp->gm_query_max_response_time_dsec * 100; + gm_ifp->cur_lmqc = pim_ifp->gm_last_member_query_count; gm_ifp->cfg_timing_fuzz.tv_sec = 0; gm_ifp->cfg_timing_fuzz.tv_usec = 10 * 1000; @@ -2268,10 +2269,26 @@ void gm_ifp_update(struct interface *ifp) if (gm_ifp->cur_query_intv != cfg_query_intv) { gm_ifp->cur_query_intv = cfg_query_intv; - gm_ifp->cur_query_intv_trig = cfg_query_intv; changed = true; } + unsigned int cfg_query_intv_trig = + pim_ifp->gm_specific_query_max_response_time_dsec * 100; + + if (gm_ifp->cur_query_intv_trig != cfg_query_intv_trig) { + gm_ifp->cur_query_intv_trig = cfg_query_intv_trig; + changed = true; + } + + unsigned int cfg_max_response = + pim_ifp->gm_query_max_response_time_dsec * 100; + + if (gm_ifp->cur_max_resp != cfg_max_response) + gm_ifp->cur_max_resp = cfg_max_response; + + if (gm_ifp->cur_lmqc != pim_ifp->gm_last_member_query_count) + gm_ifp->cur_lmqc = pim_ifp->gm_last_member_query_count; + enum gm_version cfg_version; if (pim_ifp->mld_version == 1) diff --git a/pimd/pim6_mld.h b/pimd/pim6_mld.h index 95523c2922b6..540d2e1899df 100644 --- a/pimd/pim6_mld.h +++ b/pimd/pim6_mld.h @@ -324,6 +324,7 @@ struct gm_if { unsigned int cur_query_intv_trig; /* ms */ unsigned int cur_max_resp; /* ms */ enum gm_version cur_version; + int cur_lmqc; /* last member query count in ds */ /* this value (positive, default 10ms) defines our "timing tolerance": * - added to deadlines for expiring joins diff --git a/pimd/pim_nb_config.c b/pimd/pim_nb_config.c index 72b16a5f49e1..aaad56e543ae 100644 --- a/pimd/pim_nb_config.c +++ b/pimd/pim_nb_config.c @@ -454,14 +454,17 @@ static void change_query_interval(struct pim_interface *pim_ifp, } #endif -#if PIM_IPV == 4 -static void change_query_max_response_time(struct pim_interface *pim_ifp, - int query_max_response_time_dsec) +static void change_query_max_response_time(struct interface *ifp, + int query_max_response_time_dsec) { +#if PIM_IPV == 4 struct listnode *sock_node; struct gm_sock *igmp; struct listnode *grp_node; struct gm_group *grp; +#endif + + struct pim_interface *pim_ifp = ifp->info; if (pim_ifp->gm_query_max_response_time_dsec == query_max_response_time_dsec) @@ -469,6 +472,9 @@ static void change_query_max_response_time(struct pim_interface *pim_ifp, pim_ifp->gm_query_max_response_time_dsec = query_max_response_time_dsec; +#if PIM_IPV == 6 + gm_ifp_update(ifp); +#else /* * Below we modify socket/group/source timers in order to quickly * reflect the change. Otherwise, those timers would args->eventually @@ -501,8 +507,8 @@ static void change_query_max_response_time(struct pim_interface *pim_ifp, igmp_source_reset_gmi(grp, src); } } +#endif /* PIM_IPV == 4 */ } -#endif int routing_control_plane_protocols_name_validate( struct nb_cb_create_args *args) @@ -2797,7 +2803,6 @@ int lib_interface_gmp_address_family_query_interval_modify( int lib_interface_gmp_address_family_query_max_response_time_modify( struct nb_cb_modify_args *args) { -#if PIM_IPV == 4 struct interface *ifp; int query_max_response_time_dsec; @@ -2810,13 +2815,9 @@ int lib_interface_gmp_address_family_query_max_response_time_modify( ifp = nb_running_get_entry(args->dnode, NULL, true); query_max_response_time_dsec = yang_dnode_get_uint16(args->dnode, NULL); - change_query_max_response_time(ifp->info, - query_max_response_time_dsec); + change_query_max_response_time(ifp, + query_max_response_time_dsec); } -#else - /* TBD Depends on MLD data structure changes */ -#endif - return NB_OK; } @@ -2827,7 +2828,6 @@ int lib_interface_gmp_address_family_query_max_response_time_modify( int lib_interface_gmp_address_family_last_member_query_interval_modify( struct nb_cb_modify_args *args) { -#if PIM_IPV == 4 struct interface *ifp; struct pim_interface *pim_ifp; int last_member_query_interval; @@ -2847,9 +2847,6 @@ int lib_interface_gmp_address_family_last_member_query_interval_modify( break; } -#else - /* TBD Depends on MLD data structure changes */ -#endif return NB_OK; } @@ -2860,7 +2857,6 @@ 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; @@ -2879,9 +2875,6 @@ int lib_interface_gmp_address_family_robustness_variable_modify( break; } -#else - /* TBD Depends on MLD data structure changes */ -#endif return NB_OK; } diff --git a/pimd/pim_vty.c b/pimd/pim_vty.c index cfbd436981f2..c18652f72ea0 100644 --- a/pimd/pim_vty.c +++ b/pimd/pim_vty.c @@ -378,9 +378,29 @@ static int gm_config_write(struct vty *vty, int writes, if (pim_ifp->mld_version != MLD_DEFAULT_VERSION) vty_out(vty, " ipv6 mld version %d\n", pim_ifp->mld_version); + + /* IF ipv6 mld query-max-response-time */ + if (pim_ifp->gm_query_max_response_time_dsec != + IGMP_QUERY_MAX_RESPONSE_TIME_DSEC) + vty_out(vty, " ipv6 mld query-max-response-time %d\n", + pim_ifp->gm_query_max_response_time_dsec); + if (pim_ifp->gm_default_query_interval != IGMP_GENERAL_QUERY_INTERVAL) vty_out(vty, " ipv6 mld query-interval %d\n", pim_ifp->gm_default_query_interval); + + /* IF ipv6 mld last-member_query-count */ + if (pim_ifp->gm_last_member_query_count != + IGMP_DEFAULT_ROBUSTNESS_VARIABLE) + vty_out(vty, " ipv6 mld last-member-query-count %d\n", + pim_ifp->gm_last_member_query_count); + + /* IF ipv6 mld last-member_query-interval */ + if (pim_ifp->gm_specific_query_max_response_time_dsec != + IGMP_SPECIFIC_QUERY_MAX_RESPONSE_TIME_DSEC) + vty_out(vty, " ipv6 mld last-member-query-interval %d\n", + pim_ifp->gm_specific_query_max_response_time_dsec); + return 0; } #endif