From 13460c44a22415dd55846aca6fc31cf8607c90e9 Mon Sep 17 00:00:00 2001 From: Feng Lu Date: Thu, 3 Jul 2014 18:24:34 +0800 Subject: 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 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 Reviewed-by: Alain Ritoux Signed-off-by: Nicolas Dichtel (cherry picked from commit 55cfa2f190620f7c711944637659bc208970324d) --- lib/ns.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/ns.h') diff --git a/lib/ns.h b/lib/ns.h index 81e24562c..3fac73986 100644 --- a/lib/ns.h +++ b/lib/ns.h @@ -33,7 +33,7 @@ typedef u_int16_t ns_id_t; /* * The command strings */ - +#define NS_RUN_DIR "/var/run/netns" #define NS_CMD_STR "logical-router <0-65535>" #define NS_CMD_HELP_STR "Specify the Logical-Router\nThe Logical-Router ID\n" -- cgit v1.2.3