mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-11 23:50:25 +00:00
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>
This commit is contained in:
parent
18c949070b
commit
c21dbf9214
@ -1658,6 +1658,22 @@ void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
|
|||||||
*/
|
*/
|
||||||
unsigned int cfg80211_classify8021d(struct sk_buff *skb);
|
unsigned int cfg80211_classify8021d(struct sk_buff *skb);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cfg80211_find_ie - find information element in data
|
||||||
|
*
|
||||||
|
* @eid: element ID
|
||||||
|
* @ies: data consisting of IEs
|
||||||
|
* @len: length of data
|
||||||
|
*
|
||||||
|
* This function will return %NULL if the element ID could
|
||||||
|
* not be found or if the element is invalid (claims to be
|
||||||
|
* longer than the given data), or a pointer to the first byte
|
||||||
|
* of the requested element, that is the byte containing the
|
||||||
|
* element ID. There are no checks on the element length
|
||||||
|
* other than having to fit into the given data.
|
||||||
|
*/
|
||||||
|
const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Regulatory helper functions for wiphys
|
* Regulatory helper functions for wiphys
|
||||||
*/
|
*/
|
||||||
|
@ -143,9 +143,9 @@ void cfg80211_bss_expire(struct cfg80211_registered_device *dev)
|
|||||||
dev->bss_generation++;
|
dev->bss_generation++;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 *find_ie(u8 num, u8 *ies, int len)
|
const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)
|
||||||
{
|
{
|
||||||
while (len > 2 && ies[0] != num) {
|
while (len > 2 && ies[0] != eid) {
|
||||||
len -= ies[1] + 2;
|
len -= ies[1] + 2;
|
||||||
ies += ies[1] + 2;
|
ies += ies[1] + 2;
|
||||||
}
|
}
|
||||||
@ -155,11 +155,12 @@ static u8 *find_ie(u8 num, u8 *ies, int len)
|
|||||||
return NULL;
|
return NULL;
|
||||||
return ies;
|
return ies;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(cfg80211_find_ie);
|
||||||
|
|
||||||
static int cmp_ies(u8 num, u8 *ies1, size_t len1, u8 *ies2, size_t len2)
|
static int cmp_ies(u8 num, u8 *ies1, size_t len1, u8 *ies2, size_t len2)
|
||||||
{
|
{
|
||||||
const u8 *ie1 = find_ie(num, ies1, len1);
|
const u8 *ie1 = cfg80211_find_ie(num, ies1, len1);
|
||||||
const u8 *ie2 = find_ie(num, ies2, len2);
|
const u8 *ie2 = cfg80211_find_ie(num, ies2, len2);
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
if (!ie1 && !ie2)
|
if (!ie1 && !ie2)
|
||||||
@ -185,7 +186,7 @@ static bool is_bss(struct cfg80211_bss *a,
|
|||||||
if (!ssid)
|
if (!ssid)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
ssidie = find_ie(WLAN_EID_SSID,
|
ssidie = cfg80211_find_ie(WLAN_EID_SSID,
|
||||||
a->information_elements,
|
a->information_elements,
|
||||||
a->len_information_elements);
|
a->len_information_elements);
|
||||||
if (!ssidie)
|
if (!ssidie)
|
||||||
@ -204,7 +205,7 @@ static bool is_mesh(struct cfg80211_bss *a,
|
|||||||
if (!is_zero_ether_addr(a->bssid))
|
if (!is_zero_ether_addr(a->bssid))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ie = find_ie(WLAN_EID_MESH_ID,
|
ie = cfg80211_find_ie(WLAN_EID_MESH_ID,
|
||||||
a->information_elements,
|
a->information_elements,
|
||||||
a->len_information_elements);
|
a->len_information_elements);
|
||||||
if (!ie)
|
if (!ie)
|
||||||
@ -214,7 +215,7 @@ static bool is_mesh(struct cfg80211_bss *a,
|
|||||||
if (memcmp(ie + 2, meshid, meshidlen))
|
if (memcmp(ie + 2, meshid, meshidlen))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ie = find_ie(WLAN_EID_MESH_CONFIG,
|
ie = cfg80211_find_ie(WLAN_EID_MESH_CONFIG,
|
||||||
a->information_elements,
|
a->information_elements,
|
||||||
a->len_information_elements);
|
a->len_information_elements);
|
||||||
if (!ie)
|
if (!ie)
|
||||||
@ -395,9 +396,10 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
|
|||||||
|
|
||||||
if (is_zero_ether_addr(res->pub.bssid)) {
|
if (is_zero_ether_addr(res->pub.bssid)) {
|
||||||
/* must be mesh, verify */
|
/* must be mesh, verify */
|
||||||
meshid = find_ie(WLAN_EID_MESH_ID, res->pub.information_elements,
|
meshid = cfg80211_find_ie(WLAN_EID_MESH_ID,
|
||||||
|
res->pub.information_elements,
|
||||||
res->pub.len_information_elements);
|
res->pub.len_information_elements);
|
||||||
meshcfg = find_ie(WLAN_EID_MESH_CONFIG,
|
meshcfg = cfg80211_find_ie(WLAN_EID_MESH_CONFIG,
|
||||||
res->pub.information_elements,
|
res->pub.information_elements,
|
||||||
res->pub.len_information_elements);
|
res->pub.len_information_elements);
|
||||||
if (!meshid || !meshcfg ||
|
if (!meshid || !meshcfg ||
|
||||||
|
Loading…
x
Reference in New Issue
Block a user