]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: extended community for EAD routes
authorAnuradha Karuppiah <anuradhak@cumulusnetworks.com>
Fri, 27 Mar 2020 20:56:08 +0000 (13:56 -0700)
committerAnuradha Karuppiah <anuradhak@cumulusnetworks.com>
Wed, 5 Aug 2020 13:46:12 +0000 (06:46 -0700)
1. EAD routes require support for ESI_LABEL extended community. The
primary info in this EC is a flags the specifies if the ES is
Single-active or active-acive.
2. Also fixed up ES_IMPORT_RT string. Support was added a long time
ago for ESR/Type-4 routes but it has not really been exercised for
MH functionality till now.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
bgpd/bgp_ecommunity.c
bgpd/bgp_ecommunity.h

index d6c311bfa03e16066a01cb9cbe0bb759771279cb..0990d0b872868090b5bcd702c63b33bc537c6f18 100644 (file)
@@ -810,6 +810,30 @@ char *ecommunity_ecom2str(struct ecommunity *ecom, int format, int filter)
                                            ECOMMUNITY_EVPN_SUBTYPE_ND_ROUTER_FLAG))
                                        strlcpy(encbuf, "ND:Router Flag",
                                                sizeof(encbuf));
+                       } else if (*pnt
+                                  == ECOMMUNITY_EVPN_SUBTYPE_ES_IMPORT_RT) {
+                               struct ethaddr mac;
+
+                               pnt++;
+                               memcpy(&mac, pnt, ETH_ALEN);
+                               snprintf(encbuf,
+                                       sizeof(encbuf),
+                                       "ES-Import-Rt:%02x:%02x:%02x:%02x:%02x:%02x",
+                                       (uint8_t)mac.octet[0],
+                                       (uint8_t)mac.octet[1],
+                                       (uint8_t)mac.octet[2],
+                                       (uint8_t)mac.octet[3],
+                                       (uint8_t)mac.octet[4],
+                                       (uint8_t)mac.octet[5]);
+                       } else if (*pnt
+                                  == ECOMMUNITY_EVPN_SUBTYPE_ESI_LABEL) {
+                               uint8_t flags = *++pnt;
+
+                               snprintf(encbuf,
+                                       sizeof(encbuf), "ESI-label-Rt:%s",
+                                       (flags &
+                                        ECOMMUNITY_EVPN_SUBTYPE_ESI_SA_FLAG) ?
+                                       "SA":"AA");
                        } else
                                unk_ecom = 1;
                } else if (type == ECOMMUNITY_ENCODE_REDIRECT_IP_NH) {
@@ -865,21 +889,6 @@ char *ecommunity_ecom2str(struct ecommunity *ecom, int format, int filter)
                        } else if (sub_type == ECOMMUNITY_TRAFFIC_MARKING) {
                                snprintf(encbuf, sizeof(encbuf),
                                         "FS:marking %u", *(pnt + 5));
-                       } else if (*pnt
-                                  == ECOMMUNITY_EVPN_SUBTYPE_ES_IMPORT_RT) {
-                               struct ethaddr mac;
-
-                               memcpy(&mac, pnt, ETH_ALEN);
-
-                               snprintf(
-                                       encbuf, sizeof(encbuf),
-                                       "ES-Import-Rt:%02x:%02x:%02x:%02x:%02x:%02x",
-                                       (uint8_t)mac.octet[0],
-                                       (uint8_t)mac.octet[1],
-                                       (uint8_t)mac.octet[2],
-                                       (uint8_t)mac.octet[3],
-                                       (uint8_t)mac.octet[4],
-                                       (uint8_t)mac.octet[5]);
                        } else
                                unk_ecom = 1;
                } else if (type == ECOMMUNITY_ENCODE_AS_NON_TRANS) {
index 7deae8e746f2e2dfdd343066a3cb3ceb8cae2f1d..1e9ffcb6787b69efcc72075fac76b045e81dd1e3 100644 (file)
@@ -76,6 +76,8 @@
 #define ECOMMUNITY_EVPN_SUBTYPE_ND_ROUTER_FLAG         0x01
 #define ECOMMUNITY_EVPN_SUBTYPE_ND_OVERRIDE_FLAG       0x02
 
+#define ECOMMUNITY_EVPN_SUBTYPE_ESI_SA_FLAG (1 << 0) /* single-active */
+
 /* Low-order octet of the Extended Communities type field for OPAQUE types */
 #define ECOMMUNITY_OPAQUE_SUBTYPE_ENCAP     0x0c