If the user preconfigures a vrf with import and export rules, before creating a new network on vpnv4 address, then BGP update emitted will contain the exported rts mentioned by the vrf export rule. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com> --- bgpd/bgp_route.c | 11 +++++++++++ bgpd/bgp_route.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 76ca587d95fe..25b30ef88d3f 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -3921,6 +3921,11 @@ bgp_static_update_safi (struct bgp *bgp, struct prefix *p, attr.med = bgp_static->igpmetric; attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC); + if (bgp_static->ecomm) + { + bgp_attr_extra_get (&attr)->ecommunity = ecommunity_dup (bgp_static->ecomm); + attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_EXT_COMMUNITIES); + } /* Apply route-map. */ if (bgp_static->rmap.name) { @@ -4340,6 +4345,7 @@ bgp_static_set_safi (safi_t safi, struct vty *vty, const char *ip_str, struct bgp_node *rn; struct bgp_table *table; struct bgp_static *bgp_static; + struct bgp_vrf *vrf; u_char tag[3]; ret = str2prefix (ip_str, &p); @@ -4388,6 +4394,11 @@ bgp_static_set_safi (safi_t safi, struct vty *vty, const char *ip_str, bgp_static->igpmetric = 0; bgp_static->igpnexthop.s_addr = 0; memcpy(bgp_static->tag, tag, 3); + vrf = bgp_vrf_lookup(bgp, &prd); + if (vrf) + { + bgp_static->ecomm = vrf->rt_export; + } bgp_static->prd = prd; if (rmap_str) diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h index ba6dc86a8e2f..f04a88749da6 100644 --- a/bgpd/bgp_route.h +++ b/bgpd/bgp_route.h @@ -198,6 +198,8 @@ struct bgp_static /* Route Distinguisher */ struct prefix_rd prd; + struct ecommunity *ecomm; + /* MPLS label. */ u_char tag[3]; }; -- 2.1.4