From afb6d3f5c1bc66c64b956e575fbf87f6a6804456 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 23 Oct 2017 18:10:01 -0400 Subject: [PATCH] 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 --- bgpd/bgp_zebra.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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 -- 2.39.5