aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Paulo <rpaulo@gmail.com>2009-11-09 18:46:39 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-11-11 15:23:56 -0500
commit3491707a070c1183c709516b2f876f798c7a9a84 (patch)
treeff12e29a8009b18cfb859ca780902cef5daa1e8e
parentac9d1a7bef71afa4837769ef38edb0f7e2ef8028 (diff)
mac80211: update meshconf IE
This updates the Mesh Configuration IE according to the latest draft (3.03). Notable changes include the simplified protocol IDs. 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>
-rw-r--r--include/linux/ieee80211.h2
-rw-r--r--net/mac80211/ieee80211_i.h10
-rw-r--r--net/mac80211/mesh.c69
3 files changed, 35 insertions, 46 deletions
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 0aa831467493..50c684db33c7 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -115,7 +115,7 @@
115#define IEEE80211_MAX_SSID_LEN 32 115#define IEEE80211_MAX_SSID_LEN 32
116 116
117#define IEEE80211_MAX_MESH_ID_LEN 32 117#define IEEE80211_MAX_MESH_ID_LEN 32
118#define IEEE80211_MESH_CONFIG_LEN 24 118#define IEEE80211_MESH_CONFIG_LEN 7
119 119
120#define IEEE80211_QOS_CTL_LEN 2 120#define IEEE80211_QOS_CTL_LEN 2
121#define IEEE80211_QOS_CTL_TID_MASK 0x000F 121#define IEEE80211_QOS_CTL_TID_MASK 0x000F
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 1ef767366b77..1f4f88a8f80c 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -361,15 +361,15 @@ struct ieee80211_if_mesh {
361 u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN]; 361 u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN];
362 size_t mesh_id_len; 362 size_t mesh_id_len;
363 /* Active Path Selection Protocol Identifier */ 363 /* Active Path Selection Protocol Identifier */
364 u8 mesh_pp_id[4]; 364 u8 mesh_pp_id;
365 /* Active Path Selection Metric Identifier */ 365 /* Active Path Selection Metric Identifier */
366 u8 mesh_pm_id[4]; 366 u8 mesh_pm_id;
367 /* Congestion Control Mode Identifier */ 367 /* Congestion Control Mode Identifier */
368 u8 mesh_cc_id[4]; 368 u8 mesh_cc_id;
369 /* Synchronization Protocol Identifier */ 369 /* Synchronization Protocol Identifier */
370 u8 mesh_sp_id[4]; 370 u8 mesh_sp_id;
371 /* Authentication Protocol Identifier */ 371 /* Authentication Protocol Identifier */
372 u8 mesh_auth_id[4]; 372 u8 mesh_auth_id;
373 /* Local mesh Destination Sequence Number */ 373 /* Local mesh Destination Sequence Number */
374 u32 dsn; 374 u32 dsn;
375 /* Last used PREQ ID */ 375 /* Last used PREQ ID */
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index 9a733890eb47..a49a3374acb1 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -15,14 +15,14 @@
15#define IEEE80211_MESH_PEER_INACTIVITY_LIMIT (1800 * HZ) 15#define IEEE80211_MESH_PEER_INACTIVITY_LIMIT (1800 * HZ)
16#define IEEE80211_MESH_HOUSEKEEPING_INTERVAL (60 * HZ) 16#define IEEE80211_MESH_HOUSEKEEPING_INTERVAL (60 * HZ)
17 17
18#define PP_OFFSET 1 /* Path Selection Protocol */ 18#define MESHCONF_PP_OFFSET 0 /* Path Selection Protocol */
19#define PM_OFFSET 5 /* Path Selection Metric */ 19#define MESHCONF_PM_OFFSET 1 /* Path Selection Metric */
20#define CC_OFFSET 9 /* Congestion Control Mode */ 20#define MESHCONF_CC_OFFSET 2 /* Congestion Control Mode */
21#define SP_OFFSET 13 /* Synchronization Protocol */ 21#define MESHCONF_SP_OFFSET 3 /* Synchronization Protocol */
22#define AUTH_OFFSET 17 /* Authentication Protocol */ 22#define MESHCONF_AUTH_OFFSET 4 /* Authentication Protocol */
23#define CAPAB_OFFSET 22 23#define MESHCONF_CAPAB_OFFSET 6
24#define CAPAB_ACCEPT_PLINKS 0x80 24#define MESHCONF_CAPAB_ACCEPT_PLINKS 0x01
25#define CAPAB_FORWARDING 0x10 25#define MESHCONF_CAPAB_FORWARDING 0x08
26 26
27#define TMR_RUNNING_HK 0 27#define TMR_RUNNING_HK 0
28#define TMR_RUNNING_MP 1 28#define TMR_RUNNING_MP 1
@@ -85,11 +85,12 @@ bool mesh_matches_local(struct ieee802_11_elems *ie, struct ieee80211_sub_if_dat
85 */ 85 */
86 if (ifmsh->mesh_id_len == ie->mesh_id_len && 86 if (ifmsh->mesh_id_len == ie->mesh_id_len &&
87 memcmp(ifmsh->mesh_id, ie->mesh_id, ie->mesh_id_len) == 0 && 87 memcmp(ifmsh->mesh_id, ie->mesh_id, ie->mesh_id_len) == 0 &&
88 memcmp(ifmsh->mesh_pp_id, ie->mesh_config + PP_OFFSET, 4) == 0 && 88 (ifmsh->mesh_pp_id == *(ie->mesh_config + MESHCONF_PP_OFFSET))&&
89 memcmp(ifmsh->mesh_pm_id, ie->mesh_config + PM_OFFSET, 4) == 0 && 89 (ifmsh->mesh_pm_id == *(ie->mesh_config + MESHCONF_PM_OFFSET))&&
90 memcmp(ifmsh->mesh_cc_id, ie->mesh_config + CC_OFFSET, 4) == 0 && 90 (ifmsh->mesh_cc_id == *(ie->mesh_config + MESHCONF_CC_OFFSET))&&
91 memcmp(ifmsh->mesh_sp_id, ie->mesh_config + SP_OFFSET, 4) == 0 && 91 (ifmsh->mesh_sp_id == *(ie->mesh_config + MESHCONF_SP_OFFSET))&&
92 memcmp(ifmsh->mesh_auth_id, ie->mesh_config + AUTH_OFFSET, 4) == 0) 92 (ifmsh->mesh_auth_id == *(ie->mesh_config +
93 MESHCONF_AUTH_OFFSET)))
93 return true; 94 return true;
94 95
95 return false; 96 return false;
@@ -102,7 +103,8 @@ bool mesh_matches_local(struct ieee802_11_elems *ie, struct ieee80211_sub_if_dat
102 */ 103 */
103bool mesh_peer_accepts_plinks(struct ieee802_11_elems *ie) 104bool mesh_peer_accepts_plinks(struct ieee802_11_elems *ie)
104{ 105{
105 return (*(ie->mesh_config + CAPAB_OFFSET) & CAPAB_ACCEPT_PLINKS) != 0; 106 return (*(ie->mesh_config + MESHCONF_CAPAB_OFFSET) &
107 MESHCONF_CAPAB_ACCEPT_PLINKS) != 0;
106} 108}
107 109
108/** 110/**
@@ -128,18 +130,11 @@ void mesh_accept_plinks_update(struct ieee80211_sub_if_data *sdata)
128 130
129void mesh_ids_set_default(struct ieee80211_if_mesh *sta) 131void mesh_ids_set_default(struct ieee80211_if_mesh *sta)
130{ 132{
131 u8 oui[3] = {0x00, 0x0F, 0xAC}; 133 sta->mesh_pp_id = 0; /* HWMP */
132 134 sta->mesh_pm_id = 0; /* Airtime */
133 memcpy(sta->mesh_pp_id, oui, sizeof(oui)); 135 sta->mesh_cc_id = 0; /* Disabled */
134 memcpy(sta->mesh_pm_id, oui, sizeof(oui)); 136 sta->mesh_sp_id = 0; /* Neighbor Offset */
135 memcpy(sta->mesh_cc_id, oui, sizeof(oui)); 137 sta->mesh_auth_id = 0; /* Disabled */
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;
143} 138}
144 139
145int mesh_rmc_init(struct ieee80211_sub_if_data *sdata) 140int mesh_rmc_init(struct ieee80211_sub_if_data *sdata)
@@ -260,28 +255,21 @@ void mesh_mgmt_ies_add(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata)
260 pos = skb_put(skb, 2 + IEEE80211_MESH_CONFIG_LEN); 255 pos = skb_put(skb, 2 + IEEE80211_MESH_CONFIG_LEN);
261 *pos++ = WLAN_EID_MESH_CONFIG; 256 *pos++ = WLAN_EID_MESH_CONFIG;
262 *pos++ = IEEE80211_MESH_CONFIG_LEN; 257 *pos++ = IEEE80211_MESH_CONFIG_LEN;
263 /* Version */
264 *pos++ = 1;
265 258
266 /* Active path selection protocol ID */ 259 /* Active path selection protocol ID */
267 memcpy(pos, sdata->u.mesh.mesh_pp_id, 4); 260 *pos++ = sdata->u.mesh.mesh_pp_id;
268 pos += 4;
269 261
270 /* Active path selection metric ID */ 262 /* Active path selection metric ID */
271 memcpy(pos, sdata->u.mesh.mesh_pm_id, 4); 263 *pos++ = sdata->u.mesh.mesh_pm_id;
272 pos += 4;
273 264
274 /* Congestion control mode identifier */ 265 /* Congestion control mode identifier */
275 memcpy(pos, sdata->u.mesh.mesh_cc_id, 4); 266 *pos++ = sdata->u.mesh.mesh_cc_id;
276 pos += 4;
277 267
278 /* Synchronization protocol identifier */ 268 /* Synchronization protocol identifier */
279 memcpy(pos, sdata->u.mesh.mesh_sp_id, 4); 269 *pos++ = sdata->u.mesh.mesh_sp_id;
280 pos += 4;
281 270
282 /* Authentication Protocol identifier */ 271 /* Authentication Protocol identifier */
283 memcpy(pos, sdata->u.mesh.mesh_auth_id, 4); 272 *pos++ = sdata->u.mesh.mesh_auth_id;
284 pos += 4;
285 273
286 /* Mesh Formation Info */ 274 /* Mesh Formation Info */
287 memset(pos, 0x00, 1); 275 memset(pos, 0x00, 1);
@@ -289,8 +277,9 @@ void mesh_mgmt_ies_add(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata)
289 277
290 /* Mesh capability */ 278 /* Mesh capability */
291 sdata->u.mesh.accepting_plinks = mesh_plink_availables(sdata); 279 sdata->u.mesh.accepting_plinks = mesh_plink_availables(sdata);
292 *pos = CAPAB_FORWARDING; 280 *pos = MESHCONF_CAPAB_FORWARDING;
293 *pos++ |= sdata->u.mesh.accepting_plinks ? CAPAB_ACCEPT_PLINKS : 0x00; 281 *pos++ |= sdata->u.mesh.accepting_plinks ?
282 MESHCONF_CAPAB_ACCEPT_PLINKS : 0x00;
294 *pos++ = 0x00; 283 *pos++ = 0x00;
295 284
296 return; 285 return;