summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_ns.c
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2019-12-20 17:51:37 +0100
committerPhilippe Guibert <philippe.guibert@6wind.com>2020-05-18 14:11:03 +0200
commitc4d466c830083e8ba58881d7ad03a90f6baf0754 (patch)
tree456bc18dd349493771699855e2ad2ba7de36aab1 /zebra/zebra_ns.c
parentzebra: local mac entries populated in correct netnamespace (diff)
downloadfrr-c4d466c830083e8ba58881d7ad03a90f6baf0754.tar.xz
frr-c4d466c830083e8ba58881d7ad03a90f6baf0754.zip
lib, zebra: reuse and adapt ns_list walk functionality
the walk routine is used by vxlan service to identify some contexts in each specific network namespace, when vrf netns backend is used. that walk mechanism is extended with some additional paramters to the walk routine. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'zebra/zebra_ns.c')
-rw-r--r--zebra/zebra_ns.c35
1 files changed, 9 insertions, 26 deletions
diff --git a/zebra/zebra_ns.c b/zebra/zebra_ns.c
index 13864cd42..6462daf68 100644
--- a/zebra/zebra_ns.c
+++ b/zebra/zebra_ns.c
@@ -153,20 +153,25 @@ static int zebra_ns_disable_internal(struct zebra_ns *zns, bool complete)
/* During zebra shutdown, do partial cleanup while the async dataplane
* is still running.
*/
-int zebra_ns_early_shutdown(struct ns *ns)
+int zebra_ns_early_shutdown(struct ns *ns,
+ void *param_in __attribute__((unused)),
+ void **param_out __attribute__((unused)))
{
struct zebra_ns *zns = ns->info;
if (zns == NULL)
return 0;
- return zebra_ns_disable_internal(zns, false);
+ zebra_ns_disable_internal(zns, false);
+ return NS_WALK_CONTINUE;
}
/* During zebra shutdown, do final cleanup
* after all dataplane work is complete.
*/
-int zebra_ns_final_shutdown(struct ns *ns)
+int zebra_ns_final_shutdown(struct ns *ns,
+ void *param_in __attribute__((unused)),
+ void **param_out __attribute__((unused)))
{
struct zebra_ns *zns = ns->info;
@@ -175,7 +180,7 @@ int zebra_ns_final_shutdown(struct ns *ns)
kernel_terminate(zns, true);
- return 0;
+ return NS_WALK_CONTINUE;
}
int zebra_ns_init(const char *optional_default_name)
@@ -233,25 +238,3 @@ int zebra_ns_config_write(struct vty *vty, struct ns *ns)
vty_out(vty, " netns %s\n", ns->name);
return 0;
}
-
-void zebra_ns_list_walk(int (*exec_for_each_zns)(struct zebra_ns *zns,
- void *param_in,
- void **param_out),
- void *param_in,
- void **param_out)
-{
- struct ns *ns;
- struct zebra_ns *zns;
- int ret;
-
- RB_FOREACH (ns, ns_head, &ns_tree) {
- zns = (struct zebra_ns *)ns->info;
- if (!zns && ns->ns_id == NS_DEFAULT)
- zns = zebra_ns_lookup(ns->ns_id);
- if (!zns)
- continue;
- ret = exec_for_each_zns(zns, param_in, param_out);
- if (ret == ZNS_WALK_STOP)
- return;
- }
-}