For each received routermac extended community, the mac address is copied into routermac extended community context. For each emission, a check is done against routermac extended community, if L2VPN is enabled. If enabled, the extended community is appended.
Signed-off-by: Philippe Gubiert <philippe.guib...@6wind.com> --- bgpd/bgp_ecommunity.c | 2 +- bgpd/bgp_route.c | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c index 79b7af075e9f..de3bce41783c 100644 --- a/bgpd/bgp_ecommunity.c +++ b/bgpd/bgp_ecommunity.c @@ -204,7 +204,7 @@ ecommunity_intern (struct ecommunity *ecom) find->refcnt++; if (! find->str) - find->str = ecommunity_ecom2str (find, ECOMMUNITY_FORMAT_DISPLAY, 0); + find->str = ecommunity_ecom2str (find, ECOMMUNITY_FORMAT_DISPLAY, ECOMMUNITY_ROUTE_TARGET); return find; } diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index d1e1c6d19643..467c83c72750 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -4255,6 +4255,8 @@ bgp_static_free (struct bgp_static *bgp_static) free (bgp_static->rmap.name); if(bgp_static->eth_s_id) XFREE(MTYPE_ATTR, bgp_static->eth_s_id); + if(bgp_static->router_mac) + XFREE(MTYPE_ATTR, bgp_static->router_mac); XFREE (MTYPE_BGP_STATIC, bgp_static); } @@ -4759,6 +4761,15 @@ bgp_static_update_safi (struct bgp *bgp, struct prefix *p, if(bgp_static->eth_t_id) bet.vnid = bgp_static->eth_t_id; bgp_encap_type_vxlan_to_tlv(&bet, &attr); + if(bgp_static->router_mac) + { + struct ecommunity_val routermac; + memset(&routermac, 0, sizeof(struct ecommunity_val)); + routermac.val[0] = ECOMMUNITY_ENCODE_EVPN; + routermac.val[1] = ECOMMUNITY_SITE_ORIGIN; + memcpy(&routermac.val[2], bgp_static->router_mac, MAC_LEN); + ecommunity_add_val(bgp_attr_extra_get (&attr)->ecommunity,&routermac); + } if (bgp_static->igpnexthop.s_addr) { union gw_addr add; -- 2.1.4 _______________________________________________ Quagga-dev mailing list Quagga-dev@lists.quagga.net https://lists.quagga.net/mailman/listinfo/quagga-dev