#include "memory.h"
#include "stream.h"
+#include "bgpd/bgpd.h"
+#include "bgpd/bgp_attr.h"
+#include "bgpd/bgp_route.h"
#include "bgpd/bgp_attr_evpn.h"
+#include "bgpd/bgp_ecommunity.h"
+
+void bgp_add_routermac_ecom (struct attr* attr, char * routermac)
+{
+ struct ecommunity_val routermac_ecom;
+
+ if(attr->extra)
+ {
+ memset(&routermac_ecom, 0, sizeof(struct ecommunity_val));
+ routermac_ecom.val[0] = ECOMMUNITY_ENCODE_EVPN;
+ routermac_ecom.val[1] = ECOMMUNITY_EVPN_SUBTYPE_ROUTERMAC;
+ memcpy(&routermac_ecom.val[2], routermac, MAC_LEN);
+ if(!attr->extra->ecommunity)
+ attr->extra->ecommunity = ecommunity_new ();
+ ecommunity_add_val(attr->extra->ecommunity, &routermac_ecom);
+ }
+}
static uint8_t convertchartohexa (uint8_t *hexa, int *error)
{
#define MAX_ET 0xffffffff
u_long eth_tag_id;
+struct attr;
struct eth_segment_id
{
extern char *mac2str (char *mac);
extern char *ecom_mac2str(char *ecom_mac);
+extern void bgp_add_routermac_ecom (struct attr* attr, char * routermac);
+
#endif /* _QUAGGA_BGP_ATTR_EVPN_H */
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;
}
bet.vnid = p->u.prefix_evpn.eth_tag;
bgp_encap_type_vxlan_to_tlv(&bet, &attr);
}
+ if (bgp_static->router_mac)
+ {
+ bgp_add_routermac_ecom (&attr, bgp_static->router_mac);
+ }
}
/* Apply route-map. */
if (bgp_static->rmap.name)