ieee802154: 6lowpan: fix byteorder for frag tag
Subsystems (2)
Alexander Aring
maintainerPATCH 1/3 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_tagnet/ieee802154/6lowpan_rtnl.c:278:18: got unsigned short
--- net/ieee802154/6lowpan_rtnl.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
net/ieee802154/6lowpan_rtnl.c +5 -4
@@ -63,7 +63,7 @@ static LIST_HEAD(lowpan_devices);struct lowpan_dev_info {struct net_device *real_dev;/* real WPAN device ptr */ struct mutex dev_list_mtx;/* mutex for list ops */ -__be16 fragment_tag; +u16 fragment_tag; };struct lowpan_dev_record {
@@ -275,7 +275,8 @@ lowpan_xmit_fragmented(struct sk_buff *skb, struct net_device *dev, dgram_size =lowpan_uncompress_size (skb, &dgram_offset) - 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[1 ] = dgram_size &0xff ;
@@ -294,7 +295,7 @@ lowpan_xmit_fragmented(struct sk_buff *skb, struct net_device *dev, frag_len + skb_network_header_len(skb));if (rc) {pr_debug ("%s unable to send FRAG1 packet (tag: %d)" , - __func__, frag_tag); + __func__,ntohs (frag_tag)); goto err; }
@@ -315,7 +316,7 @@ lowpan_xmit_fragmented(struct sk_buff *skb, struct net_device *dev, frag_len);if (rc) {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; } }while (skb_unprocessed > frag_cap);
Signature · 1 line
2.1.2
Alexander Aring
maintainerPATCH 2/3 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
--- net/ieee802154/reassembly.c | 8 +++++--- net/ieee802154/reassembly.h | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-)
net/ieee802154/reassembly.c +5 -3
@@ -33,7 +33,7 @@static const char lowpan_frags_cache_name[] ="lowpan-frags" ;struct lowpan_frag_info { -__be16 d_tag; +u16 d_tag;u16 d_size;u8 d_offset; };
@@ -48,7 +48,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,u16 d_size, +static unsigned int lowpan_hash_frag (u16 tag,u16 d_size,const struct ieee802154_addr *saddr,const struct ieee802154_addr *daddr) {
@@ -330,11 +330,13 @@ static int lowpan_get_frag_info(struct sk_buff *skb, const u8 frag_type, {bool fail;u8 pattern =0 , low =0 ; +__be16 d_tag =0 ; fail =lowpan_fetch_skb (skb, &pattern,1 ); fail |=lowpan_fetch_skb (skb, &low,1 ); 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 ) { fail |=lowpan_fetch_skb (skb, &frag_info->d_offset,1 );
net/ieee802154/reassembly.h +2 -2
@@ -4,7 +4,7 @@#include <net/inet_frag.h> struct lowpan_create_arg { -__be16 tag; +u16 tag;u16 d_size;const struct ieee802154_addr *src;const struct ieee802154_addr *dst;
@@ -15,7 +15,7 @@ struct lowpan_create_arg {struct lowpan_frag_queue {struct inet_frag_queue q; -__be16 tag; +u16 tag;u16 d_size;struct ieee802154_addr saddr;struct ieee802154_addr daddr;
Signature · 1 line
2.1.2
Re: [PATCH wpan-next 2/3] ieee802154: reassembly: fix tag byteorder
Hi Alex,
Quoted 11 lines
This patch fix byte order handling in reassembly code of 802.15.4 6LoWPAN fragmentation handling.
net/ieee802154/reassembly.c:58:43: warning: restricted__be16degrades to integerSigned-off-by Alexander Aring <[email protected]>Reported-by Marcel Holtmann <[email protected]>---
net/ieee802154/reassembly.c| 8 +++++---net/ieee802154/reassembly.h| 4 ++--2 files changed, 7 insertions(+), 5 deletions(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel
Alexander Aring
maintainerPATCH 3/3 ieee802154: 6lowpan: fix sign of errno return val
In reply to Alexander AringThis patch fix ERR_PTR(-rc) to ERR_PTR(rc). The variable rc is already a negative errno value.
--- net/ieee802154/6lowpan_rtnl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ieee802154/6lowpan_rtnl.c +1 -1
@@ -233,7 +233,7 @@ lowpan_alloc_frag(struct sk_buff *skb, int size, &master_hdr->source, size);if (rc <0 ) {kfree_skb (frag); -return ERR_PTR (-rc); +return ERR_PTR (rc); } }else { frag =ERR_PTR (-ENOMEM );
Signature · 1 line
2.1.2
Re: [PATCH wpan-next 3/3] ieee802154: 6lowpan: fix sign of errno return val
Hi Alex,
Quoted 7 lines
This patch fix
ERR_PTR(-rc)toERR_PTR(rc). The variable rc is already a negative errno value.Signed-off-by Alexander Aring <[email protected]>---
net/ieee802154/6lowpan_rtnl.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel
Hi Alex,
Quoted 8 lines
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__be16degrades to integernet/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_tagnet/ieee802154/6lowpan_rtnl.c:278:18: got unsigned short
Quoted 5 lines
Signed-off-by Alexander Aring <[email protected]>Reported-by Marcel Holtmann <[email protected]>---
net/ieee802154/6lowpan_rtnl.c| 9 +++++----1 file changed, 5 insertions(+), 4 deletions(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel
Alexander Aring
maintainerHi Marcel,
Quoted 10 lines · Marcel Holtmann
Hi Alex,
Quoted 8 lines
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__be16degrades to integernet/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_tagnet/ieee802154/6lowpan_rtnl.c:278:18: got unsigned short
Quoted 8 lines
Quoted 5 lines
Signed-off-by Alexander Aring <[email protected]>Reported-by Marcel Holtmann <[email protected]>---
net/ieee802154/6lowpan_rtnl.c| 9 +++++----1 file changed, 5 insertions(+), 4 deletions(-)patch has been applied to bluetooth-next tree.
mhhh, I thought I should apply these patches to wpan-next three. That's why it's tagged with "wpan-next" and sent to linux-wpan only.
Just for global review and such things...
Then I will send it with a bunch of patches to linux-bluetooth (I should change that to send pull-requests to you).
- Alex
Hi Alex,
Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
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__be16degrades to integernet/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_tagnet/ieee802154/6lowpan_rtnl.c:278:18: got unsigned shortQuoted 8 lines
Quoted 5 lines
Signed-off-by Alexander Aring <[email protected]>Reported-by Marcel Holtmann <[email protected]>---
net/ieee802154/6lowpan_rtnl.c| 9 +++++----1 file changed, 5 insertions(+), 4 deletions(-)patch has been applied to bluetooth-next tree.
Quoted 7 lines
mhhh, I thought I should apply these patches to wpan-next three. That's why it's tagged with "wpan-next" and sent to linux-wpan only.
Just for global review and such things...
Then I will send it with a bunch of patches to linux-bluetooth (I should change that to send pull-requests to you).
if you want to send pull requests to me that is fine as well. Right now I take patches into bluetooth-next so that they get global exposure and we get them into wireless-next on a regular basis.
I am totally fine with just applying patches one by one. That is no extra work for me. I just want to get them into the tree so that they will make it into wireless-next early on.
Regards
Marcel