diff options
| author | Nathan Bahr <nbahr@atcorp.com> | 2024-06-26 12:41:45 -0500 |
|---|---|---|
| committer | Nathan Bahr <nbahr@atcorp.com> | 2024-08-15 16:20:00 +0000 |
| commit | 0cb1bf78736573f13d45e6b138a8c1ac42228b1f (patch) | |
| tree | b79a2e0bcbcdbb02d22052f03c300c06d8cd9d16 /pimd/pim6_cmd.c | |
| parent | aa9d66e922e2a232b2fd89b87d8cb7409ae82dc1 (diff) | |
pimd, yang: Implement igmp static-group command
This will add a static IGMP group that does not rely on an underlying
socket join which sends traffic to the cpu unneccesarily. Instead, the
groups are joined directly without any IGMP interactions.
New command is under interfaces, 'ip igmp static-group ...'.
Added an alias for 'ip igmp join ...' to 'ip igmp join-group'.
Moved IGMP join groups to new yang list "join-group" and reused
the "static-group" list for the IGMP static groups.
Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
Diffstat (limited to 'pimd/pim6_cmd.c')
| -rw-r--r-- | pimd/pim6_cmd.c | 82 |
1 files changed, 47 insertions, 35 deletions
diff --git a/pimd/pim6_cmd.c b/pimd/pim6_cmd.c index 99f1474712..f7a4e0e481 100644 --- a/pimd/pim6_cmd.c +++ b/pimd/pim6_cmd.c @@ -1363,45 +1363,56 @@ DEFPY_ATTR(no_ipv6_ssmpingd, return ret; } -DEFPY (interface_ipv6_mld_join, - interface_ipv6_mld_join_cmd, - "ipv6 mld join X:X::X:X$group [X:X::X:X$source]", +DEFPY_YANG_HIDDEN (interface_ipv6_mld_join, + interface_ipv6_mld_join_cmd, + "[no] ipv6 mld join X:X::X:X$grp [X:X::X:X]$src", + NO_STR + IPV6_STR + IFACE_MLD_STR + "MLD join multicast group\n" + "Multicast group address\n" + "Source address\n") +{ + nb_cli_enqueue_change(vty, ".", (!no ? NB_OP_CREATE : NB_OP_DESTROY), + NULL); + return nb_cli_apply_changes(vty, FRR_GMP_JOIN_GROUP_XPATH, + "frr-routing:ipv6", grp_str, + (src_str ? src_str : "::")); +} +ALIAS (interface_ipv6_mld_join, + interface_ipv6_mld_join_group_cmd, + "[no] ipv6 mld join-group X:X::X:X$grp [X:X::X:X]$src", + NO_STR IPV6_STR IFACE_MLD_STR "MLD join multicast group\n" "Multicast group address\n" - "Source address\n") -{ - char xpath[XPATH_MAXLEN]; - - if (!IN6_IS_ADDR_MULTICAST(&group)) { - vty_out(vty, "Invalid Multicast Address\n"); - return CMD_WARNING_CONFIG_FAILED; - } - - 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]", + "Source address\n"); + +DEFPY_YANG (interface_ipv6_mld_static_group, + interface_ipv6_mld_static_group_cmd, + "[no] ipv6 mld static-group X:X::X:X$grp [X:X::X:X]$src", + NO_STR + IPV6_STR + IFACE_MLD_STR + "Static multicast group\n" + "Multicast group address\n" + "Source address\n") +{ + nb_cli_enqueue_change(vty, ".", (!no ? NB_OP_CREATE : NB_OP_DESTROY), + NULL); + return nb_cli_apply_changes(vty, FRR_GMP_STATIC_GROUP_XPATH, + "frr-routing:ipv6", grp_str, + (src_str ? src_str : "::")); +} + +DEFPY (interface_no_ipv6_mld_static_group, + interface_no_ipv6_mld_static_group_cmd, + "no ipv6 mld static-group X:X::X:X$group [X:X::X:X$source]", NO_STR IPV6_STR IFACE_MLD_STR - "MLD join multicast group\n" + "Static multicast group\n" "Multicast group address\n" "Source address\n") { @@ -1415,8 +1426,8 @@ DEFPY (interface_no_ipv6_mld_join, } else source_str = "::"; - snprintf(xpath, sizeof(xpath), FRR_GMP_JOIN_XPATH, "frr-routing:ipv6", - group_str, source_str); + snprintf(xpath, sizeof(xpath), FRR_GMP_STATIC_GROUP_XPATH, + "frr-routing:ipv6", group_str, source_str); nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL); @@ -2669,7 +2680,8 @@ void pim_cmd_init(void) 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); + install_element(INTERFACE_NODE, &interface_ipv6_mld_join_group_cmd); + install_element(INTERFACE_NODE, &interface_ipv6_mld_static_group_cmd); install_element(INTERFACE_NODE, &interface_ipv6_mld_version_cmd); install_element(INTERFACE_NODE, &interface_no_ipv6_mld_version_cmd); install_element(INTERFACE_NODE, &interface_ipv6_mld_query_interval_cmd); |
