aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/mesh_plink.c
diff options
context:
space:
mode:
authorRui Paulo <rpaulo@gmail.com>2009-11-09 18:46:43 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-11-11 15:23:57 -0500
commit0938393f02c5a4db75a6e38ee31645c974169bb5 (patch)
tree2f2d29be8caf3b21fc79d0d0b67f5657528009bf /net/mac80211/mesh_plink.c
parent23c7a29cd020250646249592941261777cbeaf16 (diff)
mac80211: update peer link management IE and action frames
Update the length and format of the peer link management action frames. Signed-off-by: Rui Paulo <rpaulo@gmail.com> Signed-off-by: Javier Cardona <javier@cozybit.com> Reviewed-by: Andrey Yurovsky <andrey@cozybit.com> Tested-by: Brian Cavagnolo <brian@cozybit.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/mesh_plink.c')
-rw-r--r--net/mac80211/mesh_plink.c32
1 files changed, 17 insertions, 15 deletions
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();