gtp: fix missing initialization of netns file descriptor
0 is a valid file descriptor and it is the default value after calloc(),
so set this -1 so we don't send it through netlink as used init_netns.
Fixes: 200b2f4 ("gtp-rtnl: and netns support")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
diff --git a/src/gtp.c b/src/gtp.c
index bb5eaaf..bcc3e74 100644
--- a/src/gtp.c
+++ b/src/gtp.c
@@ -29,7 +29,14 @@
struct gtp_tunnel *gtp_tunnel_alloc(void)
{
- return calloc(1, sizeof(struct gtp_tunnel));
+ struct gtp_tunnel *t;
+
+ t = calloc(1, sizeof(struct gtp_tunnel));
+ if (!t)
+ return NULL;
+
+ t->ifns = -1;
+ return t;
}
EXPORT_SYMBOL(gtp_tunnel_alloc);