forked from Mirror/frr
Merge pull request #17987 from pguibert6WIND/evpn_bgp_l2_attr_ext_community
bgpd: add L2 attr community support as per RFC8214
This commit is contained in:
commit
a02ec27693
|
@ -1337,6 +1337,31 @@ char *ecommunity_ecom2str(struct ecommunity *ecom, int format, int filter)
|
||||||
snprintf(encbuf, sizeof(encbuf),
|
snprintf(encbuf, sizeof(encbuf),
|
||||||
"DF: (alg: %u, pref: %u)", alg,
|
"DF: (alg: %u, pref: %u)", alg,
|
||||||
pref);
|
pref);
|
||||||
|
} else if (*pnt == ECOMMUNITY_EVPN_SUBTYPE_LAYER2_ATTR) {
|
||||||
|
uint16_t flags, l2mtu;
|
||||||
|
|
||||||
|
++pnt;
|
||||||
|
memcpy(&flags, pnt, 2);
|
||||||
|
++pnt;
|
||||||
|
++pnt;
|
||||||
|
|
||||||
|
memcpy(&l2mtu, pnt, 2);
|
||||||
|
|
||||||
|
snprintf(encbuf, sizeof(encbuf),
|
||||||
|
"L2: P flag:%c, B Flag %c, C word %c, MTU %d",
|
||||||
|
CHECK_FLAG(flags,
|
||||||
|
ECOMMUNITY_EVPN_SUBTYPE_LAYER2_ATTR_PRIMARY_PE_FLAG)
|
||||||
|
? 'Y'
|
||||||
|
: 'N',
|
||||||
|
CHECK_FLAG(flags,
|
||||||
|
ECOMMUNITY_EVPN_SUBTYPE_LAYER2_ATTR_BACKUP_PE_FLAG)
|
||||||
|
? 'Y'
|
||||||
|
: 'N',
|
||||||
|
CHECK_FLAG(flags,
|
||||||
|
ECOMMUNITY_EVPN_SUBTYPE_LAYER2_ATTR_CONTROL_WORD_FLAG)
|
||||||
|
? 'Y'
|
||||||
|
: 'N',
|
||||||
|
l2mtu);
|
||||||
} else
|
} else
|
||||||
unk_ecom = true;
|
unk_ecom = true;
|
||||||
} else if (type == ECOMMUNITY_ENCODE_REDIRECT_IP_NH) {
|
} else if (type == ECOMMUNITY_ENCODE_REDIRECT_IP_NH) {
|
||||||
|
|
|
@ -68,12 +68,18 @@
|
||||||
#define ECOMMUNITY_EVPN_SUBTYPE_ESI_LABEL 0x01
|
#define ECOMMUNITY_EVPN_SUBTYPE_ESI_LABEL 0x01
|
||||||
#define ECOMMUNITY_EVPN_SUBTYPE_ES_IMPORT_RT 0x02
|
#define ECOMMUNITY_EVPN_SUBTYPE_ES_IMPORT_RT 0x02
|
||||||
#define ECOMMUNITY_EVPN_SUBTYPE_ROUTERMAC 0x03
|
#define ECOMMUNITY_EVPN_SUBTYPE_ROUTERMAC 0x03
|
||||||
|
#define ECOMMUNITY_EVPN_SUBTYPE_LAYER2_ATTR 0x04
|
||||||
#define ECOMMUNITY_EVPN_SUBTYPE_DF_ELECTION 0x06
|
#define ECOMMUNITY_EVPN_SUBTYPE_DF_ELECTION 0x06
|
||||||
#define ECOMMUNITY_EVPN_SUBTYPE_DEF_GW 0x0d
|
#define ECOMMUNITY_EVPN_SUBTYPE_DEF_GW 0x0d
|
||||||
#define ECOMMUNITY_EVPN_SUBTYPE_ND 0x08
|
#define ECOMMUNITY_EVPN_SUBTYPE_ND 0x08
|
||||||
|
|
||||||
#define ECOMMUNITY_EVPN_SUBTYPE_MACMOBILITY_FLAG_STICKY 0x01
|
#define ECOMMUNITY_EVPN_SUBTYPE_MACMOBILITY_FLAG_STICKY 0x01
|
||||||
|
|
||||||
|
/* Layer2 Attributes: RFC8214 */
|
||||||
|
#define ECOMMUNITY_EVPN_SUBTYPE_LAYER2_ATTR_PRIMARY_PE_FLAG 0x01
|
||||||
|
#define ECOMMUNITY_EVPN_SUBTYPE_LAYER2_ATTR_BACKUP_PE_FLAG 0x02
|
||||||
|
#define ECOMMUNITY_EVPN_SUBTYPE_LAYER2_ATTR_CONTROL_WORD_FLAG 0x04
|
||||||
|
|
||||||
/* DF alg bits - only lower 5 bits are applicable */
|
/* DF alg bits - only lower 5 bits are applicable */
|
||||||
#define ECOMMUNITY_EVPN_SUBTYPE_DF_ALG_BITS 0x1f
|
#define ECOMMUNITY_EVPN_SUBTYPE_DF_ALG_BITS 0x1f
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue