]> git.proxmox.com Git - mirror_frr.git/commitdiff
Merge pull request #11485 from AbhishekNR/ipv6_mld_todo
authorDonatas Abraitis <donatas@opensourcerouting.org>
Thu, 18 Aug 2022 06:47:03 +0000 (09:47 +0300)
committerGitHub <noreply@github.com>
Thu, 18 Aug 2022 06:47:03 +0000 (09:47 +0300)
pim6d: Completing "ipv6 mld" config command.

pimd/pim6_mld.c
pimd/pim_addr.h
pimd/pim_iface.c
pimd/pim_nb_config.c
pimd/pim_vty.c

index c5c98d8024515c7576a0aad115d94941dd1d986c..60602ee04a390c004b0f46151f308e7f367132d2 100644 (file)
@@ -2246,8 +2246,16 @@ void gm_ifp_update(struct interface *ifp)
                return;
        }
 
-       if (!pim_ifp->mld)
+       /*
+        * If ipv6 mld is not enabled on interface, do not start mld activites.
+        */
+       if (!pim_ifp->gm_enable)
+               return;
+
+       if (!pim_ifp->mld) {
+               changed = true;
                gm_start(ifp);
+       }
 
        gm_ifp = pim_ifp->mld;
        if (IPV6_ADDR_CMP(&pim_ifp->ll_lowest, &gm_ifp->cur_ll_lowest))
index 2f2ff246754986391f0b08198cf8c61b717f3cee..defe4070cfb54697d8c3bb839f0da27118ca9370 100644 (file)
@@ -38,6 +38,7 @@ typedef struct in_addr pim_addr;
 #define PIM_AF_DBG     "pim"
 #define PIM_MROUTE_DBG  "mroute"
 #define PIMREG          "pimreg"
+#define GM              "IGMP"
 
 #define PIM_ADDR_FUNCNAME(name) ipv4_##name
 
@@ -64,6 +65,7 @@ typedef struct in6_addr pim_addr;
 #define PIM_AF_DBG     "pimv6"
 #define PIM_MROUTE_DBG  "mroute6"
 #define PIMREG          "pim6reg"
+#define GM              "MLD"
 
 #define PIM_ADDR_FUNCNAME(name) ipv6_##name
 
index 0fb5e8c6d9f1abf305d6347d6158bebbd798921d..e03e5a263074da692e280217c19fc91e51780187 100644 (file)
@@ -115,7 +115,7 @@ static int pim_sec_addr_comp(const void *p1, const void *p2)
        return 0;
 }
 
-struct pim_interface *pim_if_new(struct interface *ifp, bool igmp, bool pim,
+struct pim_interface *pim_if_new(struct interface *ifp, bool gm, bool pim,
                                 bool ispimreg, bool is_vxlan_term)
 {
        struct pim_interface *pim_ifp;
@@ -154,9 +154,7 @@ struct pim_interface *pim_if_new(struct interface *ifp, bool igmp, bool pim,
 
        pim_ifp->pim_enable = pim;
        pim_ifp->pim_passive_enable = false;
-#if PIM_IPV == 4
-       pim_ifp->gm_enable = igmp;
-#endif
+       pim_ifp->gm_enable = gm;
 
        pim_ifp->gm_join_list = NULL;
        pim_ifp->pim_neighbor_list = NULL;
@@ -810,7 +808,7 @@ void pim_if_addr_add_all(struct interface *ifp)
                          ifp->name);
        }
        /*
-        * PIM or IGMP is enabled on interface, and there is at least one
+        * PIM or IGMP/MLD is enabled on interface, and there is at least one
         * address assigned, then try to create a vif_index.
         */
        if (pim_ifp->mroute_vif_index < 0) {
index 408e86b6984b94b03cc7cdf045eb4f0a7c861061..72b16a5f49e1a5a34735b40d41e07521818f04e5 100644 (file)
@@ -348,8 +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)
+static int pim_cmd_gm_start(struct interface *ifp)
 {
        struct pim_interface *pim_ifp;
        uint8_t need_startup = 0;
@@ -377,7 +376,6 @@ 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).
@@ -2584,7 +2582,6 @@ 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 gm_enable;
        struct pim_interface *pim_ifp;
@@ -2600,9 +2597,10 @@ int lib_interface_gmp_address_family_enable_modify(
                /* Limiting mcast interfaces to number of VIFs */
                if (mcast_if_count == MAXVIFS) {
                        ifp_name = yang_dnode_get_string(if_dnode, "name");
-                       snprintf(args->errmsg, args->errmsg_len,
-                                "Max multicast interfaces(%d) Reached. Could not enable IGMP on interface %s",
-                                MAXVIFS, ifp_name);
+                       snprintf(
+                               args->errmsg, args->errmsg_len,
+                               "Max multicast interfaces(%d) Reached. Could not enable %s on interface %s",
+                               MAXVIFS, GM, ifp_name);
                        return NB_ERR_VALIDATION;
                }
                break;
@@ -2614,7 +2612,7 @@ int lib_interface_gmp_address_family_enable_modify(
                gm_enable = yang_dnode_get_bool(args->dnode, NULL);
 
                if (gm_enable)
-                       return pim_cmd_igmp_start(ifp);
+                       return pim_cmd_gm_start(ifp);
 
                else {
                        pim_ifp = ifp->info;
@@ -2626,15 +2624,16 @@ int lib_interface_gmp_address_family_enable_modify(
 
                        pim_if_membership_clear(ifp);
 
+#if PIM_IPV == 4
                        pim_if_addr_del_all_igmp(ifp);
+#else
+                       gm_ifp_teardown(ifp);
+#endif
 
                        if (!pim_ifp->pim_enable)
                                pim_if_delete(ifp);
                }
        }
-#else
-       /* TBD Depends on MLD data structure changes */
-#endif /* PIM_IPV == 4 */
        return NB_OK;
 }
 
index 3d5d68b1f4b617739df86ca7059b3ff013923f00..cfbd436981f200dd6fc3b54ac986af7478d11429 100644 (file)
@@ -370,6 +370,12 @@ static int gm_config_write(struct vty *vty, int writes,
 static int gm_config_write(struct vty *vty, int writes,
                           struct pim_interface *pim_ifp)
 {
+       /* IF ipv6 mld */
+       if (pim_ifp->gm_enable) {
+               vty_out(vty, " ipv6 mld\n");
+               ++writes;
+       }
+
        if (pim_ifp->mld_version != MLD_DEFAULT_VERSION)
                vty_out(vty, " ipv6 mld version %d\n", pim_ifp->mld_version);
        if (pim_ifp->gm_default_query_interval != IGMP_GENERAL_QUERY_INTERVAL)