Commit 9e03fdfd05e733e1136d431973625b174029c5e6

Authored by Javier Cardona
Committed by John W. Linville
1 parent 90d6f92828

mac80211: Update mesh config IE to 11s draft 3.02

The mesh config information element has changed significantly since draft 1.08
This patch brings it up to date.

Thanks to Sam Leffler and Rui Paulo for identifying this.

Signed-off-by: Javier Cardona <javier@cozybit.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Showing 3 changed files with 39 additions and 16 deletions Side-by-side Diff

include/linux/ieee80211.h
... ... @@ -115,7 +115,7 @@
115 115 #define IEEE80211_MAX_SSID_LEN 32
116 116  
117 117 #define IEEE80211_MAX_MESH_ID_LEN 32
118   -#define IEEE80211_MESH_CONFIG_LEN 19
  118 +#define IEEE80211_MESH_CONFIG_LEN 24
119 119  
120 120 #define IEEE80211_QOS_CTL_LEN 2
121 121 #define IEEE80211_QOS_CTL_TID_MASK 0x000F
net/mac80211/ieee80211_i.h
... ... @@ -367,6 +367,10 @@
367 367 u8 mesh_pm_id[4];
368 368 /* Congestion Control Mode Identifier */
369 369 u8 mesh_cc_id[4];
  370 + /* Synchronization Protocol Identifier */
  371 + u8 mesh_sp_id[4];
  372 + /* Authentication Protocol Identifier */
  373 + u8 mesh_auth_id[4];
370 374 /* Local mesh Destination Sequence Number */
371 375 u32 dsn;
372 376 /* Last used PREQ ID */
... ... @@ -18,8 +18,11 @@
18 18 #define PP_OFFSET 1 /* Path Selection Protocol */
19 19 #define PM_OFFSET 5 /* Path Selection Metric */
20 20 #define CC_OFFSET 9 /* Congestion Control Mode */
21   -#define CAPAB_OFFSET 17
22   -#define ACCEPT_PLINKS 0x80
  21 +#define SP_OFFSET 13 /* Synchronization Protocol */
  22 +#define AUTH_OFFSET 17 /* Authentication Protocol */
  23 +#define CAPAB_OFFSET 22
  24 +#define CAPAB_ACCEPT_PLINKS 0x80
  25 +#define CAPAB_FORWARDING 0x10
23 26  
24 27 #define TMR_RUNNING_HK 0
25 28 #define TMR_RUNNING_MP 1
... ... @@ -84,7 +87,9 @@
84 87 memcmp(ifmsh->mesh_id, ie->mesh_id, ie->mesh_id_len) == 0 &&
85 88 memcmp(ifmsh->mesh_pp_id, ie->mesh_config + PP_OFFSET, 4) == 0 &&
86 89 memcmp(ifmsh->mesh_pm_id, ie->mesh_config + PM_OFFSET, 4) == 0 &&
87   - memcmp(ifmsh->mesh_cc_id, ie->mesh_config + CC_OFFSET, 4) == 0)
  90 + memcmp(ifmsh->mesh_cc_id, ie->mesh_config + CC_OFFSET, 4) == 0 &&
  91 + memcmp(ifmsh->mesh_sp_id, ie->mesh_config + SP_OFFSET, 4) == 0 &&
  92 + memcmp(ifmsh->mesh_auth_id, ie->mesh_config + AUTH_OFFSET, 4) == 0)
88 93 return true;
89 94  
90 95 return false;
... ... @@ -97,7 +102,7 @@
97 102 */
98 103 bool mesh_peer_accepts_plinks(struct ieee802_11_elems *ie)
99 104 {
100   - return (*(ie->mesh_config + CAPAB_OFFSET) & ACCEPT_PLINKS) != 0;
  105 + return (*(ie->mesh_config + CAPAB_OFFSET) & CAPAB_ACCEPT_PLINKS) != 0;
101 106 }
102 107  
103 108 /**
104 109  
... ... @@ -123,11 +128,18 @@
123 128  
124 129 void mesh_ids_set_default(struct ieee80211_if_mesh *sta)
125 130 {
126   - u8 def_id[4] = {0x00, 0x0F, 0xAC, 0xff};
  131 + u8 oui[3] = {0x00, 0x0F, 0xAC};
127 132  
128   - memcpy(sta->mesh_pp_id, def_id, 4);
129   - memcpy(sta->mesh_pm_id, def_id, 4);
130   - memcpy(sta->mesh_cc_id, def_id, 4);
  133 + memcpy(sta->mesh_pp_id, oui, sizeof(oui));
  134 + memcpy(sta->mesh_pm_id, oui, sizeof(oui));
  135 + memcpy(sta->mesh_cc_id, oui, sizeof(oui));
  136 + memcpy(sta->mesh_sp_id, oui, sizeof(oui));
  137 + memcpy(sta->mesh_auth_id, oui, sizeof(oui));
  138 + sta->mesh_pp_id[sizeof(oui)] = 0;
  139 + sta->mesh_pm_id[sizeof(oui)] = 0;
  140 + sta->mesh_cc_id[sizeof(oui)] = 0xff;
  141 + sta->mesh_sp_id[sizeof(oui)] = 0xff;
  142 + sta->mesh_auth_id[sizeof(oui)] = 0x0;
131 143 }
132 144  
133 145 int mesh_rmc_init(struct ieee80211_sub_if_data *sdata)
... ... @@ -245,7 +257,7 @@
245 257 if (sdata->u.mesh.mesh_id_len)
246 258 memcpy(pos, sdata->u.mesh.mesh_id, sdata->u.mesh.mesh_id_len);
247 259  
248   - pos = skb_put(skb, 21);
  260 + pos = skb_put(skb, 2 + IEEE80211_MESH_CONFIG_LEN);
249 261 *pos++ = WLAN_EID_MESH_CONFIG;
250 262 *pos++ = IEEE80211_MESH_CONFIG_LEN;
251 263 /* Version */
252 264  
253 265  
... ... @@ -263,15 +275,22 @@
263 275 memcpy(pos, sdata->u.mesh.mesh_cc_id, 4);
264 276 pos += 4;
265 277  
266   - /* Channel precedence:
267   - * Not running simple channel unification protocol
268   - */
269   - memset(pos, 0x00, 4);
  278 + /* Synchronization protocol identifier */
  279 + memcpy(pos, sdata->u.mesh.mesh_sp_id, 4);
270 280 pos += 4;
271 281  
  282 + /* Authentication Protocol identifier */
  283 + memcpy(pos, sdata->u.mesh.mesh_auth_id, 4);
  284 + pos += 4;
  285 +
  286 + /* Mesh Formation Info */
  287 + memset(pos, 0x00, 1);
  288 + pos += 1;
  289 +
272 290 /* Mesh capability */
273 291 sdata->u.mesh.accepting_plinks = mesh_plink_availables(sdata);
274   - *pos++ = sdata->u.mesh.accepting_plinks ? ACCEPT_PLINKS : 0x00;
  292 + *pos = CAPAB_FORWARDING;
  293 + *pos++ |= sdata->u.mesh.accepting_plinks ? CAPAB_ACCEPT_PLINKS : 0x00;
275 294 *pos++ = 0x00;
276 295  
277 296 return;