]> git.proxmox.com Git - mirror_frr.git/commitdiff
pimd: Cleanup pim_if_is_loopback
authorDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 30 Apr 2018 11:50:08 +0000 (07:50 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 30 Apr 2018 11:53:01 +0000 (07:53 -0400)
The interface itself knows if it is a vrf device or
not, so let's just use a check for that in the decision
if a interface is a loopback or not.

Additionally modify function to return a bool.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
pimd/pim_iface.c
pimd/pim_iface.h
pimd/pim_pim.c

index ff7238ae97bec4339edfbef81db2413354f81543..e58d81591de81394c917e2d60f8f7426c40eb5bc 100644 (file)
@@ -1547,15 +1547,12 @@ int pim_if_connected_to_source(struct interface *ifp, struct in_addr src)
        return 0;
 }
 
-int pim_if_is_loopback(struct pim_instance *pim, struct interface *ifp)
+bool pim_if_is_loopback(struct interface *ifp)
 {
-       if (if_is_loopback(ifp))
-               return 1;
-
-       if (strcmp(ifp->name, pim->vrf->name) == 0)
-               return 1;
+       if (if_is_loopback(ifp) || if_is_vrf(ifp))
+               return true;
 
-       return 0;
+       return false;
 }
 
 int pim_if_is_vrf_device(struct interface *ifp)
index 5ecd07d227217e0fad223dfb78519a86ed1a1f54..12098fde29bd6fed6ac493f966855a69e566863e 100644 (file)
@@ -207,7 +207,7 @@ void pim_if_create_pimreg(struct pim_instance *pim);
 int pim_if_connected_to_source(struct interface *ifp, struct in_addr src);
 int pim_update_source_set(struct interface *ifp, struct in_addr source);
 
-int pim_if_is_loopback(struct pim_instance *pim, struct interface *ifp);
+bool pim_if_is_loopback(struct interface *ifp);
 
 int pim_if_is_vrf_device(struct interface *ifp);
 
index ffe5d52a156f052d7183da7c1ee85ba1a2fd454e..de09b070f467a3f2d4cf45fc3e9b8270dd9ead46 100644 (file)
@@ -653,7 +653,7 @@ static int pim_hello_send(struct interface *ifp, uint16_t holdtime)
 {
        struct pim_interface *pim_ifp = ifp->info;
 
-       if (pim_if_is_loopback(pim_ifp->pim, ifp))
+       if (pim_if_is_loopback(ifp))
                return 0;
 
        if (hello_send(ifp, holdtime)) {
@@ -755,7 +755,7 @@ void pim_hello_restart_triggered(struct interface *ifp)
        /*
         * No need to ever start loopback or vrf device hello's
         */
-       if (pim_if_is_loopback(pim_ifp->pim, ifp))
+       if (pim_if_is_loopback(ifp))
                return;
 
        /*