pimd: Handle pimreg a bit better

The pimreg device is vif_index == 0.  Allow it
to be used.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2016-06-23 11:46:57 -04:00
parent 169edb7f12
commit ae90dfbbb7
2 changed files with 13 additions and 2 deletions

View File

@ -772,6 +772,9 @@ struct interface *pim_if_find_by_vif_index(int vif_index)
struct listnode *ifnode;
struct interface *ifp;
if (vif_index == 0)
return if_lookup_by_name_vrf ("pimreg", VRF_DEFAULT);
for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), ifnode, ifp)) {
if (ifp->info) {
struct pim_interface *pim_ifp;
@ -789,7 +792,15 @@ struct interface *pim_if_find_by_vif_index(int vif_index)
*/
int pim_if_find_vifindex_by_ifindex(int ifindex)
{
return ifindex;
struct pim_interface *pim_ifp;
struct interface *ifp;
ifp = if_lookup_by_index_vrf (ifindex, VRF_DEFAULT);
pim_ifp = ifp->info;
if (!pim_ifp)
return -1;
return pim_ifp->mroute_vif_index;
}
int pim_if_lan_delay_enabled(struct interface *ifp)

View File

@ -779,7 +779,7 @@ static int fib_lookup_if_vif_index(struct in_addr addr)
vif_index = pim_if_find_vifindex_by_ifindex(first_ifindex);
if (vif_index < 1) {
if (vif_index < 0) {
char addr_str[100];
pim_inet4_dump("<addr?>", addr, addr_str, sizeof(addr_str));
zlog_warn("%s %s: low vif_index=%d < 1 nexthop for address %s",