]> git.proxmox.com Git - mirror_frr.git/blame - bgpd/bgp_evpn_private.h
Merge pull request #4165 from dslicenc/rnh-invalid-nexthops
[mirror_frr.git] / bgpd / bgp_evpn_private.h
CommitLineData
a4168ebc 1/* BGP EVPN internal definitions
2 * Copyright (C) 2017 Cumulus Networks, Inc.
3 *
4 * This file is part of FRR.
5 *
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
9 * later version.
10 *
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.
15 *
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
19 * 02111-1307, USA.
20 */
21
22#ifndef _BGP_EVPN_PRIVATE_H
23#define _BGP_EVPN_PRIVATE_H
24
25#include "vxlan.h"
26#include "zebra.h"
27
28#include "bgpd/bgpd.h"
29#include "bgpd/bgp_ecommunity.h"
30
60466a63 31#define RT_ADDRSTRLEN 28
9c92b5f7 32
2f04c4f0
AK
33/* EVPN prefix lengths. This represents the sizeof struct evpn_addr
34 * in bits */
35#define EVPN_ROUTE_PREFIXLEN (sizeof(struct evpn_addr) * 8)
a4168ebc 36
37/* EVPN route types. */
d62a17ae 38typedef enum {
39 BGP_EVPN_AD_ROUTE = 1, /* Ethernet Auto-Discovery (A-D) route */
40 BGP_EVPN_MAC_IP_ROUTE, /* MAC/IP Advertisement route */
41 BGP_EVPN_IMET_ROUTE, /* Inclusive Multicast Ethernet Tag route */
42 BGP_EVPN_ES_ROUTE, /* Ethernet Segment route */
43 BGP_EVPN_IP_PREFIX_ROUTE, /* IP Prefix route */
a4168ebc 44} bgp_evpn_route_type;
45
46/*
47 * Hash table of EVIs. Right now, the only type of EVI supported is with
48 * VxLAN encapsulation, hence each EVI corresponds to a L2 VNI.
49 * The VNIs are not "created" through BGP but through some other interface
50 * on the system. This table stores VNIs that BGP comes to know as present
51 * on the system (through interaction with zebra) as well as pre-configured
52 * VNIs (which need to be defined in the system to become "live").
53 */
d62a17ae 54struct bgpevpn {
55 vni_t vni;
29c53922 56 vrf_id_t tenant_vrf_id;
d7c0a89a 57 uint32_t flags;
a4168ebc 58#define VNI_FLAG_CFGD 0x1 /* VNI is user configured */
59#define VNI_FLAG_LIVE 0x2 /* VNI is "live" */
60#define VNI_FLAG_RD_CFGD 0x4 /* RD is user configured. */
61#define VNI_FLAG_IMPRT_CFGD 0x8 /* Import RT is user configured */
62#define VNI_FLAG_EXPRT_CFGD 0x10 /* Export RT is user configured */
c48d9f5f
MK
63#define VNI_FLAG_USE_TWO_LABELS 0x20 /* Attach both L2-VNI and L3-VNI if
64 needed for this VPN */
a4168ebc 65
bc4606bd
MK
66 struct bgp *bgp_vrf; /* back pointer to the vrf instance */
67
996c9314
LB
68 /* Flag to indicate if we are
69 * advertising the g/w mac ip for
70 * this VNI*/
d7c0a89a 71 uint8_t advertise_gw_macip;
1a98c087 72
d7c0a89a
QY
73 /* Flag to indicate if we are
74 * advertising subnet for this VNI */
75 uint8_t advertise_subnet;
31310b25 76
24864e44
CS
77 /* Flag to indicate if we are advertising the svi mac ip for this VNI*/
78 uint8_t advertise_svi_macip;
79
d7c0a89a
QY
80 /* Id for deriving the RD
81 * automatically for this VNI */
82 uint16_t rd_id;
a4168ebc 83
d7c0a89a
QY
84 /* RD for this VNI. */
85 struct prefix_rd prd;
a4168ebc 86
d7c0a89a
QY
87 /* Route type 3 field */
88 struct in_addr originator_ip;
a4168ebc 89
d7c0a89a
QY
90 /* Import and Export RTs. */
91 struct list *import_rtl;
92 struct list *export_rtl;
a4168ebc 93
d7c0a89a
QY
94 /* Route table for EVPN routes for
95 * this VNI. */
96 struct bgp_table *route_table;
a4168ebc 97
d7c0a89a 98 QOBJ_FIELDS
a4168ebc 99};
100
101DECLARE_QOBJ_TYPE(bgpevpn)
102
50f74cf1 103struct evpnes {
104
105 /* Ethernet Segment Identifier */
106 esi_t esi;
107
108 /* es flags */
109 uint16_t flags;
110#define EVPNES_LOCAL 0x01
111#define EVPNES_REMOTE 0x02
112
2bb9eff4
DS
113 /*
114 * Id for deriving the RD
115 * automatically for this ESI
116 */
50f74cf1 117 uint16_t rd_id;
118
119 /* RD for this VNI. */
120 struct prefix_rd prd;
121
122 /* originator ip address */
123 struct ipaddr originator_ip;
124
125 /* list of VTEPs in the same site */
126 struct list *vtep_list;
127
2bb9eff4
DS
128 /*
129 * Route table for EVPN routes for
130 * this ESI. - type4 routes
131 */
50f74cf1 132 struct bgp_table *route_table;
133
134 QOBJ_FIELDS
135};
136
137DECLARE_QOBJ_TYPE(evpnes)
138
a4168ebc 139/* Mapping of Import RT to VNIs.
140 * The Import RTs of all VNIs are maintained in a hash table with each
141 * RT linking to all VNIs that will import routes matching this RT.
142 */
d62a17ae 143struct irt_node {
144 /* RT */
145 struct ecommunity_val rt;
a4168ebc 146
d62a17ae 147 /* List of VNIs importing routes matching this RT. */
148 struct list *vnis;
a4168ebc 149};
150
10ebe1ab
MK
151/* Mapping of Import RT to VRFs.
152 * The Import RTs of all VRFss are maintained in a hash table with each
153 * RT linking to all VRFs that will import routes matching this RT.
154 */
155struct vrf_irt_node {
156 /* RT */
157 struct ecommunity_val rt;
158
159 /* List of VNIs importing routes matching this RT. */
160 struct list *vrfs;
161};
162
163
128ea8ab 164#define RT_TYPE_IMPORT 1
165#define RT_TYPE_EXPORT 2
166#define RT_TYPE_BOTH 3
167
85c8d83b
CS
168#define EVPN_DAD_DEFAULT_TIME 180 /* secs */
169#define EVPN_DAD_DEFAULT_MAX_MOVES 5 /* default from RFC 7432 */
170#define EVPN_DAD_DEFAULT_AUTO_RECOVERY_TIME 1800 /* secs */
171
172struct bgp_evpn_info {
173 /* enable disable dup detect */
174 bool dup_addr_detect;
175
176 /* Detection time(M) */
177 int dad_time;
178 /* Detection max moves(N) */
179 uint32_t dad_max_moves;
180 /* Permanent freeze */
181 bool dad_freeze;
182 /* Recovery time */
183 uint32_t dad_freeze_time;
24864e44
CS
184
185 /* EVPN enable - advertise svi macip routes */
186 int advertise_svi_macip;
187
85c8d83b
CS
188};
189
676f83b9 190static inline int is_vrf_rd_configured(struct bgp *bgp_vrf)
191{
996c9314 192 return (CHECK_FLAG(bgp_vrf->vrf_flags, BGP_VRF_RD_CFGD));
676f83b9 193}
194
195static inline int bgp_evpn_vrf_rd_matches_existing(struct bgp *bgp_vrf,
196 struct prefix_rd *prd)
197{
198 return (memcmp(&bgp_vrf->vrf_prd.val, prd->val, ECOMMUNITY_SIZE) == 0);
199}
200
6d8c58b7
MK
201static inline vni_t bgpevpn_get_l3vni(struct bgpevpn *vpn)
202{
bc4606bd 203 return vpn->bgp_vrf ? vpn->bgp_vrf->l3vni : 0;
6d8c58b7
MK
204}
205
206static inline void bgpevpn_get_rmac(struct bgpevpn *vpn, struct ethaddr *rmac)
207{
6d8c58b7 208 memset(rmac, 0, sizeof(struct ethaddr));
bc4606bd 209 if (!vpn->bgp_vrf)
6d8c58b7 210 return;
bc4606bd 211 memcpy(rmac, &vpn->bgp_vrf->rmac, sizeof(struct ethaddr));
6d8c58b7
MK
212}
213
214static inline struct list *bgpevpn_get_vrf_export_rtl(struct bgpevpn *vpn)
215{
bc4606bd 216 if (!vpn->bgp_vrf)
6d8c58b7
MK
217 return NULL;
218
bc4606bd 219 return vpn->bgp_vrf->vrf_export_rtl;
6d8c58b7
MK
220}
221
222static inline struct list *bgpevpn_get_vrf_import_rtl(struct bgpevpn *vpn)
223{
bc4606bd 224 if (!vpn->bgp_vrf)
6d8c58b7
MK
225 return NULL;
226
bc4606bd 227 return vpn->bgp_vrf->vrf_import_rtl;
6d8c58b7
MK
228}
229
6a8657d0
MK
230static inline void bgpevpn_unlink_from_l3vni(struct bgpevpn *vpn)
231{
bc4606bd
MK
232 /* bail if vpn is not associated to bgp_vrf */
233 if (!vpn->bgp_vrf)
6a8657d0 234 return;
996c9314 235
c48d9f5f 236 UNSET_FLAG(vpn->flags, VNI_FLAG_USE_TWO_LABELS);
bc4606bd 237 listnode_delete(vpn->bgp_vrf->l2vnis, vpn);
996c9314 238
bc4606bd
MK
239 /* remove the backpointer to the vrf instance */
240 vpn->bgp_vrf = NULL;
6a8657d0
MK
241}
242
243static inline void bgpevpn_link_to_l3vni(struct bgpevpn *vpn)
244{
245 struct bgp *bgp_vrf = NULL;
246
bc4606bd
MK
247 /* bail if vpn is already associated to vrf */
248 if (vpn->bgp_vrf)
249 return;
250
6a8657d0 251 bgp_vrf = bgp_lookup_by_vrf_id(vpn->tenant_vrf_id);
c48d9f5f 252 if (!bgp_vrf)
6a8657d0 253 return;
c48d9f5f 254
bc4606bd
MK
255 /* associate the vpn to the bgp_vrf instance */
256 vpn->bgp_vrf = bgp_vrf;
6a8657d0 257 listnode_add_sort(bgp_vrf->l2vnis, vpn);
83ea2eb0 258
c48d9f5f 259 /* check if we are advertising two labels for this vpn */
996c9314 260 if (!CHECK_FLAG(bgp_vrf->vrf_flags, BGP_VRF_L3VNI_PREFIX_ROUTES_ONLY))
c48d9f5f 261 SET_FLAG(vpn->flags, VNI_FLAG_USE_TWO_LABELS);
6a8657d0
MK
262}
263
d62a17ae 264static inline int is_vni_configured(struct bgpevpn *vpn)
128ea8ab 265{
d62a17ae 266 return (CHECK_FLAG(vpn->flags, VNI_FLAG_CFGD));
128ea8ab 267}
268
d62a17ae 269static inline int is_vni_live(struct bgpevpn *vpn)
128ea8ab 270{
d62a17ae 271 return (CHECK_FLAG(vpn->flags, VNI_FLAG_LIVE));
128ea8ab 272}
273
d62a17ae 274static inline int is_rd_configured(struct bgpevpn *vpn)
128ea8ab 275{
d62a17ae 276 return (CHECK_FLAG(vpn->flags, VNI_FLAG_RD_CFGD));
128ea8ab 277}
278
d62a17ae 279static inline int bgp_evpn_rd_matches_existing(struct bgpevpn *vpn,
280 struct prefix_rd *prd)
128ea8ab 281{
d62a17ae 282 return (memcmp(&vpn->prd.val, prd->val, ECOMMUNITY_SIZE) == 0);
128ea8ab 283}
284
d62a17ae 285static inline int is_import_rt_configured(struct bgpevpn *vpn)
128ea8ab 286{
d62a17ae 287 return (CHECK_FLAG(vpn->flags, VNI_FLAG_IMPRT_CFGD));
128ea8ab 288}
289
d62a17ae 290static inline int is_export_rt_configured(struct bgpevpn *vpn)
128ea8ab 291{
d62a17ae 292 return (CHECK_FLAG(vpn->flags, VNI_FLAG_EXPRT_CFGD));
128ea8ab 293}
294
d62a17ae 295static inline int is_vni_param_configured(struct bgpevpn *vpn)
128ea8ab 296{
d62a17ae 297 return (is_rd_configured(vpn) || is_import_rt_configured(vpn)
298 || is_export_rt_configured(vpn));
128ea8ab 299}
300
50f74cf1 301static inline void encode_es_rt_extcomm(struct ecommunity_val *eval,
302 struct ethaddr *mac)
303{
304 memset(eval, 0, sizeof(struct ecommunity_val));
305 eval->val[0] = ECOMMUNITY_ENCODE_EVPN;
306 eval->val[1] = ECOMMUNITY_EVPN_SUBTYPE_ES_IMPORT_RT;
307 memcpy(&eval->val[2], mac, ETH_ALEN);
308}
309
bc59a672
MK
310static inline void encode_rmac_extcomm(struct ecommunity_val *eval,
311 struct ethaddr *rmac)
312{
313 memset(eval, 0, sizeof(*eval));
314 eval->val[0] = ECOMMUNITY_ENCODE_EVPN;
315 eval->val[1] = ECOMMUNITY_EVPN_SUBTYPE_ROUTERMAC;
316 memcpy(&eval->val[2], rmac, ETH_ALEN);
317}
318
ead40654
MK
319static inline void encode_default_gw_extcomm(struct ecommunity_val *eval)
320{
321 memset(eval, 0, sizeof(*eval));
322 eval->val[0] = ECOMMUNITY_ENCODE_OPAQUE;
323 eval->val[1] = ECOMMUNITY_EVPN_SUBTYPE_DEF_GW;
324}
325
d7c0a89a 326static inline void encode_mac_mobility_extcomm(int static_mac, uint32_t seq,
d62a17ae 327 struct ecommunity_val *eval)
128ea8ab 328{
d62a17ae 329 memset(eval, 0, sizeof(*eval));
330 eval->val[0] = ECOMMUNITY_ENCODE_EVPN;
331 eval->val[1] = ECOMMUNITY_EVPN_SUBTYPE_MACMOBILITY;
332 if (static_mac)
333 eval->val[2] = ECOMMUNITY_EVPN_SUBTYPE_MACMOBILITY_FLAG_STICKY;
334 eval->val[4] = (seq >> 24) & 0xff;
335 eval->val[5] = (seq >> 16) & 0xff;
336 eval->val[6] = (seq >> 8) & 0xff;
337 eval->val[7] = seq & 0xff;
128ea8ab 338}
339
68e33151
CS
340static inline void encode_na_flag_extcomm(struct ecommunity_val *eval,
341 uint8_t na_flag)
342{
343 memset(eval, 0, sizeof(*eval));
344 eval->val[0] = ECOMMUNITY_ENCODE_EVPN;
345 eval->val[1] = ECOMMUNITY_EVPN_SUBTYPE_ND;
346 if (na_flag)
347 eval->val[2] |= ECOMMUNITY_EVPN_SUBTYPE_ND_ROUTER_FLAG;
348}
349
90264d64
MK
350static inline void ip_prefix_from_type5_prefix(struct prefix_evpn *evp,
351 struct prefix *ip)
352{
353 memset(ip, 0, sizeof(struct prefix));
3714a385 354 if (is_evpn_prefix_ipaddr_v4(evp)) {
90264d64 355 ip->family = AF_INET;
3714a385 356 ip->prefixlen = evp->prefix.prefix_addr.ip_prefix_length;
357 memcpy(&(ip->u.prefix4), &(evp->prefix.prefix_addr.ip.ip),
90264d64 358 IPV4_MAX_BYTELEN);
3714a385 359 } else if (is_evpn_prefix_ipaddr_v6(evp)) {
90264d64 360 ip->family = AF_INET6;
3714a385 361 ip->prefixlen = evp->prefix.prefix_addr.ip_prefix_length;
362 memcpy(&(ip->u.prefix6), &(evp->prefix.prefix_addr.ip.ip),
90264d64
MK
363 IPV6_MAX_BYTELEN);
364 }
365}
366
123214ef 367static inline int is_evpn_prefix_default(const struct prefix *evp)
6fb219da
MK
368{
369 if (evp->family != AF_EVPN)
370 return 0;
371
3714a385 372 return ((evp->u.prefix_evpn.prefix_addr.ip_prefix_length == 0) ?
373 1 : 0);
6fb219da
MK
374}
375
d3135ba3 376static inline void ip_prefix_from_type2_prefix(struct prefix_evpn *evp,
377 struct prefix *ip)
378{
379 memset(ip, 0, sizeof(struct prefix));
3714a385 380 if (is_evpn_prefix_ipaddr_v4(evp)) {
d3135ba3 381 ip->family = AF_INET;
382 ip->prefixlen = IPV4_MAX_BITLEN;
3714a385 383 memcpy(&(ip->u.prefix4), &(evp->prefix.macip_addr.ip.ip),
d3135ba3 384 IPV4_MAX_BYTELEN);
3714a385 385 } else if (is_evpn_prefix_ipaddr_v6(evp)) {
d3135ba3 386 ip->family = AF_INET6;
387 ip->prefixlen = IPV6_MAX_BITLEN;
3714a385 388 memcpy(&(ip->u.prefix6), &(evp->prefix.macip_addr.ip.ip),
d3135ba3 389 IPV6_MAX_BYTELEN);
390 }
391}
392
3714a385 393static inline void ip_prefix_from_evpn_prefix(struct prefix_evpn *evp,
394 struct prefix *ip)
395{
396 if (evp->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE)
397 ip_prefix_from_type2_prefix(evp, ip);
398 else if (evp->prefix.route_type == BGP_EVPN_IP_PREFIX_ROUTE)
399 ip_prefix_from_type5_prefix(evp, ip);
400}
401
d62a17ae 402static inline void build_evpn_type2_prefix(struct prefix_evpn *p,
403 struct ethaddr *mac,
404 struct ipaddr *ip)
128ea8ab 405{
d62a17ae 406 memset(p, 0, sizeof(struct prefix_evpn));
b03b8898 407 p->family = AF_EVPN;
50f74cf1 408 p->prefixlen = EVPN_ROUTE_PREFIXLEN;
d62a17ae 409 p->prefix.route_type = BGP_EVPN_MAC_IP_ROUTE;
3714a385 410 memcpy(&p->prefix.macip_addr.mac.octet, mac->octet, ETH_ALEN);
411 p->prefix.macip_addr.ip.ipa_type = IPADDR_NONE;
d62a17ae 412 if (ip)
3714a385 413 memcpy(&p->prefix.macip_addr.ip, ip, sizeof(*ip));
128ea8ab 414}
415
342dd0c6 416static inline void build_type5_prefix_from_ip_prefix(struct prefix_evpn *evp,
417 struct prefix *ip_prefix)
418{
419 struct ipaddr ip;
420
421 memset(&ip, 0, sizeof(struct ipaddr));
422 if (ip_prefix->family == AF_INET) {
423 ip.ipa_type = IPADDR_V4;
424 memcpy(&ip.ipaddr_v4, &ip_prefix->u.prefix4,
425 sizeof(struct in_addr));
426 } else {
427 ip.ipa_type = IPADDR_V6;
428 memcpy(&ip.ipaddr_v6, &ip_prefix->u.prefix6,
429 sizeof(struct in6_addr));
430 }
431
432 memset(evp, 0, sizeof(struct prefix_evpn));
433 evp->family = AF_EVPN;
50f74cf1 434 evp->prefixlen = EVPN_ROUTE_PREFIXLEN;
342dd0c6 435 evp->prefix.route_type = BGP_EVPN_IP_PREFIX_ROUTE;
3714a385 436 evp->prefix.prefix_addr.ip_prefix_length = ip_prefix->prefixlen;
437 evp->prefix.prefix_addr.ip.ipa_type = ip.ipa_type;
438 memcpy(&evp->prefix.prefix_addr.ip, &ip, sizeof(struct ipaddr));
342dd0c6 439}
440
d62a17ae 441static inline void build_evpn_type3_prefix(struct prefix_evpn *p,
442 struct in_addr originator_ip)
128ea8ab 443{
d62a17ae 444 memset(p, 0, sizeof(struct prefix_evpn));
b03b8898 445 p->family = AF_EVPN;
50f74cf1 446 p->prefixlen = EVPN_ROUTE_PREFIXLEN;
d62a17ae 447 p->prefix.route_type = BGP_EVPN_IMET_ROUTE;
3714a385 448 p->prefix.imet_addr.ip.ipa_type = IPADDR_V4;
449 p->prefix.imet_addr.ip.ipaddr_v4 = originator_ip;
128ea8ab 450}
451
50f74cf1 452static inline void build_evpn_type4_prefix(struct prefix_evpn *p,
453 esi_t *esi,
454 struct in_addr originator_ip)
455{
456 memset(p, 0, sizeof(struct prefix_evpn));
457 p->family = AF_EVPN;
458 p->prefixlen = EVPN_ROUTE_PREFIXLEN;
459 p->prefix.route_type = BGP_EVPN_ES_ROUTE;
460 p->prefix.es_addr.ip_prefix_length = IPV4_MAX_BITLEN;
461 p->prefix.es_addr.ip.ipa_type = IPADDR_V4;
462 p->prefix.es_addr.ip.ipaddr_v4 = originator_ip;
463 memcpy(&p->prefix.es_addr.esi, esi, sizeof(esi_t));
464}
465
486456ca
MK
466static inline int evpn_default_originate_set(struct bgp *bgp, afi_t afi,
467 safi_t safi)
468{
469 if (afi == AFI_IP &&
470 CHECK_FLAG(bgp->af_flags[AFI_L2VPN][SAFI_EVPN],
471 BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV4))
472 return 1;
473 else if (afi == AFI_IP6 &&
474 CHECK_FLAG(bgp->af_flags[AFI_L2VPN][SAFI_EVPN],
475 BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV6))
476 return 1;
477 return 0;
478}
479
50f74cf1 480static inline void es_get_system_mac(esi_t *esi,
481 struct ethaddr *mac)
482{
2bb9eff4
DS
483 /*
484 * for type-1 and type-3 ESIs,
485 * the system mac starts at val[1]
50f74cf1 486 */
487 memcpy(mac, &esi->val[1], ETH_ALEN);
488}
489
490static inline int is_es_local(struct evpnes *es)
491{
492 return CHECK_FLAG(es->flags, EVPNES_LOCAL) ? 1 : 0;
493}
494
5fd9c12b
KA
495extern void bgp_evpn_install_uninstall_default_route(struct bgp *bgp_vrf,
496 afi_t afi, safi_t safi,
497 bool add);
996c9314 498extern void evpn_rt_delete_auto(struct bgp *, vni_t, struct list *);
523cafc4 499extern void bgp_evpn_configure_export_rt_for_vrf(struct bgp *bgp_vrf,
500 struct ecommunity *ecomadd);
501extern void bgp_evpn_unconfigure_export_rt_for_vrf(struct bgp *bgp_vrf,
502 struct ecommunity *ecomdel);
503extern void bgp_evpn_configure_import_rt_for_vrf(struct bgp *bgp_vrf,
504 struct ecommunity *ecomadd);
505extern void bgp_evpn_unconfigure_import_rt_for_vrf(struct bgp *bgp_vrf,
506 struct ecommunity *ecomdel);
d62a17ae 507extern int bgp_evpn_handle_export_rt_change(struct bgp *bgp,
508 struct bgpevpn *vpn);
bf1061d8 509extern void bgp_evpn_handle_autort_change(struct bgp *bgp);
676f83b9 510extern void bgp_evpn_handle_vrf_rd_change(struct bgp *bgp_vrf, int withdraw);
d62a17ae 511extern void bgp_evpn_handle_rd_change(struct bgp *bgp, struct bgpevpn *vpn,
512 int withdraw);
513extern int bgp_evpn_install_routes(struct bgp *bgp, struct bgpevpn *vpn);
514extern int bgp_evpn_uninstall_routes(struct bgp *bgp, struct bgpevpn *vpn);
523cafc4 515extern void bgp_evpn_map_vrf_to_its_rts(struct bgp *bgp_vrf);
516extern void bgp_evpn_unmap_vrf_from_its_rts(struct bgp *bgp_vrf);
d62a17ae 517extern void bgp_evpn_map_vni_to_its_rts(struct bgp *bgp, struct bgpevpn *vpn);
518extern void bgp_evpn_unmap_vni_from_its_rts(struct bgp *bgp,
519 struct bgpevpn *vpn);
520extern void bgp_evpn_derive_auto_rt_import(struct bgp *bgp,
521 struct bgpevpn *vpn);
522extern void bgp_evpn_derive_auto_rt_export(struct bgp *bgp,
523 struct bgpevpn *vpn);
524extern void bgp_evpn_derive_auto_rd(struct bgp *bgp, struct bgpevpn *vpn);
676f83b9 525extern void bgp_evpn_derive_auto_rd_for_vrf(struct bgp *bgp);
d62a17ae 526extern struct bgpevpn *bgp_evpn_lookup_vni(struct bgp *bgp, vni_t vni);
527extern struct bgpevpn *bgp_evpn_new(struct bgp *bgp, vni_t vni,
29c53922
MK
528 struct in_addr originator_ip,
529 vrf_id_t tenant_vrf_id);
d62a17ae 530extern void bgp_evpn_free(struct bgp *bgp, struct bgpevpn *vpn);
50f74cf1 531extern struct evpnes *bgp_evpn_lookup_es(struct bgp *bgp, esi_t *esi);
532extern struct evpnes *bgp_evpn_es_new(struct bgp *bgp, esi_t *esi,
533 struct ipaddr *originator_ip);
534extern void bgp_evpn_es_free(struct bgp *bgp, struct evpnes *es);
7df407ed 535extern bool bgp_evpn_lookup_l3vni_l2vni_table(vni_t vni);
a4168ebc 536#endif /* _BGP_EVPN_PRIVATE_H */