]> git.proxmox.com Git - mirror_frr.git/blob - zebra/zebra_evpn_vxlan.h
doc: Add `show ipv6 rpf X:X::X:X` command to docs
[mirror_frr.git] / zebra / zebra_evpn_vxlan.h
1 /*
2 * Zebra EVPN for VxLAN code
3 * Copyright (C) 2016, 2017 Cumulus Networks, Inc.
4 *
5 * This file is part of FRR.
6 *
7 * FRR is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2, or (at your option) any
10 * later version.
11 *
12 * FRR is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with FRR; see the file COPYING. If not, write to the Free
19 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20 * 02111-1307, USA.
21 */
22
23 /* Get the VRR interface for SVI if any */
24 static inline struct interface *
25 zebra_get_vrr_intf_for_svi(struct interface *ifp)
26 {
27 struct zebra_vrf *zvrf = NULL;
28 struct interface *tmp_if = NULL;
29 struct zebra_if *zif = NULL;
30
31 zvrf = ifp->vrf->info;
32 assert(zvrf);
33
34 FOR_ALL_INTERFACES (zvrf->vrf, tmp_if) {
35 zif = tmp_if->info;
36 if (!zif)
37 continue;
38
39 if (!IS_ZEBRA_IF_MACVLAN(tmp_if))
40 continue;
41
42 if (zif->link == ifp)
43 return tmp_if;
44 }
45
46 return NULL;
47 }
48
49 /* EVPN<=>vxlan_zif association */
50 static inline void zevpn_vxlan_if_set(struct zebra_evpn *zevpn,
51 struct interface *ifp, bool set)
52 {
53 struct zebra_if *zif;
54
55 if (set) {
56 if (zevpn->vxlan_if == ifp)
57 return;
58 zevpn->vxlan_if = ifp;
59 } else {
60 if (!zevpn->vxlan_if)
61 return;
62 zevpn->vxlan_if = NULL;
63 }
64
65 if (ifp)
66 zif = ifp->info;
67 else
68 zif = NULL;
69
70 zebra_evpn_vxl_evpn_set(zif, zevpn, set);
71 }
72
73 /* EVPN<=>Bridge interface association */
74 static inline void zevpn_bridge_if_set(struct zebra_evpn *zevpn,
75 struct interface *ifp, bool set)
76 {
77 if (set) {
78 if (zevpn->bridge_if == ifp)
79 return;
80 zevpn->bridge_if = ifp;
81 } else {
82 if (!zevpn->bridge_if)
83 return;
84 zevpn->bridge_if = NULL;
85 }
86 }
87
88 /* EVPN<=>Bridge interface association */
89 static inline void zl3vni_bridge_if_set(struct zebra_l3vni *zl3vni,
90 struct interface *ifp, bool set)
91 {
92 if (set) {
93 if (zl3vni->bridge_if == ifp)
94 return;
95 zl3vni->bridge_if = ifp;
96 } else {
97 if (!zl3vni->bridge_if)
98 return;
99 zl3vni->bridge_if = NULL;
100 }
101 }