[PATCH bluetooth-next 5/7] ieee802154: 6lowpan: handle fragmented IPv6

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch adds handling for a fragmented uncompressed 6LoWPAN packet.
In case that the IPHC compression is above MTU 127, we should not run
IPHC compression. This is still a bug in transmit functionality that we
don't support that, but also not a bug because in worst-case we didn't
hit the case that IPHC compression doesn't fit into a single 802.15.4
frame. Nevertheless this patch adds this handling for receive functionality
only, so other 6LoWPAN stacks can send uncompressed fragmented 6LoWPAN
packets.

Signed-off-by: Alexander Aring <alex.aring@xxxxxxxxx>
---
 net/ieee802154/6lowpan/reassembly.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/net/ieee802154/6lowpan/reassembly.c b/net/ieee802154/6lowpan/reassembly.c
index c76c0cb..d47b34e 100644
--- a/net/ieee802154/6lowpan/reassembly.c
+++ b/net/ieee802154/6lowpan/reassembly.c
@@ -209,15 +209,21 @@ found:
 			goto err;
 
 		/* TODO use CALL_RXH when parsing rework is done. */
-		switch (*skb_network_header(skb) & 0xe0) {
-		case LOWPAN_DISPATCH_IPHC:
-			/* uncompress ipv6 header */
-			ret = iphc_decompress(skb, &hdr);
-			if (ret < 0)
+		if (*skb_network_header(skb) == LOWPAN_DISPATCH_IPV6) {
+			/* Pull off the 1-byte of 6lowpan header. */
+			if (lowpan_fetch_skb(skb, NULL, 1))
 				goto err;
-			break;
-		default:
-			goto err;
+		} else {
+			switch (*skb_network_header(skb) & 0xe0) {
+			case LOWPAN_DISPATCH_IPHC:
+				/* uncompress ipv6 header */
+				ret = iphc_decompress(skb, &hdr);
+				if (ret < 0)
+					goto err;
+				break;
+			default:
+				goto err;
+			}
 		}
 
 		fq->q.flags |= INET_FRAG_FIRST_IN;
-- 
2.2.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wpan" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux