diff options
Diffstat (limited to 'net/mac80211/mesh.c')
-rw-r--r-- | net/mac80211/mesh.c | 49 |
1 files changed, 34 insertions, 15 deletions
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; |