]> git.proxmox.com Git - mirror_frr.git/commitdiff
pim6d: Adding "ipv6 mld" CLI
authorAbhishek N R <abnr@vmware.com>
Tue, 18 Jan 2022 15:38:47 +0000 (07:38 -0800)
committerAbhishek N R <abnr@vmware.com>
Tue, 15 Mar 2022 06:10:41 +0000 (23:10 -0700)
Adding the Interface level config command

ipv6 mld
To enable MLD on the interface.

Signed-off-by: Abhishek N R <abnr@vmware.com>
pimd/pim6_cmd.c
pimd/pim_nb_config.c

index 53c032498bddf25c20fdcfbd0729ff49fb0fe170..a7e2b0eb0301fe98a07de0340873037c8af4776b 100644 (file)
@@ -503,6 +503,52 @@ DEFPY (interface_no_ipv6_mld_join,
        return nb_cli_apply_changes(vty, NULL);
 }
 
+DEFPY (interface_ipv6_mld,
+       interface_ipv6_mld_cmd,
+       "ipv6 mld",
+       IPV6_STR
+       IFACE_MLD_STR)
+{
+       nb_cli_enqueue_change(vty, "./enable", NB_OP_MODIFY, "true");
+
+       return nb_cli_apply_changes(vty, FRR_GMP_INTERFACE_XPATH,
+                                   "frr-routing:ipv6");
+}
+
+DEFPY (interface_no_ipv6_mld,
+       interface_no_ipv6_mld_cmd,
+       "no ipv6 mld",
+       NO_STR
+       IPV6_STR
+       IFACE_MLD_STR)
+{
+       const struct lyd_node *pim_enable_dnode;
+       char pim_if_xpath[XPATH_MAXLEN + 20];
+
+       snprintf(pim_if_xpath, sizeof(pim_if_xpath),
+                "%s/frr-pim:pim/address-family[address-family='%s']",
+                VTY_CURR_XPATH, "frr-routing:ipv6");
+
+       pim_enable_dnode = yang_dnode_getf(vty->candidate_config->dnode,
+                                          FRR_PIM_ENABLE_XPATH, VTY_CURR_XPATH,
+                                          "frr-routing:ipv6");
+       if (!pim_enable_dnode) {
+               nb_cli_enqueue_change(vty, pim_if_xpath, NB_OP_DESTROY, NULL);
+               nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL);
+       } else {
+               if (!yang_dnode_get_bool(pim_enable_dnode, ".")) {
+                       nb_cli_enqueue_change(vty, pim_if_xpath, NB_OP_DESTROY,
+                                             NULL);
+                       nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL);
+               } else
+                       nb_cli_enqueue_change(vty, "./enable", NB_OP_MODIFY,
+                                             "false");
+       }
+
+       return nb_cli_apply_changes(vty, FRR_GMP_INTERFACE_XPATH,
+                                   "frr-routing:ipv6");
+}
+
 void pim_cmd_init(void)
 {
        if_cmd_init(pim_interface_config_write);
@@ -546,6 +592,8 @@ void pim_cmd_init(void)
        install_element(VRF_NODE, &ipv6_pim_rp_prefix_list_cmd);
        install_element(CONFIG_NODE, &no_ipv6_pim_rp_prefix_list_cmd);
        install_element(VRF_NODE, &no_ipv6_pim_rp_prefix_list_cmd);
+       install_element(INTERFACE_NODE, &interface_ipv6_mld_cmd);
+       install_element(INTERFACE_NODE, &interface_no_ipv6_mld_cmd);
        install_element(INTERFACE_NODE, &interface_ipv6_mld_join_cmd);
        install_element(INTERFACE_NODE, &interface_no_ipv6_mld_join_cmd);
 }
index ddba5a3edc8857a1b9c62beef6684d4b18d657ba..6f62b6ce1fda5559ce6d4bae87c2795d82f7d87f 100644 (file)
@@ -348,6 +348,7 @@ static bool is_pim_interface(const struct lyd_node *dnode)
        return false;
 }
 
+#if PIM_IPV == 4
 static int pim_cmd_igmp_start(struct interface *ifp)
 {
        struct pim_interface *pim_ifp;
@@ -376,6 +377,7 @@ static int pim_cmd_igmp_start(struct interface *ifp)
 
        return NB_OK;
 }
+#endif /* PIM_IPV == 4 */
 
 /*
  * CLI reconfiguration affects the interface level (struct pim_interface).
@@ -2554,6 +2556,7 @@ int lib_interface_gmp_address_family_destroy(struct nb_cb_destroy_args *args)
 int lib_interface_gmp_address_family_enable_modify(
        struct nb_cb_modify_args *args)
 {
+#if PIM_IPV == 4
        struct interface *ifp;
        bool igmp_enable;
        struct pim_interface *pim_ifp;
@@ -2601,7 +2604,9 @@ int lib_interface_gmp_address_family_enable_modify(
                                pim_if_delete(ifp);
                }
        }
-
+#else
+       /* TBD Depends on MLD data structure changes */
+#endif /* PIM_IPV == 4 */
        return NB_OK;
 }
 
@@ -2675,6 +2680,7 @@ int lib_interface_gmp_address_family_mld_version_modify(
        case NB_EV_PREPARE:
        case NB_EV_ABORT:
        case NB_EV_APPLY:
+               /* TBD depends on MLD data structure changes */
                break;
        }