]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd, lib: move EVPN route type def to lib and use it in the prefix macros
authorAnuradha Karuppiah <anuradhak@cumulusnetworks.com>
Tue, 14 Jul 2020 01:21:27 +0000 (18:21 -0700)
committerAnuradha Karuppiah <anuradhak@cumulusnetworks.com>
Wed, 5 Aug 2020 13:46:13 +0000 (06:46 -0700)
Use route names instead of route type number in the EVPN prefix
macros.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
bgpd/bgp_evpn_private.h
lib/prefix.h

index b7dc218b009934fb20000ae56207bb0f9fdcd116..ca45b198a74793ff98d7150d534c1ea026ae291a 100644 (file)
 #define BGP_EVPN_TYPE4_V4_PSIZE 23
 #define BGP_EVPN_TYPE4_V6_PSIZE 34
 
-/* EVPN route types. */
-typedef enum {
-       BGP_EVPN_AD_ROUTE = 1,    /* Ethernet Auto-Discovery (A-D) route */
-       BGP_EVPN_MAC_IP_ROUTE,    /* MAC/IP Advertisement route */
-       BGP_EVPN_IMET_ROUTE,      /* Inclusive Multicast Ethernet Tag route */
-       BGP_EVPN_ES_ROUTE,      /* Ethernet Segment route */
-       BGP_EVPN_IP_PREFIX_ROUTE, /* IP Prefix route */
-} bgp_evpn_route_type;
-
 RB_HEAD(bgp_es_evi_rb_head, bgp_evpn_es_evi);
 RB_PROTOTYPE(bgp_es_evi_rb_head, bgp_evpn_es_evi, rb_node,
                bgp_es_evi_rb_cmp);
index d9edd9ee96dc84048792f8f49046e80a978d6839..400f07386f90ee4f2e5eb2efcc33189d19f181a7 100644 (file)
@@ -43,6 +43,15 @@ extern "C" {
 #define ETH_ALEN 6
 #endif
 
+/* EVPN route types. */
+typedef enum {
+       BGP_EVPN_AD_ROUTE = 1,    /* Ethernet Auto-Discovery (A-D) route */
+       BGP_EVPN_MAC_IP_ROUTE,    /* MAC/IP Advertisement route */
+       BGP_EVPN_IMET_ROUTE,      /* Inclusive Multicast Ethernet Tag route */
+       BGP_EVPN_ES_ROUTE,        /* Ethernet Segment route */
+       BGP_EVPN_IP_PREFIX_ROUTE, /* IP Prefix route */
+} bgp_evpn_route_type;
+
 /* value of first byte of ESI */
 #define ESI_TYPE_ARBITRARY 0  /* */
 #define ESI_TYPE_LACP      1  /* <> */
@@ -236,45 +245,45 @@ struct prefix_evpn {
 
 static inline int is_evpn_prefix_ipaddr_none(const struct prefix_evpn *evp)
 {
-       if (evp->prefix.route_type == 1)
+       if (evp->prefix.route_type == BGP_EVPN_AD_ROUTE)
                return IS_IPADDR_NONE(&(evp)->prefix.ead_addr.ip);
-       if (evp->prefix.route_type == 2)
+       if (evp->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE)
                return IS_IPADDR_NONE(&(evp)->prefix.macip_addr.ip);
-       if (evp->prefix.route_type == 3)
+       if (evp->prefix.route_type == BGP_EVPN_IMET_ROUTE)
                return IS_IPADDR_NONE(&(evp)->prefix.imet_addr.ip);
-       if (evp->prefix.route_type == 4)
+       if (evp->prefix.route_type == BGP_EVPN_ES_ROUTE)
                return IS_IPADDR_NONE(&(evp)->prefix.es_addr.ip);
-       if (evp->prefix.route_type == 5)
+       if (evp->prefix.route_type == BGP_EVPN_IP_PREFIX_ROUTE)
                return IS_IPADDR_NONE(&(evp)->prefix.prefix_addr.ip);
        return 0;
 }
 
 static inline int is_evpn_prefix_ipaddr_v4(const struct prefix_evpn *evp)
 {
-       if (evp->prefix.route_type == 1)
+       if (evp->prefix.route_type == BGP_EVPN_AD_ROUTE)
                return IS_IPADDR_V4(&(evp)->prefix.ead_addr.ip);
-       if (evp->prefix.route_type == 2)
+       if (evp->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE)
                return IS_IPADDR_V4(&(evp)->prefix.macip_addr.ip);
-       if (evp->prefix.route_type == 3)
+       if (evp->prefix.route_type == BGP_EVPN_IMET_ROUTE)
                return IS_IPADDR_V4(&(evp)->prefix.imet_addr.ip);
-       if (evp->prefix.route_type == 4)
+       if (evp->prefix.route_type == BGP_EVPN_ES_ROUTE)
                return IS_IPADDR_V4(&(evp)->prefix.es_addr.ip);
-       if (evp->prefix.route_type == 5)
+       if (evp->prefix.route_type == BGP_EVPN_IP_PREFIX_ROUTE)
                return IS_IPADDR_V4(&(evp)->prefix.prefix_addr.ip);
        return 0;
 }
 
 static inline int is_evpn_prefix_ipaddr_v6(const struct prefix_evpn *evp)
 {
-       if (evp->prefix.route_type == 1)
+       if (evp->prefix.route_type == BGP_EVPN_AD_ROUTE)
                return IS_IPADDR_V6(&(evp)->prefix.ead_addr.ip);
-       if (evp->prefix.route_type == 2)
+       if (evp->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE)
                return IS_IPADDR_V6(&(evp)->prefix.macip_addr.ip);
-       if (evp->prefix.route_type == 3)
+       if (evp->prefix.route_type == BGP_EVPN_IMET_ROUTE)
                return IS_IPADDR_V6(&(evp)->prefix.imet_addr.ip);
-       if (evp->prefix.route_type == 4)
+       if (evp->prefix.route_type == BGP_EVPN_ES_ROUTE)
                return IS_IPADDR_V6(&(evp)->prefix.es_addr.ip);
-       if (evp->prefix.route_type == 5)
+       if (evp->prefix.route_type == BGP_EVPN_IP_PREFIX_ROUTE)
                return IS_IPADDR_V6(&(evp)->prefix.prefix_addr.ip);
        return 0;
 }