Line data Source code
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 0 : zebra_get_vrr_intf_for_svi(struct interface *ifp)
26 : {
27 0 : struct zebra_vrf *zvrf = NULL;
28 0 : struct interface *tmp_if = NULL;
29 0 : struct zebra_if *zif = NULL;
30 :
31 0 : zvrf = ifp->vrf->info;
32 0 : assert(zvrf);
33 :
34 0 : FOR_ALL_INTERFACES (zvrf->vrf, tmp_if) {
35 0 : zif = tmp_if->info;
36 0 : if (!zif)
37 0 : continue;
38 :
39 0 : if (!IS_ZEBRA_IF_MACVLAN(tmp_if))
40 0 : continue;
41 :
42 0 : if (zif->link == ifp)
43 0 : return tmp_if;
44 : }
45 :
46 : return NULL;
47 : }
48 :
49 : /* EVPN<=>vxlan_zif association */
50 0 : static inline void zevpn_vxlan_if_set(struct zebra_evpn *zevpn,
51 : struct interface *ifp, bool set)
52 : {
53 0 : struct zebra_if *zif;
54 :
55 0 : if (set) {
56 0 : if (zevpn->vxlan_if == ifp)
57 : return;
58 0 : zevpn->vxlan_if = ifp;
59 : } else {
60 0 : if (!zevpn->vxlan_if)
61 : return;
62 0 : zevpn->vxlan_if = NULL;
63 : }
64 :
65 0 : if (ifp)
66 0 : zif = ifp->info;
67 : else
68 : zif = NULL;
69 :
70 0 : zebra_evpn_vxl_evpn_set(zif, zevpn, set);
71 : }
|