]> git.proxmox.com Git - mirror_frr.git/blobdiff - zebra/zebra_evpn_vxlan.h
Merge pull request #13445 from donaldsharp/lua_scripting_mem_leak
[mirror_frr.git] / zebra / zebra_evpn_vxlan.h
index bf8904d4926515b49623cd9947a4b92053c84d85..80b87f91cee9ca25e13d6902a9f956640df0f431 100644 (file)
@@ -1,23 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Zebra EVPN for VxLAN code
  * Copyright (C) 2016, 2017 Cumulus Networks, Inc.
- *
- * This file is part of FRR.
- *
- * FRR is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * FRR is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with FRR; see the file COPYING.  If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
  */
 
 /* Get the VRR interface for SVI if any */
@@ -28,7 +12,7 @@ zebra_get_vrr_intf_for_svi(struct interface *ifp)
        struct interface *tmp_if = NULL;
        struct zebra_if *zif = NULL;
 
-       zvrf = vrf_info_lookup(ifp->vrf_id);
+       zvrf = ifp->vrf->info;
        assert(zvrf);
 
        FOR_ALL_INTERFACES (zvrf->vrf, tmp_if) {
@@ -47,7 +31,7 @@ zebra_get_vrr_intf_for_svi(struct interface *ifp)
 }
 
 /* EVPN<=>vxlan_zif association */
-static inline void zevpn_vxlan_if_set(zebra_evpn_t *zevpn,
+static inline void zevpn_vxlan_if_set(struct zebra_evpn *zevpn,
                                      struct interface *ifp, bool set)
 {
        struct zebra_if *zif;
@@ -69,3 +53,33 @@ static inline void zevpn_vxlan_if_set(zebra_evpn_t *zevpn,
 
        zebra_evpn_vxl_evpn_set(zif, zevpn, set);
 }
+
+/* EVPN<=>Bridge interface association */
+static inline void zevpn_bridge_if_set(struct zebra_evpn *zevpn,
+                                      struct interface *ifp, bool set)
+{
+       if (set) {
+               if (zevpn->bridge_if == ifp)
+                       return;
+               zevpn->bridge_if = ifp;
+       } else {
+               if (!zevpn->bridge_if)
+                       return;
+               zevpn->bridge_if = NULL;
+       }
+}
+
+/* EVPN<=>Bridge interface association */
+static inline void zl3vni_bridge_if_set(struct zebra_l3vni *zl3vni,
+                                       struct interface *ifp, bool set)
+{
+       if (set) {
+               if (zl3vni->bridge_if == ifp)
+                       return;
+               zl3vni->bridge_if = ifp;
+       } else {
+               if (!zl3vni->bridge_if)
+                       return;
+               zl3vni->bridge_if = NULL;
+       }
+}