summaryrefslogtreecommitdiffstats
path: root/lib/vrf.h
diff options
context:
space:
mode:
authorFeng Lu <lu.feng@6wind.com>2015-05-22 11:39:59 +0200
committerVipin Kumar <vipin@cumulusnetworks.com>2015-10-30 01:25:55 +0100
commit8736158a2b4b43e841b9a7dcfcc11da0ed30bf23 (patch)
treefd0a1c20775568d991b40a96c1e60bf56838190a /lib/vrf.h
parent*: call if_init()/if_terminate() from vrf_init()/vrf_terminate() (diff)
downloadfrr-8736158a2b4b43e841b9a7dcfcc11da0ed30bf23.tar.xz
frr-8736158a2b4b43e841b9a7dcfcc11da0ed30bf23.zip
lib: move the interface list into "struct vrf"
An interface belongs to a specific VRF. So move the interface list into the "struct vrf". * vrf.c/vrf.h: - add a new member "struct list *iflist" to the the "struct vrf"; - call if_init() in vrf_new(); - call if_terminate() in vrf_delete(); - add utilities to access the interface list and VRF ID in the specified VRF. * if.c/if.h: - the global "iflist" now only exists for the default VRF; - the global "if_master" is initialized on the definition; - in if_create(), the interface is added into the list in the specified VRF; if the VRF does not exist, create one; - add parameters to if_init()/if_terminate() so that the interface list in the VRF can be initialized/destroyed; - in if_dump_all() scan the interfaces in all the VRFs; - add a command "show address vrf N" to show addresses in a specified VRF; - add a command "show address vrf all" to show addresses in all VRFs; - new APIs ifxxx_vrf() are added to access an interface in a specified VRF. The old interface APIs (the global variable "iflist" and the API functions) are not changed to keep the backward compatibility. The new APIs are used in the daemons which support multiple VRFs (till now only zebra). 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: Vincent JARDIN <vincent.jardin@6wind.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Conflicts: lib/if.c
Diffstat (limited to 'lib/vrf.h')
-rw-r--r--lib/vrf.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/vrf.h b/lib/vrf.h
index 7e0509943..d7b799875 100644
--- a/lib/vrf.h
+++ b/lib/vrf.h
@@ -23,10 +23,22 @@
#ifndef _ZEBRA_VRF_H
#define _ZEBRA_VRF_H
+#include "linklist.h"
+
/* The default VRF ID */
#define VRF_DEFAULT 0
/*
+ * The command strings
+ */
+
+#define VRF_CMD_STR "vrf <0-65535>"
+#define VRF_CMD_HELP_STR "Specify the VRF\nThe VRF ID\n"
+
+#define VRF_ALL_CMD_STR "vrf all"
+#define VRF_ALL_CMD_HELP_STR "Specify the VRF\nAll VRFs\n"
+
+/*
* VRF hooks
*/
@@ -75,6 +87,7 @@ extern vrf_iter_t vrf_iterator (vrf_id_t);
*/
extern vrf_id_t vrf_iter2id (vrf_iter_t);
extern void *vrf_iter2info (vrf_iter_t);
+extern struct list *vrf_iter2iflist (vrf_iter_t);
/*
* Utilities to obtain the user data
@@ -86,6 +99,15 @@ extern void *vrf_info_get (vrf_id_t);
extern void *vrf_info_lookup (vrf_id_t);
/*
+ * Utilities to obtain the interface list
+ */
+
+/* Look up the interface list of the specified VRF. */
+extern struct list *vrf_iflist (vrf_id_t);
+/* Get the interface list of the specified VRF. Create one if not find. */
+extern struct list *vrf_iflist_get (vrf_id_t);
+
+/*
* VRF initializer/destructor
*/
/* Please add hooks before calling vrf_init(). */