Commit cd97a713 authored by Alexander Aring's avatar Alexander Aring Committed by Marcel Holtmann

ieee802154: 6lowpan: fix byteorder for frag tag

This patch fix byteorder issues with fragment tag of generation 802.15.4
6LoWPAN fragment header.

net/ieee802154/6lowpan_rtnl.c:278:54: warning restricted __be16 degrades to integer
net/ieee802154/6lowpan_rtnl.c:278:18: warning: incorrect type in assignment (different base types)
net/ieee802154/6lowpan_rtnl.c:278:18:    expected restricted __be16 [usertype] frag_tag
net/ieee802154/6lowpan_rtnl.c:278:18:    got unsigned short
Signed-off-by: default avatarAlexander Aring <alex.aring@gmail.com>
Reported-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 39f6eb19
...@@ -63,7 +63,7 @@ static LIST_HEAD(lowpan_devices); ...@@ -63,7 +63,7 @@ static LIST_HEAD(lowpan_devices);
struct lowpan_dev_info { struct lowpan_dev_info {
struct net_device *real_dev; /* real WPAN device ptr */ struct net_device *real_dev; /* real WPAN device ptr */
struct mutex dev_list_mtx; /* mutex for list ops */ struct mutex dev_list_mtx; /* mutex for list ops */
__be16 fragment_tag; u16 fragment_tag;
}; };
struct lowpan_dev_record { struct lowpan_dev_record {
...@@ -275,7 +275,8 @@ lowpan_xmit_fragmented(struct sk_buff *skb, struct net_device *dev, ...@@ -275,7 +275,8 @@ lowpan_xmit_fragmented(struct sk_buff *skb, struct net_device *dev,
dgram_size = lowpan_uncompress_size(skb, &dgram_offset) - dgram_size = lowpan_uncompress_size(skb, &dgram_offset) -
skb->mac_len; skb->mac_len;
frag_tag = lowpan_dev_info(dev)->fragment_tag++; frag_tag = htons(lowpan_dev_info(dev)->fragment_tag);
lowpan_dev_info(dev)->fragment_tag++;
frag_hdr[0] = LOWPAN_DISPATCH_FRAG1 | ((dgram_size >> 8) & 0x07); frag_hdr[0] = LOWPAN_DISPATCH_FRAG1 | ((dgram_size >> 8) & 0x07);
frag_hdr[1] = dgram_size & 0xff; frag_hdr[1] = dgram_size & 0xff;
...@@ -294,7 +295,7 @@ lowpan_xmit_fragmented(struct sk_buff *skb, struct net_device *dev, ...@@ -294,7 +295,7 @@ lowpan_xmit_fragmented(struct sk_buff *skb, struct net_device *dev,
frag_len + skb_network_header_len(skb)); frag_len + skb_network_header_len(skb));
if (rc) { if (rc) {
pr_debug("%s unable to send FRAG1 packet (tag: %d)", pr_debug("%s unable to send FRAG1 packet (tag: %d)",
__func__, frag_tag); __func__, ntohs(frag_tag));
goto err; goto err;
} }
...@@ -315,7 +316,7 @@ lowpan_xmit_fragmented(struct sk_buff *skb, struct net_device *dev, ...@@ -315,7 +316,7 @@ lowpan_xmit_fragmented(struct sk_buff *skb, struct net_device *dev,
frag_len); frag_len);
if (rc) { if (rc) {
pr_debug("%s unable to send a FRAGN packet. (tag: %d, offset: %d)\n", pr_debug("%s unable to send a FRAGN packet. (tag: %d, offset: %d)\n",
__func__, frag_tag, skb_offset); __func__, ntohs(frag_tag), skb_offset);
goto err; goto err;
} }
} while (skb_unprocessed > frag_cap); } while (skb_unprocessed > frag_cap);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment