]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: Use stored ifindex for zebra_announce
authorDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 23 Oct 2017 22:10:01 +0000 (18:10 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 23 Oct 2017 22:12:33 +0000 (18:12 -0400)
In some situations we already know the ifp and by extension
the ifindex there is no need to look it up for every
route we send to zebra.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
bgpd/bgp_zebra.c

index ed162cb7dc23efb4523ee8bd05ed48d5b4b2c39e..0d1d768294ff572f152a52628b4453cccb2f5738 100644 (file)
@@ -1105,12 +1105,11 @@ void bgp_zebra_announce(struct bgp_node *rn, struct prefix *p,
                                                          ->ifindex;
 
                        if (!ifindex) {
-                               if (mpinfo->peer->conf_if
-                                   || mpinfo->peer->ifname)
+                               if (mpinfo->peer->conf_if)
+                                       ifindex = mpinfo->peer->ifp->ifindex;
+                               else if (mpinfo->peer->ifname)
                                        ifindex = ifname2ifindex(
-                                               mpinfo->peer->conf_if
-                                                       ? mpinfo->peer->conf_if
-                                                       : mpinfo->peer->ifname,
+                                               mpinfo->peer->ifname,
                                                bgp->vrf_id);
                                else if (mpinfo->peer->nexthop.ifp)
                                        ifindex = mpinfo->peer->nexthop.ifp