diff options
author | Feng Lu <lu.feng@6wind.com> | 2014-07-03 18:23:09 +0800 |
---|---|---|
committer | Nicolas Dichtel <nicolas.dichtel@6wind.com> | 2015-06-03 10:23:32 +0200 |
commit | 758fb8f99a7bfac3d31c419fd1a5694fc5f33f6a (patch) | |
tree | 4aa860a2b96ec03622376bf3753840155ab478fe /zebra/if_ioctl.c | |
parent | d6cf5134c05a7890738411852d9357ee5bb322f3 (diff) | |
download | quagga-758fb8f99a7bfac3d31c419fd1a5694fc5f33f6a.tar.bz2 quagga-758fb8f99a7bfac3d31c419fd1a5694fc5f33f6a.tar.xz |
zebra, lib/memtypes.c: the netlink sockets work per VRF
This patch lets the netlink sockets work per VRF.
* The definition of "struct nlsock" is moved into zebra/rib.h.
* The previous global variables "netlink" and "netlink_cmd" now
become the members of "struct zebra_vrf", and are initialized
in zebra_vrf_alloc().
* All relative functions now work for a specific VRF, by adding
a new parameter which specifies the working VRF, except those
functions in which the VRF ID can be obtained from the interface.
* kernel_init(), interface_list() and route_read() are now also
working per VRF, and moved from main() to zebra_vrf_enable().
* A new function kernel_terminate() is added to release the
netlink sockets. It is called from zebra_vrf_disable().
* Correct VRF ID, instead of the previous VRF_DEFAULT, are now
passed to the functions of processing interfaces or route
entries.
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>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'zebra/if_ioctl.c')
-rw-r--r-- | zebra/if_ioctl.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/zebra/if_ioctl.c b/zebra/if_ioctl.c index f357e154..8df877db 100644 --- a/zebra/if_ioctl.c +++ b/zebra/if_ioctl.c @@ -29,8 +29,10 @@ #include "connected.h" #include "memory.h" #include "log.h" +#include "vrf.h" #include "zebra/interface.h" +#include "zebra/rib.h" /* Interface looking up using infamous SIOCGIFCONF. */ static int @@ -442,8 +444,13 @@ interface_info_ioctl () /* Lookup all interface information. */ void -interface_list () +interface_list (struct zebra_vrf *zvrf) { + if (zvrf->vrf_id != VRF_DEFAULT) + { + zlog_warn ("interface_list: ignore VRF %u", zvrf->vrf_id); + return; + } /* Linux can do both proc & ioctl, ioctl is the only way to get interface aliases in 2.2 series kernels. */ #ifdef HAVE_PROC_NET_DEV |