]> git.puffer.fish Git - mirror/frr.git/commitdiff
pim6d: add MLD query-max-resp & robustness config
authorDavid Lamparter <equinox@opensourcerouting.org>
Tue, 5 Apr 2022 19:52:38 +0000 (21:52 +0200)
committerDavid Lamparter <equinox@opensourcerouting.org>
Fri, 29 Apr 2022 18:00:51 +0000 (20:00 +0200)
Pending some YANG remodeling to get rid of weird time units...

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
pimd/pim6_cmd.c
pimd/pim6_mld.c
pimd/pim_iface.c
pimd/pim_iface.h
pimd/pim_nb_config.c

index 557793edc0b0cbf5ba3de4aa51dc034ed682be55..bc1d478af097b0283762e47e20358d793bc72be0 100644 (file)
@@ -622,71 +622,44 @@ DEFPY (no_ipv6_mld_group_watermark,
 
 DEFPY (interface_ipv6_mld_query_max_response_time,
        interface_ipv6_mld_query_max_response_time_cmd,
-       "ipv6 mld query-max-response-time (1-65535)$qmrt",
+       "[no] ipv6 mld query-max-response-time ![(1-65535)$qmrt]",
+       NO_STR
        IPV6_STR
        IFACE_MLD_STR
        IFACE_MLD_QUERY_MAX_RESPONSE_TIME_STR
        "Query response value in milliseconds\n")
 {
+       if (no)
+               return gm_process_no_query_max_response_time_cmd(vty);
        return gm_process_query_max_response_time_cmd(vty, qmrt_str);
 }
 
-DEFPY (interface_no_ipv6_mld_query_max_response_time,
-       interface_no_ipv6_mld_query_max_response_time_cmd,
-       "no ipv6 mld query-max-response-time [(1-65535)]",
-       NO_STR
-       IPV6_STR
-       IFACE_MLD_STR
-       IFACE_MLD_QUERY_MAX_RESPONSE_TIME_STR
-       IGNORED_IN_NO_STR)
-{
-       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)]",
+DEFPY (interface_ipv6_mld_robustness,
+       interface_ipv6_mld_robustness_cmd,
+       "[no] ipv6 mld robustness ![(1-7)]",
        NO_STR
        IPV6_STR
        IFACE_MLD_STR
-       IFACE_MLD_LAST_MEMBER_QUERY_COUNT_STR
-       IGNORED_IN_NO_STR)
+       "MLD Robustness variable\n"
+       "MLD Robustness variable\n")
 {
-       return gm_process_no_last_member_query_count_cmd(vty);
+       if (no)
+               return gm_process_no_last_member_query_count_cmd(vty);
+       return gm_process_last_member_query_count_cmd(vty, robustness_str);
 }
 
 DEFPY (interface_ipv6_mld_last_member_query_interval,
        interface_ipv6_mld_last_member_query_interval_cmd,
-       "ipv6 mld last-member-query-interval (1-65535)$lmqi",
-       IPV6_STR
-       IFACE_MLD_STR
-       IFACE_MLD_LAST_MEMBER_QUERY_INTERVAL_STR
-       "Last member query interval in deciseconds\n")
-{
-       return gm_process_last_member_query_interval_cmd(vty, lmqi_str);
-}
-
-DEFPY (interface_no_ipv6_mld_last_member_query_interval,
-       interface_no_ipv6_mld_last_member_query_interval_cmd,
-       "no ipv6 mld last-member-query-interval [(1-65535)]",
+       "[no] ipv6 mld last-member-query-interval ![(1-65535)$lmqi]",
        NO_STR
        IPV6_STR
        IFACE_MLD_STR
        IFACE_MLD_LAST_MEMBER_QUERY_INTERVAL_STR
-       IGNORED_IN_NO_STR)
+       "Last member query interval in milliseconds\n")
 {
-       return gm_process_no_last_member_query_interval_cmd(vty);
+       if (no)
+               return gm_process_no_last_member_query_interval_cmd(vty);
+       return gm_process_last_member_query_interval_cmd(vty, lmqi_str);
 }
 
 DEFPY (show_ipv6_pim_rp,
@@ -1911,18 +1884,13 @@ void pim_cmd_init(void)
        install_element(VRF_NODE, &ipv6_mld_group_watermark_cmd);
        install_element(CONFIG_NODE, &no_ipv6_mld_group_watermark_cmd);
        install_element(VRF_NODE, &no_ipv6_mld_group_watermark_cmd);
+
        install_element(INTERFACE_NODE,
                        &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);
+                       &interface_ipv6_mld_robustness_cmd);
        install_element(INTERFACE_NODE,
                        &interface_ipv6_mld_last_member_query_interval_cmd);
-       install_element(INTERFACE_NODE,
-                       &interface_no_ipv6_mld_last_member_query_interval_cmd);
 
        install_element(VIEW_NODE, &show_ipv6_pim_rp_cmd);
        install_element(VIEW_NODE, &show_ipv6_pim_rp_vrf_all_cmd);
index e9c99e3be6c13c725d4efea2bfbc12c2b26df161..baf211791eddc13f0ddf1d55716100409f0a01a6 100644 (file)
@@ -2083,10 +2083,10 @@ static void gm_start(struct interface *ifp)
                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->mld_last_query_intv;
+       gm_ifp->cur_max_resp = pim_ifp->mld_max_resp_ms;
 
        gm_ifp->cfg_timing_fuzz.tv_sec = 0;
        gm_ifp->cfg_timing_fuzz.tv_usec = 10 * 1000;
@@ -2246,11 +2246,19 @@ void gm_ifp_update(struct interface *ifp)
        if (IPV6_ADDR_CMP(&pim_ifp->ll_lowest, &gm_ifp->cur_ll_lowest))
                gm_update_ll(ifp);
 
+       /* these don't trigger a new query */
+       gm_ifp->cur_query_intv_trig = pim_ifp->mld_last_query_intv;
+       gm_ifp->cur_max_resp = pim_ifp->mld_max_resp_ms;
+
        unsigned cfg_query_intv = pim_ifp->gm_default_query_interval * 1000;
 
        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;
+       }
+
+       if (gm_ifp->cur_qrv != pim_ifp->gm_default_robustness_variable) {
+               gm_ifp->cur_qrv = pim_ifp->gm_default_robustness_variable;
                changed = true;
        }
 
index 8dc902d133ca8a032d3cc1e333bc73bb7fdf2586..7db5a1352255f6662a1848137e874bf53f39dca2 100644 (file)
@@ -138,6 +138,8 @@ struct pim_interface *pim_if_new(struct interface *ifp, bool igmp, bool pim,
        pim_ifp->gm_specific_query_max_response_time_dsec =
                IGMP_SPECIFIC_QUERY_MAX_RESPONSE_TIME_DSEC;
        pim_ifp->gm_last_member_query_count = IGMP_DEFAULT_ROBUSTNESS_VARIABLE;
+       pim_ifp->mld_last_query_intv = 30000;
+       pim_ifp->mld_max_resp_ms = 5000;
 
        /* BSM config on interface: true by default */
        pim_ifp->bsm_enable = true;
index 6781cbf3a045964b56eeab72b759546862c86714..bdc7c521d6f6f7293c1632594e72717a00416b28 100644 (file)
@@ -109,6 +109,9 @@ struct pim_interface {
        int gm_last_member_query_count;               /* IGMP or MLD last member
                                                         query count
                                                       */
+       int mld_max_resp_ms;
+       int mld_last_query_intv;
+
        struct list *gm_socket_list; /* list of struct IGMP or MLD sock */
        struct list *gm_join_list;   /* list of struct IGMP or MLD join */
        struct list *gm_group_list;  /* list of struct IGMP or MLD group */
index 9611483bdfc67b60f461b4b67f4f4217e4353c55..39c8ae96763b6a216440760faab20450faa15be8 100644 (file)
@@ -2762,8 +2762,8 @@ 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;
+#if PIM_IPV == 4
        int query_max_response_time_dsec;
 
        switch (args->event) {
@@ -2779,10 +2779,23 @@ int lib_interface_gmp_address_family_query_max_response_time_modify(
                                query_max_response_time_dsec);
        }
 #else
-       /* TBD Depends on MLD data structure changes */
-#endif
+       struct pim_interface *pim_ifp;
+       int max_resp_ms;
 
+       switch (args->event) {
+       case NB_EV_VALIDATE:
+       case NB_EV_PREPARE:
+       case NB_EV_ABORT:
+               break;
+       case NB_EV_APPLY:
+               pim_ifp = pim_ifp_get(args->dnode, NULL, &ifp);
 
+               max_resp_ms = yang_dnode_get_uint16(args->dnode, NULL);
+               pim_ifp->mld_max_resp_ms = max_resp_ms;
+               gm_ifp_update(ifp);
+               break;
+       }
+#endif
        return NB_OK;
 }
 
@@ -2792,9 +2805,9 @@ 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;
+#if PIM_IPV == 4
        int last_member_query_interval;
 
        switch (args->event) {
@@ -2813,9 +2826,22 @@ int lib_interface_gmp_address_family_last_member_query_interval_modify(
                break;
        }
 #else
-       /* TBD Depends on MLD data structure changes */
-#endif
+       int last_query_intv;
+
+       switch (args->event) {
+       case NB_EV_VALIDATE:
+       case NB_EV_PREPARE:
+       case NB_EV_ABORT:
+               break;
+       case NB_EV_APPLY:
+               pim_ifp = pim_ifp_get(args->dnode, NULL, &ifp);
 
+               last_query_intv = yang_dnode_get_uint16(args->dnode, NULL);
+               pim_ifp->mld_last_query_intv = last_query_intv;
+               gm_ifp_update(ifp);
+               break;
+       }
+#endif
        return NB_OK;
 }
 
@@ -2825,9 +2851,10 @@ 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;
+
+#if PIM_IPV == 4
        int last_member_query_count;
 
        switch (args->event) {
@@ -2845,7 +2872,22 @@ int lib_interface_gmp_address_family_robustness_variable_modify(
                break;
        }
 #else
-       /* TBD Depends on MLD data structure changes */
+       int robustness;
+
+       switch (args->event) {
+       case NB_EV_VALIDATE:
+       case NB_EV_PREPARE:
+       case NB_EV_ABORT:
+               break;
+       case NB_EV_APPLY:
+               pim_ifp = pim_ifp_get(args->dnode, NULL, &ifp);
+
+               robustness = yang_dnode_get_uint8(args->dnode, NULL);
+               pim_ifp->gm_default_robustness_variable = robustness;
+               pim_ifp->gm_last_member_query_count = robustness;
+               gm_ifp_update(ifp);
+               break;
+       }
 #endif
 
        return NB_OK;