pim6d: Adding "ipv6 mld join" CLI

Adding the Interface level config command

ipv6 mld join
This command can be used to configure the static MLD join
for IPv6 group addresses on the interfaces.

Signed-off-by: Abhishek N R <abnr@vmware.com>
This commit is contained in:
Abhishek N R 2022-01-18 07:17:59 -08:00
parent 82aca4ae4f
commit fe2df4f7ba
3 changed files with 65 additions and 2 deletions

View File

@ -448,6 +448,61 @@ DEFPY (no_ipv6_pim_rp_prefix_list,
return pim_process_no_rp_plist_cmd(vty, rp_str, plist);
}
DEFPY (interface_ipv6_mld_join,
interface_ipv6_mld_join_cmd,
"ipv6 mld join X:X::X:X$group [X:X::X:X$source]",
IPV6_STR
IFACE_MLD_STR
"MLD join multicast group\n"
"Multicast group address\n"
"Source address\n")
{
char xpath[XPATH_MAXLEN];
if (source_str) {
if (IPV6_ADDR_SAME(&source, &in6addr_any)) {
vty_out(vty, "Bad source address %s\n", source_str);
return CMD_WARNING_CONFIG_FAILED;
}
} else
source_str = "::";
snprintf(xpath, sizeof(xpath), FRR_GMP_JOIN_XPATH, "frr-routing:ipv6",
group_str, source_str);
nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
return nb_cli_apply_changes(vty, NULL);
}
DEFPY (interface_no_ipv6_mld_join,
interface_no_ipv6_mld_join_cmd,
"no ipv6 mld join X:X::X:X$group [X:X::X:X$source]",
NO_STR
IPV6_STR
IFACE_MLD_STR
"MLD join multicast group\n"
"Multicast group address\n"
"Source address\n")
{
char xpath[XPATH_MAXLEN];
if (source_str) {
if (IPV6_ADDR_SAME(&source, &in6addr_any)) {
vty_out(vty, "Bad source address %s\n", source_str);
return CMD_WARNING_CONFIG_FAILED;
}
} else
source_str = "::";
snprintf(xpath, sizeof(xpath), FRR_GMP_JOIN_XPATH, "frr-routing:ipv6",
group_str, source_str);
nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
return nb_cli_apply_changes(vty, NULL);
}
void pim_cmd_init(void)
{
if_cmd_init(pim_interface_config_write);
@ -491,4 +546,6 @@ 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_join_cmd);
install_element(INTERFACE_NODE, &interface_no_ipv6_mld_join_cmd);
}

View File

@ -1203,6 +1203,7 @@ static int igmp_join_sock(const char *ifname, ifindex_t ifindex,
return join_fd;
}
#if PIM_IPV == 4
static struct gm_join *igmp_join_new(struct interface *ifp,
struct in_addr group_addr,
struct in_addr source_addr)
@ -1241,7 +1242,9 @@ static struct gm_join *igmp_join_new(struct interface *ifp,
return ij;
}
#endif /* PIM_IPV == 4 */
#if PIM_IPV == 4
ferr_r pim_if_igmp_join_add(struct interface *ifp, struct in_addr group_addr,
struct in_addr source_addr)
{
@ -1283,7 +1286,7 @@ ferr_r pim_if_igmp_join_add(struct interface *ifp, struct in_addr group_addr,
return ferr_ok();
}
#endif /* PIM_IPV == 4 */
int pim_if_igmp_join_del(struct interface *ifp, struct in_addr group_addr,
struct in_addr source_addr)

View File

@ -2806,6 +2806,7 @@ int lib_interface_gmp_address_family_robustness_variable_modify(
int lib_interface_gmp_address_family_static_group_create(
struct nb_cb_create_args *args)
{
#if PIM_IPV == 4
struct interface *ifp;
struct ipaddr source_addr;
struct ipaddr group_addr;
@ -2848,7 +2849,9 @@ int lib_interface_gmp_address_family_static_group_create(
return NB_ERR_INCONSISTENCY;
}
}
#else
/* TBD Depends on MLD data structure changes */
#endif /* PIM_IPV == 4 */
return NB_OK;
}