#include "routemap.h"
#include "frr_pthread.h"
+#include "zebra/zebra_router.h"
#include "zebra/zebra_errors.h"
#include "zebra/rib.h"
#include "zebra/zserv.h"
work_queue_free_and_null(&zebrad.ribq);
meta_queue_free(zebrad.mq);
+ zebra_router_terminate();
+
frr_fini();
exit(0);
}
zebrad.master = frr_init();
/* Zebra related initialize. */
+ zebra_router_init();
zserv_init();
rib_init();
zebra_if_init();
/* RNH init */
zebra_rnh_init();
-
+
/* Error init */
zebra_error_init();
zebra/zebra_ptm_redistribute.c \
zebra/zebra_pw.c \
zebra/zebra_rib.c \
+ zebra/zebra_router.c \
zebra/zebra_rnh.c \
zebra/zebra_routemap.c \
zebra/zebra_vrf.c \
zebra/zebra_pw.h \
zebra/zebra_rnh.h \
zebra/zebra_routemap.h \
+ zebra/zebra_router.h \
zebra/zebra_vrf.h \
zebra/zebra_vxlan.h \
zebra/zebra_vxlan_private.h \
DEFINE_MTYPE(ZEBRA, ZEBRA_NS, "Zebra Name Space")
-static inline int zebra_ns_table_entry_compare(const struct zebra_ns_table *e1,
- const struct zebra_ns_table *e2);
-
-RB_GENERATE(zebra_ns_table_head, zebra_ns_table, zebra_ns_table_entry,
- zebra_ns_table_entry_compare);
-
static struct zebra_ns *dzns;
-static inline int zebra_ns_table_entry_compare(const struct zebra_ns_table *e1,
- const struct zebra_ns_table *e2)
-{
- if (e1->tableid < e2->tableid)
- return -1;
- if (e1->tableid > e2->tableid)
- return 1;
- if (e1->ns_id < e2->ns_id)
- return -1;
- if (e1->ns_id > e2->ns_id)
- return 1;
- return (e1->afi - e2->afi);
-}
-
static int logicalrouter_config_write(struct vty *vty);
struct zebra_ns *zebra_ns_lookup(ns_id_t ns_id)
return 0;
}
-struct route_table *zebra_ns_find_table(struct zebra_ns *zns, uint32_t tableid,
- afi_t afi)
-{
- struct zebra_ns_table finder;
- struct zebra_ns_table *znst;
-
- memset(&finder, 0, sizeof(finder));
- finder.afi = afi;
- finder.tableid = tableid;
- finder.ns_id = zns->ns_id;
- znst = RB_FIND(zebra_ns_table_head, &zns->ns_tables, &finder);
-
- if (znst)
- return znst->table;
- else
- return NULL;
-}
-
-unsigned long zebra_ns_score_proto(uint8_t proto, unsigned short instance)
-{
- struct zebra_ns *zns;
- struct zebra_ns_table *znst;
- unsigned long cnt = 0;
-
- zns = zebra_ns_lookup(NS_DEFAULT);
-
- RB_FOREACH (znst, zebra_ns_table_head, &zns->ns_tables) {
- if (znst->ns_id != NS_DEFAULT)
- continue;
- cnt += rib_score_proto_table(proto, instance, znst->table);
- }
- return cnt;
-}
-
-void zebra_ns_sweep_route(void)
-{
- struct zebra_ns_table *znst;
- struct zebra_ns *zns;
-
- zns = zebra_ns_lookup(NS_DEFAULT);
-
- RB_FOREACH (znst, zebra_ns_table_head, &zns->ns_tables) {
- if (znst->ns_id != NS_DEFAULT)
- continue;
- rib_sweep_table(znst->table);
- }
-}
-
-struct route_table *zebra_ns_get_table(struct zebra_ns *zns,
- struct zebra_vrf *zvrf, uint32_t tableid,
- afi_t afi)
-{
- struct zebra_ns_table finder;
- struct zebra_ns_table *znst;
- rib_table_info_t *info;
-
- memset(&finder, 0, sizeof(finder));
- finder.afi = afi;
- finder.tableid = tableid;
- finder.ns_id = zns->ns_id;
- znst = RB_FIND(zebra_ns_table_head, &zns->ns_tables, &finder);
-
- if (znst)
- return znst->table;
-
- znst = XCALLOC(MTYPE_ZEBRA_NS, sizeof(*znst));
- znst->tableid = tableid;
- znst->afi = afi;
- znst->ns_id = zns->ns_id;
- znst->table =
- (afi == AFI_IP6) ? srcdest_table_init() : route_table_init();
-
- info = XCALLOC(MTYPE_RIB_TABLE_INFO, sizeof(*info));
- info->zvrf = zvrf;
- info->afi = afi;
- info->safi = SAFI_UNICAST;
- route_table_set_info(znst->table, info);
- znst->table->cleanup = zebra_rtable_node_cleanup;
-
- RB_INSERT(zebra_ns_table_head, &zns->ns_tables, znst);
- return znst->table;
-}
-
-static void zebra_ns_free_table(struct zebra_ns_table *znst)
-{
- void *table_info;
-
- rib_close_table(znst->table);
-
- table_info = route_table_get_info(znst->table);
- route_table_finish(znst->table);
- XFREE(MTYPE_RIB_TABLE_INFO, table_info);
- XFREE(MTYPE_ZEBRA_NS, znst);
-}
-
int zebra_ns_disable(ns_id_t ns_id, void **info)
{
- struct zebra_ns_table *znst, *tmp;
struct zebra_ns *zns = (struct zebra_ns *)(*info);
hash_clean(zns->rules_hash, zebra_pbr_rules_free);
zebra_pbr_iptable_free);
hash_free(zns->iptable_hash);
- RB_FOREACH_SAFE (znst, zebra_ns_table_head, &zns->ns_tables, tmp) {
- if (znst->ns_id != ns_id)
- continue;
- RB_REMOVE(zebra_ns_table_head, &zns->ns_tables, znst);
- zebra_ns_free_table(znst);
- }
-
route_table_finish(zns->if_table);
zebra_vxlan_ns_disable(zns);
#if defined(HAVE_RTADV)
};
#endif
-struct zebra_ns_table {
- RB_ENTRY(zebra_ns_table) zebra_ns_table_entry;
-
- uint32_t tableid;
- afi_t afi;
- ns_id_t ns_id;
-
- struct route_table *table;
-};
-RB_HEAD(zebra_ns_table_head, zebra_ns_table);
-RB_PROTOTYPE(zebra_ns_table_head, zebra_ns_table, zebra_ns_table_entry,
- zebra_ns_table_entry_compare)
-
struct zebra_ns {
/* net-ns name. */
char name[VRF_NAMSIZ];
struct route_table *if_table;
- /* L3-VNI hash table (for EVPN). Only in default instance */
- struct hash *l3vni_table;
-
#if defined(HAVE_RTADV)
struct rtadv rtadv;
#endif /* HAVE_RTADV */
- struct zebra_ns_table_head ns_tables;
-
struct hash *rules_hash;
struct hash *ipset_hash;
int zebra_ns_disabled(struct ns *ns);
int zebra_ns_disable(ns_id_t ns_id, void **info);
-extern struct route_table *zebra_ns_find_table(struct zebra_ns *zns,
- uint32_t tableid, afi_t afi);
-extern struct route_table *zebra_ns_get_table(struct zebra_ns *zns,
- struct zebra_vrf *zvrf,
- uint32_t tableid, afi_t afi);
int zebra_ns_config_write(struct vty *vty, struct ns *ns);
-unsigned long zebra_ns_score_proto(uint8_t proto, unsigned short instance);
-void zebra_ns_sweep_route(void);
#endif
#include "vrf.h"
#include "workqueue.h"
+#include "zebra/zebra_router.h"
#include "zebra/connected.h"
#include "zebra/debug.h"
#include "zebra/interface.h"
rib_sweep_table(zvrf->table[AFI_IP6][SAFI_UNICAST]);
}
- zebra_ns_sweep_route();
+ zebra_router_sweep_route();
}
/* Remove specific by protocol routes from 'table'. */
proto, instance,
zvrf->table[AFI_IP6][SAFI_UNICAST]);
- cnt += zebra_ns_score_proto(proto, instance);
+ cnt += zebra_router_score_proto(proto, instance);
return cnt;
}
#include "nexthop.h"
#include "vrf.h"
+#include "zebra/zebra_router.h"
#include "zebra/rib.h"
#include "zebra/rt.h"
#include "zebra/zserv.h"
struct route_node *prn,
struct route_entry *re)
{
- struct zebra_ns_table *znst;
+ struct zebra_router_table *zrt;
struct route_entry *o_re;
struct route_node *o_rn;
struct listnode *node;
struct zserv *client;
- struct zebra_ns *zns;
afi_t afi = AFI_IP;
if (family == AF_INET6)
if (!client)
return;
- zns = zebra_ns_lookup(NS_DEFAULT);
- RB_FOREACH (znst, zebra_ns_table_head, &zns->ns_tables) {
- if (afi != znst->afi)
+ RB_FOREACH (zrt, zebra_router_table_head, &zrouter.tables) {
+ if (afi != zrt->afi)
continue;
- for (o_rn = route_top(znst->table);
- o_rn; o_rn = srcdest_route_next(o_rn)) {
+ for (o_rn = route_top(zrt->table); o_rn;
+ o_rn = srcdest_route_next(o_rn)) {
RNODE_FOREACH_RE (o_rn, o_re) {
if (o_re->type == ZEBRA_ROUTE_PBR)
break;
--- /dev/null
+/* Zebra Router Code.
+ * Copyright (C) 2018 Cumulus Networks, Inc.
+ * Donald Sharp
+ *
+ * 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.
+ */
+#include "zebra.h"
+
+#include "zebra_router.h"
+#include "zebra_memory.h"
+
+struct zebra_router zrouter;
+
+static inline int
+zebra_router_table_entry_compare(const struct zebra_router_table *e1,
+ const struct zebra_router_table *e2);
+
+RB_GENERATE(zebra_router_table_head, zebra_router_table,
+ zebra_router_table_entry, zebra_router_table_entry_compare);
+
+
+static inline int
+zebra_router_table_entry_compare(const struct zebra_router_table *e1,
+ const struct zebra_router_table *e2)
+{
+ if (e1->tableid < e2->tableid)
+ return -1;
+ if (e1->tableid > e2->tableid)
+ return 1;
+ if (e1->ns_id < e2->ns_id)
+ return -1;
+ if (e1->ns_id > e2->ns_id)
+ return 1;
+ if (e1->afi < e2->afi)
+ return -1;
+ if (e1->afi > e2->afi)
+ return 1;
+ return (e1->safi - e2->safi);
+}
+
+
+struct route_table *zebra_router_find_table(struct zebra_vrf *zvrf,
+ uint32_t tableid, afi_t afi,
+ safi_t safi)
+{
+ struct zebra_router_table finder;
+ struct zebra_router_table *zrt;
+
+ memset(&finder, 0, sizeof(finder));
+ finder.afi = afi;
+ finder.safi = safi;
+ finder.tableid = tableid;
+ finder.ns_id = zvrf->zns->ns_id;
+ zrt = RB_FIND(zebra_router_table_head, &zrouter.tables, &finder);
+
+ if (zrt)
+ return zrt->table;
+ else
+ return NULL;
+}
+
+struct route_table *zebra_router_get_table(struct zebra_vrf *zvrf,
+ uint32_t tableid, afi_t afi,
+ safi_t safi)
+{
+ struct zebra_router_table finder;
+ struct zebra_router_table *zrt;
+ rib_table_info_t *info;
+
+ memset(&finder, 0, sizeof(finder));
+ finder.afi = afi;
+ finder.safi = safi;
+ finder.tableid = tableid;
+ finder.ns_id = zvrf->zns->ns_id;
+ zrt = RB_FIND(zebra_router_table_head, &zrouter.tables, &finder);
+
+ if (zrt)
+ return zrt->table;
+
+ zrt = XCALLOC(MTYPE_ZEBRA_NS, sizeof(*zrt));
+ zrt->tableid = tableid;
+ zrt->afi = afi;
+ zrt->ns_id = zvrf->zns->ns_id;
+ zrt->table =
+ (afi == AFI_IP6) ? srcdest_table_init() : route_table_init();
+
+ info = XCALLOC(MTYPE_RIB_TABLE_INFO, sizeof(*info));
+ info->zvrf = zvrf;
+ info->afi = afi;
+ info->safi = SAFI_UNICAST;
+ route_table_set_info(zrt->table, info);
+ zrt->table->cleanup = zebra_rtable_node_cleanup;
+
+ RB_INSERT(zebra_router_table_head, &zrouter.tables, zrt);
+ return zrt->table;
+}
+
+unsigned long zebra_router_score_proto(uint8_t proto, unsigned short instance)
+{
+ struct zebra_router_table *zrt;
+ unsigned long cnt = 0;
+
+ RB_FOREACH (zrt, zebra_router_table_head, &zrouter.tables) {
+ if (zrt->ns_id != NS_DEFAULT)
+ continue;
+ cnt += rib_score_proto_table(proto, instance, zrt->table);
+ }
+ return cnt;
+}
+
+void zebra_router_sweep_route(void)
+{
+ struct zebra_router_table *zrt;
+
+ RB_FOREACH (zrt, zebra_router_table_head, &zrouter.tables) {
+ if (zrt->ns_id != NS_DEFAULT)
+ continue;
+ rib_sweep_table(zrt->table);
+ }
+}
+
+static void zebra_router_free_table(struct zebra_router_table *zrt)
+{
+ void *table_info;
+
+ rib_close_table(zrt->table);
+
+ table_info = route_table_get_info(zrt->table);
+ route_table_finish(zrt->table);
+ XFREE(MTYPE_RIB_TABLE_INFO, table_info);
+ XFREE(MTYPE_ZEBRA_NS, zrt);
+}
+
+void zebra_router_terminate(void)
+{
+ struct zebra_router_table *zrt, *tmp;
+
+ RB_FOREACH_SAFE (zrt, zebra_router_table_head, &zrouter.tables, tmp) {
+ RB_REMOVE(zebra_router_table_head, &zrouter.tables, zrt);
+ zebra_router_free_table(zrt);
+ }
+}
+
+void zebra_router_init(void)
+{
+ zrouter.l3vni_table = NULL;
+}
--- /dev/null
+/* Zebra Router header.
+ * Copyright (C) 2018 Cumulus Networks, Inc.
+ * Donald Sharp
+ *
+ * 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.
+ */
+#ifndef __ZEBRA_ROUTER_H__
+#define __ZEBRA_ROUTER_H__
+
+#include "zebra/zebra_ns.h"
+
+/*
+ * This header file contains the idea of a router and as such
+ * owns data that is associated with a router from zebra's
+ * perspective.
+ */
+
+struct zebra_router_table {
+ RB_ENTRY(zebra_router_table) zebra_router_table_entry;
+
+ uint32_t tableid;
+ afi_t afi;
+ safi_t safi;
+ ns_id_t ns_id;
+
+ struct route_table *table;
+};
+RB_HEAD(zebra_router_table_head, zebra_router_table);
+RB_PROTOTYPE(zebra_router_table_head, zebra_router_table,
+ zebra_router_table_entry, zebra_router_table_entry_compare)
+
+struct zebra_router {
+
+ struct zebra_router_table_head tables;
+ /* L3-VNI hash table (for EVPN). Only in default instance */
+ struct hash *l3vni_table;
+};
+
+extern struct zebra_router zrouter;
+
+extern void zebra_router_init(void);
+extern void zebra_router_terminate(void);
+
+extern struct route_table *zebra_router_find_table(struct zebra_vrf *zvrf,
+ uint32_t tableid, afi_t afi,
+ safi_t safi);
+extern struct route_table *zebra_router_get_table(struct zebra_vrf *zvrf,
+ uint32_t tableid, afi_t afi,
+ safi_t safi);
+
+extern int zebra_router_config_write(struct vty *vty);
+
+extern unsigned long zebra_router_score_proto(uint8_t proto,
+ unsigned short instance);
+extern void zebra_router_sweep_route(void);
+#endif
#include "vrf.h"
#include "vty.h"
+#include "zebra/zebra_router.h"
#include "zebra/debug.h"
#include "zebra/zapi_msg.h"
#include "zebra/rib.h"
static int zebra_vrf_disable(struct vrf *vrf)
{
struct zebra_vrf *zvrf = vrf->info;
- struct route_table *table;
struct interface *ifp;
afi_t afi;
safi_t safi;
/* Cleanup (free) routing tables and NHT tables. */
for (afi = AFI_IP; afi <= AFI_IP6; afi++) {
- void *table_info;
-
- for (safi = SAFI_UNICAST; safi <= SAFI_MULTICAST; safi++) {
- table = zvrf->table[afi][safi];
- table_info = route_table_get_info(table);
- route_table_finish(table);
- XFREE(MTYPE_RIB_TABLE_INFO, table_info);
+ /*
+ * Set the table pointer to NULL as that
+ * we no-longer need a copy of it, nor do we
+ * own this data, the zebra_router structure
+ * owns these tables. Once we've cleaned up the
+ * table, see rib_close_table above
+ * we no-longer need this pointer.
+ */
+ for (safi = SAFI_UNICAST; safi <= SAFI_MULTICAST; safi++)
zvrf->table[afi][safi] = NULL;
- }
route_table_finish(zvrf->rnh_table[afi]);
zvrf->rnh_table[afi] = NULL;
assert(!zvrf->table[afi][safi]);
- if (afi == AFI_IP6)
- table = srcdest_table_init();
- else
- table = route_table_init();
+ table = zebra_router_get_table(zvrf, zvrf->table_id, afi, safi);
+
table->cleanup = zebra_rtable_node_cleanup;
zvrf->table[afi][safi] = table;
vrf_id_t vrf_id)
{
struct zebra_vrf *zvrf;
- struct zebra_ns *zns;
zvrf = vrf_info_lookup(vrf_id);
if (!zvrf)
return NULL;
- zns = zvrf->zns;
-
if (afi >= AFI_MAX)
return NULL;
* so in all cases, it does not use specific table
* so it is possible to configure tables in this VRF
*/
- return zebra_ns_get_table(zns, zvrf, table_id, afi);
+ return zebra_router_get_table(zvrf, table_id, afi,
+ SAFI_UNICAST);
}
}
#include "srcdest_table.h"
#include "vxlan.h"
+#include "zebra/zebra_router.h"
#include "zebra/zserv.h"
#include "zebra/zebra_vrf.h"
#include "zebra/zebra_mpls.h"
struct zebra_vrf *zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT);
struct route_table *t;
- t = zebra_ns_find_table(zvrf->zns, table, afi);
+ t = zebra_router_find_table(zvrf, table, afi, SAFI_UNICAST);
if (t)
do_show_route_helper(vty, zvrf, t, afi, false, 0, false, false,
0, 0, !!json);
VRF_GET_ID(vrf_id, vrf_name, !!json);
zvrf = zebra_vrf_lookup_by_id(vrf_id);
- t = zebra_ns_find_table(zvrf->zns, table, afi);
+ t = zebra_router_find_table(zvrf, table, afi, SAFI_UNICAST);
if (t)
do_show_route_helper(vty, zvrf, t, afi, false, 0, false, false,
0, 0, !!json);
#include <linux/neighbour.h>
#endif
+#include "zebra/zebra_router.h"
#include "zebra/debug.h"
#include "zebra/interface.h"
#include "zebra/rib.h"
*/
static zebra_l3vni_t *zl3vni_lookup(vni_t vni)
{
- struct zebra_ns *zns;
zebra_l3vni_t tmp_l3vni;
zebra_l3vni_t *zl3vni = NULL;
- zns = zebra_ns_lookup(NS_DEFAULT);
- assert(zns);
memset(&tmp_l3vni, 0, sizeof(zebra_l3vni_t));
tmp_l3vni.vni = vni;
- zl3vni = hash_lookup(zns->l3vni_table, &tmp_l3vni);
+ zl3vni = hash_lookup(zrouter.l3vni_table, &tmp_l3vni);
return zl3vni;
}
static zebra_l3vni_t *zl3vni_add(vni_t vni, vrf_id_t vrf_id)
{
zebra_l3vni_t tmp_zl3vni;
- struct zebra_ns *zns = NULL;
zebra_l3vni_t *zl3vni = NULL;
- zns = zebra_ns_lookup(NS_DEFAULT);
- assert(zns);
-
memset(&tmp_zl3vni, 0, sizeof(zebra_l3vni_t));
tmp_zl3vni.vni = vni;
- zl3vni = hash_get(zns->l3vni_table, &tmp_zl3vni, zl3vni_alloc);
+ zl3vni = hash_get(zrouter.l3vni_table, &tmp_zl3vni, zl3vni_alloc);
assert(zl3vni);
zl3vni->vrf_id = vrf_id;
*/
static int zl3vni_del(zebra_l3vni_t *zl3vni)
{
- struct zebra_ns *zns;
zebra_l3vni_t *tmp_zl3vni;
- zns = zebra_ns_lookup(NS_DEFAULT);
- assert(zns);
-
/* free the list of l2vnis */
list_delete(&zl3vni->l2vnis);
zl3vni->l2vnis = NULL;
zl3vni->nh_table = NULL;
/* Free the VNI hash entry and allocated memory. */
- tmp_zl3vni = hash_release(zns->l3vni_table, zl3vni);
+ tmp_zl3vni = hash_release(zrouter.l3vni_table, zl3vni);
if (tmp_zl3vni)
XFREE(MTYPE_ZL3VNI, tmp_zl3vni);
void zebra_vxlan_print_rmacs_all_l3vni(struct vty *vty, bool use_json)
{
- struct zebra_ns *zns = NULL;
json_object *json = NULL;
void *args[2];
return;
}
- zns = zebra_ns_lookup(NS_DEFAULT);
- if (!zns) {
- if (use_json)
- vty_out(vty, "{}\n");
- return;
- }
-
if (use_json)
json = json_object_new_object();
args[0] = vty;
args[1] = json;
- hash_iterate(zns->l3vni_table,
+ hash_iterate(zrouter.l3vni_table,
(void (*)(struct hash_backet *,
void *))zl3vni_print_rmac_hash_all_vni,
args);
void zebra_vxlan_print_nh_all_l3vni(struct vty *vty, bool use_json)
{
- struct zebra_ns *zns = NULL;
json_object *json = NULL;
void *args[2];
return;
}
- zns = zebra_ns_lookup(NS_DEFAULT);
- if (!zns)
- return;
-
if (use_json)
json = json_object_new_object();
args[0] = vty;
args[1] = json;
- hash_iterate(zns->l3vni_table,
+ hash_iterate(zrouter.l3vni_table,
(void (*)(struct hash_backet *,
void *))zl3vni_print_nh_hash_all_vni,
args);
int num_l3vnis = 0;
int num_vnis = 0;
json_object *json = NULL;
- struct zebra_ns *zns = NULL;
struct zebra_vrf *zvrf = NULL;
if (!is_evpn_enabled())
return;
- zns = zebra_ns_lookup(NS_DEFAULT);
- if (!zns)
- return;
-
zvrf = vrf_info_lookup(VRF_DEFAULT);
if (!zvrf)
return;
- num_l3vnis = hashcount(zns->l3vni_table);
+ num_l3vnis = hashcount(zrouter.l3vni_table);
num_l2vnis = hashcount(zvrf->vni_table);
num_vnis = num_l2vnis + num_l3vnis;
bool use_json)
{
json_object *json = NULL;
- struct zebra_ns *zns = NULL;
void *args[2];
if (!is_evpn_enabled())
return;
- zns = zebra_ns_lookup(NS_DEFAULT);
- if (!zns)
- return;
-
-
if (use_json)
json = json_object_new_object();
else
args);
/* Display all L3-VNIs */
- hash_iterate(zns->l3vni_table,
+ hash_iterate(zrouter.l3vni_table,
(void (*)(struct hash_backet *, void *))zl3vni_print_hash,
args);
{
struct stream *s = NULL;
int advertise = 0;
- struct zebra_ns *zns = NULL;
enum vxlan_flood_control flood_ctrl;
if (zvrf_id(zvrf) != VRF_DEFAULT) {
hash_iterate(zvrf->vni_table, zvni_cleanup_all, zvrf);
/* cleanup all l3vnis */
- zns = zebra_ns_lookup(NS_DEFAULT);
- if (!zns)
- return;
-
- hash_iterate(zns->l3vni_table, zl3vni_cleanup_all, NULL);
+ hash_iterate(zrouter.l3vni_table, zl3vni_cleanup_all, NULL);
}
stream_failure:
/* init the l3vni table */
void zebra_vxlan_ns_init(struct zebra_ns *zns)
{
- zns->l3vni_table = hash_create(l3vni_hash_keymake, l3vni_hash_cmp,
- "Zebra VRF L3 VNI table");
+ zrouter.l3vni_table = hash_create(l3vni_hash_keymake, l3vni_hash_cmp,
+ "Zebra VRF L3 VNI table");
}
/* free l3vni table */
void zebra_vxlan_ns_disable(struct zebra_ns *zns)
{
- hash_free(zns->l3vni_table);
+ hash_free(zrouter.l3vni_table);
}
/* get the l3vni svi ifindex */