aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2010-01-26 08:15:46 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-01-26 11:53:20 -0500
commitc21dbf9214bce129f92e1af05552553ff0e318ed (patch)
tree23f57010f34fc26ecf1d349a118f977afea418e4 /net/wireless
parent18c949070b57d2cbcc0b25c5cfa003ece204e468 (diff)
cfg80211: export cfg80211_find_ie
This new function (previously a static function called just "find_ie" can be used to find a specific IE in a buffer of IEs. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/scan.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index 06b0231ee5e3..978cac3414b5 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -143,9 +143,9 @@ void cfg80211_bss_expire(struct cfg80211_registered_device *dev)
143 dev->bss_generation++; 143 dev->bss_generation++;
144} 144}
145 145
146static u8 *find_ie(u8 num, u8 *ies, int len) 146const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)
147{ 147{
148 while (len > 2 && ies[0] != num) { 148 while (len > 2 && ies[0] != eid) {
149 len -= ies[1] + 2; 149 len -= ies[1] + 2;
150 ies += ies[1] + 2; 150 ies += ies[1] + 2;
151 } 151 }
@@ -155,11 +155,12 @@ static u8 *find_ie(u8 num, u8 *ies, int len)
155 return NULL; 155 return NULL;
156 return ies; 156 return ies;
157} 157}
158EXPORT_SYMBOL(cfg80211_find_ie);
158 159
159static int cmp_ies(u8 num, u8 *ies1, size_t len1, u8 *ies2, size_t len2) 160static int cmp_ies(u8 num, u8 *ies1, size_t len1, u8 *ies2, size_t len2)
160{ 161{
161 const u8 *ie1 = find_ie(num, ies1, len1); 162 const u8 *ie1 = cfg80211_find_ie(num, ies1, len1);
162 const u8 *ie2 = find_ie(num, ies2, len2); 163 const u8 *ie2 = cfg80211_find_ie(num, ies2, len2);
163 int r; 164 int r;
164 165
165 if (!ie1 && !ie2) 166 if (!ie1 && !ie2)
@@ -185,9 +186,9 @@ static bool is_bss(struct cfg80211_bss *a,
185 if (!ssid) 186 if (!ssid)
186 return true; 187 return true;
187 188
188 ssidie = find_ie(WLAN_EID_SSID, 189 ssidie = cfg80211_find_ie(WLAN_EID_SSID,
189 a->information_elements, 190 a->information_elements,
190 a->len_information_elements); 191 a->len_information_elements);
191 if (!ssidie) 192 if (!ssidie)
192 return false; 193 return false;
193 if (ssidie[1] != ssid_len) 194 if (ssidie[1] != ssid_len)
@@ -204,9 +205,9 @@ static bool is_mesh(struct cfg80211_bss *a,
204 if (!is_zero_ether_addr(a->bssid)) 205 if (!is_zero_ether_addr(a->bssid))
205 return false; 206 return false;
206 207
207 ie = find_ie(WLAN_EID_MESH_ID, 208 ie = cfg80211_find_ie(WLAN_EID_MESH_ID,
208 a->information_elements, 209 a->information_elements,
209 a->len_information_elements); 210 a->len_information_elements);
210 if (!ie) 211 if (!ie)
211 return false; 212 return false;
212 if (ie[1] != meshidlen) 213 if (ie[1] != meshidlen)
@@ -214,9 +215,9 @@ static bool is_mesh(struct cfg80211_bss *a,
214 if (memcmp(ie + 2, meshid, meshidlen)) 215 if (memcmp(ie + 2, meshid, meshidlen))
215 return false; 216 return false;
216 217
217 ie = find_ie(WLAN_EID_MESH_CONFIG, 218 ie = cfg80211_find_ie(WLAN_EID_MESH_CONFIG,
218 a->information_elements, 219 a->information_elements,
219 a->len_information_elements); 220 a->len_information_elements);
220 if (!ie) 221 if (!ie)
221 return false; 222 return false;
222 if (ie[1] != sizeof(struct ieee80211_meshconf_ie)) 223 if (ie[1] != sizeof(struct ieee80211_meshconf_ie))
@@ -395,11 +396,12 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
395 396
396 if (is_zero_ether_addr(res->pub.bssid)) { 397 if (is_zero_ether_addr(res->pub.bssid)) {
397 /* must be mesh, verify */ 398 /* must be mesh, verify */
398 meshid = find_ie(WLAN_EID_MESH_ID, res->pub.information_elements, 399 meshid = cfg80211_find_ie(WLAN_EID_MESH_ID,
399 res->pub.len_information_elements); 400 res->pub.information_elements,
400 meshcfg = find_ie(WLAN_EID_MESH_CONFIG, 401 res->pub.len_information_elements);
401 res->pub.information_elements, 402 meshcfg = cfg80211_find_ie(WLAN_EID_MESH_CONFIG,
402 res->pub.len_information_elements); 403 res->pub.information_elements,
404 res->pub.len_information_elements);
403 if (!meshid || !meshcfg || 405 if (!meshid || !meshcfg ||
404 meshcfg[1] != sizeof(struct ieee80211_meshconf_ie)) { 406 meshcfg[1] != sizeof(struct ieee80211_meshconf_ie)) {
405 /* bogus mesh */ 407 /* bogus mesh */