summaryrefslogtreecommitdiffstats
path: root/net/ieee802154/6lowpan/core.c
diff options
context:
space:
mode:
authorNicolas Dichtel2015-02-05 18:21:30 +0100
committerMarcel Holtmann2015-02-14 05:19:58 +0100
commitf9d1ce8f81eb046626cfa1bb0f419f8dca04bcae (patch)
tree80ebdf697f1b07b301dd0887d697dd2dad8b7356 /net/ieee802154/6lowpan/core.c
parentBluetooth: btmrvl: support SCO routing to host interface (diff)
downloadkernel-qcow2-linux-f9d1ce8f81eb046626cfa1bb0f419f8dca04bcae.tar.gz
kernel-qcow2-linux-f9d1ce8f81eb046626cfa1bb0f419f8dca04bcae.tar.xz
kernel-qcow2-linux-f9d1ce8f81eb046626cfa1bb0f419f8dca04bcae.zip
ieee802154: fix netns settings
6LoWPAN currently doesn't supports x-netns and works only in init_net. With this patch, we ensure that: - the wpan interface cannot be moved to another netns; - the 6lowpan interface cannot be moved to another netns; - the wpan interface is in the same netns than the 6lowpan interface; - the 6lowpan interface is in init_net. Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/ieee802154/6lowpan/core.c')
-rw-r--r--net/ieee802154/6lowpan/core.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/ieee802154/6lowpan/core.c b/net/ieee802154/6lowpan/core.c
index 055fbb71ba6f..dfd3c6007f60 100644
--- a/net/ieee802154/6lowpan/core.c
+++ b/net/ieee802154/6lowpan/core.c
@@ -126,6 +126,7 @@ static void lowpan_setup(struct net_device *dev)
dev->header_ops = &lowpan_header_ops;
dev->ml_priv = &lowpan_mlme;
dev->destructor = free_netdev;
+ dev->features |= NETIF_F_NETNS_LOCAL;
}
static int lowpan_validate(struct nlattr *tb[], struct nlattr *data[])
@@ -148,10 +149,11 @@ static int lowpan_newlink(struct net *src_net, struct net_device *dev,
pr_debug("adding new link\n");
- if (!tb[IFLA_LINK])
+ if (!tb[IFLA_LINK] ||
+ !net_eq(dev_net(dev), &init_net))
return -EINVAL;
/* find and hold real wpan device */
- real_dev = dev_get_by_index(src_net, nla_get_u32(tb[IFLA_LINK]));
+ real_dev = dev_get_by_index(dev_net(dev), nla_get_u32(tb[IFLA_LINK]));
if (!real_dev)
return -ENODEV;
if (real_dev->type != ARPHRD_IEEE802154) {