Skip to contentSkip to conversation

6lowpan: fix issues with byte ordering types

PATCH In review Alexander Aring 2 participants 5 messages Mar 2, 2014 – Mar 3, 2014 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover 6lowpan: fix issues with byte ordering types

Hi,

I got some mail from a "kbuild test robot" and it detected some byte ordering issues with the tag and datagram size value of 6LoWPAN IEEE 802.15.4 fragmentation header.

This patch series should fix the issues with the byte ordering.

- Alex

Alexander Aring (3):
6lowpan: fix type of datagram size parameter
6lowpan: remove initialization of tag value
6lowpan: use memcpy to set tag value in fraghdr

 net/ieee802154/6lowpan_rtnl.c | 4 +---
 net/ieee802154/reassembly.c   | 2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)
Signature · 9 lines
1.9.0


------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk

A message that is not in the archive (sent off-list or not yet received): 1393744175-23739-1-git-send-email-alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#2 lore raw

PATCH 1/3 6lowpan: fix type of datagram size parameter

Datagram size value is u16 because we convert it to host byte order and we need to read it. Only the tag value belongs to __be16 type.

---
 net/ieee802154/reassembly.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ieee802154/reassembly.c +1 -1
index eb5995e..4511fc2 100644
@@ -35,7 +35,7 @@ static struct inet_frags lowpan_frags;
 static int lowpan_frag_reasm(struct lowpan_frag_queue *fq,
 			     struct sk_buff *prev, struct net_device *dev);
 
-static unsigned int lowpan_hash_frag(__be16 tag, __be16 d_size,
+static unsigned int lowpan_hash_frag(__be16 tag, u16 d_size,
 				     const struct ieee802154_addr *saddr,
 				     const struct ieee802154_addr *daddr)
 {
Signature · 9 lines
1.9.0


------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
#3 lore raw

PATCH 2/3 6lowpan: remove initialization of tag value

In reply to a message not in the archive

The initialization of the tag value doesn't matter at begin of fragmentation. This patch removes the initialization to zero.

---
 net/ieee802154/6lowpan_rtnl.c | 1 -
 1 file changed, 1 deletion(-)
net/ieee802154/6lowpan_rtnl.c +0 -1
index c7bd8b5..178ffb9 100644
@@ -519,7 +519,6 @@ static int lowpan_newlink(struct net *src_net, struct net_device *dev,
 	}
 
 	lowpan_dev_info(dev)->real_dev = real_dev;
-	lowpan_dev_info(dev)->fragment_tag = 0;
 	mutex_init(&lowpan_dev_info(dev)->dev_list_mtx);
 
 	entry = kzalloc(sizeof(*entry), GFP_KERNEL);
Signature · 9 lines
1.9.0


------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
#4 lore raw

PATCH 3/3 6lowpan: use memcpy to set tag value in fraghdr

In reply to a message not in the archive
---
 net/ieee802154/6lowpan_rtnl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
net/ieee802154/6lowpan_rtnl.c +1 -2
index 178ffb9..e472618 100644
@@ -265,8 +265,7 @@ lowpan_skb_fragmentation(struct sk_buff *skb, struct net_device *dev)
 	/* first fragment header */
 	head[0] = LOWPAN_DISPATCH_FRAG1 | ((dgram_size >> 8) & 0x7);
 	head[1] = dgram_size & 0xff;
-	head[2] = tag >> 8;
-	head[3] = tag & 0xff;
+	memcpy(head + 2, &tag, sizeof(tag));
 
 	/* calc the nearest payload length(divided to 8) for first fragment
 	 * which fits into a IEEE802154_MTU
Signature · 9 lines
1.9.0


------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
maintainer
#5 lore raw
In reply to Alexander Aring

From: Alexander Aring <[email protected]>
Date: Sun, 2 Mar 2014 08:09:32 +0100

Quoted 5 lines

I got some mail from a "kbuild test robot" and it detected some byte ordering issues with the tag and datagram size value of 6LoWPAN IEEE 802.15.4 fragmentation header.

This patch series should fix the issues with the byte ordering.

Series applied, thank you.