Skip to content

Commit

Permalink
cfg80211: managed mode wext compatibility
Browse files Browse the repository at this point in the history
This adds code to make it possible to use the cfg80211
connect() API with wireless extensions, and because the
previous patch added emulation of that API with auth()
and assoc(), by extension also supports wext on that.
At the same time, removes code from mac80211 for wext,
but doesn't yet clean up mac80211's mlme code more.

Signed-off-by: Samuel Ortiz <samuel.ortiz@intel.com>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Johannes Berg authored and John W. Linville committed Jul 10, 2009
1 parent 6829c87 commit f212935
Show file tree
Hide file tree
Showing 10 changed files with 625 additions and 338 deletions.
36 changes: 35 additions & 1 deletion include/net/cfg80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -1253,8 +1253,14 @@ struct wireless_dev {
#ifdef CONFIG_WIRELESS_EXT
/* wext data */
struct {
struct cfg80211_ibss_params ibss;
union {
struct cfg80211_ibss_params ibss;
struct cfg80211_connect_params connect;
};
u8 *ie;
size_t ie_len;
u8 bssid[ETH_ALEN];
u8 ssid[IEEE80211_MAX_SSID_LEN];
s8 default_key, default_mgmt_key;
} wext;
#endif
Expand Down Expand Up @@ -1535,6 +1541,34 @@ int cfg80211_ibss_wext_giwap(struct net_device *dev,
struct iw_request_info *info,
struct sockaddr *ap_addr, char *extra);

int cfg80211_mgd_wext_siwfreq(struct net_device *dev,
struct iw_request_info *info,
struct iw_freq *freq, char *extra);
int cfg80211_mgd_wext_giwfreq(struct net_device *dev,
struct iw_request_info *info,
struct iw_freq *freq, char *extra);
int cfg80211_mgd_wext_siwessid(struct net_device *dev,
struct iw_request_info *info,
struct iw_point *data, char *ssid);
int cfg80211_mgd_wext_giwessid(struct net_device *dev,
struct iw_request_info *info,
struct iw_point *data, char *ssid);
int cfg80211_mgd_wext_siwap(struct net_device *dev,
struct iw_request_info *info,
struct sockaddr *ap_addr, char *extra);
int cfg80211_mgd_wext_giwap(struct net_device *dev,
struct iw_request_info *info,
struct sockaddr *ap_addr, char *extra);
int cfg80211_wext_siwgenie(struct net_device *dev,
struct iw_request_info *info,
struct iw_point *data, char *extra);
int cfg80211_wext_siwauth(struct net_device *dev,
struct iw_request_info *info,
struct iw_param *data, char *extra);
int cfg80211_wext_giwauth(struct net_device *dev,
struct iw_request_info *info,
struct iw_param *data, char *extra);

struct ieee80211_channel *cfg80211_wext_freq(struct wiphy *wiphy,
struct iw_freq *freq);

Expand Down
69 changes: 0 additions & 69 deletions net/mac80211/mlme.c
Original file line number Diff line number Diff line change
Expand Up @@ -870,70 +870,6 @@ static u32 ieee80211_handle_bss_capability(struct ieee80211_sub_if_data *sdata,
return changed;
}

static void ieee80211_sta_send_apinfo(struct ieee80211_sub_if_data *sdata)
{
union iwreq_data wrqu;

memset(&wrqu, 0, sizeof(wrqu));
if (sdata->u.mgd.flags & IEEE80211_STA_ASSOCIATED)
memcpy(wrqu.ap_addr.sa_data, sdata->u.mgd.bssid, ETH_ALEN);
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
wireless_send_event(sdata->dev, SIOCGIWAP, &wrqu, NULL);
}

static void ieee80211_sta_send_associnfo(struct ieee80211_sub_if_data *sdata)
{
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
char *buf;
size_t len;
int i;
union iwreq_data wrqu;

if (!ifmgd->assocreq_ies && !ifmgd->assocresp_ies)
return;

buf = kmalloc(50 + 2 * (ifmgd->assocreq_ies_len +
ifmgd->assocresp_ies_len), GFP_KERNEL);
if (!buf)
return;

len = sprintf(buf, "ASSOCINFO(");
if (ifmgd->assocreq_ies) {
len += sprintf(buf + len, "ReqIEs=");
for (i = 0; i < ifmgd->assocreq_ies_len; i++) {
len += sprintf(buf + len, "%02x",
ifmgd->assocreq_ies[i]);
}
}
if (ifmgd->assocresp_ies) {
if (ifmgd->assocreq_ies)
len += sprintf(buf + len, " ");
len += sprintf(buf + len, "RespIEs=");
for (i = 0; i < ifmgd->assocresp_ies_len; i++) {
len += sprintf(buf + len, "%02x",
ifmgd->assocresp_ies[i]);
}
}
len += sprintf(buf + len, ")");

if (len > IW_CUSTOM_MAX) {
len = sprintf(buf, "ASSOCRESPIE=");
for (i = 0; i < ifmgd->assocresp_ies_len; i++) {
len += sprintf(buf + len, "%02x",
ifmgd->assocresp_ies[i]);
}
}

if (len <= IW_CUSTOM_MAX) {
memset(&wrqu, 0, sizeof(wrqu));
wrqu.data.length = len;
wireless_send_event(sdata->dev, IWEVCUSTOM, &wrqu, buf);
}

kfree(buf);
}


static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
u32 bss_info_changed)
{
Expand Down Expand Up @@ -966,7 +902,6 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,

ifmgd->flags |= IEEE80211_STA_PREV_BSSID_SET;
memcpy(ifmgd->prev_bssid, sdata->u.mgd.bssid, ETH_ALEN);
ieee80211_sta_send_associnfo(sdata);

ifmgd->last_probe = jiffies;
ieee80211_led_assoc(local, 1);
Expand All @@ -993,8 +928,6 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,

netif_tx_start_all_queues(sdata->dev);
netif_carrier_on(sdata->dev);

ieee80211_sta_send_apinfo(sdata);
}

static void ieee80211_direct_probe(struct ieee80211_sub_if_data *sdata)
Expand Down Expand Up @@ -1147,8 +1080,6 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
changed |= BSS_CHANGED_ASSOC;
sdata->vif.bss_conf.assoc = false;

ieee80211_sta_send_apinfo(sdata);

if (self_disconnected || reason == WLAN_REASON_DISASSOC_STA_HAS_LEFT) {
ifmgd->state = IEEE80211_STA_MLME_DISABLED;
ieee80211_rx_bss_remove(sdata, ifmgd->bssid,
Expand Down
Loading

0 comments on commit f212935

Please sign in to comment.