diff options
author | Feng Lu <lu.feng@6wind.com> | 2014-07-03 12:24:34 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-09-09 18:15:14 +0200 |
commit | 13460c44a22415dd55846aca6fc31cf8607c90e9 (patch) | |
tree | ccd21cfc7fbd813e01607cf959ee19ac865b93a1 /zebra/zebra_ns.h | |
parent | lib: Create ns.c (diff) | |
download | frr-13460c44a22415dd55846aca6fc31cf8607c90e9.tar.xz frr-13460c44a22415dd55846aca6fc31cf8607c90e9.zip |
lib, vtysh: support multiple VRFs by using linux netns
We realize VRFs with linux netns by default. The main job is
to associate a VRF with a netns. Currently this is done by
the configuration:
[no] vrf N netns <netns-name>
This command is also available in vtysh and goes to only
zebra, because presently only zebra supports multiple VRF.
A file descriptor is added to "struct vrf". This is for the
associated netns file. Once the command "vrf N netns NAME"
is executed, the specified file is opened and the file
descriptor is stored in the VRF N. In this way the
association is formed.
In vrf_socket(), we first switch to the specified VRF by
using the stored file descriptor, and then can allocate
a socket which is working in the associated netns.
Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
(cherry picked from commit 55cfa2f190620f7c711944637659bc208970324d)
Diffstat (limited to 'zebra/zebra_ns.h')
-rw-r--r-- | zebra/zebra_ns.h | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/zebra/zebra_ns.h b/zebra/zebra_ns.h index 07fcfcdac..8a821c465 100644 --- a/zebra/zebra_ns.h +++ b/zebra/zebra_ns.h @@ -23,6 +23,8 @@ #if !defined(__ZEBRA_NS_H__) #define __ZEBRA_NS_H__ +#include <lib/ns.h> + #ifdef HAVE_NETLINK /* Socket interface to kernel */ struct nlsock @@ -34,9 +36,6 @@ struct nlsock }; #endif -/* NetNS ID type. */ -typedef u_int16_t ns_id_t; - struct zebra_ns { /* net-ns name. */ |