aboutsummaryrefslogtreecommitdiffstats
path: root/net/6lowpan
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2015-09-02 08:21:25 -0400
committerMarcel Holtmann <marcel@holtmann.org>2015-09-17 07:20:03 -0400
commit72a5e6bb5120d6464c9e7855c5a22555ede819dc (patch)
tree14be5cd534bf3e6d7043cfd2f9d08c24b7028419 /net/6lowpan
parentf801cf40243d8f81ac05aa7466d9d8b1e676ee7c (diff)
ieee820154: 6lowpan: dispatch evaluation rework
This patch complete reworks the evaluation of 6lowpan dispatch value by introducing a receive handler mechanism for each dispatch value. A list of changes: - Doing uncompression on-the-fly when FRAG1 is received, this require some special handling for 802.15.4 lltype in generic 6lowpan branch for setting the payload length correct. - Fix dispatch mask for fragmentation. - Add IPv6 dispatch evaluation for FRAG1. - Add skb_unshare for dispatch which might manipulate the skb data buffer. Cc: Jukka Rissanen <jukka.rissanen@linux.intel.com> Reviewed-by: Stefan Schmidt <stefan@osg.samsung.com> Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/6lowpan')
-rw-r--r--net/6lowpan/iphc.c13
-rw-r--r--net/6lowpan/nhc_udp.c13
2 files changed, 24 insertions, 2 deletions
diff --git a/net/6lowpan/iphc.c b/net/6lowpan/iphc.c
index 1e0071fdcf72..78c8a495b571 100644
--- a/net/6lowpan/iphc.c
+++ b/net/6lowpan/iphc.c
@@ -366,7 +366,18 @@ lowpan_header_decompress(struct sk_buff *skb, struct net_device *dev,
366 return err; 366 return err;
367 } 367 }
368 368
369 hdr.payload_len = htons(skb->len); 369 switch (lowpan_priv(dev)->lltype) {
370 case LOWPAN_LLTYPE_IEEE802154:
371 if (lowpan_802154_cb(skb)->d_size)
372 hdr.payload_len = htons(lowpan_802154_cb(skb)->d_size -
373 sizeof(struct ipv6hdr));
374 else
375 hdr.payload_len = htons(skb->len);
376 break;
377 default:
378 hdr.payload_len = htons(skb->len);
379 break;
380 }
370 381
371 pr_debug("skb headroom size = %d, data length = %d\n", 382 pr_debug("skb headroom size = %d, data length = %d\n",
372 skb_headroom(skb), skb->len); 383 skb_headroom(skb), skb->len);
diff --git a/net/6lowpan/nhc_udp.c b/net/6lowpan/nhc_udp.c
index c6bcaeb428ae..72d0b57eb6e5 100644
--- a/net/6lowpan/nhc_udp.c
+++ b/net/6lowpan/nhc_udp.c
@@ -71,7 +71,18 @@ static int udp_uncompress(struct sk_buff *skb, size_t needed)
71 * here, we obtain the hint from the remaining size of the 71 * here, we obtain the hint from the remaining size of the
72 * frame 72 * frame
73 */ 73 */
74 uh.len = htons(skb->len + sizeof(struct udphdr)); 74 switch (lowpan_priv(skb->dev)->lltype) {
75 case LOWPAN_LLTYPE_IEEE802154:
76 if (lowpan_802154_cb(skb)->d_size)
77 uh.len = htons(lowpan_802154_cb(skb)->d_size -
78 sizeof(struct ipv6hdr));
79 else
80 uh.len = htons(skb->len + sizeof(struct udphdr));
81 break;
82 default:
83 uh.len = htons(skb->len + sizeof(struct udphdr));
84 break;
85 }
75 pr_debug("uncompressed UDP length: src = %d", ntohs(uh.len)); 86 pr_debug("uncompressed UDP length: src = %d", ntohs(uh.len));
76 87
77 /* replace the compressed UDP head by the uncompressed UDP 88 /* replace the compressed UDP head by the uncompressed UDP