diff options
author | Rui Paulo <rpaulo@gmail.com> | 2009-11-18 13:40:00 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-11-18 17:09:27 -0500 |
commit | 136cfa28615ccce0f9374811480e0b81c4191ea5 (patch) | |
tree | 9a07d6f316d19f85fd989b17e75d931f907c7d1a /net | |
parent | fe7a5d5c1ad659bf0ec7dc171e122aeefa16ac25 (diff) |
mac80211: use a structure to hold the mesh config information element
Signed-off-by: Rui Paulo <rpaulo@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/mac80211/ieee80211_i.h | 3 | ||||
-rw-r--r-- | net/mac80211/mesh.c | 23 | ||||
-rw-r--r-- | net/mac80211/util.c | 4 | ||||
-rw-r--r-- | net/wireless/scan.c | 9 |
4 files changed, 16 insertions, 23 deletions
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 74e79935de0a..87d27f450a05 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -798,7 +798,7 @@ struct ieee802_11_elems { | |||
798 | u8 *wmm_param; | 798 | u8 *wmm_param; |
799 | struct ieee80211_ht_cap *ht_cap_elem; | 799 | struct ieee80211_ht_cap *ht_cap_elem; |
800 | struct ieee80211_ht_info *ht_info_elem; | 800 | struct ieee80211_ht_info *ht_info_elem; |
801 | u8 *mesh_config; | 801 | struct ieee80211_meshconf_ie *mesh_config; |
802 | u8 *mesh_id; | 802 | u8 *mesh_id; |
803 | u8 *peer_link; | 803 | u8 *peer_link; |
804 | u8 *preq; | 804 | u8 *preq; |
@@ -826,7 +826,6 @@ struct ieee802_11_elems { | |||
826 | u8 ext_supp_rates_len; | 826 | u8 ext_supp_rates_len; |
827 | u8 wmm_info_len; | 827 | u8 wmm_info_len; |
828 | u8 wmm_param_len; | 828 | u8 wmm_param_len; |
829 | u8 mesh_config_len; | ||
830 | u8 mesh_id_len; | 829 | u8 mesh_id_len; |
831 | u8 peer_link_len; | 830 | u8 peer_link_len; |
832 | u8 preq_len; | 831 | u8 preq_len; |
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index 3a0683ba357b..51adb1115215 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c | |||
@@ -16,12 +16,6 @@ | |||
16 | #define IEEE80211_MESH_HOUSEKEEPING_INTERVAL (60 * HZ) | 16 | #define IEEE80211_MESH_HOUSEKEEPING_INTERVAL (60 * HZ) |
17 | #define IEEE80211_MESH_RANN_INTERVAL (1 * HZ) | 17 | #define IEEE80211_MESH_RANN_INTERVAL (1 * HZ) |
18 | 18 | ||
19 | #define MESHCONF_PP_OFFSET 0 /* Path Selection Protocol */ | ||
20 | #define MESHCONF_PM_OFFSET 1 /* Path Selection Metric */ | ||
21 | #define MESHCONF_CC_OFFSET 2 /* Congestion Control Mode */ | ||
22 | #define MESHCONF_SP_OFFSET 3 /* Synchronization Protocol */ | ||
23 | #define MESHCONF_AUTH_OFFSET 4 /* Authentication Protocol */ | ||
24 | #define MESHCONF_CAPAB_OFFSET 6 | ||
25 | #define MESHCONF_CAPAB_ACCEPT_PLINKS 0x01 | 19 | #define MESHCONF_CAPAB_ACCEPT_PLINKS 0x01 |
26 | #define MESHCONF_CAPAB_FORWARDING 0x08 | 20 | #define MESHCONF_CAPAB_FORWARDING 0x08 |
27 | 21 | ||
@@ -87,12 +81,11 @@ bool mesh_matches_local(struct ieee802_11_elems *ie, struct ieee80211_sub_if_dat | |||
87 | */ | 81 | */ |
88 | if (ifmsh->mesh_id_len == ie->mesh_id_len && | 82 | if (ifmsh->mesh_id_len == ie->mesh_id_len && |
89 | memcmp(ifmsh->mesh_id, ie->mesh_id, ie->mesh_id_len) == 0 && | 83 | memcmp(ifmsh->mesh_id, ie->mesh_id, ie->mesh_id_len) == 0 && |
90 | (ifmsh->mesh_pp_id == *(ie->mesh_config + MESHCONF_PP_OFFSET))&& | 84 | (ifmsh->mesh_pp_id == ie->mesh_config->meshconf_psel) && |
91 | (ifmsh->mesh_pm_id == *(ie->mesh_config + MESHCONF_PM_OFFSET))&& | 85 | (ifmsh->mesh_pm_id == ie->mesh_config->meshconf_pmetric) && |
92 | (ifmsh->mesh_cc_id == *(ie->mesh_config + MESHCONF_CC_OFFSET))&& | 86 | (ifmsh->mesh_cc_id == ie->mesh_config->meshconf_congest) && |
93 | (ifmsh->mesh_sp_id == *(ie->mesh_config + MESHCONF_SP_OFFSET))&& | 87 | (ifmsh->mesh_sp_id == ie->mesh_config->meshconf_synch) && |
94 | (ifmsh->mesh_auth_id == *(ie->mesh_config + | 88 | (ifmsh->mesh_auth_id == ie->mesh_config->meshconf_auth)) |
95 | MESHCONF_AUTH_OFFSET))) | ||
96 | return true; | 89 | return true; |
97 | 90 | ||
98 | return false; | 91 | return false; |
@@ -105,7 +98,7 @@ bool mesh_matches_local(struct ieee802_11_elems *ie, struct ieee80211_sub_if_dat | |||
105 | */ | 98 | */ |
106 | bool mesh_peer_accepts_plinks(struct ieee802_11_elems *ie) | 99 | bool mesh_peer_accepts_plinks(struct ieee802_11_elems *ie) |
107 | { | 100 | { |
108 | return (*(ie->mesh_config + MESHCONF_CAPAB_OFFSET) & | 101 | return (ie->mesh_config->meshconf_cap & |
109 | MESHCONF_CAPAB_ACCEPT_PLINKS) != 0; | 102 | MESHCONF_CAPAB_ACCEPT_PLINKS) != 0; |
110 | } | 103 | } |
111 | 104 | ||
@@ -262,9 +255,9 @@ void mesh_mgmt_ies_add(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata) | |||
262 | if (sdata->u.mesh.mesh_id_len) | 255 | if (sdata->u.mesh.mesh_id_len) |
263 | memcpy(pos, sdata->u.mesh.mesh_id, sdata->u.mesh.mesh_id_len); | 256 | memcpy(pos, sdata->u.mesh.mesh_id, sdata->u.mesh.mesh_id_len); |
264 | 257 | ||
265 | pos = skb_put(skb, 2 + IEEE80211_MESH_CONFIG_LEN); | 258 | pos = skb_put(skb, 2 + sizeof(struct ieee80211_meshconf_ie)); |
266 | *pos++ = WLAN_EID_MESH_CONFIG; | 259 | *pos++ = WLAN_EID_MESH_CONFIG; |
267 | *pos++ = IEEE80211_MESH_CONFIG_LEN; | 260 | *pos++ = sizeof(struct ieee80211_meshconf_ie); |
268 | 261 | ||
269 | /* Active path selection protocol ID */ | 262 | /* Active path selection protocol ID */ |
270 | *pos++ = sdata->u.mesh.mesh_pp_id; | 263 | *pos++ = sdata->u.mesh.mesh_pp_id; |
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 5ae1bf389849..2fb0432ac830 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -666,8 +666,8 @@ u32 ieee802_11_parse_elems_crc(u8 *start, size_t len, | |||
666 | elems->mesh_id_len = elen; | 666 | elems->mesh_id_len = elen; |
667 | break; | 667 | break; |
668 | case WLAN_EID_MESH_CONFIG: | 668 | case WLAN_EID_MESH_CONFIG: |
669 | elems->mesh_config = pos; | 669 | if (elen >= sizeof(struct ieee80211_meshconf_ie)) |
670 | elems->mesh_config_len = elen; | 670 | elems->mesh_config = (void *)pos; |
671 | break; | 671 | break; |
672 | case WLAN_EID_PEER_LINK: | 672 | case WLAN_EID_PEER_LINK: |
673 | elems->peer_link = pos; | 673 | elems->peer_link = pos; |
diff --git a/net/wireless/scan.c b/net/wireless/scan.c index e2d344ff6745..d03447d68cdd 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c | |||
@@ -217,7 +217,7 @@ static bool is_mesh(struct cfg80211_bss *a, | |||
217 | a->len_information_elements); | 217 | a->len_information_elements); |
218 | if (!ie) | 218 | if (!ie) |
219 | return false; | 219 | return false; |
220 | if (ie[1] != IEEE80211_MESH_CONFIG_LEN) | 220 | if (ie[1] != sizeof(struct ieee80211_meshconf_ie)) |
221 | return false; | 221 | return false; |
222 | 222 | ||
223 | /* | 223 | /* |
@@ -225,7 +225,8 @@ static bool is_mesh(struct cfg80211_bss *a, | |||
225 | * comparing since that may differ between stations taking | 225 | * comparing since that may differ between stations taking |
226 | * part in the same mesh. | 226 | * part in the same mesh. |
227 | */ | 227 | */ |
228 | return memcmp(ie + 2, meshcfg, IEEE80211_MESH_CONFIG_LEN - 2) == 0; | 228 | return memcmp(ie + 2, meshcfg, |
229 | sizeof(struct ieee80211_meshconf_ie) - 2) == 0; | ||
229 | } | 230 | } |
230 | 231 | ||
231 | static int cmp_bss(struct cfg80211_bss *a, | 232 | static int cmp_bss(struct cfg80211_bss *a, |
@@ -399,7 +400,7 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev, | |||
399 | res->pub.information_elements, | 400 | res->pub.information_elements, |
400 | res->pub.len_information_elements); | 401 | res->pub.len_information_elements); |
401 | if (!meshid || !meshcfg || | 402 | if (!meshid || !meshcfg || |
402 | meshcfg[1] != IEEE80211_MESH_CONFIG_LEN) { | 403 | meshcfg[1] != sizeof(struct ieee80211_meshconf_ie)) { |
403 | /* bogus mesh */ | 404 | /* bogus mesh */ |
404 | kref_put(&res->ref, bss_release); | 405 | kref_put(&res->ref, bss_release); |
405 | return NULL; | 406 | return NULL; |
@@ -865,7 +866,7 @@ ieee80211_bss(struct wiphy *wiphy, struct iw_request_info *info, | |||
865 | break; | 866 | break; |
866 | case WLAN_EID_MESH_CONFIG: | 867 | case WLAN_EID_MESH_CONFIG: |
867 | ismesh = true; | 868 | ismesh = true; |
868 | if (ie[1] != IEEE80211_MESH_CONFIG_LEN) | 869 | if (ie[1] != sizeof(struct ieee80211_meshconf_ie)) |
869 | break; | 870 | break; |
870 | buf = kmalloc(50, GFP_ATOMIC); | 871 | buf = kmalloc(50, GFP_ATOMIC); |
871 | if (!buf) | 872 | if (!buf) |