From 1ec90b5ede849763a21ba6c180e39657305a0d0c Mon Sep 17 00:00:00 2001 From: vivek Date: Wed, 28 Mar 2018 22:11:30 -0700 Subject: [PATCH] bgpd: Fix peer determination from parent for imported routes When routes are imported into a VRF from the global VPN table, the parent instance is either the default instance in the case of L3VPN or the source VRF in the case of VRF-to-VRF route leaking. Hence, obtain the source peer by just looking at the parent route information. Ticket: CM-20283 Signed-off-by: Vivek Venkatraman --- bgpd/bgp_zebra.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 1c32291740..7872897234 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -1082,16 +1082,9 @@ void bgp_zebra_announce(struct bgp_node *rn, struct prefix *p, if (info->type == ZEBRA_ROUTE_BGP && info->sub_type == BGP_ROUTE_IMPORTED) { - struct bgp_info *bi; - - /* - * Look at parent chain for peer sort - */ - for (bi = info; bi->extra && bi->extra->parent; - bi = bi->extra->parent) { - - peer = ((struct bgp_info *)(bi->extra->parent))->peer; - } + /* Obtain peer from parent */ + if (info->extra && info->extra->parent) + peer = ((struct bgp_info *)(info->extra->parent))->peer; } tag = info->attr->tag;