From: vivek Date: Fri, 6 Apr 2018 16:31:11 +0000 (-0700) Subject: bgpd: Fix VRF route leaking for multipath routes X-Git-Tag: frr-6.1-dev~455^2~4 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=6c0a6053555440eda670c3fbc4238b45f625f4db;p=matthieu%2Ffrr.git bgpd: Fix VRF route leaking for multipath routes Ensure that the next hop of the leaked VRF is not overwritten when the route is being imported into the target VRF from the VPN table. Also, in the case of multipath routes, ensure that the nexthop's ifindex is not inadvertently reset. Signed-off-by: Vivek Venkatraman --- diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index a86ea0e522..52a246387e 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -1287,17 +1287,11 @@ void bgp_zebra_announce(struct bgp_node *rn, struct prefix *p, } } - if (bgp->table_map[afi][safi].name || nh_othervrf) { + if (bgp->table_map[afi][safi].name) { /* Copy info and attributes, so the route-map apply doesn't modify the BGP route info. */ local_attr = *mpinfo->attr; mpinfo_cp->attr = &local_attr; - if (nh_othervrf) { - /* allow route-map to modify */ - local_attr.nexthop = - info->extra->nexthop_orig.u - .prefix4; - } } if (bgp->table_map[afi][safi].name) { @@ -1322,19 +1316,11 @@ void bgp_zebra_announce(struct bgp_node *rn, struct prefix *p, ifindex_t ifindex; struct in6_addr *nexthop; - if (bgp->table_map[afi][safi].name || nh_othervrf) { + if (bgp->table_map[afi][safi].name) { /* Copy info and attributes, so the route-map apply doesn't modify the BGP route info. */ local_attr = *mpinfo->attr; mpinfo_cp->attr = &local_attr; - if (nh_othervrf) { - /* allow route-map to modify */ - local_attr.mp_nexthop_global = - info->extra->nexthop_orig.u - .prefix6; - local_attr.mp_nexthop_len = - BGP_ATTR_NHLEN_IPV6_GLOBAL; - } } if (bgp->table_map[afi][safi].name) { diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 1d43567ce3..9510a0e12c 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -1233,14 +1233,6 @@ static void _netlink_route_build_multipath(const char *routedesc, int bytelen, "netlink_route_multipath() (%s): " "nexthop via if %u", routedesc, nexthop->ifindex); - } else if (nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX) { - if (IS_ZEBRA_DEBUG_KERNEL) - zlog_debug( - "netlink_route_multipath() (%s): " - "nexthop via if %u", - routedesc, nexthop->ifindex); - } else { - rtnh->rtnh_ifindex = 0; } }