2016-04-14 04:40:18 +02:00
|
|
|
/*
|
|
|
|
* Zebra NS header
|
|
|
|
* Copyright (C) 2016 Cumulus Networks, Inc.
|
|
|
|
* 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.
|
|
|
|
*
|
2017-05-13 10:25:29 +02:00
|
|
|
* 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
|
2016-04-14 04:40:18 +02:00
|
|
|
*/
|
|
|
|
#if !defined(__ZEBRA_NS_H__)
|
|
|
|
#define __ZEBRA_NS_H__
|
|
|
|
|
2014-07-03 12:24:34 +02:00
|
|
|
#include <lib/ns.h>
|
2018-02-04 13:33:33 +01:00
|
|
|
#include <lib/vrf.h>
|
2014-07-03 12:24:34 +02:00
|
|
|
|
2018-04-22 22:01:20 +02:00
|
|
|
#include "zebra/rib.h"
|
|
|
|
#include "zebra/zebra_vrf.h"
|
|
|
|
|
2019-03-25 15:11:55 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2016-04-14 04:40:18 +02:00
|
|
|
#ifdef HAVE_NETLINK
|
|
|
|
/* Socket interface to kernel */
|
|
|
|
struct nlsock {
|
|
|
|
int sock;
|
|
|
|
int seq;
|
|
|
|
struct sockaddr_nl snl;
|
2016-11-01 21:57:53 +01:00
|
|
|
char name[64];
|
2016-04-14 04:40:18 +02:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct zebra_ns {
|
|
|
|
/* net-ns name. */
|
|
|
|
char name[VRF_NAMSIZ];
|
|
|
|
|
|
|
|
/* Identifier. */
|
|
|
|
ns_id_t ns_id;
|
|
|
|
|
|
|
|
#ifdef HAVE_NETLINK
|
2018-11-12 21:57:03 +01:00
|
|
|
struct nlsock netlink; /* kernel messages */
|
|
|
|
struct nlsock netlink_cmd; /* command channel */
|
|
|
|
struct nlsock netlink_dplane; /* dataplane channel */
|
2016-04-14 04:40:18 +02:00
|
|
|
struct thread *t_netlink;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct route_table *if_table;
|
|
|
|
|
2017-12-07 18:27:31 +01:00
|
|
|
/* Back pointer */
|
|
|
|
struct ns *ns;
|
2016-04-14 04:40:18 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct zebra_ns *zebra_ns_lookup(ns_id_t ns_id);
|
|
|
|
|
2018-12-21 16:25:20 +01:00
|
|
|
int zebra_ns_init(const char *optional_default_name);
|
2016-04-14 04:40:18 +02:00
|
|
|
int zebra_ns_enable(ns_id_t ns_id, void **info);
|
2017-12-08 14:32:38 +01:00
|
|
|
int zebra_ns_disabled(struct ns *ns);
|
2020-06-03 13:22:26 +02:00
|
|
|
int zebra_ns_early_shutdown(struct ns *ns);
|
|
|
|
int zebra_ns_final_shutdown(struct ns *ns);
|
|
|
|
|
2017-12-06 12:03:59 +01:00
|
|
|
int zebra_ns_config_write(struct vty *vty, struct ns *ns);
|
2018-03-16 04:30:17 +01:00
|
|
|
|
zebra: importation of bgp evpn rt5 from vni with other netns
With vrf-lite mechanisms, it is possible to create layer 3 vnis by
creating a bridge interface in default vr, by creating a vxlan interface
that is attached to that bridge interface, then by moving the vxlan
interface to the wished vrf.
With vrf-netns mechanism, it is slightly different since bridged
interfaces can not be separated in different network namespaces. To make
it work, the setup consists in :
- creating a vxlan interface on default vrf.
- move the vxlan interface to the wished vrf ( with an other netns)
- create a bridge interface in the wished vrf
- attach the vxlan interface to that bridged interface
from that point, if BGP is enabled to advertise vnis in default vrf,
then vxlan interfaces are discovered appropriately in other vrfs,
provided that the link interface still resides in the vrf where l2vpn is
advertised.
to import ipv4 entries from a separate vrf, into the l2vpn, the
configuration of vni in the dedicated vrf + the advertisement of ipv4
entries in bgp vrf will import the entries in the bgp l2vpn.
the modification consists in parsing the vxlan interfaces in all network
namespaces, where the link resides in the same network namespace as the
bgp core instance where bgp l2vpn is enabled.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-09-26 18:49:59 +02:00
|
|
|
#define ZNS_WALK_CONTINUE 0
|
|
|
|
#define ZNS_WALK_STOP 1
|
|
|
|
void zebra_ns_list_walk(int (*exec_for_each_zns)(struct zebra_ns *zns,
|
|
|
|
void *param_in,
|
|
|
|
void **param_out),
|
|
|
|
void *param_in,
|
|
|
|
void **param_out);
|
|
|
|
|
2019-03-25 15:11:55 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-04-14 04:40:18 +02:00
|
|
|
#endif
|