6lowpan_rtnl: fix fragmentation with two fragments
Subsystems (3)
PATCH 1/1 6lowpan_rtnl: fix fragmentation with two fragments
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").
--- net/ieee802154/6lowpan_rtnl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ieee802154/6lowpan_rtnl.c +2 -2
@@ -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 ;
Signature · 9 lines
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
Hi,
please ignore this one, I also detected a off by one error on a corner of a multiple fragment payload length if we have 3 fragments or above.
- Alex
------------------------------------------------------------------------------
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