return CMD_SUCCESS;
}
+DEFUN (show_ip_pim_rp,
+ show_ip_pim_rp_cmd,
+ "show ip pim rp-info ",
+ SHOW_STR
+ IP_STR
+ PIM_STR
+ "PIM RP information\n")
+{
+ pim_rp_show_information (vty);
+
+ return CMD_SUCCESS;
+}
+
DEFUN (show_ip_pim_rpf,
show_ip_pim_rpf_cmd,
"show ip pim rpf",
install_element (VIEW_NODE, &show_ip_pim_upstream_cmd);
install_element (VIEW_NODE, &show_ip_pim_upstream_join_desired_cmd);
install_element (VIEW_NODE, &show_ip_pim_upstream_rpf_cmd);
+ install_element (VIEW_NODE, &show_ip_pim_rp_cmd);
install_element (VIEW_NODE, &show_ip_multicast_cmd);
install_element (VIEW_NODE, &show_ip_mroute_cmd);
install_element (VIEW_NODE, &show_ip_mroute_count_cmd);
#include "linklist.h"
#include "prefix.h"
#include "memory.h"
+#include "vty.h"
+#include "vrf.h"
#include "pimd.h"
#include "pim_vty.h"
#include "pim_rpf.h"
#include "pim_sock.h"
#include "pim_memory.h"
+#include "pim_iface.h"
struct rp_info
{
return NULL;
}
+static void
+pim_rp_check_interfaces (struct rp_info *rp_info)
+{
+ struct listnode *node;
+ struct interface *ifp;
+
+ for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
+ {
+ struct pim_interface *pim_ifp = ifp->info;
+
+ if (!pim_ifp)
+ continue;
+
+ if (pim_ifp->primary_address.s_addr == rp_info->rp.rpf_addr.s_addr)
+ rp_info->i_am_rp = 1;
+ }
+}
+
int
pim_rp_new (const char *rp, const char *group_range)
{
XFREE (MTYPE_PIM_RP, rp_info);
if (!pim_rp_setup ())
return -2;
+ pim_rp_check_interfaces (rp_all);
return 0;
}
if (!pim_rp_setup ())
return -2;
+ pim_rp_check_interfaces (rp_info);
return 0;
}
return 0;
}
+
+void
+pim_rp_show_information (struct vty *vty)
+{
+ struct rp_info *rp_info;
+ struct listnode *node;
+
+ vty_out (vty, "RP Addr Group Oif I_am_RP%s", VTY_NEWLINE);
+ for (ALL_LIST_ELEMENTS_RO (qpim_rp_list, node, rp_info))
+ {
+ char buf[48];
+ vty_out (vty, "%-10s %-10s %-10s%-10d%s",
+ inet_ntoa (rp_info->rp.rpf_addr),
+ prefix2str(&rp_info->group, buf, 48),
+ rp_info->rp.source_nexthop.interface->name,
+ rp_info->i_am_rp, VTY_NEWLINE);
+ }
+ return;
+}