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 <vivek@cumulusnetworks.com>
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;