aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/ieee80211.h16
-rw-r--r--net/mac80211/ieee80211_i.h3
-rw-r--r--net/mac80211/mesh.c23
-rw-r--r--net/mac80211/util.c4
-rw-r--r--net/wireless/scan.c9
5 files changed, 31 insertions, 24 deletions
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 49b1abd2fe97..afa8e0ac27a7 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -115,7 +115,6 @@
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 7
119 118
120#define IEEE80211_QOS_CTL_LEN 2 119#define IEEE80211_QOS_CTL_LEN 2
121#define IEEE80211_QOS_CTL_TID_MASK 0x000F 120#define IEEE80211_QOS_CTL_TID_MASK 0x000F
@@ -555,6 +554,21 @@ struct ieee80211_tim_ie {
555} __attribute__ ((packed)); 554} __attribute__ ((packed));
556 555
557/** 556/**
557 * struct ieee80211_meshconf_ie
558 *
559 * This structure refers to "Mesh Configuration information element"
560 */
561struct ieee80211_meshconf_ie {
562 u8 meshconf_psel;
563 u8 meshconf_pmetric;
564 u8 meshconf_congest;
565 u8 meshconf_synch;
566 u8 meshconf_auth;
567 u8 meshconf_form;
568 u8 meshconf_cap;
569} __attribute__ ((packed));
570
571/**
558 * struct ieee80211_rann_ie 572 * struct ieee80211_rann_ie
559 * 573 *
560 * This structure refers to "Root Announcement information element" 574 * This structure refers to "Root Announcement information element"
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 */
106bool mesh_peer_accepts_plinks(struct ieee802_11_elems *ie) 99bool 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
231static int cmp_bss(struct cfg80211_bss *a, 232static 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)