aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/mac80211/mesh.c2
-rw-r--r--net/mac80211/mesh.h2
-rw-r--r--net/mac80211/mesh_plink.c32
-rw-r--r--net/mac80211/rx.c2
4 files changed, 20 insertions, 18 deletions
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index 79425182c290..63427d983216 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -553,7 +553,7 @@ static void ieee80211_mesh_rx_mgmt_action(struct ieee80211_sub_if_data *sdata,
553 struct ieee80211_rx_status *rx_status) 553 struct ieee80211_rx_status *rx_status)
554{ 554{
555 switch (mgmt->u.action.category) { 555 switch (mgmt->u.action.category) {
556 case PLINK_CATEGORY: 556 case MESH_PLINK_CATEGORY:
557 mesh_rx_plink_frame(sdata, mgmt, len, rx_status); 557 mesh_rx_plink_frame(sdata, mgmt, len, rx_status);
558 break; 558 break;
559 case MESH_PATH_SEL_CATEGORY: 559 case MESH_PATH_SEL_CATEGORY:
diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h
index 9948107e8313..536d5c07fd19 100644
--- a/net/mac80211/mesh.h
+++ b/net/mac80211/mesh.h
@@ -206,7 +206,7 @@ struct mesh_rmc {
206#define MESH_MAX_MPATHS 1024 206#define MESH_MAX_MPATHS 1024
207 207
208/* Pending ANA approval */ 208/* Pending ANA approval */
209#define PLINK_CATEGORY 30 209#define MESH_PLINK_CATEGORY 30
210#define MESH_PATH_SEL_CATEGORY 32 210#define MESH_PATH_SEL_CATEGORY 32
211 211
212/* Public interfaces */ 212/* Public interfaces */
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c
index 418875246a0b..8a54bc836c92 100644
--- a/net/mac80211/mesh_plink.c
+++ b/net/mac80211/mesh_plink.c
@@ -18,9 +18,8 @@
18#define mpl_dbg(fmt, args...) do { (void)(0); } while (0) 18#define mpl_dbg(fmt, args...) do { (void)(0); } while (0)
19#endif 19#endif
20 20
21#define PLINK_GET_FRAME_SUBTYPE(p) (p) 21#define PLINK_GET_LLID(p) (p + 4)
22#define PLINK_GET_LLID(p) (p + 1) 22#define PLINK_GET_PLID(p) (p + 6)
23#define PLINK_GET_PLID(p) (p + 3)
24 23
25#define mod_plink_timer(s, t) (mod_timer(&s->plink_timer, \ 24#define mod_plink_timer(s, t) (mod_timer(&s->plink_timer, \
26 jiffies + HZ * t / 1000)) 25 jiffies + HZ * t / 1000))
@@ -154,6 +153,7 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata,
154 struct sk_buff *skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400); 153 struct sk_buff *skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400);
155 struct ieee80211_mgmt *mgmt; 154 struct ieee80211_mgmt *mgmt;
156 bool include_plid = false; 155 bool include_plid = false;
156 static const u8 meshpeeringproto[] = { 0x00, 0x0F, 0xAC, 0x2A };
157 u8 *pos; 157 u8 *pos;
158 int ie_len; 158 int ie_len;
159 159
@@ -171,7 +171,7 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata,
171 memcpy(mgmt->da, da, ETH_ALEN); 171 memcpy(mgmt->da, da, ETH_ALEN);
172 memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); 172 memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN);
173 /* BSSID is left zeroed, wildcard value */ 173 /* BSSID is left zeroed, wildcard value */
174 mgmt->u.action.category = PLINK_CATEGORY; 174 mgmt->u.action.category = MESH_PLINK_CATEGORY;
175 mgmt->u.action.u.plink_action.action_code = action; 175 mgmt->u.action.u.plink_action.action_code = action;
176 176
177 if (action == PLINK_CLOSE) 177 if (action == PLINK_CLOSE)
@@ -189,18 +189,18 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata,
189 /* Add Peer Link Management element */ 189 /* Add Peer Link Management element */
190 switch (action) { 190 switch (action) {
191 case PLINK_OPEN: 191 case PLINK_OPEN:
192 ie_len = 3; 192 ie_len = 6;
193 break; 193 break;
194 case PLINK_CONFIRM: 194 case PLINK_CONFIRM:
195 ie_len = 5; 195 ie_len = 8;
196 include_plid = true; 196 include_plid = true;
197 break; 197 break;
198 case PLINK_CLOSE: 198 case PLINK_CLOSE:
199 default: 199 default:
200 if (!plid) 200 if (!plid)
201 ie_len = 5; 201 ie_len = 8;
202 else { 202 else {
203 ie_len = 7; 203 ie_len = 10;
204 include_plid = true; 204 include_plid = true;
205 } 205 }
206 break; 206 break;
@@ -209,7 +209,8 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata,
209 pos = skb_put(skb, 2 + ie_len); 209 pos = skb_put(skb, 2 + ie_len);
210 *pos++ = WLAN_EID_PEER_LINK; 210 *pos++ = WLAN_EID_PEER_LINK;
211 *pos++ = ie_len; 211 *pos++ = ie_len;
212 *pos++ = action; 212 memcpy(pos, meshpeeringproto, sizeof(meshpeeringproto));
213 pos += 4;
213 memcpy(pos, &llid, 2); 214 memcpy(pos, &llid, 2);
214 if (include_plid) { 215 if (include_plid) {
215 pos += 2; 216 pos += 2;
@@ -419,12 +420,13 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
419 return; 420 return;
420 } 421 }
421 422
422 ftype = *((u8 *)PLINK_GET_FRAME_SUBTYPE(elems.peer_link)); 423 ftype = mgmt->u.action.u.plink_action.action_code;
423 ie_len = elems.peer_link_len; 424 ie_len = elems.peer_link_len;
424 if ((ftype == PLINK_OPEN && ie_len != 3) || 425 if ((ftype == PLINK_OPEN && ie_len != 6) ||
425 (ftype == PLINK_CONFIRM && ie_len != 5) || 426 (ftype == PLINK_CONFIRM && ie_len != 8) ||
426 (ftype == PLINK_CLOSE && ie_len != 5 && ie_len != 7)) { 427 (ftype == PLINK_CLOSE && ie_len != 8 && ie_len != 10)) {
427 mpl_dbg("Mesh plink: incorrect plink ie length\n"); 428 mpl_dbg("Mesh plink: incorrect plink ie length %d %d\n",
429 ftype, ie_len);
428 return; 430 return;
429 } 431 }
430 432
@@ -436,7 +438,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
436 * from the point of view of this host. 438 * from the point of view of this host.
437 */ 439 */
438 memcpy(&plid, PLINK_GET_LLID(elems.peer_link), 2); 440 memcpy(&plid, PLINK_GET_LLID(elems.peer_link), 2);
439 if (ftype == PLINK_CONFIRM || (ftype == PLINK_CLOSE && ie_len == 7)) 441 if (ftype == PLINK_CONFIRM || (ftype == PLINK_CLOSE && ie_len == 10))
440 memcpy(&llid, PLINK_GET_PLID(elems.peer_link), 2); 442 memcpy(&llid, PLINK_GET_PLID(elems.peer_link), 2);
441 443
442 rcu_read_lock(); 444 rcu_read_lock();
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 28316b2a585f..4066570dd414 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -507,7 +507,7 @@ ieee80211_rx_mesh_check(struct ieee80211_rx_data *rx)
507 507
508 if (ieee80211_is_action(hdr->frame_control)) { 508 if (ieee80211_is_action(hdr->frame_control)) {
509 mgmt = (struct ieee80211_mgmt *)hdr; 509 mgmt = (struct ieee80211_mgmt *)hdr;
510 if (mgmt->u.action.category != PLINK_CATEGORY) 510 if (mgmt->u.action.category != MESH_PLINK_CATEGORY)
511 return RX_DROP_MONITOR; 511 return RX_DROP_MONITOR;
512 return RX_CONTINUE; 512 return RX_CONTINUE;
513 } 513 }