]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_attr_evpn.h
bgpd: rfapi code does not need to assert on memory allocations
[mirror_frr.git] / bgpd / bgp_attr_evpn.h
index 25654ba709386a1ea1dfa1d0f1b6abff9c4a8459..bb4a8169301233a4aaba7dd7b0f94b5a269b70ea 100644 (file)
 #ifndef _QUAGGA_BGP_ATTR_EVPN_H
 #define _QUAGGA_BGP_ATTR_EVPN_H
 
-/* value of first byte of ESI */
-#define ESI_TYPE_ARBITRARY 0  /* */
-#define ESI_TYPE_LACP      1  /* <> */
-#define ESI_TYPE_BRIDGE    2  /* <Root bridge Mac-6B>:<Root Br Priority-2B>:00 */
-#define ESI_TYPE_MAC       3  /* <Syst Mac Add-6B>:<Local Discriminator Value-3B> */
-#define ESI_TYPE_ROUTER    4  /* <RouterId-4B>:<Local Discriminator Value-4B> */
-#define ESI_TYPE_AS        5  /* <AS-4B>:<Local Discriminator Value-4B> */
-
-#define MAX_ESI {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}
-#define ESI_LEN 10
-
 #define MAX_ET 0xffffffff
 
 struct attr;
 
-/* EVPN ESI */
-struct eth_segment_id {
-       uint8_t val[ESI_LEN];
-};
-
-union gw_addr {
-       struct in_addr ipv4;
-       struct in6_addr ipv6;
+enum overlay_index_type {
+       OVERLAY_INDEX_TYPE_NONE,
+       OVERLAY_INDEX_GATEWAY_IP,
+       OVERLAY_INDEX_ESI,
+       OVERLAY_INDEX_MAC,
 };
 
+/*
+ * Structure to store ovrelay index for EVPN type-5 route
+ * This structure stores ESI and Gateway IP overlay index.
+ * MAC overlay index is stored in the RMAC attribute.
+ */
 struct bgp_route_evpn {
-       struct eth_segment_id eth_s_id;
-       union gw_addr gw_ip;
+       enum overlay_index_type type;
+       esi_t eth_s_id;
+       struct ipaddr gw_ip;
 };
 
-extern int str2esi(const char *str, struct eth_segment_id *id);
-extern char *esi2str(struct eth_segment_id *id);
+extern bool str2esi(const char *str, esi_t *id);
 extern char *ecom_mac2str(char *ecom_mac);
 
 extern void bgp_add_routermac_ecom(struct attr *attr,
@@ -64,9 +55,11 @@ extern uint32_t bgp_attr_mac_mobility_seqnum(struct attr *attr,
                                             uint8_t *sticky);
 extern uint8_t bgp_attr_default_gw(struct attr *attr);
 
-extern void bgp_attr_evpn_na_flag(struct attr *attr, uint8_t *router_flag);
+extern void bgp_attr_evpn_na_flag(struct attr *attr, uint8_t *router_flag,
+               bool *proxy);
+extern uint16_t bgp_attr_df_pref_from_ec(struct attr *attr, uint8_t *alg);
 
-extern bool is_zero_gw_ip(const union gw_addr *gw_ip, afi_t afi);
 
-extern bool is_zero_esi(const struct eth_segment_id *esi);
+extern bool bgp_route_evpn_same(const struct bgp_route_evpn *e1,
+                               const struct bgp_route_evpn *e2);
 #endif /* _QUAGGA_BGP_ATTR_EVPN_H */