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
;
66 #define VNI_FLAG_CFGD 0x1 /* VNI is user configured */
67 #define VNI_FLAG_LIVE 0x2 /* VNI is "live" */
68 #define VNI_FLAG_RD_CFGD 0x4 /* RD is user configured. */
69 #define VNI_FLAG_IMPRT_CFGD 0x8 /* Import RT is user configured */
70 #define VNI_FLAG_EXPRT_CFGD 0x10 /* Export RT is user configured */
71 #define VNI_FLAG_USE_TWO_LABELS 0x20 /* Attach both L2-VNI and L3-VNI if
72 needed for this VPN */
74 struct bgp
*bgp_vrf
; /* back pointer to the vrf instance */
76 /* Flag to indicate if we are
77 * advertising the g/w mac ip for
79 uint8_t advertise_gw_macip
;
81 /* Flag to indicate if we are
82 * advertising subnet for this VNI */
83 uint8_t advertise_subnet
;
85 /* Flag to indicate if we are advertising the svi mac ip for this VNI*/
86 uint8_t advertise_svi_macip
;
88 /* Id for deriving the RD
89 * automatically for this VNI */
92 /* RD for this VNI. */
95 /* Route type 3 field */
96 struct in_addr originator_ip
;
98 /* PIM-SM MDT group for BUM flooding */
99 struct in_addr mcast_grp
;
101 /* Import and Export RTs. */
102 struct list
*import_rtl
;
103 struct list
*export_rtl
;
105 /* Route table for EVPN routes for
107 struct bgp_table
*route_table
;
109 /* RB tree of ES-EVIs */
110 struct bgp_es_evi_rb_head es_evi_rb_tree
;
112 /* List of local ESs */
113 struct list
*local_es_evi_list
;
118 DECLARE_QOBJ_TYPE(bgpevpn
)
120 /* Mapping of Import RT to VNIs.
121 * The Import RTs of all VNIs are maintained in a hash table with each
122 * RT linking to all VNIs that will import routes matching this RT.
126 struct ecommunity_val rt
;
128 /* List of VNIs importing routes matching this RT. */
132 /* Mapping of Import RT to VRFs.
133 * The Import RTs of all VRFss are maintained in a hash table with each
134 * RT linking to all VRFs that will import routes matching this RT.
136 struct vrf_irt_node
{
138 struct ecommunity_val rt
;
140 /* List of VNIs importing routes matching this RT. */
145 #define RT_TYPE_IMPORT 1
146 #define RT_TYPE_EXPORT 2
147 #define RT_TYPE_BOTH 3
149 #define EVPN_DAD_DEFAULT_TIME 180 /* secs */
150 #define EVPN_DAD_DEFAULT_MAX_MOVES 5 /* default from RFC 7432 */
151 #define EVPN_DAD_DEFAULT_AUTO_RECOVERY_TIME 1800 /* secs */
153 struct bgp_evpn_info
{
154 /* enable disable dup detect */
155 bool dup_addr_detect
;
157 /* Detection time(M) */
159 /* Detection max moves(N) */
160 uint32_t dad_max_moves
;
161 /* Permanent freeze */
164 uint32_t dad_freeze_time
;
166 /* EVPN enable - advertise svi macip routes */
167 int advertise_svi_macip
;
169 /* PIP feature knob */
171 /* PIP IP (sys ip) */
172 struct in_addr pip_ip
;
173 struct in_addr pip_ip_static
;
174 /* PIP MAC (sys MAC) */
175 struct ethaddr pip_rmac
;
176 struct ethaddr pip_rmac_static
;
177 struct ethaddr pip_rmac_zebra
;
181 static inline int is_vrf_rd_configured(struct bgp
*bgp_vrf
)
183 return (CHECK_FLAG(bgp_vrf
->vrf_flags
, BGP_VRF_RD_CFGD
));
186 static inline int bgp_evpn_vrf_rd_matches_existing(struct bgp
*bgp_vrf
,
187 struct prefix_rd
*prd
)
189 return (memcmp(&bgp_vrf
->vrf_prd
.val
, prd
->val
, ECOMMUNITY_SIZE
) == 0);
192 static inline vni_t
bgpevpn_get_l3vni(struct bgpevpn
*vpn
)
194 return vpn
->bgp_vrf
? vpn
->bgp_vrf
->l3vni
: 0;
197 static inline void bgpevpn_get_rmac(struct bgpevpn
*vpn
, struct ethaddr
*rmac
)
199 memset(rmac
, 0, sizeof(struct ethaddr
));
202 memcpy(rmac
, &vpn
->bgp_vrf
->rmac
, sizeof(struct ethaddr
));
205 static inline struct list
*bgpevpn_get_vrf_export_rtl(struct bgpevpn
*vpn
)
210 return vpn
->bgp_vrf
->vrf_export_rtl
;
213 static inline struct list
*bgpevpn_get_vrf_import_rtl(struct bgpevpn
*vpn
)
218 return vpn
->bgp_vrf
->vrf_import_rtl
;
221 extern void bgp_evpn_es_evi_vrf_ref(struct bgpevpn
*vpn
);
222 extern void bgp_evpn_es_evi_vrf_deref(struct bgpevpn
*vpn
);
224 static inline void bgpevpn_unlink_from_l3vni(struct bgpevpn
*vpn
)
226 /* bail if vpn is not associated to bgp_vrf */
230 UNSET_FLAG(vpn
->flags
, VNI_FLAG_USE_TWO_LABELS
);
231 listnode_delete(vpn
->bgp_vrf
->l2vnis
, vpn
);
233 bgp_evpn_es_evi_vrf_deref(vpn
);
235 /* remove the backpointer to the vrf instance */
236 bgp_unlock(vpn
->bgp_vrf
);
240 static inline void bgpevpn_link_to_l3vni(struct bgpevpn
*vpn
)
242 struct bgp
*bgp_vrf
= NULL
;
244 /* bail if vpn is already associated to vrf */
248 bgp_vrf
= bgp_lookup_by_vrf_id(vpn
->tenant_vrf_id
);
252 /* associate the vpn to the bgp_vrf instance */
253 vpn
->bgp_vrf
= bgp_lock(bgp_vrf
);
254 listnode_add_sort(bgp_vrf
->l2vnis
, vpn
);
257 * If L3VNI is configured,
258 * check if we are advertising two labels for this vpn
260 if (bgp_vrf
->l3vni
&&
261 !CHECK_FLAG(bgp_vrf
->vrf_flags
, BGP_VRF_L3VNI_PREFIX_ROUTES_ONLY
))
262 SET_FLAG(vpn
->flags
, VNI_FLAG_USE_TWO_LABELS
);
264 bgp_evpn_es_evi_vrf_ref(vpn
);
267 static inline int is_vni_configured(struct bgpevpn
*vpn
)
269 return (CHECK_FLAG(vpn
->flags
, VNI_FLAG_CFGD
));
272 static inline int is_vni_live(struct bgpevpn
*vpn
)
274 return (CHECK_FLAG(vpn
->flags
, VNI_FLAG_LIVE
));
277 static inline int is_l3vni_live(struct bgp
*bgp_vrf
)
279 return (bgp_vrf
->l3vni
&& bgp_vrf
->l3vni_svi_ifindex
);
282 static inline int is_rd_configured(struct bgpevpn
*vpn
)
284 return (CHECK_FLAG(vpn
->flags
, VNI_FLAG_RD_CFGD
));
287 static inline int bgp_evpn_rd_matches_existing(struct bgpevpn
*vpn
,
288 struct prefix_rd
*prd
)
290 return (memcmp(&vpn
->prd
.val
, prd
->val
, ECOMMUNITY_SIZE
) == 0);
293 static inline int is_import_rt_configured(struct bgpevpn
*vpn
)
295 return (CHECK_FLAG(vpn
->flags
, VNI_FLAG_IMPRT_CFGD
));
298 static inline int is_export_rt_configured(struct bgpevpn
*vpn
)
300 return (CHECK_FLAG(vpn
->flags
, VNI_FLAG_EXPRT_CFGD
));
303 static inline int is_vni_param_configured(struct bgpevpn
*vpn
)
305 return (is_rd_configured(vpn
) || is_import_rt_configured(vpn
)
306 || is_export_rt_configured(vpn
));
309 static inline void encode_es_rt_extcomm(struct ecommunity_val
*eval
,
312 memset(eval
, 0, sizeof(struct ecommunity_val
));
313 eval
->val
[0] = ECOMMUNITY_ENCODE_EVPN
;
314 eval
->val
[1] = ECOMMUNITY_EVPN_SUBTYPE_ES_IMPORT_RT
;
315 memcpy(&eval
->val
[2], mac
, ETH_ALEN
);
318 static inline void encode_df_elect_extcomm(struct ecommunity_val
*eval
,
321 memset(eval
, 0, sizeof(*eval
));
322 eval
->val
[0] = ECOMMUNITY_ENCODE_EVPN
;
323 eval
->val
[1] = ECOMMUNITY_EVPN_SUBTYPE_DF_ELECTION
;
324 eval
->val
[2] = EVPN_MH_DF_ALG_PREF
;
325 eval
->val
[6] = (pref
>> 8) & 0xff;
326 eval
->val
[7] = pref
& 0xff;
329 static inline void encode_esi_label_extcomm(struct ecommunity_val
*eval
,
332 memset(eval
, 0, sizeof(struct ecommunity_val
));
333 eval
->val
[0] = ECOMMUNITY_ENCODE_EVPN
;
334 eval
->val
[1] = ECOMMUNITY_EVPN_SUBTYPE_ESI_LABEL
;
336 eval
->val
[2] |= (1 << 0);
339 static inline void encode_rmac_extcomm(struct ecommunity_val
*eval
,
340 struct ethaddr
*rmac
)
342 memset(eval
, 0, sizeof(*eval
));
343 eval
->val
[0] = ECOMMUNITY_ENCODE_EVPN
;
344 eval
->val
[1] = ECOMMUNITY_EVPN_SUBTYPE_ROUTERMAC
;
345 memcpy(&eval
->val
[2], rmac
, ETH_ALEN
);
348 static inline void encode_default_gw_extcomm(struct ecommunity_val
*eval
)
350 memset(eval
, 0, sizeof(*eval
));
351 eval
->val
[0] = ECOMMUNITY_ENCODE_OPAQUE
;
352 eval
->val
[1] = ECOMMUNITY_EVPN_SUBTYPE_DEF_GW
;
355 static inline void encode_mac_mobility_extcomm(int static_mac
, uint32_t seq
,
356 struct ecommunity_val
*eval
)
358 memset(eval
, 0, sizeof(*eval
));
359 eval
->val
[0] = ECOMMUNITY_ENCODE_EVPN
;
360 eval
->val
[1] = ECOMMUNITY_EVPN_SUBTYPE_MACMOBILITY
;
362 eval
->val
[2] = ECOMMUNITY_EVPN_SUBTYPE_MACMOBILITY_FLAG_STICKY
;
363 eval
->val
[4] = (seq
>> 24) & 0xff;
364 eval
->val
[5] = (seq
>> 16) & 0xff;
365 eval
->val
[6] = (seq
>> 8) & 0xff;
366 eval
->val
[7] = seq
& 0xff;
369 static inline void encode_na_flag_extcomm(struct ecommunity_val
*eval
,
370 uint8_t na_flag
, bool proxy
)
372 memset(eval
, 0, sizeof(*eval
));
373 eval
->val
[0] = ECOMMUNITY_ENCODE_EVPN
;
374 eval
->val
[1] = ECOMMUNITY_EVPN_SUBTYPE_ND
;
376 eval
->val
[2] |= ECOMMUNITY_EVPN_SUBTYPE_ND_ROUTER_FLAG
;
378 eval
->val
[2] |= ECOMMUNITY_EVPN_SUBTYPE_PROXY_FLAG
;
381 static inline void ip_prefix_from_type5_prefix(const struct prefix_evpn
*evp
,
384 memset(ip
, 0, sizeof(struct prefix
));
385 if (is_evpn_prefix_ipaddr_v4(evp
)) {
386 ip
->family
= AF_INET
;
387 ip
->prefixlen
= evp
->prefix
.prefix_addr
.ip_prefix_length
;
388 memcpy(&(ip
->u
.prefix4
), &(evp
->prefix
.prefix_addr
.ip
.ip
),
390 } else if (is_evpn_prefix_ipaddr_v6(evp
)) {
391 ip
->family
= AF_INET6
;
392 ip
->prefixlen
= evp
->prefix
.prefix_addr
.ip_prefix_length
;
393 memcpy(&(ip
->u
.prefix6
), &(evp
->prefix
.prefix_addr
.ip
.ip
),
398 static inline int is_evpn_prefix_default(const struct prefix
*evp
)
400 if (evp
->family
!= AF_EVPN
)
403 return ((evp
->u
.prefix_evpn
.prefix_addr
.ip_prefix_length
== 0) ?
407 static inline void ip_prefix_from_type2_prefix(const struct prefix_evpn
*evp
,
410 memset(ip
, 0, sizeof(struct prefix
));
411 if (is_evpn_prefix_ipaddr_v4(evp
)) {
412 ip
->family
= AF_INET
;
413 ip
->prefixlen
= IPV4_MAX_BITLEN
;
414 memcpy(&(ip
->u
.prefix4
), &(evp
->prefix
.macip_addr
.ip
.ip
),
416 } else if (is_evpn_prefix_ipaddr_v6(evp
)) {
417 ip
->family
= AF_INET6
;
418 ip
->prefixlen
= IPV6_MAX_BITLEN
;
419 memcpy(&(ip
->u
.prefix6
), &(evp
->prefix
.macip_addr
.ip
.ip
),
424 static inline void ip_prefix_from_evpn_prefix(const struct prefix_evpn
*evp
,
427 if (evp
->prefix
.route_type
== BGP_EVPN_MAC_IP_ROUTE
)
428 ip_prefix_from_type2_prefix(evp
, ip
);
429 else if (evp
->prefix
.route_type
== BGP_EVPN_IP_PREFIX_ROUTE
)
430 ip_prefix_from_type5_prefix(evp
, ip
);
433 static inline void build_evpn_type2_prefix(struct prefix_evpn
*p
,
437 memset(p
, 0, sizeof(struct prefix_evpn
));
439 p
->prefixlen
= EVPN_ROUTE_PREFIXLEN
;
440 p
->prefix
.route_type
= BGP_EVPN_MAC_IP_ROUTE
;
441 memcpy(&p
->prefix
.macip_addr
.mac
.octet
, mac
->octet
, ETH_ALEN
);
442 p
->prefix
.macip_addr
.ip
.ipa_type
= IPADDR_NONE
;
444 memcpy(&p
->prefix
.macip_addr
.ip
, ip
, sizeof(*ip
));
448 build_type5_prefix_from_ip_prefix(struct prefix_evpn
*evp
,
449 const struct prefix
*ip_prefix
)
453 memset(&ip
, 0, sizeof(struct ipaddr
));
454 if (ip_prefix
->family
== AF_INET
) {
455 ip
.ipa_type
= IPADDR_V4
;
456 memcpy(&ip
.ipaddr_v4
, &ip_prefix
->u
.prefix4
,
457 sizeof(struct in_addr
));
459 ip
.ipa_type
= IPADDR_V6
;
460 memcpy(&ip
.ipaddr_v6
, &ip_prefix
->u
.prefix6
,
461 sizeof(struct in6_addr
));
464 memset(evp
, 0, sizeof(struct prefix_evpn
));
465 evp
->family
= AF_EVPN
;
466 evp
->prefixlen
= EVPN_ROUTE_PREFIXLEN
;
467 evp
->prefix
.route_type
= BGP_EVPN_IP_PREFIX_ROUTE
;
468 evp
->prefix
.prefix_addr
.ip_prefix_length
= ip_prefix
->prefixlen
;
469 evp
->prefix
.prefix_addr
.ip
.ipa_type
= ip
.ipa_type
;
470 memcpy(&evp
->prefix
.prefix_addr
.ip
, &ip
, sizeof(struct ipaddr
));
473 static inline void build_evpn_type3_prefix(struct prefix_evpn
*p
,
474 struct in_addr originator_ip
)
476 memset(p
, 0, sizeof(struct prefix_evpn
));
478 p
->prefixlen
= EVPN_ROUTE_PREFIXLEN
;
479 p
->prefix
.route_type
= BGP_EVPN_IMET_ROUTE
;
480 p
->prefix
.imet_addr
.ip
.ipa_type
= IPADDR_V4
;
481 p
->prefix
.imet_addr
.ip
.ipaddr_v4
= originator_ip
;
484 static inline void build_evpn_type4_prefix(struct prefix_evpn
*p
,
486 struct in_addr originator_ip
)
488 memset(p
, 0, sizeof(struct prefix_evpn
));
490 p
->prefixlen
= EVPN_ROUTE_PREFIXLEN
;
491 p
->prefix
.route_type
= BGP_EVPN_ES_ROUTE
;
492 p
->prefix
.es_addr
.ip_prefix_length
= IPV4_MAX_BITLEN
;
493 p
->prefix
.es_addr
.ip
.ipa_type
= IPADDR_V4
;
494 p
->prefix
.es_addr
.ip
.ipaddr_v4
= originator_ip
;
495 memcpy(&p
->prefix
.es_addr
.esi
, esi
, sizeof(esi_t
));
498 static inline void build_evpn_type1_prefix(struct prefix_evpn
*p
,
501 struct in_addr originator_ip
)
503 memset(p
, 0, sizeof(struct prefix_evpn
));
505 p
->prefixlen
= EVPN_ROUTE_PREFIXLEN
;
506 p
->prefix
.route_type
= BGP_EVPN_AD_ROUTE
;
507 p
->prefix
.ead_addr
.eth_tag
= eth_tag
;
508 p
->prefix
.ead_addr
.ip
.ipa_type
= IPADDR_V4
;
509 p
->prefix
.ead_addr
.ip
.ipaddr_v4
= originator_ip
;
510 memcpy(&p
->prefix
.ead_addr
.esi
, esi
, sizeof(esi_t
));
513 static inline void evpn_type1_prefix_global_copy(struct prefix_evpn
*global_p
,
514 const struct prefix_evpn
*vni_p
)
516 memcpy(global_p
, vni_p
, sizeof(*global_p
));
517 global_p
->prefix
.ead_addr
.ip
.ipa_type
= 0;
518 global_p
->prefix
.ead_addr
.ip
.ipaddr_v4
.s_addr
= INADDR_ANY
;
521 /* EAD prefix in the global table doesn't include the VTEP-IP so
522 * we need to create a different copy for the VNI
524 static inline struct prefix_evpn
*evpn_type1_prefix_vni_copy(
525 struct prefix_evpn
*vni_p
,
526 const struct prefix_evpn
*global_p
,
527 struct in_addr originator_ip
)
529 memcpy(vni_p
, global_p
, sizeof(*vni_p
));
530 vni_p
->prefix
.ead_addr
.ip
.ipa_type
= IPADDR_V4
;
531 vni_p
->prefix
.ead_addr
.ip
.ipaddr_v4
= originator_ip
;
536 static inline int evpn_default_originate_set(struct bgp
*bgp
, afi_t afi
,
540 CHECK_FLAG(bgp
->af_flags
[AFI_L2VPN
][SAFI_EVPN
],
541 BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV4
))
543 else if (afi
== AFI_IP6
&&
544 CHECK_FLAG(bgp
->af_flags
[AFI_L2VPN
][SAFI_EVPN
],
545 BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV6
))
550 static inline void es_get_system_mac(esi_t
*esi
,
554 * for type-1 and type-3 ESIs,
555 * the system mac starts at val[1]
557 memcpy(mac
, &esi
->val
[1], ETH_ALEN
);
560 static inline bool bgp_evpn_is_svi_macip_enabled(struct bgpevpn
*vpn
)
562 struct bgp
*bgp_evpn
= NULL
;
564 bgp_evpn
= bgp_get_evpn();
566 return (bgp_evpn
->evpn_info
->advertise_svi_macip
||
567 vpn
->advertise_svi_macip
);
570 static inline bool bgp_evpn_is_path_local(struct bgp
*bgp
,
571 struct bgp_path_info
*pi
)
573 return (pi
->peer
== bgp
->peer_self
574 && pi
->type
== ZEBRA_ROUTE_BGP
575 && pi
->sub_type
== BGP_ROUTE_STATIC
);
578 extern struct zclient
*zclient
;
580 extern void bgp_evpn_install_uninstall_default_route(struct bgp
*bgp_vrf
,
581 afi_t afi
, safi_t safi
,
583 extern void evpn_rt_delete_auto(struct bgp
*, vni_t
, struct list
*);
584 extern void bgp_evpn_configure_export_rt_for_vrf(struct bgp
*bgp_vrf
,
585 struct ecommunity
*ecomadd
);
586 extern void bgp_evpn_unconfigure_export_rt_for_vrf(struct bgp
*bgp_vrf
,
587 struct ecommunity
*ecomdel
);
588 extern void bgp_evpn_configure_import_rt_for_vrf(struct bgp
*bgp_vrf
,
589 struct ecommunity
*ecomadd
);
590 extern void bgp_evpn_unconfigure_import_rt_for_vrf(struct bgp
*bgp_vrf
,
591 struct ecommunity
*ecomdel
);
592 extern int bgp_evpn_handle_export_rt_change(struct bgp
*bgp
,
593 struct bgpevpn
*vpn
);
594 extern void bgp_evpn_handle_autort_change(struct bgp
*bgp
);
595 extern void bgp_evpn_handle_vrf_rd_change(struct bgp
*bgp_vrf
, int withdraw
);
596 extern void bgp_evpn_handle_rd_change(struct bgp
*bgp
, struct bgpevpn
*vpn
,
598 extern int bgp_evpn_install_routes(struct bgp
*bgp
, struct bgpevpn
*vpn
);
599 extern int bgp_evpn_uninstall_routes(struct bgp
*bgp
, struct bgpevpn
*vpn
);
600 extern void bgp_evpn_map_vrf_to_its_rts(struct bgp
*bgp_vrf
);
601 extern void bgp_evpn_unmap_vrf_from_its_rts(struct bgp
*bgp_vrf
);
602 extern void bgp_evpn_map_vni_to_its_rts(struct bgp
*bgp
, struct bgpevpn
*vpn
);
603 extern void bgp_evpn_unmap_vni_from_its_rts(struct bgp
*bgp
,
604 struct bgpevpn
*vpn
);
605 extern void bgp_evpn_derive_auto_rt_import(struct bgp
*bgp
,
606 struct bgpevpn
*vpn
);
607 extern void bgp_evpn_derive_auto_rt_export(struct bgp
*bgp
,
608 struct bgpevpn
*vpn
);
609 extern void bgp_evpn_derive_auto_rd(struct bgp
*bgp
, struct bgpevpn
*vpn
);
610 extern void bgp_evpn_derive_auto_rd_for_vrf(struct bgp
*bgp
);
611 extern struct bgpevpn
*bgp_evpn_lookup_vni(struct bgp
*bgp
, vni_t vni
);
612 extern struct bgpevpn
*bgp_evpn_new(struct bgp
*bgp
, vni_t vni
,
613 struct in_addr originator_ip
,
614 vrf_id_t tenant_vrf_id
,
615 struct in_addr mcast_grp
);
616 extern void bgp_evpn_free(struct bgp
*bgp
, struct bgpevpn
*vpn
);
617 extern bool bgp_evpn_lookup_l3vni_l2vni_table(vni_t vni
);
618 extern int update_routes_for_vni(struct bgp
*bgp
, struct bgpevpn
*vpn
);
619 extern void delete_evpn_route_entry(struct bgp
*bgp
, afi_t afi
, safi_t safi
,
620 struct bgp_dest
*dest
,
621 struct bgp_path_info
**pi
);
622 int vni_list_cmp(void *p1
, void *p2
);
623 extern int evpn_route_select_install(struct bgp
*bgp
, struct bgpevpn
*vpn
,
624 struct bgp_dest
*dest
);
625 extern struct bgp_dest
*bgp_global_evpn_node_get(struct bgp_table
*table
,
626 afi_t afi
, safi_t safi
,
627 const struct prefix_evpn
*evp
,
628 struct prefix_rd
*prd
);
629 extern struct bgp_dest
*
630 bgp_global_evpn_node_lookup(struct bgp_table
*table
, afi_t afi
, safi_t safi
,
631 const struct prefix_evpn
*evp
,
632 struct prefix_rd
*prd
);
633 extern struct bgp_node
*bgp_global_evpn_node_get(struct bgp_table
*table
,
634 afi_t afi
, safi_t safi
,
635 const struct prefix_evpn
*evp
,
636 struct prefix_rd
*prd
);
637 extern struct bgp_node
*
638 bgp_global_evpn_node_lookup(struct bgp_table
*table
, afi_t afi
, safi_t safi
,
639 const struct prefix_evpn
*evp
,
640 struct prefix_rd
*prd
);
641 extern void bgp_evpn_import_route_in_vrfs(struct bgp_path_info
*pi
, int import
);
642 #endif /* _BGP_EVPN_PRIVATE_H */