Unify association request interface by having the madwifi private IOCTL translate to the wireless extensions interface.

git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@3405 0192ed92-7a03-0410-a25b-9323aeb14dbd
This commit is contained in:
mentor 2008-03-26 00:02:26 +00:00
parent 545cf26ad4
commit 5cbfbae447

View File

@ -510,7 +510,8 @@ ieee80211_ioctl_siwap(struct net_device *dev, struct iw_request_info *info,
*/ */
vap->iv_flags &= ~IEEE80211_F_DESBSSID; vap->iv_flags &= ~IEEE80211_F_DESBSSID;
if (!IEEE80211_ADDR_NULL(&ap_addr->sa_data)) { if (!IEEE80211_ADDR_NULL(&ap_addr->sa_data)) {
if (!IEEE80211_ADDR_EQ(vap->iv_des_bssid, (u_int8_t*) "\xff\xff\xff\xff\xff\xff")) if (!IEEE80211_ADDR_EQ(vap->iv_des_bssid,
(uint8_t[8]){0xff}))
vap->iv_flags |= IEEE80211_F_DESBSSID; vap->iv_flags |= IEEE80211_F_DESBSSID;
IEEE80211_ADDR_COPY(vap->iv_des_bssid, &ap_addr->sa_data); IEEE80211_ADDR_COPY(vap->iv_des_bssid, &ap_addr->sa_data);
@ -3638,27 +3639,6 @@ struct scanlookup { /* XXX: right place for declaration? */
const struct ieee80211_scan_entry *se; const struct ieee80211_scan_entry *se;
}; };
/*
* Match mac address and any ssid.
*/
static int
mlmelookup(void *arg, const struct ieee80211_scan_entry *se)
{
struct scanlookup *look = arg;
if (!IEEE80211_ADDR_EQ(look->mac, se->se_macaddr))
return 0;
if (look->esslen != 0) {
if (se->se_ssid[1] != look->esslen)
return 0;
if (memcmp(look->essid, se->se_ssid + 2, look->esslen))
return 0;
}
look->se = se;
return 0;
}
static int static int
ieee80211_ioctl_setmlme(struct net_device *dev, struct iw_request_info *info, ieee80211_ioctl_setmlme(struct net_device *dev, struct iw_request_info *info,
void *w, char *extra) void *w, char *extra)
@ -3681,25 +3661,10 @@ ieee80211_ioctl_setmlme(struct net_device *dev, struct iw_request_info *info,
switch (mlme->im_op) { switch (mlme->im_op) {
case IEEE80211_MLME_ASSOC: case IEEE80211_MLME_ASSOC:
if (vap->iv_opmode == IEEE80211_M_STA) { if (vap->iv_opmode == IEEE80211_M_STA) {
struct scanlookup lookup; struct sockaddr ap_addr;
memset(&ap_addr, 0, sizeof(ap_addr));
lookup.se = NULL; IEEE80211_ADDR_COPY(ap_addr.sa_data, mlme->im_macaddr);
lookup.mac = mlme->im_macaddr; return ieee80211_ioctl_siwap(dev, NULL, &ap_addr, NULL);
/* XXX use revised api w/ explicit ssid */
lookup.esslen = vap->iv_des_ssid[0].len;
lookup.essid = vap->iv_des_ssid[0].ssid;
ieee80211_scan_iterate(ic, mlmelookup, &lookup);
if (lookup.se != NULL) {
vap->iv_nsdone = 0;
vap->iv_nsparams.result = 0;
if (ieee80211_sta_join(vap, lookup.se))
while (!vap->iv_nsdone)
IEEE80211_RESCHEDULE();
if (!vap->iv_nsparams.result)
return 0;
return -EINVAL;
} else
return -ENOENT;
} else } else
return -EOPNOTSUPP; return -EOPNOTSUPP;
case IEEE80211_MLME_DISASSOC: case IEEE80211_MLME_DISASSOC: