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.guib...@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 a4d7b642ebc4..aa67ee59c396 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -3887,6 +3887,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) { @@ -4196,6 +4201,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]; bgp = vty->index; @@ -4246,6 +4252,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 0152a82dc725..7a2fc2f6bb76 100644 --- a/bgpd/bgp_route.h +++ b/bgpd/bgp_route.h @@ -125,6 +125,8 @@ struct bgp_static /* Route Distinguisher */ struct prefix_rd prd; + struct ecommunity *ecomm; + /* MPLS label. */ u_char tag[3]; }; -- 2.1.4 _______________________________________________ Quagga-dev mailing list Quagga-dev@lists.quagga.net https://lists.quagga.net/mailman/listinfo/quagga-dev