mirror of
https://github.com/FRRouting/frr.git
synced 2025-04-30 13:37:17 +02:00
pim6d: support group-type command
Allow user to query about IPv6 address group type: - not-multicast - ASM - SSM Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
This commit is contained in:
parent
8d70f071c3
commit
58a071f351
|
@ -28,6 +28,8 @@
|
|||
#include "pim_addr.h"
|
||||
#include "pim_nht.h"
|
||||
#include "pim_bsm.h"
|
||||
#include "pim_ssm.h"
|
||||
#include "pim_util.h"
|
||||
#include "pim_iface.h"
|
||||
#include "pim_zebra.h"
|
||||
#include "pim_instance.h"
|
||||
|
@ -2439,6 +2441,79 @@ DEFPY (show_ipv6_pim_bsrp,
|
|||
return pim_show_group_rp_mappings_info_helper(vrf, vty, !!json);
|
||||
}
|
||||
|
||||
DEFPY(show_ipv6_pim_ssm_range,
|
||||
show_ipv6_pim_ssm_range_cmd,
|
||||
"show ipv6 pim [vrf NAME$vrf_name] group-type [json$json]",
|
||||
SHOW_STR
|
||||
IPV6_STR
|
||||
PIM_STR
|
||||
VRF_CMD_HELP_STR
|
||||
"PIM group type\n"
|
||||
JSON_STR)
|
||||
{
|
||||
struct pim_instance *pim;
|
||||
const char *range_str;
|
||||
struct pim_ssm *ssm;
|
||||
struct vrf *vrf = NULL;
|
||||
|
||||
if (vrf_name)
|
||||
vrf = vrf_lookup_by_name(vrf_name);
|
||||
if (vrf == NULL)
|
||||
vrf = vrf_lookup_by_id(VRF_DEFAULT);
|
||||
|
||||
pim = vrf->info;
|
||||
ssm = pim->ssm_info;
|
||||
range_str = ssm->plist_name ? ssm->plist_name : PIM6_SSM_STANDARD_RANGE;
|
||||
if (json) {
|
||||
struct json_object *json_root;
|
||||
|
||||
json_root = json_object_new_object();
|
||||
json_object_string_add(json_root, "ssmGroups", range_str);
|
||||
vty_json(vty, json_root);
|
||||
} else
|
||||
vty_out(vty, "SSM group range : %s\n", range_str);
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFPY(show_ipv6_pim_group_type,
|
||||
show_ipv6_pim_group_type_cmd,
|
||||
"show ipv6 pim [vrf NAME$vrf_name] group-type X:X::X:X$group [json$json]",
|
||||
SHOW_STR
|
||||
IP_STR
|
||||
PIM_STR
|
||||
VRF_CMD_HELP_STR
|
||||
"multicast group type\n"
|
||||
"group address\n"
|
||||
JSON_STR)
|
||||
{
|
||||
struct pim_instance *pim;
|
||||
const char *type_str;
|
||||
struct vrf *vrf = NULL;
|
||||
|
||||
if (vrf_name)
|
||||
vrf = vrf_lookup_by_name(vrf_name);
|
||||
if (vrf == NULL)
|
||||
vrf = vrf_lookup_by_id(VRF_DEFAULT);
|
||||
|
||||
pim = vrf->info;
|
||||
if (pim_is_group_ff00_8(group))
|
||||
type_str = pim_is_grp_ssm(pim, group) ? "SSM" : "ASM";
|
||||
else
|
||||
type_str = "not-multicast";
|
||||
|
||||
if (json) {
|
||||
struct json_object *json_root;
|
||||
|
||||
json_root = json_object_new_object();
|
||||
json_object_string_add(json_root, "groupType", type_str);
|
||||
vty_json(vty, json_root);
|
||||
} else
|
||||
vty_out(vty, "Group type : %s\n", type_str);
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFPY(clear_ipv6_mld_interfaces,
|
||||
clear_ipv6_mld_interfaces_cmd,
|
||||
"clear ipv6 mld [vrf NAME$vrf_name] interfaces",
|
||||
|
@ -3066,6 +3141,8 @@ void pim_cmd_init(void)
|
|||
install_element(VIEW_NODE, &show_ipv6_pim_bsr_cmd);
|
||||
install_element(VIEW_NODE, &show_ipv6_pim_bsm_db_cmd);
|
||||
install_element(VIEW_NODE, &show_ipv6_pim_bsrp_cmd);
|
||||
install_element(VIEW_NODE, &show_ipv6_pim_ssm_range_cmd);
|
||||
install_element(VIEW_NODE, &show_ipv6_pim_group_type_cmd);
|
||||
install_element(ENABLE_NODE, &clear_ipv6_mld_interfaces_cmd);
|
||||
install_element(ENABLE_NODE, &clear_ipv6_pim_statistics_cmd);
|
||||
install_element(ENABLE_NODE, &clear_ipv6_mroute_cmd);
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#define PIM_SSM_H
|
||||
|
||||
#define PIM_SSM_STANDARD_RANGE "232.0.0.0/8"
|
||||
#define PIM6_SSM_STANDARD_RANGE "FF30::/32"
|
||||
|
||||
struct pim_instance;
|
||||
|
||||
|
|
|
@ -129,6 +129,20 @@ int pim_is_group_224_4(struct in_addr group_addr)
|
|||
return prefix_match(&group_all, &group);
|
||||
}
|
||||
|
||||
bool pim_is_group_ff00_8(struct in6_addr group_address)
|
||||
{
|
||||
struct prefix group_all = { .family = AF_INET6,
|
||||
.prefixlen = 8,
|
||||
.u.prefix6.s6_addr = { 0xFF } };
|
||||
struct prefix group;
|
||||
|
||||
group.family = AF_INET6;
|
||||
group.u.prefix6 = group_address;
|
||||
group.prefixlen = IPV6_MAX_BITLEN;
|
||||
|
||||
return prefix_match(&group_all, &group);
|
||||
}
|
||||
|
||||
static bool pim_cisco_match(const struct filter *filter, const struct in_addr *source,
|
||||
const struct in_addr *group)
|
||||
{
|
||||
|
|
|
@ -23,6 +23,7 @@ void pim_pkt_dump(const char *label, const uint8_t *buf, int size);
|
|||
|
||||
int pim_is_group_224_0_0_0_24(struct in_addr group_addr);
|
||||
int pim_is_group_224_4(struct in_addr group_addr);
|
||||
bool pim_is_group_ff00_8(struct in6_addr group_address);
|
||||
enum filter_type pim_access_list_apply(struct access_list *access, const struct in_addr *source,
|
||||
const struct in_addr *group);
|
||||
bool pim_is_group_filtered(struct pim_interface *pim_ifp, pim_addr *grp, pim_addr *src);
|
||||
|
|
Loading…
Reference in a new issue