* [PATCH net-next v2 0/2] 6lowpan: fragmentation fixes
@ 2014-06-02 11:21 Alexander Aring
2014-06-02 11:21 ` [PATCH net-next v2 1/2] 6lowpan_rtnl: fix fragmentation with two fragments Alexander Aring
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Alexander Aring @ 2014-06-02 11:21 UTC (permalink / raw)
To: alex.bluesman.smirnov
Cc: dbaryshkov, linux-zigbee-devel, netdev, phoebe.buckheister,
werner, Alexander Aring
This patch series fix the 6LoWPAN fragmentation which are in two cases broken.
The first case is if we have exactly two 6LoWPAN fragments only. This is fixed
by patch "6lowpan_rtnl: fix fragmentation with two fragments".
The second case is a off by one issue if we have payload which hits the fragment
boundary.
Both issues are introduced by commit d4b2816d67d6e07b2f27037f282d8db03a5829d7
("6lowpan: fix fragmentation").
Alexander Aring (2):
6lowpan_rtnl: fix fragmentation with two fragments
6lowpan_rtnl: fix off by one while fragmentation
net/ieee802154/6lowpan_rtnl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--
1.9.3
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net-next v2 1/2] 6lowpan_rtnl: fix fragmentation with two fragments
2014-06-02 11:21 [PATCH net-next v2 0/2] 6lowpan: fragmentation fixes Alexander Aring
@ 2014-06-02 11:21 ` Alexander Aring
[not found] ` <1401708118-16436-1-git-send-email-alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-06-02 17:40 ` [PATCH net-next v2 0/2] 6lowpan: fragmentation fixes David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Alexander Aring @ 2014-06-02 11:21 UTC (permalink / raw)
To: alex.bluesman.smirnov
Cc: dbaryshkov, linux-zigbee-devel, netdev, phoebe.buckheister,
werner, Alexander Aring
This patch fix the 6LoWPAN fragmentation for the case if we have exactly
two fragments. The problem is that the (skb_unprocessed >= frag_cap)
condition is always false on the second fragment after sending the first
fragment. A fragmentation with only one fragment doesn't make any sense.
The solution is that we use a do while loop here, that ensures we sending
always a minimum of two fragments if we need a fragmentation.
This issue was introduced by commit d4b2816d67d6e07b2f27037f282d8db03a5829d7
("6lowpan: fix fragmentation").
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
net/ieee802154/6lowpan_rtnl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ieee802154/6lowpan_rtnl.c b/net/ieee802154/6lowpan_rtnl.c
index 1ae8a56..9d57026 100644
--- a/net/ieee802154/6lowpan_rtnl.c
+++ b/net/ieee802154/6lowpan_rtnl.c
@@ -312,7 +312,7 @@ lowpan_xmit_fragmented(struct sk_buff *skb, struct net_device *dev,
frag_hdr[0] |= LOWPAN_DISPATCH_FRAGN;
frag_cap = round_down(payload_cap - LOWPAN_FRAGN_HEAD_SIZE, 8);
- while (skb_unprocessed >= frag_cap) {
+ do {
dgram_offset += frag_len;
skb_offset += frag_len;
skb_unprocessed -= frag_len;
@@ -328,7 +328,7 @@ lowpan_xmit_fragmented(struct sk_buff *skb, struct net_device *dev,
__func__, frag_tag, skb_offset);
goto err;
}
- }
+ } while (skb_unprocessed >= frag_cap);
consume_skb(skb);
return NET_XMIT_SUCCESS;
--
1.9.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
[parent not found: <1401708118-16436-1-git-send-email-alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* [PATCH net-next v2 2/2] 6lowpan_rtnl: fix off by one while fragmentation
[not found] ` <1401708118-16436-1-git-send-email-alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2014-06-02 11:21 ` Alexander Aring
0 siblings, 0 replies; 4+ messages in thread
From: Alexander Aring @ 2014-06-02 11:21 UTC (permalink / raw)
To: alex.bluesman.smirnov-Re5JQEeQqe8AvxtiuMwx3w
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
linux-zigbee-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
This patch fix a off by one error while fragmentation. If the frag_cap
value is equal to skb_unprocessed value we need to stop the
fragmentation loop because the last fragment which has a size of
skb_unprocessed fits into the frag capability size.
This issue was introduced by commit d4b2816d67d6e07b2f27037f282d8db03a5829d7
("6lowpan: fix fragmentation").
Signed-off-by: Alexander Aring <alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
net/ieee802154/6lowpan_rtnl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ieee802154/6lowpan_rtnl.c b/net/ieee802154/6lowpan_rtnl.c
index 9d57026..fe6bd7a 100644
--- a/net/ieee802154/6lowpan_rtnl.c
+++ b/net/ieee802154/6lowpan_rtnl.c
@@ -328,7 +328,7 @@ lowpan_xmit_fragmented(struct sk_buff *skb, struct net_device *dev,
__func__, frag_tag, skb_offset);
goto err;
}
- } while (skb_unprocessed >= frag_cap);
+ } while (skb_unprocessed > frag_cap);
consume_skb(skb);
return NET_XMIT_SUCCESS;
--
1.9.3
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next v2 0/2] 6lowpan: fragmentation fixes
2014-06-02 11:21 [PATCH net-next v2 0/2] 6lowpan: fragmentation fixes Alexander Aring
2014-06-02 11:21 ` [PATCH net-next v2 1/2] 6lowpan_rtnl: fix fragmentation with two fragments Alexander Aring
[not found] ` <1401708118-16436-1-git-send-email-alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2014-06-02 17:40 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2014-06-02 17:40 UTC (permalink / raw)
To: alex.aring
Cc: alex.bluesman.smirnov, dbaryshkov, linux-zigbee-devel, netdev,
phoebe.buckheister, werner
From: Alexander Aring <alex.aring@gmail.com>
Date: Mon, 2 Jun 2014 13:21:56 +0200
> This patch series fix the 6LoWPAN fragmentation which are in two cases broken.
>
> The first case is if we have exactly two 6LoWPAN fragments only. This is fixed
> by patch "6lowpan_rtnl: fix fragmentation with two fragments".
> The second case is a off by one issue if we have payload which hits the fragment
> boundary.
>
> Both issues are introduced by commit d4b2816d67d6e07b2f27037f282d8db03a5829d7
> ("6lowpan: fix fragmentation").
Series applied, thanks Alexander.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-06-02 17:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-02 11:21 [PATCH net-next v2 0/2] 6lowpan: fragmentation fixes Alexander Aring
2014-06-02 11:21 ` [PATCH net-next v2 1/2] 6lowpan_rtnl: fix fragmentation with two fragments Alexander Aring
[not found] ` <1401708118-16436-1-git-send-email-alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-06-02 11:21 ` [PATCH net-next v2 2/2] 6lowpan_rtnl: fix off by one while fragmentation Alexander Aring
2014-06-02 17:40 ` [PATCH net-next v2 0/2] 6lowpan: fragmentation fixes David Miller
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).