* [PATCH bluetooth-next 0/2] ieee802154: 6lowpan: fixes for multiple interfaces
@ 2015-08-15 9:00 Alexander Aring
2015-08-15 9:00 ` [PATCH bluetooth-next 1/2] ieee802154: 6lowpan: fix packet layer registration Alexander Aring
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Alexander Aring @ 2015-08-15 9:00 UTC (permalink / raw)
To: linux-wpan; +Cc: kernel, Alexander Aring
Hi,
while working on "ieee802154: 6lowpan: cleanup and rework dispatch evaluation",
I detected issues which was introduced by removal the multiple interfaces
feature _per_ wpan interface. These are:
- multiple registration for the packet handler -> fixed by open_count
- check on if the wpan interface has a lowpan interface.
I also detect the missing dev_put while lowpan netdev_registation and
take some patches like moving the ARPHRD check earlier, we need to
check on this before evaluating the ieee802154_ptr.
- Alex
Alexander Aring (2):
ieee802154: 6lowpan: fix packet layer registration
ieee802154: 6lowpan: fix non-lowpan wpan interfaces
net/ieee802154/6lowpan/core.c | 22 +++++++++++++++++-----
net/ieee802154/6lowpan/rx.c | 7 ++++---
2 files changed, 21 insertions(+), 8 deletions(-)
--
2.5.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH bluetooth-next 1/2] ieee802154: 6lowpan: fix packet layer registration
2015-08-15 9:00 [PATCH bluetooth-next 0/2] ieee802154: 6lowpan: fixes for multiple interfaces Alexander Aring
@ 2015-08-15 9:00 ` Alexander Aring
2015-08-15 9:00 ` [PATCH bluetooth-next 2/2] ieee802154: 6lowpan: fix non-lowpan wpan interfaces Alexander Aring
2015-08-15 21:29 ` [PATCH bluetooth-next 0/2] ieee802154: 6lowpan: fixes for multiple interfaces Marcel Holtmann
2 siblings, 0 replies; 4+ messages in thread
From: Alexander Aring @ 2015-08-15 9:00 UTC (permalink / raw)
To: linux-wpan; +Cc: kernel, Alexander Aring
This patch fixes 802.15.4 packet layer registration when mutliple
lowpan interfaces will be added. We need to register the packet layer at
the first lowpan interface and deregister it at the last interface. This
done by open_count variable which is protected by rtnl.
Additional do a quiet fix by adding dev_put(real_dev) when netdev
registration fails, which fix the refcount for the wpan dev.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
net/ieee802154/6lowpan/core.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/net/ieee802154/6lowpan/core.c b/net/ieee802154/6lowpan/core.c
index 180e9f5..27c25ad 100644
--- a/net/ieee802154/6lowpan/core.c
+++ b/net/ieee802154/6lowpan/core.c
@@ -52,6 +52,8 @@
#include "6lowpan_i.h"
+static int open_count;
+
static struct header_ops lowpan_header_ops = {
.create = lowpan_header_create,
};
@@ -141,12 +143,18 @@ static int lowpan_newlink(struct net *src_net, struct net_device *dev,
lowpan_netdev_setup(dev, LOWPAN_LLTYPE_IEEE802154);
ret = register_netdevice(dev);
- if (ret >= 0) {
- real_dev->ieee802154_ptr->lowpan_dev = dev;
- lowpan_rx_init();
+ if (ret < 0) {
+ dev_put(real_dev);
+ return ret;
}
- return ret;
+ real_dev->ieee802154_ptr->lowpan_dev = dev;
+ if (!open_count)
+ lowpan_rx_init();
+
+ open_count++;
+
+ return 0;
}
static void lowpan_dellink(struct net_device *dev, struct list_head *head)
@@ -156,7 +164,11 @@ static void lowpan_dellink(struct net_device *dev, struct list_head *head)
ASSERT_RTNL();
- lowpan_rx_exit();
+ open_count--;
+
+ if (!open_count)
+ lowpan_rx_exit();
+
real_dev->ieee802154_ptr->lowpan_dev = NULL;
unregister_netdevice(dev);
dev_put(real_dev);
--
2.5.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH bluetooth-next 2/2] ieee802154: 6lowpan: fix non-lowpan wpan interfaces
2015-08-15 9:00 [PATCH bluetooth-next 0/2] ieee802154: 6lowpan: fixes for multiple interfaces Alexander Aring
2015-08-15 9:00 ` [PATCH bluetooth-next 1/2] ieee802154: 6lowpan: fix packet layer registration Alexander Aring
@ 2015-08-15 9:00 ` Alexander Aring
2015-08-15 21:29 ` [PATCH bluetooth-next 0/2] ieee802154: 6lowpan: fixes for multiple interfaces Marcel Holtmann
2 siblings, 0 replies; 4+ messages in thread
From: Alexander Aring @ 2015-08-15 9:00 UTC (permalink / raw)
To: linux-wpan; +Cc: kernel, Alexander Aring
We receive all 802.15.4 frames on the packet handler "lowpan_rcv" this
patch checks if the wpan device belongs to a lowpan interface.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
net/ieee802154/6lowpan/rx.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/net/ieee802154/6lowpan/rx.c b/net/ieee802154/6lowpan/rx.c
index d6f5e8e..12e1020 100644
--- a/net/ieee802154/6lowpan/rx.c
+++ b/net/ieee802154/6lowpan/rx.c
@@ -67,6 +67,10 @@ static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev,
struct ieee802154_hdr hdr;
int ret;
+ if (dev->type != ARPHRD_IEEE802154 ||
+ !dev->ieee802154_ptr->lowpan_dev)
+ goto drop;
+
skb = skb_share_check(skb, GFP_ATOMIC);
if (!skb)
goto drop;
@@ -77,9 +81,6 @@ static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev,
if (skb->pkt_type == PACKET_OTHERHOST)
goto drop_skb;
- if (dev->type != ARPHRD_IEEE802154)
- goto drop_skb;
-
if (ieee802154_hdr_peek_addrs(skb, &hdr) < 0)
goto drop_skb;
--
2.5.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH bluetooth-next 0/2] ieee802154: 6lowpan: fixes for multiple interfaces
2015-08-15 9:00 [PATCH bluetooth-next 0/2] ieee802154: 6lowpan: fixes for multiple interfaces Alexander Aring
2015-08-15 9:00 ` [PATCH bluetooth-next 1/2] ieee802154: 6lowpan: fix packet layer registration Alexander Aring
2015-08-15 9:00 ` [PATCH bluetooth-next 2/2] ieee802154: 6lowpan: fix non-lowpan wpan interfaces Alexander Aring
@ 2015-08-15 21:29 ` Marcel Holtmann
2 siblings, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2015-08-15 21:29 UTC (permalink / raw)
To: Alexander Aring; +Cc: linux-wpan, kernel
Hi Alex,
> while working on "ieee802154: 6lowpan: cleanup and rework dispatch evaluation",
> I detected issues which was introduced by removal the multiple interfaces
> feature _per_ wpan interface. These are:
>
> - multiple registration for the packet handler -> fixed by open_count
> - check on if the wpan interface has a lowpan interface.
>
> I also detect the missing dev_put while lowpan netdev_registation and
> take some patches like moving the ARPHRD check earlier, we need to
> check on this before evaluating the ieee802154_ptr.
>
> - Alex
>
> Alexander Aring (2):
> ieee802154: 6lowpan: fix packet layer registration
> ieee802154: 6lowpan: fix non-lowpan wpan interfaces
>
> net/ieee802154/6lowpan/core.c | 22 +++++++++++++++++-----
> net/ieee802154/6lowpan/rx.c | 7 ++++---
> 2 files changed, 21 insertions(+), 8 deletions(-)
both patches have been applied to bluetooth-next tree.
Regards
Marcel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-08-15 21:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-15 9:00 [PATCH bluetooth-next 0/2] ieee802154: 6lowpan: fixes for multiple interfaces Alexander Aring
2015-08-15 9:00 ` [PATCH bluetooth-next 1/2] ieee802154: 6lowpan: fix packet layer registration Alexander Aring
2015-08-15 9:00 ` [PATCH bluetooth-next 2/2] ieee802154: 6lowpan: fix non-lowpan wpan interfaces Alexander Aring
2015-08-15 21:29 ` [PATCH bluetooth-next 0/2] ieee802154: 6lowpan: fixes for multiple interfaces Marcel Holtmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox