1 /* BGP EVPN internal definitions
2 * Copyright (C) 2017 Cumulus Networks, Inc.
4 * This file is part of FRR.
6 * FRR is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
11 * FRR is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with FRR; see the file COPYING. If not, write to the Free
18 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
22 #ifndef _BGP_EVPN_PRIVATE_H
23 #define _BGP_EVPN_PRIVATE_H
28 #include "bgpd/bgpd.h"
29 #include "bgpd/bgp_ecommunity.h"
31 #define RT_ADDRSTRLEN 28
33 /* EVPN prefix lengths. This represents the sizeof struct evpn_addr
35 #define EVPN_ROUTE_PREFIXLEN (sizeof(struct evpn_addr) * 8)
37 /* EVPN route RD buffer length */
38 #define BGP_EVPN_PREFIX_RD_LEN 100
40 /* packet sizes for EVPN routes */
41 /* Type-1 route should be 25 bytes
42 * RD (8), ESI (10), eth-tag (4), vni (3)
44 #define BGP_EVPN_TYPE1_PSIZE 25
45 /* Type-4 route should be either 23 or 35 bytes
46 * RD (8), ESI (10), ip-len (1), ip (4 or 16)
48 #define BGP_EVPN_TYPE4_V4_PSIZE 23
49 #define BGP_EVPN_TYPE4_V6_PSIZE 34
51 RB_HEAD(bgp_es_evi_rb_head
, bgp_evpn_es_evi
);
52 RB_PROTOTYPE(bgp_es_evi_rb_head
, bgp_evpn_es_evi
, rb_node
,
55 * Hash table of EVIs. Right now, the only type of EVI supported is with
56 * VxLAN encapsulation, hence each EVI corresponds to a L2 VNI.
57 * The VNIs are not "created" through BGP but through some other interface
58 * on the system. This table stores VNIs that BGP comes to know as present
59 * on the system (through interaction with zebra) as well as pre-configured
60 * VNIs (which need to be defined in the system to become "live").
64 vrf_id_t tenant_vrf_id
;
65 ifindex_t svi_ifindex
;
67 #define VNI_FLAG_CFGD 0x1 /* VNI is user configured */
68 #define VNI_FLAG_LIVE 0x2 /* VNI is "live" */
69 #define VNI_FLAG_RD_CFGD 0x4 /* RD is user configured. */
70 #define VNI_FLAG_IMPRT_CFGD 0x8 /* Import RT is user configured */
71 #define VNI_FLAG_EXPRT_CFGD 0x10 /* Export RT is user configured */
72 #define VNI_FLAG_USE_TWO_LABELS 0x20 /* Attach both L2-VNI and L3-VNI if
73 needed for this VPN */
75 struct bgp
*bgp_vrf
; /* back pointer to the vrf instance */
77 /* Flag to indicate if we are
78 * advertising the g/w mac ip for
80 uint8_t advertise_gw_macip
;
82 /* Flag to indicate if we are
83 * advertising subnet for this VNI */
84 uint8_t advertise_subnet
;
86 /* Flag to indicate if we are advertising the svi mac ip for this VNI*/
87 uint8_t advertise_svi_macip
;
89 /* Id for deriving the RD
90 * automatically for this VNI */
93 /* RD for this VNI. */
96 /* Route type 3 field */
97 struct in_addr originator_ip
;
99 /* PIM-SM MDT group for BUM flooding */
100 struct in_addr mcast_grp
;
102 /* Import and Export RTs. */
103 struct list
*import_rtl
;
104 struct list
*export_rtl
;
107 * EVPN route that uses gateway IP overlay index as its nexthop
108 * needs to do a recursive lookup.
109 * A remote MAC/IP entry should be present for the gateway IP.
110 * Maintain a hash of the addresses received via remote MAC/IP routes
111 * for efficient gateway IP recursive lookup in this EVI
113 struct hash
*remote_ip_hash
;
115 /* Route table for EVPN routes for
117 struct bgp_table
*route_table
;
119 /* RB tree of ES-EVIs */
120 struct bgp_es_evi_rb_head es_evi_rb_tree
;
122 /* List of local ESs */
123 struct list
*local_es_evi_list
;
128 DECLARE_QOBJ_TYPE(bgpevpn
);
130 /* Mapping of Import RT to VNIs.
131 * The Import RTs of all VNIs are maintained in a hash table with each
132 * RT linking to all VNIs that will import routes matching this RT.
136 struct ecommunity_val rt
;
138 /* List of VNIs importing routes matching this RT. */
142 /* Mapping of Import RT to VRFs.
143 * The Import RTs of all VRFss are maintained in a hash table with each
144 * RT linking to all VRFs that will import routes matching this RT.
146 struct vrf_irt_node
{
148 struct ecommunity_val rt
;
150 /* List of VNIs importing routes matching this RT. */
155 #define RT_TYPE_IMPORT 1
156 #define RT_TYPE_EXPORT 2
157 #define RT_TYPE_BOTH 3
159 #define EVPN_DAD_DEFAULT_TIME 180 /* secs */
160 #define EVPN_DAD_DEFAULT_MAX_MOVES 5 /* default from RFC 7432 */
161 #define EVPN_DAD_DEFAULT_AUTO_RECOVERY_TIME 1800 /* secs */
163 struct bgp_evpn_info
{
164 /* enable disable dup detect */
165 bool dup_addr_detect
;
167 /* Detection time(M) */
169 /* Detection max moves(N) */
170 uint32_t dad_max_moves
;
171 /* Permanent freeze */
174 uint32_t dad_freeze_time
;
176 /* EVPN enable - advertise svi macip routes */
177 int advertise_svi_macip
;
179 /* PIP feature knob */
181 /* PIP IP (sys ip) */
182 struct in_addr pip_ip
;
183 struct in_addr pip_ip_static
;
184 /* PIP MAC (sys MAC) */
185 struct ethaddr pip_rmac
;
186 struct ethaddr pip_rmac_static
;
187 struct ethaddr pip_rmac_zebra
;
191 /* This structure defines an entry in remote_ip_hash */
192 struct evpn_remote_ip
{
194 struct list
*macip_path_list
;
197 static inline int is_vrf_rd_configured(struct bgp
*bgp_vrf
)
199 return (CHECK_FLAG(bgp_vrf
->vrf_flags
, BGP_VRF_RD_CFGD
));
202 static inline int bgp_evpn_vrf_rd_matches_existing(struct bgp
*bgp_vrf
,
203 struct prefix_rd
*prd
)
205 return (memcmp(&bgp_vrf
->vrf_prd
.val
, prd
->val
, ECOMMUNITY_SIZE
) == 0);
208 static inline vni_t
bgpevpn_get_l3vni(struct bgpevpn
*vpn
)
210 return vpn
->bgp_vrf
? vpn
->bgp_vrf
->l3vni
: 0;
213 static inline void bgpevpn_get_rmac(struct bgpevpn
*vpn
, struct ethaddr
*rmac
)
215 memset(rmac
, 0, sizeof(struct ethaddr
));
218 memcpy(rmac
, &vpn
->bgp_vrf
->rmac
, sizeof(struct ethaddr
));
221 static inline struct list
*bgpevpn_get_vrf_export_rtl(struct bgpevpn
*vpn
)
226 return vpn
->bgp_vrf
->vrf_export_rtl
;
229 static inline struct list
*bgpevpn_get_vrf_import_rtl(struct bgpevpn
*vpn
)
234 return vpn
->bgp_vrf
->vrf_import_rtl
;
237 extern void bgp_evpn_es_evi_vrf_ref(struct bgpevpn
*vpn
);
238 extern void bgp_evpn_es_evi_vrf_deref(struct bgpevpn
*vpn
);
240 static inline void bgpevpn_unlink_from_l3vni(struct bgpevpn
*vpn
)
242 /* bail if vpn is not associated to bgp_vrf */
246 UNSET_FLAG(vpn
->flags
, VNI_FLAG_USE_TWO_LABELS
);
247 listnode_delete(vpn
->bgp_vrf
->l2vnis
, vpn
);
249 bgp_evpn_es_evi_vrf_deref(vpn
);
251 /* remove the backpointer to the vrf instance */
252 bgp_unlock(vpn
->bgp_vrf
);
256 static inline void bgpevpn_link_to_l3vni(struct bgpevpn
*vpn
)
258 struct bgp
*bgp_vrf
= NULL
;
260 /* bail if vpn is already associated to vrf */
264 bgp_vrf
= bgp_lookup_by_vrf_id(vpn
->tenant_vrf_id
);
268 /* associate the vpn to the bgp_vrf instance */
269 vpn
->bgp_vrf
= bgp_lock(bgp_vrf
);
270 listnode_add_sort(bgp_vrf
->l2vnis
, vpn
);
273 * If L3VNI is configured,
274 * check if we are advertising two labels for this vpn
276 if (bgp_vrf
->l3vni
&&
277 !CHECK_FLAG(bgp_vrf
->vrf_flags
, BGP_VRF_L3VNI_PREFIX_ROUTES_ONLY
))
278 SET_FLAG(vpn
->flags
, VNI_FLAG_USE_TWO_LABELS
);
280 bgp_evpn_es_evi_vrf_ref(vpn
);
283 static inline int is_vni_configured(struct bgpevpn
*vpn
)
285 return (CHECK_FLAG(vpn
->flags
, VNI_FLAG_CFGD
));
288 static inline int is_vni_live(struct bgpevpn
*vpn
)
290 return (CHECK_FLAG(vpn
->flags
, VNI_FLAG_LIVE
));
293 static inline int is_l3vni_live(struct bgp
*bgp_vrf
)
295 return (bgp_vrf
->l3vni
&& bgp_vrf
->l3vni_svi_ifindex
);
298 static inline int is_rd_configured(struct bgpevpn
*vpn
)
300 return (CHECK_FLAG(vpn
->flags
, VNI_FLAG_RD_CFGD
));
303 static inline int bgp_evpn_rd_matches_existing(struct bgpevpn
*vpn
,
304 struct prefix_rd
*prd
)
306 return (memcmp(&vpn
->prd
.val
, prd
->val
, ECOMMUNITY_SIZE
) == 0);
309 static inline int is_import_rt_configured(struct bgpevpn
*vpn
)
311 return (CHECK_FLAG(vpn
->flags
, VNI_FLAG_IMPRT_CFGD
));
314 static inline int is_export_rt_configured(struct bgpevpn
*vpn
)
316 return (CHECK_FLAG(vpn
->flags
, VNI_FLAG_EXPRT_CFGD
));
319 static inline int is_vni_param_configured(struct bgpevpn
*vpn
)
321 return (is_rd_configured(vpn
) || is_import_rt_configured(vpn
)
322 || is_export_rt_configured(vpn
));
325 static inline void encode_es_rt_extcomm(struct ecommunity_val
*eval
,
328 memset(eval
, 0, sizeof(struct ecommunity_val
));
329 eval
->val
[0] = ECOMMUNITY_ENCODE_EVPN
;
330 eval
->val
[1] = ECOMMUNITY_EVPN_SUBTYPE_ES_IMPORT_RT
;
331 memcpy(&eval
->val
[2], mac
, ETH_ALEN
);
334 static inline void encode_df_elect_extcomm(struct ecommunity_val
*eval
,
337 memset(eval
, 0, sizeof(*eval
));
338 eval
->val
[0] = ECOMMUNITY_ENCODE_EVPN
;
339 eval
->val
[1] = ECOMMUNITY_EVPN_SUBTYPE_DF_ELECTION
;
340 eval
->val
[2] = EVPN_MH_DF_ALG_PREF
;
341 eval
->val
[6] = (pref
>> 8) & 0xff;
342 eval
->val
[7] = pref
& 0xff;
345 static inline void encode_esi_label_extcomm(struct ecommunity_val
*eval
,
348 memset(eval
, 0, sizeof(struct ecommunity_val
));
349 eval
->val
[0] = ECOMMUNITY_ENCODE_EVPN
;
350 eval
->val
[1] = ECOMMUNITY_EVPN_SUBTYPE_ESI_LABEL
;
352 eval
->val
[2] |= (1 << 0);
355 static inline void encode_rmac_extcomm(struct ecommunity_val
*eval
,
356 struct ethaddr
*rmac
)
358 memset(eval
, 0, sizeof(*eval
));
359 eval
->val
[0] = ECOMMUNITY_ENCODE_EVPN
;
360 eval
->val
[1] = ECOMMUNITY_EVPN_SUBTYPE_ROUTERMAC
;
361 memcpy(&eval
->val
[2], rmac
, ETH_ALEN
);
364 static inline void encode_default_gw_extcomm(struct ecommunity_val
*eval
)
366 memset(eval
, 0, sizeof(*eval
));
367 eval
->val
[0] = ECOMMUNITY_ENCODE_OPAQUE
;
368 eval
->val
[1] = ECOMMUNITY_EVPN_SUBTYPE_DEF_GW
;
371 static inline void encode_mac_mobility_extcomm(int static_mac
, uint32_t seq
,
372 struct ecommunity_val
*eval
)
374 memset(eval
, 0, sizeof(*eval
));
375 eval
->val
[0] = ECOMMUNITY_ENCODE_EVPN
;
376 eval
->val
[1] = ECOMMUNITY_EVPN_SUBTYPE_MACMOBILITY
;
378 eval
->val
[2] = ECOMMUNITY_EVPN_SUBTYPE_MACMOBILITY_FLAG_STICKY
;
379 eval
->val
[4] = (seq
>> 24) & 0xff;
380 eval
->val
[5] = (seq
>> 16) & 0xff;
381 eval
->val
[6] = (seq
>> 8) & 0xff;
382 eval
->val
[7] = seq
& 0xff;
385 static inline void encode_na_flag_extcomm(struct ecommunity_val
*eval
,
386 uint8_t na_flag
, bool proxy
)
388 memset(eval
, 0, sizeof(*eval
));
389 eval
->val
[0] = ECOMMUNITY_ENCODE_EVPN
;
390 eval
->val
[1] = ECOMMUNITY_EVPN_SUBTYPE_ND
;
392 eval
->val
[2] |= ECOMMUNITY_EVPN_SUBTYPE_ND_ROUTER_FLAG
;
394 eval
->val
[2] |= ECOMMUNITY_EVPN_SUBTYPE_PROXY_FLAG
;
397 static inline void ip_prefix_from_type5_prefix(const struct prefix_evpn
*evp
,
400 memset(ip
, 0, sizeof(struct prefix
));
401 if (is_evpn_prefix_ipaddr_v4(evp
)) {
402 ip
->family
= AF_INET
;
403 ip
->prefixlen
= evp
->prefix
.prefix_addr
.ip_prefix_length
;
404 memcpy(&(ip
->u
.prefix4
), &(evp
->prefix
.prefix_addr
.ip
.ip
),
406 } else if (is_evpn_prefix_ipaddr_v6(evp
)) {
407 ip
->family
= AF_INET6
;
408 ip
->prefixlen
= evp
->prefix
.prefix_addr
.ip_prefix_length
;
409 memcpy(&(ip
->u
.prefix6
), &(evp
->prefix
.prefix_addr
.ip
.ip
),
414 static inline int is_evpn_prefix_default(const struct prefix
*evp
)
416 if (evp
->family
!= AF_EVPN
)
419 return ((evp
->u
.prefix_evpn
.prefix_addr
.ip_prefix_length
== 0) ?
423 static inline void ip_prefix_from_type2_prefix(const struct prefix_evpn
*evp
,
426 memset(ip
, 0, sizeof(struct prefix
));
427 if (is_evpn_prefix_ipaddr_v4(evp
)) {
428 ip
->family
= AF_INET
;
429 ip
->prefixlen
= IPV4_MAX_BITLEN
;
430 memcpy(&(ip
->u
.prefix4
), &(evp
->prefix
.macip_addr
.ip
.ip
),
432 } else if (is_evpn_prefix_ipaddr_v6(evp
)) {
433 ip
->family
= AF_INET6
;
434 ip
->prefixlen
= IPV6_MAX_BITLEN
;
435 memcpy(&(ip
->u
.prefix6
), &(evp
->prefix
.macip_addr
.ip
.ip
),
440 static inline void ip_prefix_from_evpn_prefix(const struct prefix_evpn
*evp
,
443 if (evp
->prefix
.route_type
== BGP_EVPN_MAC_IP_ROUTE
)
444 ip_prefix_from_type2_prefix(evp
, ip
);
445 else if (evp
->prefix
.route_type
== BGP_EVPN_IP_PREFIX_ROUTE
)
446 ip_prefix_from_type5_prefix(evp
, ip
);
449 static inline void build_evpn_type2_prefix(struct prefix_evpn
*p
,
453 memset(p
, 0, sizeof(struct prefix_evpn
));
455 p
->prefixlen
= EVPN_ROUTE_PREFIXLEN
;
456 p
->prefix
.route_type
= BGP_EVPN_MAC_IP_ROUTE
;
457 memcpy(&p
->prefix
.macip_addr
.mac
.octet
, mac
->octet
, ETH_ALEN
);
458 p
->prefix
.macip_addr
.ip
.ipa_type
= IPADDR_NONE
;
460 memcpy(&p
->prefix
.macip_addr
.ip
, ip
, sizeof(*ip
));
464 build_type5_prefix_from_ip_prefix(struct prefix_evpn
*evp
,
465 const struct prefix
*ip_prefix
)
469 memset(&ip
, 0, sizeof(struct ipaddr
));
470 if (ip_prefix
->family
== AF_INET
) {
471 ip
.ipa_type
= IPADDR_V4
;
472 memcpy(&ip
.ipaddr_v4
, &ip_prefix
->u
.prefix4
,
473 sizeof(struct in_addr
));
475 ip
.ipa_type
= IPADDR_V6
;
476 memcpy(&ip
.ipaddr_v6
, &ip_prefix
->u
.prefix6
,
477 sizeof(struct in6_addr
));
480 memset(evp
, 0, sizeof(struct prefix_evpn
));
481 evp
->family
= AF_EVPN
;
482 evp
->prefixlen
= EVPN_ROUTE_PREFIXLEN
;
483 evp
->prefix
.route_type
= BGP_EVPN_IP_PREFIX_ROUTE
;
484 evp
->prefix
.prefix_addr
.ip_prefix_length
= ip_prefix
->prefixlen
;
485 evp
->prefix
.prefix_addr
.ip
.ipa_type
= ip
.ipa_type
;
486 memcpy(&evp
->prefix
.prefix_addr
.ip
, &ip
, sizeof(struct ipaddr
));
489 static inline void build_evpn_type3_prefix(struct prefix_evpn
*p
,
490 struct in_addr originator_ip
)
492 memset(p
, 0, sizeof(struct prefix_evpn
));
494 p
->prefixlen
= EVPN_ROUTE_PREFIXLEN
;
495 p
->prefix
.route_type
= BGP_EVPN_IMET_ROUTE
;
496 p
->prefix
.imet_addr
.ip
.ipa_type
= IPADDR_V4
;
497 p
->prefix
.imet_addr
.ip
.ipaddr_v4
= originator_ip
;
500 static inline void build_evpn_type4_prefix(struct prefix_evpn
*p
,
502 struct in_addr originator_ip
)
504 memset(p
, 0, sizeof(struct prefix_evpn
));
506 p
->prefixlen
= EVPN_ROUTE_PREFIXLEN
;
507 p
->prefix
.route_type
= BGP_EVPN_ES_ROUTE
;
508 p
->prefix
.es_addr
.ip_prefix_length
= IPV4_MAX_BITLEN
;
509 p
->prefix
.es_addr
.ip
.ipa_type
= IPADDR_V4
;
510 p
->prefix
.es_addr
.ip
.ipaddr_v4
= originator_ip
;
511 memcpy(&p
->prefix
.es_addr
.esi
, esi
, sizeof(esi_t
));
514 static inline void build_evpn_type1_prefix(struct prefix_evpn
*p
,
517 struct in_addr originator_ip
)
519 memset(p
, 0, sizeof(struct prefix_evpn
));
521 p
->prefixlen
= EVPN_ROUTE_PREFIXLEN
;
522 p
->prefix
.route_type
= BGP_EVPN_AD_ROUTE
;
523 p
->prefix
.ead_addr
.eth_tag
= eth_tag
;
524 p
->prefix
.ead_addr
.ip
.ipa_type
= IPADDR_V4
;
525 p
->prefix
.ead_addr
.ip
.ipaddr_v4
= originator_ip
;
526 memcpy(&p
->prefix
.ead_addr
.esi
, esi
, sizeof(esi_t
));
529 static inline void evpn_type1_prefix_global_copy(struct prefix_evpn
*global_p
,
530 const struct prefix_evpn
*vni_p
)
532 memcpy(global_p
, vni_p
, sizeof(*global_p
));
533 global_p
->prefix
.ead_addr
.ip
.ipa_type
= 0;
534 global_p
->prefix
.ead_addr
.ip
.ipaddr_v4
.s_addr
= INADDR_ANY
;
537 /* EAD prefix in the global table doesn't include the VTEP-IP so
538 * we need to create a different copy for the VNI
540 static inline struct prefix_evpn
*evpn_type1_prefix_vni_copy(
541 struct prefix_evpn
*vni_p
,
542 const struct prefix_evpn
*global_p
,
543 struct in_addr originator_ip
)
545 memcpy(vni_p
, global_p
, sizeof(*vni_p
));
546 vni_p
->prefix
.ead_addr
.ip
.ipa_type
= IPADDR_V4
;
547 vni_p
->prefix
.ead_addr
.ip
.ipaddr_v4
= originator_ip
;
552 static inline int evpn_default_originate_set(struct bgp
*bgp
, afi_t afi
,
556 CHECK_FLAG(bgp
->af_flags
[AFI_L2VPN
][SAFI_EVPN
],
557 BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV4
))
559 else if (afi
== AFI_IP6
&&
560 CHECK_FLAG(bgp
->af_flags
[AFI_L2VPN
][SAFI_EVPN
],
561 BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV6
))
566 static inline void es_get_system_mac(esi_t
*esi
,
570 * for type-1 and type-3 ESIs,
571 * the system mac starts at val[1]
573 memcpy(mac
, &esi
->val
[1], ETH_ALEN
);
576 static inline bool bgp_evpn_is_svi_macip_enabled(struct bgpevpn
*vpn
)
578 struct bgp
*bgp_evpn
= NULL
;
580 bgp_evpn
= bgp_get_evpn();
582 return (bgp_evpn
->evpn_info
->advertise_svi_macip
||
583 vpn
->advertise_svi_macip
);
586 static inline bool bgp_evpn_is_path_local(struct bgp
*bgp
,
587 struct bgp_path_info
*pi
)
589 return (pi
->peer
== bgp
->peer_self
590 && pi
->type
== ZEBRA_ROUTE_BGP
591 && pi
->sub_type
== BGP_ROUTE_STATIC
);
594 extern struct zclient
*zclient
;
596 extern void bgp_evpn_install_uninstall_default_route(struct bgp
*bgp_vrf
,
597 afi_t afi
, safi_t safi
,
599 extern void evpn_rt_delete_auto(struct bgp
*, vni_t
, struct list
*);
600 extern void bgp_evpn_configure_export_rt_for_vrf(struct bgp
*bgp_vrf
,
601 struct ecommunity
*ecomadd
);
602 extern void bgp_evpn_unconfigure_export_rt_for_vrf(struct bgp
*bgp_vrf
,
603 struct ecommunity
*ecomdel
);
604 extern void bgp_evpn_configure_import_rt_for_vrf(struct bgp
*bgp_vrf
,
605 struct ecommunity
*ecomadd
);
606 extern void bgp_evpn_unconfigure_import_rt_for_vrf(struct bgp
*bgp_vrf
,
607 struct ecommunity
*ecomdel
);
608 extern int bgp_evpn_handle_export_rt_change(struct bgp
*bgp
,
609 struct bgpevpn
*vpn
);
610 extern void bgp_evpn_handle_autort_change(struct bgp
*bgp
);
611 extern void bgp_evpn_handle_vrf_rd_change(struct bgp
*bgp_vrf
, int withdraw
);
612 extern void bgp_evpn_handle_rd_change(struct bgp
*bgp
, struct bgpevpn
*vpn
,
614 extern int bgp_evpn_install_routes(struct bgp
*bgp
, struct bgpevpn
*vpn
);
615 extern int bgp_evpn_uninstall_routes(struct bgp
*bgp
, struct bgpevpn
*vpn
);
616 extern void bgp_evpn_map_vrf_to_its_rts(struct bgp
*bgp_vrf
);
617 extern void bgp_evpn_unmap_vrf_from_its_rts(struct bgp
*bgp_vrf
);
618 extern void bgp_evpn_map_vni_to_its_rts(struct bgp
*bgp
, struct bgpevpn
*vpn
);
619 extern void bgp_evpn_unmap_vni_from_its_rts(struct bgp
*bgp
,
620 struct bgpevpn
*vpn
);
621 extern void bgp_evpn_derive_auto_rt_import(struct bgp
*bgp
,
622 struct bgpevpn
*vpn
);
623 extern void bgp_evpn_derive_auto_rt_export(struct bgp
*bgp
,
624 struct bgpevpn
*vpn
);
625 extern void bgp_evpn_derive_auto_rd(struct bgp
*bgp
, struct bgpevpn
*vpn
);
626 extern void bgp_evpn_derive_auto_rd_for_vrf(struct bgp
*bgp
);
627 extern struct bgpevpn
*bgp_evpn_lookup_vni(struct bgp
*bgp
, vni_t vni
);
628 extern struct bgpevpn
*bgp_evpn_new(struct bgp
*bgp
, vni_t vni
,
629 struct in_addr originator_ip
,
630 vrf_id_t tenant_vrf_id
,
631 struct in_addr mcast_grp
,
632 ifindex_t svi_ifindex
);
633 extern void bgp_evpn_free(struct bgp
*bgp
, struct bgpevpn
*vpn
);
634 extern bool bgp_evpn_lookup_l3vni_l2vni_table(vni_t vni
);
635 extern int update_routes_for_vni(struct bgp
*bgp
, struct bgpevpn
*vpn
);
636 extern void delete_evpn_route_entry(struct bgp
*bgp
, afi_t afi
, safi_t safi
,
637 struct bgp_dest
*dest
,
638 struct bgp_path_info
**pi
);
639 int vni_list_cmp(void *p1
, void *p2
);
640 extern int evpn_route_select_install(struct bgp
*bgp
, struct bgpevpn
*vpn
,
641 struct bgp_dest
*dest
);
642 extern struct bgp_dest
*bgp_global_evpn_node_get(struct bgp_table
*table
,
643 afi_t afi
, safi_t safi
,
644 const struct prefix_evpn
*evp
,
645 struct prefix_rd
*prd
);
646 extern struct bgp_dest
*
647 bgp_global_evpn_node_lookup(struct bgp_table
*table
, afi_t afi
, safi_t safi
,
648 const struct prefix_evpn
*evp
,
649 struct prefix_rd
*prd
);
650 extern void bgp_evpn_import_route_in_vrfs(struct bgp_path_info
*pi
, int import
);
651 extern void bgp_evpn_update_type2_route_entry(struct bgp
*bgp
,
654 struct bgp_path_info
*local_pi
,
656 extern int bgp_evpn_route_entry_install_if_vrf_match(struct bgp
*bgp_vrf
,
657 struct bgp_path_info
*pi
,
659 extern void bgp_evpn_import_type2_route(struct bgp_path_info
*pi
, int import
);
660 #endif /* _BGP_EVPN_PRIVATE_H */