Mailing List Archive

[PATCH v3 5/5] bgpd: vpnv4 af exports extended communities
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 c4236fab481b..1d7533c49aad 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -3964,6 +3964,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)
{
@@ -4264,6 +4269,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;
@@ -4314,6 +4320,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