summaryrefslogtreecommitdiff
path: root/lib/ns.c
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2017-12-08 19:06:34 +0100
committerPhilippe Guibert <philippe.guibert@6wind.com>2018-02-27 11:11:24 +0100
commitfe533c564e1901ee6b767708345abb52a56056af (patch)
tree6837eb93d5e7e0ea4edf93286e4cf785c94a2868 /lib/ns.c
parentc17d483845c4b772270cade18f2ce5a5e14bc14e (diff)
zebra: socket operations stick to namespace if necessary
Upon following calls: interface poll, address poll, route poll, and ICMPv6 handling, each new Namespace is being parsed. For that, the socket operations need to switch from one NS to one other, to get the necessary information. As of now, there is a crash when dumping interfaces, through show running-config. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'lib/ns.c')
-rw-r--r--lib/ns.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/ns.c b/lib/ns.c
index fcac28cf7e..170290a9e9 100644
--- a/lib/ns.c
+++ b/lib/ns.c
@@ -565,9 +565,9 @@ void ns_terminate(void)
int ns_socket(int domain, int type, int protocol, ns_id_t ns_id)
{
struct ns *ns = ns_lookup(ns_id);
- int ret = -1;
+ int ret;
- if (!ns_is_enabled(ns)) {
+ if (!ns || !ns_is_enabled(ns)) {
errno = ENOSYS;
return -1;
}