netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bluetooth-next v2] ieee802154: fix netns settings
@ 2015-01-28 14:58 Nicolas Dichtel
  2015-01-28 20:36 ` Alexander Aring
  0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Dichtel @ 2015-01-28 14:58 UTC (permalink / raw)
  To: alex.aring; +Cc: netdev, davem, Nicolas Dichtel

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>
---

Note: only compile tested.

v2: update patch title
    rebase the patch on bluetooth-next
    update flag features in cfg802154_netdev_notifier_call

 net/ieee802154/6lowpan/core.c | 6 ++++--
 net/ieee802154/core.c         | 1 +
 2 files changed, 5 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) {
diff --git a/net/ieee802154/core.c b/net/ieee802154/core.c
index 18bc7e738507..888d0991c761 100644
--- a/net/ieee802154/core.c
+++ b/net/ieee802154/core.c
@@ -225,6 +225,7 @@ static int cfg802154_netdev_notifier_call(struct notifier_block *nb,
 	switch (state) {
 		/* TODO NETDEV_DEVTYPE */
 	case NETDEV_REGISTER:
+		dev->features |= NETIF_F_NETNS_LOCAL;
 		wpan_dev->identifier = ++rdev->wpan_dev_id;
 		list_add_rcu(&wpan_dev->list, &rdev->wpan_dev_list);
 		rdev->devlist_generation++;
-- 
2.2.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH bluetooth-next v2] ieee802154: fix netns settings
  2015-01-28 14:58 [PATCH bluetooth-next v2] ieee802154: fix netns settings Nicolas Dichtel
@ 2015-01-28 20:36 ` Alexander Aring
  2015-02-05  9:10   ` Alexander Aring
  0 siblings, 1 reply; 7+ messages in thread
From: Alexander Aring @ 2015-01-28 20:36 UTC (permalink / raw)
  To: Nicolas Dichtel; +Cc: netdev, davem, linux-wpan, marcel

On Wed, Jan 28, 2015 at 03:58:32PM +0100, Nicolas Dichtel wrote:
> 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>

Marcel, can you please queue this for bluetooth-next?

Thanks.

- Alex

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH bluetooth-next v2] ieee802154: fix netns settings
  2015-01-28 20:36 ` Alexander Aring
@ 2015-02-05  9:10   ` Alexander Aring
  2015-02-05 16:03     ` Marcel Holtmann
  0 siblings, 1 reply; 7+ messages in thread
From: Alexander Aring @ 2015-02-05  9:10 UTC (permalink / raw)
  To: Nicolas Dichtel; +Cc: netdev, davem, linux-wpan, marcel

On Wed, Jan 28, 2015 at 09:36:53PM +0100, Alexander Aring wrote:
> On Wed, Jan 28, 2015 at 03:58:32PM +0100, Nicolas Dichtel wrote:
> > 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>
> 
> Marcel, can you please queue this for bluetooth-next?
> 

ping.

- Alex

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH bluetooth-next v2] ieee802154: fix netns settings
  2015-02-05  9:10   ` Alexander Aring
@ 2015-02-05 16:03     ` Marcel Holtmann
  2015-02-05 17:21       ` [PATCH bluetooth-next v3] " Nicolas Dichtel
  0 siblings, 1 reply; 7+ messages in thread
From: Marcel Holtmann @ 2015-02-05 16:03 UTC (permalink / raw)
  To: Alexander Aring
  Cc: Nicolas Dichtel, Network Development, David S. Miller, linux-wpan

Hi Alex,

>>> 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>
>> 
>> Marcel, can you please queue this for bluetooth-next?
>> 
> 
> ping.

I completely missed this one and it is not even showing up in my local archive. Care to resend it with your ack attached to it.

Regards

Marcel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH bluetooth-next v3] ieee802154: fix netns settings
  2015-02-05 16:03     ` Marcel Holtmann
@ 2015-02-05 17:21       ` Nicolas Dichtel
  2015-02-05 17:31         ` Alexander Aring
  2015-02-12 20:34         ` Marcel Holtmann
  0 siblings, 2 replies; 7+ messages in thread
From: Nicolas Dichtel @ 2015-02-05 17:21 UTC (permalink / raw)
  To: marcel; +Cc: alex.aring, netdev, davem, Nicolas Dichtel

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>
---

Note: only compile tested.

v3: rebase on head of bluetooth-next
    add the Acked-by line

v2: update patch title
    rebase the patch on bluetooth-next
    update flag features in cfg802154_netdev_notifier_call

 net/ieee802154/6lowpan/core.c | 6 ++++--
 net/ieee802154/core.c         | 1 +
 2 files changed, 5 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) {
diff --git a/net/ieee802154/core.c b/net/ieee802154/core.c
index 18bc7e738507..888d0991c761 100644
--- a/net/ieee802154/core.c
+++ b/net/ieee802154/core.c
@@ -225,6 +225,7 @@ static int cfg802154_netdev_notifier_call(struct notifier_block *nb,
 	switch (state) {
 		/* TODO NETDEV_DEVTYPE */
 	case NETDEV_REGISTER:
+		dev->features |= NETIF_F_NETNS_LOCAL;
 		wpan_dev->identifier = ++rdev->wpan_dev_id;
 		list_add_rcu(&wpan_dev->list, &rdev->wpan_dev_list);
 		rdev->devlist_generation++;
-- 
2.2.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH bluetooth-next v3] ieee802154: fix netns settings
  2015-02-05 17:21       ` [PATCH bluetooth-next v3] " Nicolas Dichtel
@ 2015-02-05 17:31         ` Alexander Aring
  2015-02-12 20:34         ` Marcel Holtmann
  1 sibling, 0 replies; 7+ messages in thread
From: Alexander Aring @ 2015-02-05 17:31 UTC (permalink / raw)
  To: Nicolas Dichtel; +Cc: marcel, netdev, davem

Hi Nicolas,

On Thu, Feb 05, 2015 at 06:21:30PM +0100, Nicolas Dichtel wrote:
> 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>

thanks for resend this patch and added my ack, thanks.

- Alex

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH bluetooth-next v3] ieee802154: fix netns settings
  2015-02-05 17:21       ` [PATCH bluetooth-next v3] " Nicolas Dichtel
  2015-02-05 17:31         ` Alexander Aring
@ 2015-02-12 20:34         ` Marcel Holtmann
  1 sibling, 0 replies; 7+ messages in thread
From: Marcel Holtmann @ 2015-02-12 20:34 UTC (permalink / raw)
  To: Nicolas Dichtel; +Cc: Alexander Aring, Network Development, David S. Miller

Hi Nicolas,

> 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>
> ---
> 
> Note: only compile tested.
> 
> v3: rebase on head of bluetooth-next
>    add the Acked-by line
> 
> v2: update patch title
>    rebase the patch on bluetooth-next
>    update flag features in cfg802154_netdev_notifier_call
> 
> net/ieee802154/6lowpan/core.c | 6 ++++--
> net/ieee802154/core.c         | 1 +
> 2 files changed, 5 insertions(+), 2 deletions(-)

patch has been applied bluetooth-next tree.

Regards

Marcel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-02-12 20:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-28 14:58 [PATCH bluetooth-next v2] ieee802154: fix netns settings Nicolas Dichtel
2015-01-28 20:36 ` Alexander Aring
2015-02-05  9:10   ` Alexander Aring
2015-02-05 16:03     ` Marcel Holtmann
2015-02-05 17:21       ` [PATCH bluetooth-next v3] " Nicolas Dichtel
2015-02-05 17:31         ` Alexander Aring
2015-02-12 20:34         ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).