aboutsummaryrefslogtreecommitdiffstats
path: root/net/ieee802154
diff options
context:
space:
mode:
authorTony Cheneau <tony.cheneau@amnesiak.org>2012-07-11 02:51:15 -0400
committerDavid S. Miller <davem@davemloft.net>2012-07-17 01:51:15 -0400
commit4576039ffc04ffe672081159a11cf6e0b875a069 (patch)
tree72d2fb6b5677cdd360b6a735772f250c5069e573 /net/ieee802154
parentd4787a15432384826a0bed42d189fc2a97dc73ea (diff)
6lowpan: Change byte order when storing/accessing u16 tag
The tag field should be stored and accessed using big endian byte order (as intended in the specs). Or else, when displayed with a trafic analyser, such a Wireshark, the field not properly displayed (e.g. 0x01 00 instead of 0x00 01, and so on). Signed-off-by: Tony Cheneau <tony.cheneau@amnesiak.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ieee802154')
-rw-r--r--net/ieee802154/6lowpan.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index 416a54d31fb2..536c6e21b20e 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
@@ -302,7 +302,7 @@ static inline int lowpan_fetch_skb_u16(struct sk_buff *skb, u16 *val)
302 if (unlikely(!pskb_may_pull(skb, 2))) 302 if (unlikely(!pskb_may_pull(skb, 2)))
303 return -EINVAL; 303 return -EINVAL;
304 304
305 *val = skb->data[0] | (skb->data[1] << 8); 305 *val = (skb->data[0] << 8) | skb->data[1];
306 skb_pull(skb, 2); 306 skb_pull(skb, 2);
307 307
308 return 0; 308 return 0;
@@ -1006,8 +1006,8 @@ lowpan_skb_fragmentation(struct sk_buff *skb)
1006 /* first fragment header */ 1006 /* first fragment header */
1007 head[0] = LOWPAN_DISPATCH_FRAG1 | (payload_length & 0x7); 1007 head[0] = LOWPAN_DISPATCH_FRAG1 | (payload_length & 0x7);
1008 head[1] = (payload_length >> 3) & 0xff; 1008 head[1] = (payload_length >> 3) & 0xff;
1009 head[2] = tag & 0xff; 1009 head[2] = tag >> 8;
1010 head[3] = tag >> 8; 1010 head[3] = tag & 0xff;
1011 1011
1012 err = lowpan_fragment_xmit(skb, head, header_length, 0, 0); 1012 err = lowpan_fragment_xmit(skb, head, header_length, 0, 0);
1013 1013