Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 315229
b: refs/heads/master
c: ea4c12f
h: refs/heads/master
i:
  315227: 283431e
v: v3
  • Loading branch information
Avinash Patil authored and John W. Linville committed Jul 9, 2012
1 parent fffe6b4 commit 5b691e1
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 55 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: adb6ed0c5a8b906b3d75f4d0b1b2e252795029c0
refs/heads/master: ea4c12f02b826221510d3040469f3f8bca921d6a
119 changes: 65 additions & 54 deletions trunk/drivers/net/wireless/mwifiex/ie.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,62 +217,17 @@ mwifiex_update_uap_custom_ie(struct mwifiex_private *priv,
return ret;
}

/* This function parses different IEs- Tail IEs, beacon IEs, probe response IEs,
* association response IEs from cfg80211_ap_settings function and sets these IE
* to FW.
/* This function parses beacon IEs, probe response IEs, association response IEs
* from cfg80211_ap_settings->beacon and sets these IE to FW.
*/
int mwifiex_set_mgmt_ies(struct mwifiex_private *priv,
struct cfg80211_beacon_data *data)
static int mwifiex_set_mgmt_beacon_data_ies(struct mwifiex_private *priv,
struct cfg80211_beacon_data *data)
{
struct mwifiex_ie *beacon_ie = NULL, *pr_ie = NULL;
struct mwifiex_ie *ar_ie = NULL, *gen_ie = NULL;
struct ieee_types_header *rsn_ie = NULL, *wpa_ie = NULL;
struct mwifiex_ie *beacon_ie = NULL, *pr_ie = NULL, *ar_ie = NULL;
u16 beacon_idx = MWIFIEX_AUTO_IDX_MASK, pr_idx = MWIFIEX_AUTO_IDX_MASK;
u16 ar_idx = MWIFIEX_AUTO_IDX_MASK, rsn_idx = MWIFIEX_AUTO_IDX_MASK;
u16 mask, ie_len = 0;
const u8 *vendor_ie;
u16 ar_idx = MWIFIEX_AUTO_IDX_MASK;
int ret = 0;

if (data->tail && data->tail_len) {
gen_ie = kzalloc(sizeof(struct mwifiex_ie), GFP_KERNEL);
if (!gen_ie)
return -ENOMEM;
gen_ie->ie_index = cpu_to_le16(rsn_idx);
mask = MGMT_MASK_BEACON | MGMT_MASK_PROBE_RESP |
MGMT_MASK_ASSOC_RESP;
gen_ie->mgmt_subtype_mask = cpu_to_le16(mask);

rsn_ie = (void *)cfg80211_find_ie(WLAN_EID_RSN,
data->tail, data->tail_len);
if (rsn_ie) {
memcpy(gen_ie->ie_buffer, rsn_ie, rsn_ie->len + 2);
ie_len = rsn_ie->len + 2;
gen_ie->ie_length = cpu_to_le16(ie_len);
}

vendor_ie = cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT,
WLAN_OUI_TYPE_MICROSOFT_WPA,
data->tail, data->tail_len);
if (vendor_ie) {
wpa_ie = (struct ieee_types_header *)vendor_ie;
memcpy(gen_ie->ie_buffer + ie_len,
wpa_ie, wpa_ie->len + 2);
ie_len += wpa_ie->len + 2;
gen_ie->ie_length = cpu_to_le16(ie_len);
}

if (rsn_ie || wpa_ie) {
if (mwifiex_update_uap_custom_ie(priv, gen_ie, &rsn_idx,
NULL, NULL,
NULL, NULL)) {
ret = -1;
goto done;
}

priv->rsn_idx = rsn_idx;
}
}

if (data->beacon_ies && data->beacon_ies_len) {
beacon_ie = kmalloc(sizeof(struct mwifiex_ie), GFP_KERNEL);
if (!beacon_ie) {
Expand Down Expand Up @@ -309,8 +264,8 @@ int mwifiex_set_mgmt_ies(struct mwifiex_private *priv,
}

ar_ie->ie_index = cpu_to_le16(ar_idx);
mask = MGMT_MASK_ASSOC_RESP | MGMT_MASK_REASSOC_RESP;
ar_ie->mgmt_subtype_mask = cpu_to_le16(mask);
ar_ie->mgmt_subtype_mask = cpu_to_le16(MGMT_MASK_ASSOC_RESP |
MGMT_MASK_REASSOC_RESP);
ar_ie->ie_length = cpu_to_le16(data->assocresp_ies_len);
memcpy(ar_ie->ie_buffer, data->assocresp_ies,
data->assocresp_ies_len);
Expand All @@ -332,11 +287,67 @@ int mwifiex_set_mgmt_ies(struct mwifiex_private *priv,
kfree(beacon_ie);
kfree(pr_ie);
kfree(ar_ie);
kfree(gen_ie);

return ret;
}

/* This function parses different IEs-tail IEs, beacon IEs, probe response IEs,
* association response IEs from cfg80211_ap_settings function and sets these IE
* to FW.
*/
int mwifiex_set_mgmt_ies(struct mwifiex_private *priv,
struct cfg80211_beacon_data *info)
{
struct mwifiex_ie *gen_ie;
struct ieee_types_header *rsn_ie, *wpa_ie = NULL;
u16 rsn_idx = MWIFIEX_AUTO_IDX_MASK, ie_len = 0;
const u8 *vendor_ie;

if (info->tail && info->tail_len) {
gen_ie = kzalloc(sizeof(struct mwifiex_ie), GFP_KERNEL);
if (!gen_ie)
return -ENOMEM;
gen_ie->ie_index = cpu_to_le16(rsn_idx);
gen_ie->mgmt_subtype_mask = cpu_to_le16(MGMT_MASK_BEACON |
MGMT_MASK_PROBE_RESP |
MGMT_MASK_ASSOC_RESP);

rsn_ie = (void *)cfg80211_find_ie(WLAN_EID_RSN,
info->tail, info->tail_len);
if (rsn_ie) {
memcpy(gen_ie->ie_buffer, rsn_ie, rsn_ie->len + 2);
ie_len = rsn_ie->len + 2;
gen_ie->ie_length = cpu_to_le16(ie_len);
}

vendor_ie = cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT,
WLAN_OUI_TYPE_MICROSOFT_WPA,
info->tail,
info->tail_len);
if (vendor_ie) {
wpa_ie = (struct ieee_types_header *)vendor_ie;
memcpy(gen_ie->ie_buffer + ie_len,
wpa_ie, wpa_ie->len + 2);
ie_len += wpa_ie->len + 2;
gen_ie->ie_length = cpu_to_le16(ie_len);
}

if (rsn_ie || wpa_ie) {
if (mwifiex_update_uap_custom_ie(priv, gen_ie, &rsn_idx,
NULL, NULL,
NULL, NULL)) {
kfree(gen_ie);
return -1;
}
priv->rsn_idx = rsn_idx;
}

kfree(gen_ie);
}

return mwifiex_set_mgmt_beacon_data_ies(priv, info);
}

/* This function removes management IE set */
int mwifiex_del_mgmt_ies(struct mwifiex_private *priv)
{
Expand Down

0 comments on commit 5b691e1

Please sign in to comment.