pim6d: Completing "ipv6 mld" command.

Signed-off-by: Abhishek N R <abnr@vmware.com>
This commit is contained in:
Abhishek N R 2022-06-28 03:53:04 -07:00
parent d841284b70
commit 5c1b3cd2d9
5 changed files with 30 additions and 17 deletions

View File

@ -2246,8 +2246,16 @@ void gm_ifp_update(struct interface *ifp)
return; 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_start(ifp);
}
gm_ifp = pim_ifp->mld; gm_ifp = pim_ifp->mld;
if (IPV6_ADDR_CMP(&pim_ifp->ll_lowest, &gm_ifp->cur_ll_lowest)) if (IPV6_ADDR_CMP(&pim_ifp->ll_lowest, &gm_ifp->cur_ll_lowest))

View File

@ -36,6 +36,7 @@ typedef struct in_addr pim_addr;
#define PIM_MAX_BITLEN IPV4_MAX_BITLEN #define PIM_MAX_BITLEN IPV4_MAX_BITLEN
#define PIM_AF_NAME "ip" #define PIM_AF_NAME "ip"
#define PIMREG "pimreg" #define PIMREG "pimreg"
#define GM "IGMP"
#define PIM_ADDR_FUNCNAME(name) ipv4_##name #define PIM_ADDR_FUNCNAME(name) ipv4_##name
@ -60,6 +61,7 @@ typedef struct in6_addr pim_addr;
#define PIM_MAX_BITLEN IPV6_MAX_BITLEN #define PIM_MAX_BITLEN IPV6_MAX_BITLEN
#define PIM_AF_NAME "ipv6" #define PIM_AF_NAME "ipv6"
#define PIMREG "pim6reg" #define PIMREG "pim6reg"
#define GM "MLD"
#define PIM_ADDR_FUNCNAME(name) ipv6_##name #define PIM_ADDR_FUNCNAME(name) ipv6_##name

View File

@ -115,7 +115,7 @@ static int pim_sec_addr_comp(const void *p1, const void *p2)
return 0; 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) bool ispimreg, bool is_vxlan_term)
{ {
struct pim_interface *pim_ifp; 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_enable = pim;
pim_ifp->pim_passive_enable = false; pim_ifp->pim_passive_enable = false;
#if PIM_IPV == 4 pim_ifp->gm_enable = gm;
pim_ifp->gm_enable = igmp;
#endif
pim_ifp->gm_join_list = NULL; pim_ifp->gm_join_list = NULL;
pim_ifp->pim_neighbor_list = NULL; pim_ifp->pim_neighbor_list = NULL;
@ -821,7 +819,7 @@ void pim_if_addr_add_all(struct interface *ifp)
} /* pim */ } /* pim */
} }
/* /*
* 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. * address assigned, then try to create a vif_index.
*/ */
if (pim_ifp->mroute_vif_index < 0) { if (pim_ifp->mroute_vif_index < 0) {

View File

@ -348,8 +348,7 @@ static bool is_pim_interface(const struct lyd_node *dnode)
return false; return false;
} }
#if PIM_IPV == 4 static int pim_cmd_gm_start(struct interface *ifp)
static int pim_cmd_igmp_start(struct interface *ifp)
{ {
struct pim_interface *pim_ifp; struct pim_interface *pim_ifp;
uint8_t need_startup = 0; uint8_t need_startup = 0;
@ -377,7 +376,6 @@ static int pim_cmd_igmp_start(struct interface *ifp)
return NB_OK; return NB_OK;
} }
#endif /* PIM_IPV == 4 */
/* /*
* CLI reconfiguration affects the interface level (struct pim_interface). * 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( int lib_interface_gmp_address_family_enable_modify(
struct nb_cb_modify_args *args) struct nb_cb_modify_args *args)
{ {
#if PIM_IPV == 4
struct interface *ifp; struct interface *ifp;
bool gm_enable; bool gm_enable;
struct pim_interface *pim_ifp; struct pim_interface *pim_ifp;
@ -2600,9 +2597,10 @@ int lib_interface_gmp_address_family_enable_modify(
/* Limiting mcast interfaces to number of VIFs */ /* Limiting mcast interfaces to number of VIFs */
if (mcast_if_count == MAXVIFS) { if (mcast_if_count == MAXVIFS) {
ifp_name = yang_dnode_get_string(if_dnode, "name"); ifp_name = yang_dnode_get_string(if_dnode, "name");
snprintf(args->errmsg, args->errmsg_len, snprintf(
"Max multicast interfaces(%d) Reached. Could not enable IGMP on interface %s", args->errmsg, args->errmsg_len,
MAXVIFS, ifp_name); "Max multicast interfaces(%d) Reached. Could not enable %s on interface %s",
MAXVIFS, GM, ifp_name);
return NB_ERR_VALIDATION; return NB_ERR_VALIDATION;
} }
break; break;
@ -2614,7 +2612,7 @@ int lib_interface_gmp_address_family_enable_modify(
gm_enable = yang_dnode_get_bool(args->dnode, NULL); gm_enable = yang_dnode_get_bool(args->dnode, NULL);
if (gm_enable) if (gm_enable)
return pim_cmd_igmp_start(ifp); return pim_cmd_gm_start(ifp);
else { else {
pim_ifp = ifp->info; pim_ifp = ifp->info;
@ -2626,15 +2624,16 @@ int lib_interface_gmp_address_family_enable_modify(
pim_if_membership_clear(ifp); pim_if_membership_clear(ifp);
#if PIM_IPV == 4
pim_if_addr_del_all_igmp(ifp); pim_if_addr_del_all_igmp(ifp);
#else
gm_ifp_teardown(ifp);
#endif
if (!pim_ifp->pim_enable) if (!pim_ifp->pim_enable)
pim_if_delete(ifp); pim_if_delete(ifp);
} }
} }
#else
/* TBD Depends on MLD data structure changes */
#endif /* PIM_IPV == 4 */
return NB_OK; return NB_OK;
} }

View File

@ -365,6 +365,12 @@ static int gm_config_write(struct vty *vty, int writes,
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) 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) if (pim_ifp->mld_version != MLD_DEFAULT_VERSION)
vty_out(vty, " ipv6 mld version %d\n", pim_ifp->mld_version); vty_out(vty, " ipv6 mld version %d\n", pim_ifp->mld_version);
if (pim_ifp->gm_default_query_interval != IGMP_GENERAL_QUERY_INTERVAL) if (pim_ifp->gm_default_query_interval != IGMP_GENERAL_QUERY_INTERVAL)