diff options
-rw-r--r-- | include/linux/ieee80211.h | 2 | ||||
-rw-r--r-- | net/mac80211/ieee80211_i.h | 4 | ||||
-rw-r--r-- | net/mac80211/mesh.c | 49 |
3 files changed, 39 insertions, 16 deletions
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index 21556a2d9e7e..52e15e079c61 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 19 | 118 | #define IEEE80211_MESH_CONFIG_LEN 24 |
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 93e618a980d1..455cc7ade9f5 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -367,6 +367,10 @@ struct ieee80211_if_mesh { | |||
367 | u8 mesh_pm_id[4]; | 367 | u8 mesh_pm_id[4]; |
368 | /* Congestion Control Mode Identifier */ | 368 | /* Congestion Control Mode Identifier */ |
369 | u8 mesh_cc_id[4]; | 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 | /* Local mesh Destination Sequence Number */ | 374 | /* Local mesh Destination Sequence Number */ |
371 | u32 dsn; | 375 | u32 dsn; |
372 | /* Last used PREQ ID */ | 376 | /* Last used PREQ ID */ |
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index 3185e18c8214..f7364e56f1ee 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c | |||
@@ -18,8 +18,11 @@ | |||
18 | #define PP_OFFSET 1 /* Path Selection Protocol */ | 18 | #define PP_OFFSET 1 /* Path Selection Protocol */ |
19 | #define PM_OFFSET 5 /* Path Selection Metric */ | 19 | #define PM_OFFSET 5 /* Path Selection Metric */ |
20 | #define CC_OFFSET 9 /* Congestion Control Mode */ | 20 | #define CC_OFFSET 9 /* Congestion Control Mode */ |
21 | #define CAPAB_OFFSET 17 | 21 | #define SP_OFFSET 13 /* Synchronization Protocol */ |
22 | #define ACCEPT_PLINKS 0x80 | 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 | #define TMR_RUNNING_HK 0 | 27 | #define TMR_RUNNING_HK 0 |
25 | #define TMR_RUNNING_MP 1 | 28 | #define TMR_RUNNING_MP 1 |
@@ -84,7 +87,9 @@ bool mesh_matches_local(struct ieee802_11_elems *ie, struct ieee80211_sub_if_dat | |||
84 | 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 && |
85 | memcmp(ifmsh->mesh_pp_id, ie->mesh_config + PP_OFFSET, 4) == 0 && | 88 | memcmp(ifmsh->mesh_pp_id, ie->mesh_config + PP_OFFSET, 4) == 0 && |
86 | memcmp(ifmsh->mesh_pm_id, ie->mesh_config + PM_OFFSET, 4) == 0 && | 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 | return true; | 93 | return true; |
89 | 94 | ||
90 | return false; | 95 | return false; |
@@ -97,7 +102,7 @@ bool mesh_matches_local(struct ieee802_11_elems *ie, struct ieee80211_sub_if_dat | |||
97 | */ | 102 | */ |
98 | bool mesh_peer_accepts_plinks(struct ieee802_11_elems *ie) | 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 | /** |
@@ -123,11 +128,18 @@ void mesh_accept_plinks_update(struct ieee80211_sub_if_data *sdata) | |||
123 | 128 | ||
124 | void mesh_ids_set_default(struct ieee80211_if_mesh *sta) | 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); | 133 | memcpy(sta->mesh_pp_id, oui, sizeof(oui)); |
129 | memcpy(sta->mesh_pm_id, def_id, 4); | 134 | memcpy(sta->mesh_pm_id, oui, sizeof(oui)); |
130 | memcpy(sta->mesh_cc_id, def_id, 4); | 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 | int mesh_rmc_init(struct ieee80211_sub_if_data *sdata) | 145 | int mesh_rmc_init(struct ieee80211_sub_if_data *sdata) |
@@ -245,7 +257,7 @@ void mesh_mgmt_ies_add(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata) | |||
245 | if (sdata->u.mesh.mesh_id_len) | 257 | if (sdata->u.mesh.mesh_id_len) |
246 | memcpy(pos, sdata->u.mesh.mesh_id, sdata->u.mesh.mesh_id_len); | 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 | *pos++ = WLAN_EID_MESH_CONFIG; | 261 | *pos++ = WLAN_EID_MESH_CONFIG; |
250 | *pos++ = IEEE80211_MESH_CONFIG_LEN; | 262 | *pos++ = IEEE80211_MESH_CONFIG_LEN; |
251 | /* Version */ | 263 | /* Version */ |
@@ -263,15 +275,22 @@ void mesh_mgmt_ies_add(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata) | |||
263 | memcpy(pos, sdata->u.mesh.mesh_cc_id, 4); | 275 | memcpy(pos, sdata->u.mesh.mesh_cc_id, 4); |
264 | pos += 4; | 276 | pos += 4; |
265 | 277 | ||
266 | /* Channel precedence: | 278 | /* Synchronization protocol identifier */ |
267 | * Not running simple channel unification protocol | 279 | memcpy(pos, sdata->u.mesh.mesh_sp_id, 4); |
268 | */ | ||
269 | memset(pos, 0x00, 4); | ||
270 | pos += 4; | 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 | /* Mesh capability */ | 290 | /* Mesh capability */ |
273 | sdata->u.mesh.accepting_plinks = mesh_plink_availables(sdata); | 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 | *pos++ = 0x00; | 294 | *pos++ = 0x00; |
276 | 295 | ||
277 | return; | 296 | return; |