pimd: Remove expensive lookup for if a device is a vrf device

Interfaces know if they are a vrf device or not and this data
is passed up to the protocol.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2018-04-30 07:56:24 -04:00
parent 7f432a28e0
commit e55a43d491
2 changed files with 5 additions and 9 deletions

View file

@ -1555,16 +1555,12 @@ bool pim_if_is_loopback(struct interface *ifp)
return false;
}
int pim_if_is_vrf_device(struct interface *ifp)
bool pim_if_is_vrf_device(struct interface *ifp)
{
struct vrf *vrf;
if (if_is_vrf(ifp))
return true;
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
if (strncmp(ifp->name, vrf->name, strlen(ifp->name)) == 0)
return 1;
}
return 0;
return false;
}
int pim_if_ifchannel_count(struct pim_interface *pim_ifp)

View file

@ -209,7 +209,7 @@ int pim_update_source_set(struct interface *ifp, struct in_addr source);
bool pim_if_is_loopback(struct interface *ifp);
int pim_if_is_vrf_device(struct interface *ifp);
bool pim_if_is_vrf_device(struct interface *ifp);
int pim_if_ifchannel_count(struct pim_interface *pim_ifp);
#endif /* PIM_IFACE_H */