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

ieee802154: reassembly: fix tag byteorder

This patch fix byte order handling in reassembly code of 802.15.4
6LoWPAN fragmentation handling.

net/ieee802154/reassembly.c:58:43: warning: restricted __be16 degrades to integer
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 cd97a713
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
static const char lowpan_frags_cache_name[] = "lowpan-frags"; static const char lowpan_frags_cache_name[] = "lowpan-frags";
struct lowpan_frag_info { struct lowpan_frag_info {
__be16 d_tag; u16 d_tag;
u16 d_size; u16 d_size;
u8 d_offset; u8 d_offset;
}; };
...@@ -48,7 +48,7 @@ static struct inet_frags lowpan_frags; ...@@ -48,7 +48,7 @@ static struct inet_frags lowpan_frags;
static int lowpan_frag_reasm(struct lowpan_frag_queue *fq, static int lowpan_frag_reasm(struct lowpan_frag_queue *fq,
struct sk_buff *prev, struct net_device *dev); struct sk_buff *prev, struct net_device *dev);
static unsigned int lowpan_hash_frag(__be16 tag, u16 d_size, static unsigned int lowpan_hash_frag(u16 tag, u16 d_size,
const struct ieee802154_addr *saddr, const struct ieee802154_addr *saddr,
const struct ieee802154_addr *daddr) const struct ieee802154_addr *daddr)
{ {
...@@ -330,11 +330,13 @@ static int lowpan_get_frag_info(struct sk_buff *skb, const u8 frag_type, ...@@ -330,11 +330,13 @@ static int lowpan_get_frag_info(struct sk_buff *skb, const u8 frag_type,
{ {
bool fail; bool fail;
u8 pattern = 0, low = 0; u8 pattern = 0, low = 0;
__be16 d_tag = 0;
fail = lowpan_fetch_skb(skb, &pattern, 1); fail = lowpan_fetch_skb(skb, &pattern, 1);
fail |= lowpan_fetch_skb(skb, &low, 1); fail |= lowpan_fetch_skb(skb, &low, 1);
frag_info->d_size = (pattern & 7) << 8 | low; frag_info->d_size = (pattern & 7) << 8 | low;
fail |= lowpan_fetch_skb(skb, &frag_info->d_tag, 2); fail |= lowpan_fetch_skb(skb, &d_tag, 2);
frag_info->d_tag = ntohs(d_tag);
if (frag_type == LOWPAN_DISPATCH_FRAGN) { if (frag_type == LOWPAN_DISPATCH_FRAGN) {
fail |= lowpan_fetch_skb(skb, &frag_info->d_offset, 1); fail |= lowpan_fetch_skb(skb, &frag_info->d_offset, 1);
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include <net/inet_frag.h> #include <net/inet_frag.h>
struct lowpan_create_arg { struct lowpan_create_arg {
__be16 tag; u16 tag;
u16 d_size; u16 d_size;
const struct ieee802154_addr *src; const struct ieee802154_addr *src;
const struct ieee802154_addr *dst; const struct ieee802154_addr *dst;
...@@ -15,7 +15,7 @@ struct lowpan_create_arg { ...@@ -15,7 +15,7 @@ struct lowpan_create_arg {
struct lowpan_frag_queue { struct lowpan_frag_queue {
struct inet_frag_queue q; struct inet_frag_queue q;
__be16 tag; u16 tag;
u16 d_size; u16 d_size;
struct ieee802154_addr saddr; struct ieee802154_addr saddr;
struct ieee802154_addr daddr; struct ieee802154_addr daddr;
......
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