Skip to content

Commit abf154a

Browse files
committed
merge with v3.7.x branch of stable-kernel
Signed-off-by: Robert Nelson <[email protected]>
1 parent 1ca909a commit abf154a

File tree

198 files changed

+120806
-78
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

198 files changed

+120806
-78
lines changed

patch.sh

Lines changed: 234 additions & 27 deletions
Large diffs are not rendered by default.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
From 97b20d82142a22f5d4c816ce4501ccc72eec14f2 Mon Sep 17 00:00:00 2001
2+
From: Tony Cheneau <[email protected]>
3+
Date: Mon, 25 Jun 2012 19:45:33 +0000
4+
Subject: [PATCH 01/16] 6lowpan: lowpan_is_iid_16_bit_compressable() does not
5+
detect compressable address correctly
6+
7+
The current test is not RFC6282 compliant. The same issue has been found
8+
out and fixed in Contiki. This patch is basicaly a port of their fix.
9+
10+
Signed-off-by: Tony Cheneau <[email protected]>
11+
---
12+
net/ieee802154/6lowpan.h | 14 ++++++++------
13+
1 files changed, 8 insertions(+), 6 deletions(-)
14+
15+
diff --git a/net/ieee802154/6lowpan.h b/net/ieee802154/6lowpan.h
16+
index 8c2251f..efd1a57 100644
17+
--- a/net/ieee802154/6lowpan.h
18+
+++ b/net/ieee802154/6lowpan.h
19+
@@ -87,14 +87,16 @@
20+
#define is_addr_link_local(a) (((a)->s6_addr16[0]) == 0x80FE)
21+
22+
/*
23+
- * check whether we can compress the IID to 16 bits,
24+
- * it's possible for unicast adresses with first 49 bits are zero only.
25+
- */
26+
+* check whether we can compress the IID to 16 bits,
27+
+* it's possible for unicast adresses with first 49 bits are zero only.
28+
+*/
29+
#define lowpan_is_iid_16_bit_compressable(a) \
30+
((((a)->s6_addr16[4]) == 0) && \
31+
- (((a)->s6_addr16[5]) == 0) && \
32+
- (((a)->s6_addr16[6]) == 0) && \
33+
- ((((a)->s6_addr[14]) & 0x80) == 0))
34+
+ (((a)->s6_addr[10]) == 0) && \
35+
+ (((a)->s6_addr[11]) == 0xff) && \
36+
+ (((a)->s6_addr[12]) == 0xfe) && \
37+
+ (((a)->s6_addr[13]) == 0))
38+
+
39+
40+
/* multicast address */
41+
#define is_addr_mcast(a) (((a)->s6_addr[0]) == 0xFF)
42+
--
43+
1.7.7.6
44+
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
From 3dcfe184dca3051b45f69c17240061d73ee8ef05 Mon Sep 17 00:00:00 2001
2+
From: Tony Cheneau <[email protected]>
3+
Date: Mon, 25 Jun 2012 19:45:45 +0000
4+
Subject: [PATCH 02/16] 6lowpan: next header is not properly set upon
5+
decompression of a UDP header.
6+
7+
This causes a drop of the UDP packet.
8+
9+
Signed-off-by: Tony Cheneau <[email protected]>
10+
---
11+
net/ieee802154/6lowpan.c | 5 ++++-
12+
1 files changed, 4 insertions(+), 1 deletions(-)
13+
14+
diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
15+
index 6d42c17..b53a71a4 100644
16+
--- a/net/ieee802154/6lowpan.c
17+
+++ b/net/ieee802154/6lowpan.c
18+
@@ -913,9 +913,12 @@ lowpan_process_data(struct sk_buff *skb)
19+
}
20+
21+
/* UDP data uncompression */
22+
- if (iphc0 & LOWPAN_IPHC_NH_C)
23+
+ if (iphc0 & LOWPAN_IPHC_NH_C) {
24+
if (lowpan_uncompress_udp_header(skb))
25+
goto drop;
26+
+ hdr.nexthdr = UIP_PROTO_UDP;
27+
+ }
28+
+
29+
30+
/* Not fragmented package */
31+
hdr.payload_len = htons(skb->len);
32+
--
33+
1.7.7.6
34+
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
From baca02a14e4a89a6ed552a3c7062316fcabcb45a Mon Sep 17 00:00:00 2001
2+
From: Tony Cheneau <[email protected]>
3+
Date: Mon, 25 Jun 2012 19:48:12 +0000
4+
Subject: [PATCH 03/16] 6lowpan: always enable link-layer acknowledgments
5+
6+
This feature is especially important when using fragmentation, because
7+
the reassembly mechanism can not recover from the loss of a fragment.
8+
9+
Note that some hardware ignore this flag and not will not transmit any
10+
acknowledgments if this is set.
11+
12+
Signed-off-by: Tony Cheneau <[email protected]>
13+
---
14+
net/ieee802154/6lowpan.c | 4 ++++
15+
1 files changed, 4 insertions(+), 0 deletions(-)
16+
17+
diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
18+
index b53a71a4..49d91df 100644
19+
--- a/net/ieee802154/6lowpan.c
20+
+++ b/net/ieee802154/6lowpan.c
21+
@@ -589,6 +589,10 @@ static int lowpan_header_create(struct sk_buff *skb,
22+
23+
mac_cb(skb)->flags = IEEE802154_FC_TYPE_DATA;
24+
25+
+ /* request acknowledgment when possible */
26+
+ if (!lowpan_is_addr_broadcast(daddr))
27+
+ mac_cb(skb)->flags |= MAC_CB_FLAG_ACKREQ;
28+
+
29+
return dev_hard_header(skb, lowpan_dev_info(dev)->real_dev,
30+
type, (void *)&da, (void *)&sa, skb->len);
31+
}
32+
--
33+
1.7.7.6
34+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
From 75852f26b39df4ecb014ffdfe1e04abc5dc26f11 Mon Sep 17 00:00:00 2001
2+
From: Tony Cheneau <[email protected]>
3+
Date: Tue, 17 Jul 2012 17:59:39 -0400
4+
Subject: [PATCH 04/16] mac802154: turn on ACK when enabled by the upper
5+
layers
6+
7+
Signed-off-by: Tony Cheneau <[email protected]>
8+
---
9+
net/mac802154/wpan.c | 2 ++
10+
1 files changed, 2 insertions(+), 0 deletions(-)
11+
12+
diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c
13+
index f30f6d4..d6aea7f 100644
14+
--- a/net/mac802154/wpan.c
15+
+++ b/net/mac802154/wpan.c
16+
@@ -149,6 +149,8 @@ static int mac802154_header_create(struct sk_buff *skb,
17+
18+
head[pos++] = mac_cb(skb)->seq; /* DSN/BSN */
19+
fc = mac_cb_type(skb);
20+
+ if (mac_cb_is_ackreq(skb))
21+
+ fc |= IEEE802154_FC_ACK_REQ;
22+
23+
if (!saddr) {
24+
spin_lock_bh(&priv->mib_lock);
25+
--
26+
1.7.7.6
27+
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
From ddb3bdb8805f04814cac8f87babc39cd05a2a49a Mon Sep 17 00:00:00 2001
2+
From: Tony Cheneau <[email protected]>
3+
Date: Tue, 4 Sep 2012 23:48:13 -0400
4+
Subject: [PATCH 05/16] 6lowpan: use short IEEE 802.15.4 addresses for
5+
broadcast destination
6+
7+
It is intended that the IEEE 802.15.4 standard uses the 0xFFFF short address (2
8+
bytes) for message broadcasting.
9+
10+
Signed-off-by: Tony Cheneau <[email protected]>
11+
---
12+
net/ieee802154/6lowpan.c | 21 +++++++++++++--------
13+
1 files changed, 13 insertions(+), 8 deletions(-)
14+
15+
diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
16+
index 49d91df..8a2ee95 100644
17+
--- a/net/ieee802154/6lowpan.c
18+
+++ b/net/ieee802154/6lowpan.c
19+
@@ -577,21 +577,26 @@ static int lowpan_header_create(struct sk_buff *skb,
20+
* this isn't implemented in mainline yet, so currently we assign 0xff
21+
*/
22+
{
23+
+ mac_cb(skb)->flags = IEEE802154_FC_TYPE_DATA;
24+
+
25+
/* prepare wpan address data */
26+
sa.addr_type = IEEE802154_ADDR_LONG;
27+
sa.pan_id = 0xff;
28+
-
29+
- da.addr_type = IEEE802154_ADDR_LONG;
30+
- da.pan_id = 0xff;
31+
-
32+
- memcpy(&(da.hwaddr), daddr, 8);
33+
memcpy(&(sa.hwaddr), saddr, 8);
34+
35+
- mac_cb(skb)->flags = IEEE802154_FC_TYPE_DATA;
36+
+ da.pan_id = 0xff;
37+
+ /* if the destination address is the broadcast address,
38+
+ use short address */
39+
+ if (lowpan_is_addr_broadcast(daddr)) {
40+
+ da.addr_type = IEEE802154_ADDR_SHORT;
41+
+ da.short_addr = IEEE802154_ADDR_BROADCAST;
42+
+ } else {
43+
+ da.addr_type = IEEE802154_ADDR_LONG;
44+
+ memcpy(&(da.hwaddr), daddr, 8);
45+
46+
- /* request acknowledgment when possible */
47+
- if (!lowpan_is_addr_broadcast(daddr))
48+
+ /* request acknowledgment */
49+
mac_cb(skb)->flags |= MAC_CB_FLAG_ACKREQ;
50+
+ }
51+
52+
return dev_hard_header(skb, lowpan_dev_info(dev)->real_dev,
53+
type, (void *)&da, (void *)&sa, skb->len);
54+
--
55+
1.7.7.6
56+
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
From 059c943044d018069885b9723c84a4a301ab408c Mon Sep 17 00:00:00 2001
2+
From: Tony Cheneau <[email protected]>
3+
Date: Sat, 8 Sep 2012 00:15:54 -0400
4+
Subject: [PATCH 06/16] 6lowpan: fix first fragment (FRAG1) handling
5+
6+
The first fragment, FRAG1, must contain some payload according to the
7+
specs. However, as it is currently written, the first fragment will
8+
remain empty and only contain the 6lowpan headers.
9+
10+
This patch also extract the transport layer information from the first
11+
fragment. This information is later on use when uncompressing UDP
12+
header.
13+
14+
Signed-off-by: Tony Cheneau <[email protected]>
15+
---
16+
net/ieee802154/6lowpan.c | 54 +++++++++++++++++++++++++++++++++++----------
17+
1 files changed, 42 insertions(+), 12 deletions(-)
18+
19+
diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
20+
index 8a2ee95..38cecaf 100644
21+
--- a/net/ieee802154/6lowpan.c
22+
+++ b/net/ieee802154/6lowpan.c
23+
@@ -654,7 +654,7 @@ static void lowpan_fragment_timer_expired(unsigned long entry_addr)
24+
}
25+
26+
static struct lowpan_fragment *
27+
-lowpan_alloc_new_frame(struct sk_buff *skb, u8 len, u16 tag)
28+
+lowpan_alloc_new_frame(struct sk_buff *skb, u16 len, u16 tag)
29+
{
30+
struct lowpan_fragment *frame;
31+
32+
@@ -735,6 +735,18 @@ lowpan_process_data(struct sk_buff *skb)
33+
/* adds the 3 MSB to the 8 LSB to retrieve the 11 bits length */
34+
len = ((iphc0 & 7) << 8) | slen;
35+
36+
+ if ((iphc0 & LOWPAN_DISPATCH_MASK) == LOWPAN_DISPATCH_FRAG1) {
37+
+ pr_debug("%s received a FRAG1 packet (tag: %d, "
38+
+ "size of the entire IP packet: %d)"
39+
+ , __func__, tag, len);
40+
+ } else { /* FRAGN */
41+
+ if (lowpan_fetch_skb_u8(skb, &offset))
42+
+ goto unlock_and_drop;
43+
+ pr_debug("%s received a FRAGN packet (tag: %d, "
44+
+ "size of the entire IP packet: %d, "
45+
+ "offset: %d)", __func__, tag, len, offset * 8);
46+
+ }
47+
+
48+
/*
49+
* check if frame assembling with the same tag is
50+
* already in progress
51+
@@ -749,17 +761,13 @@ lowpan_process_data(struct sk_buff *skb)
52+
53+
/* alloc new frame structure */
54+
if (!found) {
55+
+ pr_debug("%s first fragment received for tag %d, "
56+
+ "begin packet reassembly", __func__, tag);
57+
frame = lowpan_alloc_new_frame(skb, len, tag);
58+
if (!frame)
59+
goto unlock_and_drop;
60+
}
61+
62+
- if ((iphc0 & LOWPAN_DISPATCH_MASK) == LOWPAN_DISPATCH_FRAG1)
63+
- goto unlock_and_drop;
64+
-
65+
- if (lowpan_fetch_skb_u8(skb, &offset)) /* fetch offset */
66+
- goto unlock_and_drop;
67+
-
68+
/* if payload fits buffer, copy it */
69+
if (likely((offset * 8 + skb->len) <= frame->length))
70+
skb_copy_to_linear_data_offset(frame->skb, offset * 8,
71+
@@ -777,6 +785,10 @@ lowpan_process_data(struct sk_buff *skb)
72+
list_del(&frame->list);
73+
spin_unlock_bh(&flist_lock);
74+
75+
+ pr_debug("%s successfully reassembled fragment "
76+
+ "(tag %d)", __func__, tag);
77+
+
78+
+
79+
dev_kfree_skb(skb);
80+
skb = frame->skb;
81+
kfree(frame);
82+
@@ -976,13 +988,13 @@ static int lowpan_get_mac_header_length(struct sk_buff *skb)
83+
84+
static int
85+
lowpan_fragment_xmit(struct sk_buff *skb, u8 *head,
86+
- int mlen, int plen, int offset)
87+
+ int mlen, int plen, int offset, int type)
88+
{
89+
struct sk_buff *frag;
90+
int hlen, ret;
91+
92+
- /* if payload length is zero, therefore it's a first fragment */
93+
- hlen = (plen == 0 ? LOWPAN_FRAG1_HEAD_SIZE : LOWPAN_FRAGN_HEAD_SIZE);
94+
+ hlen = (type == LOWPAN_DISPATCH_FRAG1 ? LOWPAN_FRAG1_HEAD_SIZE :
95+
+ LOWPAN_FRAGN_HEAD_SIZE);
96+
97+
lowpan_raw_dump_inline(__func__, "6lowpan fragment header", head, hlen);
98+
99+
@@ -1025,7 +1037,18 @@ lowpan_skb_fragmentation(struct sk_buff *skb)
100+
head[2] = tag >> 8;
101+
head[3] = tag & 0xff;
102+
103+
- err = lowpan_fragment_xmit(skb, head, header_length, 0, 0);
104+
+ err = lowpan_fragment_xmit(skb, head, header_length, LOWPAN_FRAG_SIZE,
105+
+ 0, LOWPAN_DISPATCH_FRAG1);
106+
+
107+
+ if (err) {
108+
+#if DEBUG
109+
+ pr_debug("%s unable to send FRAG1 packet (tag: %d)",
110+
+ __func__, tag);
111+
+#endif /* DEBUG */
112+
+ goto exit;
113+
+ }
114+
+
115+
+ offset = LOWPAN_FRAG_SIZE;
116+
117+
/* next fragment header */
118+
head[0] &= ~LOWPAN_DISPATCH_FRAG1;
119+
@@ -1040,10 +1063,17 @@ lowpan_skb_fragmentation(struct sk_buff *skb)
120+
len = payload_length - offset;
121+
122+
err = lowpan_fragment_xmit(skb, head, header_length,
123+
- len, offset);
124+
+ len, offset, LOWPAN_DISPATCH_FRAGN);
125+
+ if (err) {
126+
+ pr_debug("%s unable to send a subsequent FRAGN packet "
127+
+ "(tag: %d, offset: %d", __func__, tag, offset);
128+
+ goto exit;
129+
+ }
130+
+
131+
offset += len;
132+
}
133+
134+
+exit:
135+
return err;
136+
}
137+
138+
--
139+
1.7.7.6
140+

0 commit comments

Comments
 (0)