]>
Commit | Line | Data |
---|---|---|
8b5fdf2e PR |
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 = vrf_info_lookup(ifp->vrf_id); | |
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(zebra_evpn_t *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 | } |