----- Original Message -----
From: "Pablo Neira Ayuso"
<pablo(a)soleta.eu>
To: "Andreas Schultz" <aschultz(a)tpip.net>
Cc: openbsc(a)lists.osmocom.org, "Harald Welte" <laforge(a)gnumonks.org>
Sent: Monday, November 16, 2015 6:43:55 PM
Subject: Re: [PATCH 05/16] gtp-rtnl: and netns support
On Mon, Nov 16, 2015 at 04:06:46PM +0100, Andreas
Schultz wrote:
diff --git a/libgtnl/src/gtp-genl.c
b/libgtnl/src/gtp-genl.c
index c1f60ab..9e68a30 100644
--- a/libgtnl/src/gtp-genl.c
+++ b/libgtnl/src/gtp-genl.c
@@ -44,6 +44,8 @@
static void gtp_build_payload(struct nlmsghdr *nlh, struct gtp_tunnel *t)
{
mnl_attr_put_u32(nlh, GTPA_VERSION, t->gtp_version);
+ if (t->ifns > 0)
+ mnl_attr_put_u32(nlh, GTPA_NET_NS_FD, t->ifns);
Any reason not to consider descriptor zero as valid?
ifns is a file descriptor and fd's are as far as I know always greater zero.
So, I didn't see a reason to permit zero there when simply not setting the
attribute would serve the same purpose.
I guess we'll need some flags for gtp_tunnel so we
know what we have
set here.
mnl_attr_put_u32(nlh, GTPA_LINK, t->ifidx);
mnl_attr_put_u32(nlh, GTPA_SGSN_ADDRESS, t->sgsn_addr.s_addr);
mnl_attr_put_u32(nlh, GTPA_MS_ADDRESS, t->ms_addr.s_addr);
diff --git a/libgtnl/src/gtp-rtnl.c b/libgtnl/src/gtp-rtnl.c
index 22b9430..db54653 100644
--- a/libgtnl/src/gtp-rtnl.c
+++ b/libgtnl/src/gtp-rtnl.c
@@ -38,6 +38,10 @@
#include "internal.h"
+#if !defined(IFLA_LINK_NETNSID)
+#define IFLA_LINK_NETNSID (IFLA_PHYS_SWITCH_ID + 1)
+#endif
Why do you need this?
I'm test compiling the library on an older kernel. I'll remove that.