]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: Remove expensive lookup for if a device is a vrf device 2143/head
authorDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 30 Apr 2018 11:56:24 +0000 (07:56 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 30 Apr 2018 11:56:24 +0000 (07:56 -0400)
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>
pimd/pim_iface.c
pimd/pim_iface.h

index e58d81591de81394c917e2d60f8f7426c40eb5bc..5996a3ac96b9f1f75745f85afa66f20f8be5882e 100644 (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;
-
-       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
-               if (strncmp(ifp->name, vrf->name, strlen(ifp->name)) == 0)
-                       return 1;
-       }
+       if (if_is_vrf(ifp))
+               return true;
 
-       return 0;
+       return false;
 }
 
 int pim_if_ifchannel_count(struct pim_interface *pim_ifp)
index 12098fde29bd6fed6ac493f966855a69e566863e..cf025cbd4a27be279c825f24d6d39f77c13de767 100644 (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 */