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 abad79f5c9d4..6acf2e2015c4 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -3961,6 +3961,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) { @@ -4261,6 +4266,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; @@ -4311,6 +4317,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 25a42e87bd94..642839d6d59f 100644 --- a/bgpd/bgp_route.h +++ b/bgpd/bgp_route.h @@ -137,6 +137,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