From: Donald Sharp Date: Mon, 23 Oct 2017 22:10:01 +0000 (-0400) Subject: bgpd: Use stored ifindex for zebra_announce X-Git-Tag: frr-4.0-dev~195^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=afb6d3f5c1bc66c64b956e575fbf87f6a6804456;p=matthieu%2Ffrr.git bgpd: Use stored ifindex for zebra_announce 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 --- diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index ed162cb7dc..0d1d768294 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -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