[frr] [PATCH v2 06/10] bgpd: vpnv4 af exports extended communities
Philippe Guibert
philippe.guibert at 6wind.com
Wed Dec 21 09:02:09 EST 2016
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 at 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 617e3950b26f..a3bb95d5c1c1 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 9f18535481a7..df1e8d8e056a 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
More information about the dev
mailing list