}
}
-static void pim_show_join(struct pim_instance *pim, struct vty *vty, bool uj)
+static void pim_show_join(struct pim_instance *pim, struct vty *vty,
+ struct prefix_sg *sg, bool uj)
{
struct pim_interface *pim_ifp;
struct pim_ifchannel *ch;
continue;
RB_FOREACH (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
+ if (sg->grp.s_addr != 0
+ && sg->grp.s_addr != ch->sg.grp.s_addr)
+ continue;
+ if (sg->src.s_addr != 0
+ && sg->src.s_addr != ch->sg.src.s_addr)
+ continue;
pim_show_join_helper(vty, pim_ifp, ch, json, now, uj);
} /* scan interface channels */
}
return CMD_SUCCESS;
}
-DEFUN (show_ip_pim_join,
+DEFPY (show_ip_pim_join,
show_ip_pim_join_cmd,
- "show ip pim [vrf NAME] join [json]",
+ "show ip pim [vrf NAME] join [A.B.C.D$s_or_g [A.B.C.D$g]] [json$json]",
SHOW_STR
IP_STR
PIM_STR
VRF_CMD_HELP_STR
"PIM interface join information\n"
+ "The Source or Group\n"
+ "The Group\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_sg sg = {0};
+ struct vrf *v;
+ bool uj = !!json;
+ struct pim_instance *pim;
- if (!vrf)
+ v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
+
+ if (!v) {
+ vty_out(vty, "%% Vrf specified: %s does not exist\n", vrf);
return CMD_WARNING;
+ }
+ pim = pim_get_pim_instance(v->vrf_id);
+
+ if (!pim) {
+ vty_out(vty, "%% Unable to find pim instance\n");
+ return CMD_WARNING;
+ }
+
+ if (s_or_g.s_addr != 0) {
+ if (g.s_addr != 0) {
+ sg.src = s_or_g;
+ sg.grp = g;
+ } else
+ sg.grp = s_or_g;
+ }
- pim_show_join(vrf->info, vty, uj);
+ pim_show_join(pim, vty, &sg, uj);
return CMD_SUCCESS;
}
"PIM interface join information\n"
JSON_STR)
{
+ struct prefix_sg sg = {0};
bool uj = use_json(argc, argv);
struct vrf *vrf;
bool first = true;
first = false;
} else
vty_out(vty, "VRF: %s\n", vrf->name);
- pim_show_join(vrf->info, vty, uj);
+ pim_show_join(vrf->info, vty, &sg, uj);
}
if (uj)
vty_out(vty, "}\n");