mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-26 04:54:44 +00:00
bgpd: add L2 attr community support as per RFC8214
The L2 attribute extended community can not be decoded when using L2VPN EVPN as a route reflector. Decode the extended community and dump the detailed information about flags and MTU information. > rt4# show bgp l2vpn evpn > BGP table version is 1, local router ID is 4.4.4.4 > Status codes: s suppressed, d damped, h history, * valid, > best, i - internal > Origin codes: i - IGP, e - EGP, ? - incomplete > EVPN type-1 prefix: [1]:[EthTag]:[ESI]:[IPlen]:[VTEP-IP]:[Frag-id] > EVPN type-2 prefix: [2]:[EthTag]:[MAClen]:[MAC]:[IPlen]:[IP] > EVPN type-3 prefix: [3]:[EthTag]:[IPlen]:[OrigIP] > EVPN type-4 prefix: [4]:[ESI]:[IPlen]:[OrigIP] > EVPN type-5 prefix: [5]:[EthTag]:[IPlen]:[IP] > > Network Next Hop Metric LocPrf Weight Path > Route Distinguisher: 1.1.1.1:100 > *>i[1]:[12]:[00:00:00:00:00:00:00:00:00:00]:[32]:[0.0.0.0]:[0] > 1.1.1.1 100 0 i > RT:65500:100 L2: P flag:N, B Flag N, C word N, MTU 0 > Route Distinguisher: 5.5.5.5:100 > *>i[1]:[10]:[00:00:00:00:00:00:00:00:00:00]:[32]:[0.0.0.0]:[0] > 5.5.5.5 100 0 i > RT:65500:100 L2: P flag:N, B Flag N, C word N, MTU 0 > Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
This commit is contained in:
parent
f74fa9543b
commit
af8e792205
@ -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 New Issue
Block a user