pimd: Get Static mroutes displaying again

The static mroutes were making the assumption that the vif index
and the ifindex were the same.  This is not necessarily the case.

Additionally if we are displaying a *,G route only display
the G.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2017-02-24 10:29:15 -05:00
parent 79bdcd9974
commit ce9531309c

View File

@ -316,27 +316,34 @@ int pim_static_del(struct interface *iif, struct interface *oif, struct in_addr
int int
pim_static_write_mroute (struct vty *vty, struct interface *ifp) pim_static_write_mroute (struct vty *vty, struct interface *ifp)
{ {
struct pim_interface *pim_ifp = ifp->info;
struct listnode *node; struct listnode *node;
struct static_route *sroute; struct static_route *sroute;
int count = 0; int count = 0;
char sbuf[INET_ADDRSTRLEN]; char sbuf[INET_ADDRSTRLEN];
char gbuf[INET_ADDRSTRLEN]; char gbuf[INET_ADDRSTRLEN];
if (!pim_ifp)
return 0;
for (ALL_LIST_ELEMENTS_RO (qpim_static_route_list, node, sroute)) for (ALL_LIST_ELEMENTS_RO (qpim_static_route_list, node, sroute))
{ {
pim_inet4_dump ("<ifaddr?>", sroute->group, gbuf, sizeof (gbuf)); pim_inet4_dump ("<ifaddr?>", sroute->group, gbuf, sizeof (gbuf));
pim_inet4_dump ("<ifaddr?>", sroute->source, sbuf, sizeof (sbuf)); pim_inet4_dump ("<ifaddr?>", sroute->source, sbuf, sizeof (sbuf));
if (sroute->iif == ifp->ifindex) if (sroute->iif == pim_ifp->mroute_vif_index)
{ {
int i; int i;
for (i = 0; i < MAXVIFS; i++) for (i = 0; i < MAXVIFS; i++)
if (sroute->oif_ttls[i]) if (sroute->oif_ttls[i])
{ {
struct interface *oifp = if_lookup_by_index (i); struct interface *oifp = pim_if_find_by_vif_index (i);
vty_out (vty, " ip mroute %s %s %s%s", oifp->name, gbuf, sbuf, VTY_NEWLINE); if (sroute->source.s_addr == 0)
count ++; vty_out (vty, " ip mroute %s %s%s", oifp->name, gbuf, VTY_NEWLINE);
} else
} vty_out (vty, " ip mroute %s %s %s%s", oifp->name, gbuf, sbuf, VTY_NEWLINE);
count ++;
}
}
} }
return count; return count;