aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/mesh.c
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 /net/mac80211/mesh.c
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>
Diffstat (limited to 'net/mac80211/mesh.c')
-rw-r--r--net/mac80211/mesh.c69
1 files changed, 29 insertions, 40 deletions
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index 9a733890eb4..a49a3374acb 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;