+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Zebra Vrf Header
* Copyright (C) 2016 Cumulus Networks
* Donald Sharp
- *
- * This file is part of Quagga.
- *
- * Quagga 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.
- *
- * Quagga 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 this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#if !defined(__ZEBRA_VRF_H__)
#define __ZEBRA_VRF_H__
#include <zebra/zebra_ns.h>
#include <zebra/zebra_pw.h>
+#include <zebra/rtadv.h>
#include <lib/vxlan.h>
#ifdef __cplusplus
/* Recursive Nexthop table */
struct route_table *rnh_table[AFI_MAX];
-
- /* Import check table (used mostly by BGP */
- struct route_table *import_check_table[AFI_MAX];
+ struct route_table *rnh_table_multicast[AFI_MAX];
struct otable_head other_tables;
struct table_manager *tbl_mgr;
-#if defined(HAVE_RTADV)
struct rtadv rtadv;
-#endif /* HAVE_RTADV */
- int zebra_rnh_ip_default_route;
- int zebra_rnh_ipv6_default_route;
+ bool zebra_rnh_ip_default_route;
+ bool zebra_rnh_ipv6_default_route;
};
#define PROTO_RM_NAME(zvrf, afi, rtype) zvrf->proto_rm[afi][rtype].name
#define NHT_RM_NAME(zvrf, afi, rtype) zvrf->nht_rm[afi][rtype].name
/*
* special macro to allow us to get the correct zebra_vrf
*/
-#define ZEBRA_DECLVAR_CONTEXT(A, B) \
- struct vrf *A; \
- if (vty->node == CONFIG_NODE) \
- A = vrf_lookup_by_id(VRF_DEFAULT); \
- else \
- A = VTY_GET_CONTEXT(vrf); \
- VTY_CHECK_CONTEXT(A); \
- struct zebra_vrf *B = A->info
+#define ZEBRA_DECLVAR_CONTEXT_VRF(vrfptr, zvrfptr) \
+ VTY_DECLVAR_CONTEXT_VRF(vrfptr); \
+ struct zebra_vrf *zvrfptr = vrfptr->info; \
+ MACRO_REQUIRE_SEMICOLON() /* end */
static inline vrf_id_t zvrf_id(struct zebra_vrf *zvrf)
{
extern struct zebra_vrf *zebra_vrf_alloc(struct vrf *vrf);
extern struct route_table *zebra_vrf_table(afi_t, safi_t, vrf_id_t);
+/*
+ * API to associate a VRF with a NETNS.
+ * Called either from vty or through discovery.
+ */
+extern int zebra_vrf_netns_handler_create(struct vty *vty, struct vrf *vrf,
+ char *pathname, ns_id_t ext_ns_id,
+ ns_id_t ns_id, ns_id_t rel_def_ns_id);
+
extern void zebra_vrf_init(void);
extern void zebra_rtable_node_cleanup(struct route_table *table,