]> git.proxmox.com Git - mirror_frr.git/commit - zebra/zebra_ns.h
lib, vtysh: support multiple VRFs by using linux netns
authorFeng Lu <lu.feng@6wind.com>
Thu, 3 Jul 2014 10:24:34 +0000 (18:24 +0800)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 9 Sep 2016 16:15:14 +0000 (12:15 -0400)
commit13460c44a22415dd55846aca6fc31cf8607c90e9
treeccd21cfc7fbd813e01607cf959ee19ac865b93a1
parent32bcb8b0a54e1468e8fe9e303ba78a71ce05cf3d
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)
12 files changed:
configure.ac
lib/command.c
lib/command.h
lib/ns.c
lib/ns.h
vtysh/Makefile.am
vtysh/extract.pl.in
vtysh/vtysh.c
vtysh/vtysh.h
vtysh/vtysh_config.c
zebra/zebra_ns.c
zebra/zebra_ns.h