summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas.abraitis@gmail.com>2022-03-02 12:30:51 +0100
committerDonatas Abraitis <donatas@opensourcerouting.org>2022-03-12 09:41:07 +0100
commit8c0a76808a3a3615eb4edad0fc30ccf783eb3cb6 (patch)
tree2d878ce6464e5e62737dd7a6d1ccc6ed138f384b
parentMerge pull request #10759 from opensourcerouting/feature/add_more_stats_for_igmp (diff)
downloadfrr-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>
-rw-r--r--doc/user/pim.rst4
-rw-r--r--pimd/pim_cmd.c25
-rw-r--r--pimd/pim_rp.c22
-rw-r--r--pimd/pim_rp.h4
-rw-r--r--pimd/pim_ssm.h2
5 files changed, 46 insertions, 11 deletions
diff --git a/doc/user/pim.rst b/doc/user/pim.rst
index 1c3a0110a..30363dfdf 100644
--- a/doc/user/pim.rst
+++ b/doc/user/pim.rst
@@ -505,10 +505,12 @@ cause great confusion.
Display information about a S,G pair and how the RPF would be chosen. This
is especially useful if there are ECMP's available from the RPF lookup.
-.. clicmd:: show ip pim rp-info
+.. clicmd:: show ip pim [vrf NAME] rp-info [A.B.C.D/M] [json]
Display information about RP's that are configured on this router.
+ You can filter the output by specifying an arbitrary group.
+
.. clicmd:: show ip pim rpf
Display information about currently being used S,G's and their RPF lookup
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index a9b57cabb..4232a021f 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -5340,39 +5340,56 @@ DEFUN (show_ip_pim_upstream_rpf,
DEFUN (show_ip_pim_rp,
show_ip_pim_rp_cmd,
- "show ip pim [vrf NAME] rp-info [json]",
+ "show ip pim [vrf NAME] rp-info [A.B.C.D/M] [json]",
SHOW_STR
IP_STR
PIM_STR
VRF_CMD_HELP_STR
"PIM RP information\n"
+ "Multicast Group range\n"
JSON_STR)
{
int idx = 2;
struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx);
bool uj = use_json(argc, argv);
+ struct prefix *range = NULL;
if (!vrf)
return CMD_WARNING;
- pim_rp_show_information(vrf->info, vty, uj);
+ if (argv_find(argv, argc, "A.B.C.D/M", &idx)) {
+ range = prefix_new();
+ (void)str2prefix(argv[idx]->arg, range);
+ apply_mask(range);
+ }
+
+ pim_rp_show_information(vrf->info, range, vty, uj);
return CMD_SUCCESS;
}
DEFUN (show_ip_pim_rp_vrf_all,
show_ip_pim_rp_vrf_all_cmd,
- "show ip pim vrf all rp-info [json]",
+ "show ip pim vrf all rp-info [A.B.C.D/M] [json]",
SHOW_STR
IP_STR
PIM_STR
VRF_CMD_HELP_STR
"PIM RP information\n"
+ "Multicast Group range\n"
JSON_STR)
{
+ int idx = 0;
bool uj = use_json(argc, argv);
struct vrf *vrf;
bool first = true;
+ struct prefix *range = NULL;
+
+ if (argv_find(argv, argc, "A.B.C.D/M", &idx)) {
+ range = prefix_new();
+ (void)str2prefix(argv[idx]->arg, range);
+ apply_mask(range);
+ }
if (uj)
vty_out(vty, "{ ");
@@ -5384,7 +5401,7 @@ DEFUN (show_ip_pim_rp_vrf_all,
first = false;
} else
vty_out(vty, "VRF: %s\n", vrf->name);
- pim_rp_show_information(vrf->info, vty, uj);
+ pim_rp_show_information(vrf->info, range, vty, uj);
}
if (uj)
vty_out(vty, "}\n");
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;
}
diff --git a/pimd/pim_rp.h b/pimd/pim_rp.h
index 29834f8e5..04faeb5f2 100644
--- a/pimd/pim_rp.h
+++ b/pimd/pim_rp.h
@@ -78,8 +78,8 @@ struct pim_rpf *pim_rp_g(struct pim_instance *pim, pim_addr group);
#define I_am_RP(P, G) pim_rp_i_am_rp ((P), (G))
#define RP(P, G) pim_rp_g ((P), (G))
-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);
void pim_resolve_rp_nh(struct pim_instance *pim, struct pim_neighbor *nbr);
int pim_rp_list_cmp(void *v1, void *v2);
struct rp_info *pim_rp_find_match_group(struct pim_instance *pim,
diff --git a/pimd/pim_ssm.h b/pimd/pim_ssm.h
index 117713b86..c6b697821 100644
--- a/pimd/pim_ssm.h
+++ b/pimd/pim_ssm.h
@@ -34,7 +34,7 @@ struct pim_ssm {
void pim_ssm_prefix_list_update(struct pim_instance *pim,
struct prefix_list *plist);
-int pim_is_grp_ssm(struct pim_instance *pim, pim_addr group_addr);
+extern int pim_is_grp_ssm(struct pim_instance *pim, pim_addr group_addr);
int pim_ssm_range_set(struct pim_instance *pim, vrf_id_t vrf_id,
const char *plist_name);
void *pim_ssm_init(void);