summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_ecommunity.c25
-rw-r--r--bgpd/bgp_ecommunity.h6
2 files changed, 31 insertions, 0 deletions
diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c
index e794ccb308..2c6ae65f85 100644
--- a/bgpd/bgp_ecommunity.c
+++ b/bgpd/bgp_ecommunity.c
@@ -1337,6 +1337,31 @@ char *ecommunity_ecom2str(struct ecommunity *ecom, int format, int filter)
snprintf(encbuf, sizeof(encbuf),
"DF: (alg: %u, pref: %u)", alg,
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
unk_ecom = true;
} else if (type == ECOMMUNITY_ENCODE_REDIRECT_IP_NH) {
diff --git a/bgpd/bgp_ecommunity.h b/bgpd/bgp_ecommunity.h
index af9d481c19..0e68b15807 100644
--- a/bgpd/bgp_ecommunity.h
+++ b/bgpd/bgp_ecommunity.h
@@ -68,12 +68,18 @@
#define ECOMMUNITY_EVPN_SUBTYPE_ESI_LABEL 0x01
#define ECOMMUNITY_EVPN_SUBTYPE_ES_IMPORT_RT 0x02
#define ECOMMUNITY_EVPN_SUBTYPE_ROUTERMAC 0x03
+#define ECOMMUNITY_EVPN_SUBTYPE_LAYER2_ATTR 0x04
#define ECOMMUNITY_EVPN_SUBTYPE_DF_ELECTION 0x06
#define ECOMMUNITY_EVPN_SUBTYPE_DEF_GW 0x0d
#define ECOMMUNITY_EVPN_SUBTYPE_ND 0x08
#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 */
#define ECOMMUNITY_EVPN_SUBTYPE_DF_ALG_BITS 0x1f