diff options
author | Donatas Abraitis <donatas.abraitis@gmail.com> | 2022-03-02 12:30:51 +0100 |
---|---|---|
committer | Donatas Abraitis <donatas@opensourcerouting.org> | 2022-03-12 09:41:07 +0100 |
commit | 8c0a76808a3a3615eb4edad0fc30ccf783eb3cb6 (patch) | |
tree | 2d878ce6464e5e62737dd7a6d1ccc6ed138f384b /pimd/pim_rp.c | |
parent | Merge pull request #10759 from opensourcerouting/feature/add_more_stats_for_igmp (diff) | |
download | frr-8c0a76808a3a3615eb4edad0fc30ccf783eb3cb6.tar.xz frr-8c0a76808a3a3615eb4edad0fc30ccf783eb3cb6.zip |
pimd: Show group-type under `show ip pim rp-info`
And filter by group for PIM.
```
exit1-debian-11# show ip pim rp-info
RP address group/prefix-list OIF I am RP Source Group-Type
192.168.10.17 238.0.0.0/24 eth2 no Static ASM
192.168.10.110 232.0.0.0/24 eth2 no Static SSM
exit1-debian-11# show ip pim rp-info 238.0.0.0/24
RP address group/prefix-list OIF I am RP Source Group-Type
192.168.10.17 238.0.0.0/24 eth2 no Static ASM
exit1-debian-11# show ip pim rp-info 238.0.0.0/24 json
{
"192.168.10.17":[
{
"rpAddress":"192.168.10.17",
"outboundInterface":"eth2",
"iAmRP":false,
"group":"238.0.0.0/24",
"source":"Static",
"groupType":"ASM"
}
]
}
exit1-debian-11#
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'pimd/pim_rp.c')
-rw-r--r-- | pimd/pim_rp.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/pimd/pim_rp.c b/pimd/pim_rp.c index 00a1e1b58..99727cf83 100644 --- a/pimd/pim_rp.c +++ b/pimd/pim_rp.c @@ -49,6 +49,7 @@ #include "pim_zebra.h" #include "pim_bsm.h" #include "pim_util.h" +#include "pim_ssm.h" /* Cleanup pim->rpf_hash each node data */ void pim_rp_list_hash_clean(void *data) @@ -1145,7 +1146,8 @@ int pim_rp_config_write(struct pim_instance *pim, struct vty *vty, return count; } -void pim_rp_show_information(struct pim_instance *pim, struct vty *vty, bool uj) +void pim_rp_show_information(struct pim_instance *pim, struct prefix *range, + struct vty *vty, bool uj) { struct rp_info *rp_info; struct rp_info *prev_rp_info = NULL; @@ -1160,11 +1162,22 @@ void pim_rp_show_information(struct pim_instance *pim, struct vty *vty, bool uj) json = json_object_new_object(); else vty_out(vty, - "RP address group/prefix-list OIF I am RP Source\n"); + "RP address group/prefix-list OIF I am RP Source Group-Type\n"); for (ALL_LIST_ELEMENTS_RO(pim->rp_list, node, rp_info)) { if (pim_rpf_addr_is_inaddr_any(&rp_info->rp)) continue; +#if PIM_IPV == 4 + pim_addr group = rp_info->group.u.prefix4; +#else + pim_addr group = rp_info->group.u.prefix6; +#endif + const char *group_type = + pim_is_grp_ssm(pim, group) ? "SSM" : "ASM"; + + if (range && !prefix_same(&rp_info->group, range)) + continue; + if (rp_info->rp_src == RP_SRC_STATIC) strlcpy(source, "Static", sizeof(source)); else if (rp_info->rp_src == RP_SRC_BSR) @@ -1214,6 +1227,8 @@ void pim_rp_show_information(struct pim_instance *pim, struct vty *vty, bool uj) "%pFX", &rp_info->group); json_object_string_add(json_row, "source", source); + json_object_string_add(json_row, "groupType", + group_type); json_object_array_add(json_rp_rows, json_row); } else { @@ -1236,7 +1251,8 @@ void pim_rp_show_information(struct pim_instance *pim, struct vty *vty, bool uj) else vty_out(vty, "no"); - vty_out(vty, "%14s\n", source); + vty_out(vty, "%14s", source); + vty_out(vty, "%6s\n", group_type); } prev_rp_info = rp_info; } |