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>
This commit is contained in:
Pablo Neira Ayuso 2016-05-08 18:22:54 +02:00
parent 17c816ff84
commit ee7bb1fb2e
1 changed files with 8 additions and 1 deletions

View File

@ -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);