2009-06-13 11:38:31 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*
|
|
|
|
* File: iwctl.c
|
|
|
|
*
|
|
|
|
* Purpose: wireless ext & ioctl functions
|
|
|
|
*
|
|
|
|
* Author: Lyndon Chen
|
|
|
|
*
|
|
|
|
* Date: July 5, 2006
|
|
|
|
*
|
|
|
|
* Functions:
|
|
|
|
*
|
|
|
|
* Revision History:
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "device.h"
|
2012-11-24 14:22:08 +00:00
|
|
|
#include "iwctl.h"
|
2009-06-13 11:38:31 +00:00
|
|
|
#include "mac.h"
|
|
|
|
#include "card.h"
|
|
|
|
#include "hostap.h"
|
|
|
|
#include "power.h"
|
|
|
|
#include "rf.h"
|
|
|
|
#include "iowpa.h"
|
|
|
|
#include "wpactl.h"
|
2012-11-24 14:22:08 +00:00
|
|
|
#include "control.h"
|
|
|
|
#include "rndis.h"
|
2009-06-13 11:38:31 +00:00
|
|
|
|
|
|
|
static const long frequency_list[] = {
|
2012-06-24 23:56:15 +00:00
|
|
|
2412, 2417, 2422, 2427, 2432, 2437, 2442, 2447, 2452, 2457, 2462, 2467, 2472, 2484,
|
|
|
|
4915, 4920, 4925, 4935, 4940, 4945, 4960, 4980,
|
|
|
|
5035, 5040, 5045, 5055, 5060, 5080, 5170, 5180, 5190, 5200, 5210, 5220, 5230, 5240,
|
|
|
|
5260, 5280, 5300, 5320, 5500, 5520, 5540, 5560, 5580, 5600, 5620, 5640, 5660, 5680,
|
|
|
|
5700, 5745, 5765, 5785, 5805, 5825
|
|
|
|
};
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-06-24 23:56:43 +00:00
|
|
|
static int msglevel = MSG_LEVEL_INFO;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
|
|
|
struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev)
|
|
|
|
{
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_private *pDevice = netdev_priv(dev);
|
2009-06-13 11:38:31 +00:00
|
|
|
long ldBm;
|
|
|
|
|
|
|
|
pDevice->wstats.status = pDevice->eOPMode;
|
2013-02-26 01:32:51 +00:00
|
|
|
RFvRSSITodBm(pDevice, (u8)(pDevice->uCurrRSSI), &ldBm);
|
2009-06-13 11:38:31 +00:00
|
|
|
pDevice->wstats.qual.level = ldBm;
|
|
|
|
pDevice->wstats.qual.noise = 0;
|
|
|
|
pDevice->wstats.qual.updated = 1;
|
|
|
|
pDevice->wstats.discard.nwid = 0;
|
|
|
|
pDevice->wstats.discard.code = 0;
|
|
|
|
pDevice->wstats.discard.fragment = 0;
|
|
|
|
pDevice->wstats.discard.misc = 0;
|
|
|
|
pDevice->wstats.miss.beacon = 0;
|
|
|
|
return &pDevice->wstats;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2012-06-24 23:57:27 +00:00
|
|
|
* Wireless Handler: get protocol name
|
2009-06-13 11:38:31 +00:00
|
|
|
*/
|
2012-06-24 23:56:05 +00:00
|
|
|
int iwctl_giwname(struct net_device *dev, struct iw_request_info *info,
|
2012-11-24 14:22:08 +00:00
|
|
|
union iwreq_data *wrqu, char *extra)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2012-11-24 14:22:08 +00:00
|
|
|
strcpy(wrqu->name, "802.11-a/b/g");
|
2009-06-13 11:38:31 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2012-06-24 23:57:27 +00:00
|
|
|
* Wireless Handler: set scan
|
2009-06-13 11:38:31 +00:00
|
|
|
*/
|
2012-06-24 23:56:05 +00:00
|
|
|
int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info,
|
2012-11-24 14:22:08 +00:00
|
|
|
union iwreq_data *wrqu, char *extra)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_private *pDevice = netdev_priv(dev);
|
2012-11-24 14:22:08 +00:00
|
|
|
struct iw_point *wrq = &wrqu->data;
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
2012-06-24 23:56:43 +00:00
|
|
|
struct iw_scan_req *req = (struct iw_scan_req *)extra;
|
2013-02-26 01:32:51 +00:00
|
|
|
u8 abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
|
2012-07-08 22:58:36 +00:00
|
|
|
PWLAN_IE_SSID pItemSSID = NULL;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-06-24 23:56:15 +00:00
|
|
|
if (!(pDevice->flags & DEVICE_FLAGS_OPENED))
|
|
|
|
return -EINVAL;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-11-24 14:22:08 +00:00
|
|
|
PRINT_K(" SIOCSIWSCAN\n");
|
|
|
|
|
|
|
|
if (pMgmt == NULL)
|
|
|
|
return -EFAULT;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-06-24 23:56:15 +00:00
|
|
|
if (pMgmt->eScanState == WMAC_IS_SCANNING) {
|
|
|
|
// In scanning..
|
|
|
|
PRINT_K("SIOCSIWSCAN(overlap??)-->In scanning...\n");
|
|
|
|
return -EAGAIN;
|
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-06-24 23:57:27 +00:00
|
|
|
if (pDevice->byReAssocCount > 0) { // reject scan when re-associating!
|
|
|
|
// send scan event to wpa_Supplicant
|
2012-06-24 23:56:15 +00:00
|
|
|
union iwreq_data wrqu;
|
|
|
|
PRINT_K("wireless_send_event--->SIOCGIWSCAN(scan done)\n");
|
|
|
|
memset(&wrqu, 0, sizeof(wrqu));
|
|
|
|
wireless_send_event(pDevice->dev, SIOCGIWSCAN, &wrqu, NULL);
|
|
|
|
return 0;
|
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
|
|
|
|
spin_lock_irq(&pDevice->lock);
|
|
|
|
|
2012-06-24 23:57:13 +00:00
|
|
|
BSSvClearBSSList((void *)pDevice, pDevice->bLinkPass);
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-06-24 23:57:27 +00:00
|
|
|
// mike add: active scan OR passive scan OR desire_ssid scan
|
2012-06-24 23:57:20 +00:00
|
|
|
if (wrq->length == sizeof(struct iw_scan_req)) {
|
2012-06-24 23:57:48 +00:00
|
|
|
if (wrq->flags & IW_SCAN_THIS_ESSID) { // desire_ssid scan
|
2012-06-24 23:56:15 +00:00
|
|
|
memset(abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
|
|
|
|
pItemSSID = (PWLAN_IE_SSID)abyScanSSID;
|
|
|
|
pItemSSID->byElementID = WLAN_EID_SSID;
|
|
|
|
memcpy(pItemSSID->abySSID, req->essid, (int)req->essid_len);
|
2012-11-24 14:50:00 +00:00
|
|
|
if (pItemSSID->abySSID[req->essid_len] == '\0') {
|
2012-06-24 23:57:39 +00:00
|
|
|
if (req->essid_len > 0)
|
2012-11-24 14:50:00 +00:00
|
|
|
pItemSSID->len = req->essid_len;
|
2012-07-08 22:58:52 +00:00
|
|
|
} else {
|
2012-06-24 23:56:15 +00:00
|
|
|
pItemSSID->len = req->essid_len;
|
2012-07-08 22:58:52 +00:00
|
|
|
}
|
2012-06-24 23:56:15 +00:00
|
|
|
pMgmt->eScanType = WMAC_SCAN_PASSIVE;
|
2012-06-24 23:57:39 +00:00
|
|
|
PRINT_K("SIOCSIWSCAN:[desired_ssid=%s,len=%d]\n", ((PWLAN_IE_SSID)abyScanSSID)->abySSID,
|
2012-06-24 23:56:15 +00:00
|
|
|
((PWLAN_IE_SSID)abyScanSSID)->len);
|
2012-06-24 23:57:13 +00:00
|
|
|
bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, abyScanSSID);
|
2012-06-24 23:56:15 +00:00
|
|
|
spin_unlock_irq(&pDevice->lock);
|
|
|
|
|
|
|
|
return 0;
|
2012-06-24 23:57:48 +00:00
|
|
|
} else if (req->scan_type == IW_SCAN_TYPE_PASSIVE) { // passive scan
|
2012-06-24 23:56:15 +00:00
|
|
|
pMgmt->eScanType = WMAC_SCAN_PASSIVE;
|
|
|
|
}
|
2012-06-24 23:57:48 +00:00
|
|
|
} else { // active scan
|
2012-06-24 23:56:15 +00:00
|
|
|
pMgmt->eScanType = WMAC_SCAN_ACTIVE;
|
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-06-24 23:56:15 +00:00
|
|
|
pMgmt->eScanType = WMAC_SCAN_PASSIVE;
|
2012-06-24 23:57:13 +00:00
|
|
|
bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, NULL);
|
2009-06-13 11:38:31 +00:00
|
|
|
spin_unlock_irq(&pDevice->lock);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Wireless Handler : get scan results
|
|
|
|
*/
|
2012-06-24 23:56:05 +00:00
|
|
|
int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info,
|
2012-11-24 14:22:08 +00:00
|
|
|
union iwreq_data *wrqu, char *extra)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2012-11-24 14:22:08 +00:00
|
|
|
struct iw_point *wrq = &wrqu->data;
|
2012-06-24 23:56:43 +00:00
|
|
|
int ii;
|
|
|
|
int jj;
|
|
|
|
int kk;
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_private *pDevice = netdev_priv(dev);
|
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
2012-06-24 23:56:43 +00:00
|
|
|
PKnownBSS pBSS;
|
|
|
|
PWLAN_IE_SSID pItemSSID;
|
|
|
|
PWLAN_IE_SUPP_RATES pSuppRates;
|
|
|
|
PWLAN_IE_SUPP_RATES pExtSuppRates;
|
2009-06-13 11:38:31 +00:00
|
|
|
char *current_ev = extra;
|
|
|
|
char *end_buf = extra + IW_SCAN_MAX_DATA;
|
|
|
|
char *current_val = NULL;
|
|
|
|
struct iw_event iwe;
|
|
|
|
long ldBm;
|
|
|
|
|
2012-06-24 23:56:15 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSCAN\n");
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-11-24 14:22:08 +00:00
|
|
|
if (pMgmt == NULL)
|
|
|
|
return -EFAULT;
|
|
|
|
|
2012-06-24 23:56:15 +00:00
|
|
|
if (pMgmt->eScanState == WMAC_IS_SCANNING) {
|
|
|
|
// In scanning..
|
2009-06-13 11:38:31 +00:00
|
|
|
return -EAGAIN;
|
|
|
|
}
|
|
|
|
pBSS = &(pMgmt->sBSSList[0]);
|
2013-10-15 19:46:40 +00:00
|
|
|
for (ii = 0, jj = 0; jj < MAX_BSS_NUM; jj++) {
|
2009-06-13 11:38:31 +00:00
|
|
|
if (current_ev >= end_buf)
|
|
|
|
break;
|
2012-06-24 23:56:15 +00:00
|
|
|
pBSS = &(pMgmt->sBSSList[jj]);
|
|
|
|
if (pBSS->bActive) {
|
2012-06-24 23:57:27 +00:00
|
|
|
// ADD mac address
|
2012-06-24 23:56:15 +00:00
|
|
|
memset(&iwe, 0, sizeof(iwe));
|
|
|
|
iwe.cmd = SIOCGIWAP;
|
|
|
|
iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
|
2009-06-13 11:38:31 +00:00
|
|
|
memcpy(iwe.u.ap_addr.sa_data, pBSS->abyBSSID, WLAN_BSSID_LEN);
|
2012-07-08 22:58:36 +00:00
|
|
|
current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_ADDR_LEN);
|
2012-06-24 23:57:27 +00:00
|
|
|
// ADD ssid
|
2012-06-24 23:56:15 +00:00
|
|
|
memset(&iwe, 0, sizeof(iwe));
|
|
|
|
iwe.cmd = SIOCGIWESSID;
|
|
|
|
pItemSSID = (PWLAN_IE_SSID)pBSS->abySSID;
|
|
|
|
iwe.u.data.length = pItemSSID->len;
|
|
|
|
iwe.u.data.flags = 1;
|
2012-06-24 23:57:39 +00:00
|
|
|
current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, pItemSSID->abySSID);
|
2012-06-24 23:57:27 +00:00
|
|
|
// ADD mode
|
2012-06-24 23:56:15 +00:00
|
|
|
memset(&iwe, 0, sizeof(iwe));
|
|
|
|
iwe.cmd = SIOCGIWMODE;
|
2012-06-24 23:57:48 +00:00
|
|
|
if (WLAN_GET_CAP_INFO_ESS(pBSS->wCapInfo))
|
2012-06-24 23:56:15 +00:00
|
|
|
iwe.u.mode = IW_MODE_INFRA;
|
2012-06-24 23:57:48 +00:00
|
|
|
else
|
2012-06-24 23:56:15 +00:00
|
|
|
iwe.u.mode = IW_MODE_ADHOC;
|
|
|
|
iwe.len = IW_EV_UINT_LEN;
|
2012-06-24 23:57:39 +00:00
|
|
|
current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_UINT_LEN);
|
2012-06-24 23:57:27 +00:00
|
|
|
// ADD frequency
|
2012-06-24 23:56:15 +00:00
|
|
|
pSuppRates = (PWLAN_IE_SUPP_RATES)pBSS->abySuppRates;
|
|
|
|
pExtSuppRates = (PWLAN_IE_SUPP_RATES)pBSS->abyExtSuppRates;
|
|
|
|
memset(&iwe, 0, sizeof(iwe));
|
|
|
|
iwe.cmd = SIOCGIWFREQ;
|
|
|
|
iwe.u.freq.m = pBSS->uChannel;
|
|
|
|
iwe.u.freq.e = 0;
|
|
|
|
iwe.u.freq.i = 0;
|
2013-10-15 19:46:40 +00:00
|
|
|
current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_FREQ_LEN);
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2012-06-24 23:56:15 +00:00
|
|
|
int f = (int)pBSS->uChannel - 1;
|
2012-06-24 23:57:32 +00:00
|
|
|
if (f < 0)
|
|
|
|
f = 0;
|
2012-06-24 23:56:15 +00:00
|
|
|
iwe.u.freq.m = frequency_list[f] * 100000;
|
|
|
|
iwe.u.freq.e = 1;
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
2012-06-24 23:57:39 +00:00
|
|
|
current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_FREQ_LEN);
|
2012-06-24 23:57:27 +00:00
|
|
|
// ADD quality
|
2012-06-24 23:56:15 +00:00
|
|
|
memset(&iwe, 0, sizeof(iwe));
|
|
|
|
iwe.cmd = IWEVQUAL;
|
2013-02-26 01:32:51 +00:00
|
|
|
RFvRSSITodBm(pDevice, (u8)(pBSS->uRSSI), &ldBm);
|
2012-06-24 23:56:15 +00:00
|
|
|
iwe.u.qual.level = ldBm;
|
|
|
|
iwe.u.qual.noise = 0;
|
2010-08-03 23:25:50 +00:00
|
|
|
|
2012-07-08 22:58:36 +00:00
|
|
|
if (-ldBm < 50)
|
2009-06-13 11:38:31 +00:00
|
|
|
iwe.u.qual.qual = 100;
|
2012-06-24 23:57:48 +00:00
|
|
|
else if (-ldBm > 90)
|
2012-06-24 23:56:15 +00:00
|
|
|
iwe.u.qual.qual = 0;
|
2012-06-24 23:57:48 +00:00
|
|
|
else
|
2012-06-24 23:57:39 +00:00
|
|
|
iwe.u.qual.qual = (40 - (-ldBm - 50)) * 100 / 40;
|
|
|
|
iwe.u.qual.updated = 7;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-06-24 23:57:39 +00:00
|
|
|
current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_QUAL_LEN);
|
2012-06-24 23:57:27 +00:00
|
|
|
// ADD encryption
|
2012-06-24 23:56:15 +00:00
|
|
|
memset(&iwe, 0, sizeof(iwe));
|
|
|
|
iwe.cmd = SIOCGIWENCODE;
|
|
|
|
iwe.u.data.length = 0;
|
2012-06-24 23:57:48 +00:00
|
|
|
if (WLAN_GET_CAP_INFO_PRIVACY(pBSS->wCapInfo))
|
2012-06-24 23:57:39 +00:00
|
|
|
iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
|
2012-06-24 23:57:48 +00:00
|
|
|
else
|
2012-06-24 23:56:15 +00:00
|
|
|
iwe.u.data.flags = IW_ENCODE_DISABLED;
|
2012-06-24 23:57:39 +00:00
|
|
|
current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, pItemSSID->abySSID);
|
2012-06-24 23:56:15 +00:00
|
|
|
|
|
|
|
memset(&iwe, 0, sizeof(iwe));
|
|
|
|
iwe.cmd = SIOCGIWRATE;
|
|
|
|
iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
|
|
|
|
current_val = current_ev + IW_EV_LCP_LEN;
|
|
|
|
|
2012-06-24 23:57:39 +00:00
|
|
|
for (kk = 0; kk < 12; kk++) {
|
2012-06-24 23:56:15 +00:00
|
|
|
if (pSuppRates->abyRates[kk] == 0)
|
|
|
|
break;
|
|
|
|
// Bit rate given in 500 kb/s units (+ 0x80)
|
|
|
|
iwe.u.bitrate.value = ((pSuppRates->abyRates[kk] & 0x7f) * 500000);
|
2012-06-24 23:57:39 +00:00
|
|
|
current_val = iwe_stream_add_value(info, current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN);
|
2012-06-24 23:56:15 +00:00
|
|
|
}
|
2012-06-24 23:57:39 +00:00
|
|
|
for (kk = 0; kk < 8; kk++) {
|
2012-06-24 23:56:15 +00:00
|
|
|
if (pExtSuppRates->abyRates[kk] == 0)
|
|
|
|
break;
|
|
|
|
// Bit rate given in 500 kb/s units (+ 0x80)
|
|
|
|
iwe.u.bitrate.value = ((pExtSuppRates->abyRates[kk] & 0x7f) * 500000);
|
2012-06-24 23:57:39 +00:00
|
|
|
current_val = iwe_stream_add_value(info, current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN);
|
2012-06-24 23:56:15 +00:00
|
|
|
}
|
|
|
|
|
2012-06-24 23:57:20 +00:00
|
|
|
if ((current_val - current_ev) > IW_EV_LCP_LEN)
|
2012-06-24 23:56:15 +00:00
|
|
|
current_ev = current_val;
|
|
|
|
|
|
|
|
if ((pBSS->wWPALen > 0) && (pBSS->wWPALen <= MAX_WPA_IE_LEN)) {
|
|
|
|
memset(&iwe, 0, sizeof(iwe));
|
|
|
|
iwe.cmd = IWEVGENIE;
|
|
|
|
iwe.u.data.length = pBSS->wWPALen;
|
2012-06-24 23:57:39 +00:00
|
|
|
current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, pBSS->byWPAIE);
|
2012-06-24 23:56:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ((pBSS->wRSNLen > 0) && (pBSS->wRSNLen <= MAX_WPA_IE_LEN)) {
|
|
|
|
memset(&iwe, 0, sizeof(iwe));
|
|
|
|
iwe.cmd = IWEVGENIE;
|
|
|
|
iwe.u.data.length = pBSS->wRSNLen;
|
2012-06-24 23:57:39 +00:00
|
|
|
current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, pBSS->byRSNIE);
|
2012-06-24 23:56:15 +00:00
|
|
|
}
|
|
|
|
}
|
2012-06-24 23:57:27 +00:00
|
|
|
} // for
|
2009-06-13 11:38:31 +00:00
|
|
|
wrq->length = current_ev - extra;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2012-06-24 23:57:27 +00:00
|
|
|
* Wireless Handler: set frequence or channel
|
2009-06-13 11:38:31 +00:00
|
|
|
*/
|
2012-06-24 23:56:05 +00:00
|
|
|
int iwctl_siwfreq(struct net_device *dev, struct iw_request_info *info,
|
2012-11-24 14:22:08 +00:00
|
|
|
union iwreq_data *wrqu, char *extra)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_private *pDevice = netdev_priv(dev);
|
2012-11-24 14:22:08 +00:00
|
|
|
struct iw_freq *wrq = &wrqu->freq;
|
2009-06-13 11:38:31 +00:00
|
|
|
int rc = 0;
|
|
|
|
|
2012-11-24 14:22:08 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFREQ\n");
|
2009-06-13 11:38:31 +00:00
|
|
|
|
|
|
|
// If setting by frequency, convert to a channel
|
2012-06-24 23:57:48 +00:00
|
|
|
if ((wrq->e == 1) && (wrq->m >= (int)2.412e8) &&
|
2012-06-24 23:57:13 +00:00
|
|
|
(wrq->m <= (int)2.487e8)) {
|
2009-06-13 11:38:31 +00:00
|
|
|
int f = wrq->m / 100000;
|
|
|
|
int c = 0;
|
2012-06-24 23:57:20 +00:00
|
|
|
while ((c < 14) && (f != frequency_list[c]))
|
2009-06-13 11:38:31 +00:00
|
|
|
c++;
|
|
|
|
wrq->e = 0;
|
|
|
|
wrq->m = c + 1;
|
|
|
|
}
|
|
|
|
// Setting by channel number
|
2012-06-24 23:57:48 +00:00
|
|
|
if ((wrq->m > 14) || (wrq->e > 0)) {
|
2009-06-13 11:38:31 +00:00
|
|
|
rc = -EOPNOTSUPP;
|
2012-06-24 23:57:48 +00:00
|
|
|
} else {
|
2009-06-13 11:38:31 +00:00
|
|
|
int channel = wrq->m;
|
2012-06-24 23:57:20 +00:00
|
|
|
if ((channel < 1) || (channel > 14)) {
|
2009-06-13 11:38:31 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: New channel value of %d is invalid!\n", dev->name, wrq->m);
|
|
|
|
rc = -EINVAL;
|
|
|
|
} else {
|
2012-06-24 23:56:15 +00:00
|
|
|
// Yes ! We can set it !!!
|
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Set to channel = %d\n", channel);
|
|
|
|
pDevice->uChannel = channel;
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2012-06-24 23:57:27 +00:00
|
|
|
* Wireless Handler: get frequence or channel
|
2009-06-13 11:38:31 +00:00
|
|
|
*/
|
2012-06-24 23:56:05 +00:00
|
|
|
int iwctl_giwfreq(struct net_device *dev, struct iw_request_info *info,
|
2012-11-24 14:22:08 +00:00
|
|
|
union iwreq_data *wrqu, char *extra)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_private *pDevice = netdev_priv(dev);
|
2012-11-24 14:22:08 +00:00
|
|
|
struct iw_freq *wrq = &wrqu->freq;
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-11-24 14:22:08 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFREQ\n");
|
|
|
|
|
|
|
|
if (pMgmt == NULL)
|
|
|
|
return -EFAULT;
|
|
|
|
|
2009-06-13 11:38:31 +00:00
|
|
|
#ifdef WEXT_USECHANNELS
|
|
|
|
wrq->m = (int)pMgmt->uCurrChannel;
|
|
|
|
wrq->e = 0;
|
|
|
|
#else
|
|
|
|
{
|
|
|
|
int f = (int)pMgmt->uCurrChannel - 1;
|
2012-06-24 23:57:20 +00:00
|
|
|
if (f < 0)
|
2012-06-24 23:56:15 +00:00
|
|
|
f = 0;
|
2009-06-13 11:38:31 +00:00
|
|
|
wrq->m = frequency_list[f] * 100000;
|
|
|
|
wrq->e = 1;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2012-06-24 23:57:27 +00:00
|
|
|
* Wireless Handler: set operation mode
|
2009-06-13 11:38:31 +00:00
|
|
|
*/
|
2012-06-24 23:56:05 +00:00
|
|
|
int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info,
|
2012-11-24 14:22:08 +00:00
|
|
|
union iwreq_data *wrqu, char *extra)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_private *pDevice = netdev_priv(dev);
|
2012-11-24 14:22:08 +00:00
|
|
|
__u32 *wmode = &wrqu->mode;
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
2012-06-24 23:56:15 +00:00
|
|
|
int rc = 0;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-11-24 14:22:08 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWMODE\n");
|
|
|
|
|
|
|
|
if (pMgmt == NULL)
|
|
|
|
return -EFAULT;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-06-24 23:56:15 +00:00
|
|
|
if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP && pDevice->bEnableHostapd) {
|
2012-11-24 14:22:08 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
|
|
|
|
"Can't set operation mode, hostapd is running\n");
|
2012-06-24 23:56:15 +00:00
|
|
|
return rc;
|
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-06-24 23:57:20 +00:00
|
|
|
switch (*wmode) {
|
2009-06-13 11:38:31 +00:00
|
|
|
case IW_MODE_ADHOC:
|
2012-06-24 23:56:15 +00:00
|
|
|
if (pMgmt->eConfigMode != WMAC_CONFIG_IBSS_STA) {
|
|
|
|
pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA;
|
2012-06-24 23:57:48 +00:00
|
|
|
if (pDevice->flags & DEVICE_FLAGS_OPENED)
|
2013-02-13 01:36:30 +00:00
|
|
|
pDevice->bCommit = true;
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
2013-10-15 19:46:41 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to ad-hoc\n");
|
2009-06-13 11:38:31 +00:00
|
|
|
break;
|
|
|
|
case IW_MODE_AUTO:
|
|
|
|
case IW_MODE_INFRA:
|
2012-06-24 23:56:15 +00:00
|
|
|
if (pMgmt->eConfigMode != WMAC_CONFIG_ESS_STA) {
|
|
|
|
pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA;
|
2012-06-24 23:57:48 +00:00
|
|
|
if (pDevice->flags & DEVICE_FLAGS_OPENED)
|
2013-02-13 01:36:30 +00:00
|
|
|
pDevice->bCommit = true;
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
2013-10-15 19:46:41 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to infrastructure\n");
|
2009-06-13 11:38:31 +00:00
|
|
|
break;
|
|
|
|
case IW_MODE_MASTER:
|
|
|
|
|
2012-06-24 23:56:15 +00:00
|
|
|
pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA;
|
2009-06-13 11:38:31 +00:00
|
|
|
rc = -EOPNOTSUPP;
|
|
|
|
break;
|
|
|
|
|
2012-06-24 23:56:15 +00:00
|
|
|
if (pMgmt->eConfigMode != WMAC_CONFIG_AP) {
|
|
|
|
pMgmt->eConfigMode = WMAC_CONFIG_AP;
|
2012-06-24 23:57:48 +00:00
|
|
|
if (pDevice->flags & DEVICE_FLAGS_OPENED)
|
2013-02-13 01:36:30 +00:00
|
|
|
pDevice->bCommit = true;
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
2013-10-15 19:46:41 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to Access Point\n");
|
2009-06-13 11:38:31 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case IW_MODE_REPEAT:
|
2012-06-24 23:56:15 +00:00
|
|
|
pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA;
|
2009-06-13 11:38:31 +00:00
|
|
|
rc = -EOPNOTSUPP;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
rc = -EINVAL;
|
|
|
|
}
|
|
|
|
|
2012-11-24 14:22:08 +00:00
|
|
|
if (pDevice->bCommit) {
|
|
|
|
if (pMgmt->eConfigMode == WMAC_CONFIG_AP) {
|
|
|
|
netif_stop_queue(pDevice->dev);
|
|
|
|
spin_lock_irq(&pDevice->lock);
|
|
|
|
bScheduleCommand((void *) pDevice,
|
|
|
|
WLAN_CMD_RUN_AP, NULL);
|
|
|
|
spin_unlock_irq(&pDevice->lock);
|
|
|
|
} else {
|
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
|
|
|
|
"Commit the settings\n");
|
|
|
|
|
|
|
|
spin_lock_irq(&pDevice->lock);
|
|
|
|
|
|
|
|
if (pDevice->bLinkPass &&
|
|
|
|
memcmp(pMgmt->abyCurrSSID,
|
|
|
|
pMgmt->abyDesireSSID,
|
|
|
|
WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN)) {
|
|
|
|
bScheduleCommand((void *) pDevice,
|
|
|
|
WLAN_CMD_DISASSOCIATE, NULL);
|
|
|
|
} else {
|
2013-02-13 01:36:29 +00:00
|
|
|
pDevice->bLinkPass = false;
|
2012-11-24 14:22:08 +00:00
|
|
|
pMgmt->eCurrState = WMAC_STATE_IDLE;
|
|
|
|
memset(pMgmt->abyCurrBSSID, 0, 6);
|
|
|
|
}
|
|
|
|
|
|
|
|
ControlvMaskByte(pDevice,
|
|
|
|
MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY,
|
|
|
|
LEDSTS_STS, LEDSTS_SLOW);
|
|
|
|
|
|
|
|
netif_stop_queue(pDevice->dev);
|
|
|
|
|
|
|
|
pMgmt->eScanType = WMAC_SCAN_ACTIVE;
|
|
|
|
|
|
|
|
if (!pDevice->bWPASuppWextEnabled)
|
|
|
|
bScheduleCommand((void *) pDevice,
|
|
|
|
WLAN_CMD_BSSID_SCAN,
|
|
|
|
pMgmt->abyDesireSSID);
|
|
|
|
|
|
|
|
bScheduleCommand((void *) pDevice,
|
|
|
|
WLAN_CMD_SSID,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
spin_unlock_irq(&pDevice->lock);
|
|
|
|
}
|
2013-02-13 01:36:29 +00:00
|
|
|
pDevice->bCommit = false;
|
2012-11-24 14:22:08 +00:00
|
|
|
}
|
|
|
|
|
2009-06-13 11:38:31 +00:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2012-06-24 23:57:27 +00:00
|
|
|
* Wireless Handler: get operation mode
|
2009-06-13 11:38:31 +00:00
|
|
|
*/
|
2012-11-24 14:22:08 +00:00
|
|
|
int iwctl_giwmode(struct net_device *dev, struct iw_request_info *info,
|
|
|
|
union iwreq_data *wrqu, char *extra)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_private *pDevice = netdev_priv(dev);
|
2012-11-24 14:22:08 +00:00
|
|
|
__u32 *wmode = &wrqu->mode;
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-11-24 14:22:08 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWMODE\n");
|
|
|
|
|
|
|
|
if (pMgmt == NULL)
|
|
|
|
return -EFAULT;
|
|
|
|
|
2009-06-13 11:38:31 +00:00
|
|
|
// If not managed, assume it's ad-hoc
|
|
|
|
switch (pMgmt->eConfigMode) {
|
|
|
|
case WMAC_CONFIG_ESS_STA:
|
|
|
|
*wmode = IW_MODE_INFRA;
|
|
|
|
break;
|
|
|
|
case WMAC_CONFIG_IBSS_STA:
|
2012-06-24 23:56:15 +00:00
|
|
|
*wmode = IW_MODE_ADHOC;
|
2009-06-13 11:38:31 +00:00
|
|
|
break;
|
|
|
|
case WMAC_CONFIG_AUTO:
|
|
|
|
*wmode = IW_MODE_INFRA;
|
|
|
|
break;
|
|
|
|
case WMAC_CONFIG_AP:
|
|
|
|
*wmode = IW_MODE_MASTER;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
*wmode = IW_MODE_ADHOC;
|
|
|
|
}
|
2012-11-24 14:22:08 +00:00
|
|
|
|
|
|
|
return 0;
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2012-06-24 23:57:27 +00:00
|
|
|
* Wireless Handler: get capability range
|
2009-06-13 11:38:31 +00:00
|
|
|
*/
|
2012-11-24 14:22:08 +00:00
|
|
|
int iwctl_giwrange(struct net_device *dev, struct iw_request_info *info,
|
|
|
|
union iwreq_data *wrqu, char *extra)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2012-11-24 14:22:08 +00:00
|
|
|
struct iw_point *wrq = &wrqu->data;
|
2012-06-24 23:57:13 +00:00
|
|
|
struct iw_range *range = (struct iw_range *)extra;
|
2012-06-24 23:56:43 +00:00
|
|
|
int i;
|
|
|
|
int k;
|
2013-02-26 01:32:51 +00:00
|
|
|
u8 abySupportedRates[13] = {
|
2012-06-24 23:56:43 +00:00
|
|
|
0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48,
|
|
|
|
0x60, 0x6C, 0x90
|
|
|
|
};
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-06-24 23:56:15 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRANGE\n");
|
2009-06-13 11:38:31 +00:00
|
|
|
if (wrq->pointer) {
|
|
|
|
wrq->length = sizeof(struct iw_range);
|
|
|
|
memset(range, 0, sizeof(struct iw_range));
|
|
|
|
range->min_nwid = 0x0000;
|
|
|
|
range->max_nwid = 0x0000;
|
|
|
|
range->num_channels = 14;
|
|
|
|
// Should be based on cap_rid.country to give only
|
2012-06-24 23:57:27 +00:00
|
|
|
// what the current card support
|
2009-06-13 11:38:31 +00:00
|
|
|
k = 0;
|
2010-05-20 02:50:00 +00:00
|
|
|
for (i = 0; i < 14; i++) {
|
2009-06-13 11:38:31 +00:00
|
|
|
range->freq[k].i = i + 1; // List index
|
|
|
|
range->freq[k].m = frequency_list[i] * 100000;
|
|
|
|
range->freq[k++].e = 1; // Values in table in MHz -> * 10^5 * 10
|
|
|
|
}
|
|
|
|
range->num_frequency = k;
|
|
|
|
// Hum... Should put the right values there
|
2012-06-24 23:56:15 +00:00
|
|
|
range->max_qual.qual = 100;
|
2009-06-13 11:38:31 +00:00
|
|
|
range->max_qual.level = 0;
|
|
|
|
range->max_qual.noise = 0;
|
|
|
|
range->sensitivity = 255;
|
|
|
|
|
2012-06-24 23:57:39 +00:00
|
|
|
for (i = 0; i < 13; i++) {
|
2009-06-13 11:38:31 +00:00
|
|
|
range->bitrate[i] = abySupportedRates[i] * 500000;
|
2012-06-24 23:57:20 +00:00
|
|
|
if (range->bitrate[i] == 0)
|
2009-06-13 11:38:31 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
range->num_bitrates = i;
|
|
|
|
|
|
|
|
// Set an indication of the max TCP throughput
|
|
|
|
// in bit/s that we can expect using this interface.
|
|
|
|
// May be use for QoS stuff... Jean II
|
2012-06-24 23:57:20 +00:00
|
|
|
if (i > 2)
|
2009-06-13 11:38:31 +00:00
|
|
|
range->throughput = 5 * 1000 * 1000;
|
|
|
|
else
|
|
|
|
range->throughput = 1.5 * 1000 * 1000;
|
|
|
|
|
|
|
|
range->min_rts = 0;
|
|
|
|
range->max_rts = 2312;
|
|
|
|
range->min_frag = 256;
|
|
|
|
range->max_frag = 2312;
|
|
|
|
|
2012-06-24 23:56:15 +00:00
|
|
|
// the encoding capabilities
|
|
|
|
range->num_encoding_sizes = 3;
|
|
|
|
// 64(40) bits WEP
|
|
|
|
range->encoding_size[0] = 5;
|
|
|
|
// 128(104) bits WEP
|
|
|
|
range->encoding_size[1] = 13;
|
|
|
|
// 256 bits for WPA-PSK
|
|
|
|
range->encoding_size[2] = 32;
|
|
|
|
// 4 keys are allowed
|
|
|
|
range->max_encoding_tokens = 4;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-06-24 23:56:15 +00:00
|
|
|
range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 |
|
|
|
|
IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
|
|
|
range->min_pmp = 0;
|
2012-06-24 23:57:27 +00:00
|
|
|
range->max_pmp = 1000000; // 1 secs
|
2009-06-13 11:38:31 +00:00
|
|
|
range->min_pmt = 0;
|
2012-06-24 23:57:27 +00:00
|
|
|
range->max_pmt = 1000000; // 1 secs
|
2009-06-13 11:38:31 +00:00
|
|
|
range->pmp_flags = IW_POWER_PERIOD;
|
|
|
|
range->pmt_flags = IW_POWER_TIMEOUT;
|
|
|
|
range->pm_capa = IW_POWER_PERIOD | IW_POWER_TIMEOUT | IW_POWER_ALL_R;
|
|
|
|
|
|
|
|
// Transmit Power - values are in mW
|
2012-06-24 23:56:15 +00:00
|
|
|
range->txpower[0] = 100;
|
2009-06-13 11:38:31 +00:00
|
|
|
range->num_txpower = 1;
|
|
|
|
range->txpower_capa = IW_TXPOW_MWATT;
|
2012-11-24 14:50:00 +00:00
|
|
|
range->we_version_source = WIRELESS_EXT;
|
2009-06-13 11:38:31 +00:00
|
|
|
range->we_version_compiled = WIRELESS_EXT;
|
|
|
|
range->retry_capa = IW_RETRY_LIMIT | IW_RETRY_LIFETIME;
|
|
|
|
range->retry_flags = IW_RETRY_LIMIT;
|
|
|
|
range->r_time_flags = IW_RETRY_LIFETIME;
|
|
|
|
range->min_retry = 1;
|
|
|
|
range->max_retry = 65535;
|
|
|
|
range->min_r_time = 1024;
|
|
|
|
range->max_r_time = 65535 * 1024;
|
|
|
|
// Experimental measurements - boundary 11/5.5 Mb/s
|
|
|
|
// Note : with or without the (local->rssi), results
|
|
|
|
// are somewhat different. - Jean II
|
|
|
|
range->avg_qual.qual = 6;
|
2012-06-24 23:57:27 +00:00
|
|
|
range->avg_qual.level = 176; // -80 dBm
|
2009-06-13 11:38:31 +00:00
|
|
|
range->avg_qual.noise = 0;
|
|
|
|
}
|
2012-11-24 14:22:08 +00:00
|
|
|
|
|
|
|
return 0;
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Wireless Handler : set ap mac address
|
|
|
|
*/
|
2012-06-24 23:56:05 +00:00
|
|
|
int iwctl_siwap(struct net_device *dev, struct iw_request_info *info,
|
2012-11-24 14:22:08 +00:00
|
|
|
union iwreq_data *wrqu, char *extra)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_private *pDevice = netdev_priv(dev);
|
2012-11-24 14:22:08 +00:00
|
|
|
struct sockaddr *wrq = &wrqu->ap_addr;
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
2012-06-24 23:56:15 +00:00
|
|
|
int rc = 0;
|
2013-02-26 01:32:51 +00:00
|
|
|
u8 ZeroBSSID[WLAN_BSSID_LEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-11-24 14:22:08 +00:00
|
|
|
PRINT_K(" SIOCSIWAP\n");
|
|
|
|
|
|
|
|
if (pMgmt == NULL)
|
|
|
|
return -EFAULT;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-07-08 22:58:52 +00:00
|
|
|
if (wrq->sa_family != ARPHRD_ETHER) {
|
2009-06-13 11:38:31 +00:00
|
|
|
rc = -EINVAL;
|
2012-07-08 22:58:52 +00:00
|
|
|
} else {
|
2009-06-13 11:38:31 +00:00
|
|
|
memcpy(pMgmt->abyDesireBSSID, wrq->sa_data, 6);
|
2012-06-24 23:57:27 +00:00
|
|
|
// mike: add
|
2012-06-24 23:56:15 +00:00
|
|
|
if ((is_broadcast_ether_addr(pMgmt->abyDesireBSSID)) ||
|
2012-06-24 23:57:39 +00:00
|
|
|
(memcmp(pMgmt->abyDesireBSSID, ZeroBSSID, 6) == 0)) {
|
2012-06-24 23:56:15 +00:00
|
|
|
PRINT_K("SIOCSIWAP:invalid desired BSSID return!\n");
|
|
|
|
return rc;
|
|
|
|
}
|
2012-06-24 23:57:27 +00:00
|
|
|
// mike add: if desired AP is hidden ssid(there are
|
|
|
|
// two same BSSID in list), then ignore,because you
|
|
|
|
// don't known which one to be connect with??
|
2012-06-24 23:56:15 +00:00
|
|
|
{
|
2012-06-24 23:56:43 +00:00
|
|
|
unsigned ii;
|
|
|
|
unsigned uSameBssidNum = 0;
|
2012-06-24 23:56:15 +00:00
|
|
|
for (ii = 0; ii < MAX_BSS_NUM; ii++) {
|
|
|
|
if (pMgmt->sBSSList[ii].bActive &&
|
Staging: Convert uses of compare_ether_addr to ether_addr_equal
Preliminary to removing compare_ether_addr altogether:
Use the new bool function ether_addr_equal to add
some clarity and reduce the likelihood for misuse
of compare_ether_addr for sorting.
Additionally:
Used is_zero_ether_addr, removed now unused variable
Converted uses of &foo[0] to foo
Done via cocci script: (and a little typing)
$ cat compare_ether_addr.cocci
@@
expression a,b;
@@
- !compare_ether_addr(a, b)
+ ether_addr_equal(a, b)
@@
expression a,b;
@@
- compare_ether_addr(a, b)
+ !ether_addr_equal(a, b)
@@
expression a,b;
@@
- !ether_addr_equal(a, b) == 0
+ ether_addr_equal(a, b)
@@
expression a,b;
@@
- !ether_addr_equal(a, b) != 0
+ !ether_addr_equal(a, b)
@@
expression a,b;
@@
- ether_addr_equal(a, b) == 0
+ !ether_addr_equal(a, b)
@@
expression a,b;
@@
- ether_addr_equal(a, b) != 0
+ ether_addr_equal(a, b)
@@
expression a,b;
@@
- !!ether_addr_equal(a, b)
+ ether_addr_equal(a, b)
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-01 19:15:47 +00:00
|
|
|
ether_addr_equal(pMgmt->sBSSList[ii].abyBSSID,
|
|
|
|
pMgmt->abyDesireBSSID)) {
|
2012-06-24 23:56:15 +00:00
|
|
|
uSameBssidNum++;
|
|
|
|
}
|
|
|
|
}
|
2012-06-24 23:57:20 +00:00
|
|
|
if (uSameBssidNum >= 2) { //hit: desired AP is in hidden ssid mode!!!
|
2012-06-24 23:56:15 +00:00
|
|
|
PRINT_K("SIOCSIWAP:ignore for desired AP in hidden mode\n");
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-24 23:57:48 +00:00
|
|
|
if (pDevice->flags & DEVICE_FLAGS_OPENED)
|
2013-02-13 01:36:30 +00:00
|
|
|
pDevice->bCommit = true;
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2012-06-24 23:57:27 +00:00
|
|
|
* Wireless Handler: get ap mac address
|
2009-06-13 11:38:31 +00:00
|
|
|
*/
|
2012-06-24 23:56:05 +00:00
|
|
|
int iwctl_giwap(struct net_device *dev, struct iw_request_info *info,
|
2012-11-24 14:22:08 +00:00
|
|
|
union iwreq_data *wrqu, char *extra)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_private *pDevice = netdev_priv(dev);
|
2012-11-24 14:22:08 +00:00
|
|
|
struct sockaddr *wrq = &wrqu->ap_addr;
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-11-24 14:22:08 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAP\n");
|
|
|
|
|
|
|
|
if (pMgmt == NULL)
|
|
|
|
return -EFAULT;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-06-24 23:56:15 +00:00
|
|
|
memcpy(wrq->sa_data, pMgmt->abyCurrBSSID, 6);
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2013-02-13 01:36:29 +00:00
|
|
|
if ((pDevice->bLinkPass == false) && (pMgmt->eCurrMode != WMAC_MODE_ESS_AP))
|
2012-06-24 23:56:15 +00:00
|
|
|
memset(wrq->sa_data, 0, 6);
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-06-24 23:57:48 +00:00
|
|
|
if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)
|
2012-06-24 23:56:15 +00:00
|
|
|
memcpy(wrq->sa_data, pMgmt->abyCurrBSSID, 6);
|
2009-06-13 11:38:31 +00:00
|
|
|
|
|
|
|
wrq->sa_family = ARPHRD_ETHER;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2012-06-24 23:57:27 +00:00
|
|
|
* Wireless Handler: get ap list
|
2009-06-13 11:38:31 +00:00
|
|
|
*/
|
2012-06-24 23:56:05 +00:00
|
|
|
int iwctl_giwaplist(struct net_device *dev, struct iw_request_info *info,
|
2012-11-24 14:22:08 +00:00
|
|
|
union iwreq_data *wrqu, char *extra)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2012-11-24 14:22:08 +00:00
|
|
|
struct iw_point *wrq = &wrqu->data;
|
2012-11-13 21:04:36 +00:00
|
|
|
struct sockaddr *sock;
|
|
|
|
struct iw_quality *qual;
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_private *pDevice = netdev_priv(dev);
|
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
2012-11-13 21:04:36 +00:00
|
|
|
PKnownBSS pBSS = &pMgmt->sBSSList[0];
|
2012-06-24 23:56:43 +00:00
|
|
|
int ii;
|
|
|
|
int jj;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-11-13 21:04:36 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAPLIST\n");
|
|
|
|
/* Only super-user can see AP list */
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-11-13 21:04:36 +00:00
|
|
|
if (pBSS == NULL)
|
|
|
|
return -ENODEV;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-11-13 21:04:36 +00:00
|
|
|
if (!capable(CAP_NET_ADMIN))
|
|
|
|
return -EPERM;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-11-13 21:04:36 +00:00
|
|
|
if (!wrq->pointer)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
sock = kzalloc(sizeof(struct sockaddr) * IW_MAX_AP, GFP_KERNEL);
|
2012-11-15 16:57:29 +00:00
|
|
|
if (sock == NULL)
|
|
|
|
return -ENOMEM;
|
2012-11-13 21:04:36 +00:00
|
|
|
qual = kzalloc(sizeof(struct iw_quality) * IW_MAX_AP, GFP_KERNEL);
|
2012-11-15 16:57:29 +00:00
|
|
|
if (qual == NULL) {
|
|
|
|
kfree(sock);
|
2012-11-13 21:04:36 +00:00
|
|
|
return -ENOMEM;
|
2012-11-15 16:57:29 +00:00
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-11-13 21:04:36 +00:00
|
|
|
for (ii = 0, jj = 0; ii < MAX_BSS_NUM; ii++) {
|
|
|
|
if (!pBSS[ii].bActive)
|
|
|
|
continue;
|
|
|
|
if (jj >= IW_MAX_AP)
|
|
|
|
break;
|
|
|
|
memcpy(sock[jj].sa_data, pBSS[ii].abyBSSID, 6);
|
|
|
|
sock[jj].sa_family = ARPHRD_ETHER;
|
|
|
|
qual[jj].level = pBSS[ii].uRSSI;
|
|
|
|
qual[jj].qual = qual[jj].noise = 0;
|
|
|
|
qual[jj].updated = 2;
|
|
|
|
jj++;
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
2012-11-13 21:04:36 +00:00
|
|
|
|
|
|
|
wrq->flags = 1; /* Should be defined */
|
|
|
|
wrq->length = jj;
|
|
|
|
memcpy(extra, sock, sizeof(struct sockaddr) * jj);
|
|
|
|
memcpy(extra + sizeof(struct sockaddr) * jj, qual,
|
|
|
|
sizeof(struct iw_quality) * jj);
|
|
|
|
|
|
|
|
kfree(sock);
|
|
|
|
kfree(qual);
|
|
|
|
|
|
|
|
return 0;
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2012-06-24 23:57:27 +00:00
|
|
|
* Wireless Handler: set essid
|
2009-06-13 11:38:31 +00:00
|
|
|
*/
|
2012-06-24 23:56:05 +00:00
|
|
|
int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info,
|
2012-11-24 14:22:08 +00:00
|
|
|
union iwreq_data *wrqu, char *extra)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_private *pDevice = netdev_priv(dev);
|
2012-11-24 14:22:08 +00:00
|
|
|
struct iw_point *wrq = &wrqu->essid;
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
2012-06-24 23:56:43 +00:00
|
|
|
PWLAN_IE_SSID pItemSSID;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-11-24 14:22:08 +00:00
|
|
|
if (pMgmt == NULL)
|
|
|
|
return -EFAULT;
|
|
|
|
|
2012-06-24 23:56:15 +00:00
|
|
|
if (!(pDevice->flags & DEVICE_FLAGS_OPENED))
|
|
|
|
return -EINVAL;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-06-24 23:56:15 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWESSID :\n");
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2013-02-13 01:36:29 +00:00
|
|
|
pDevice->fWPA_Authened = false;
|
2009-06-13 11:38:31 +00:00
|
|
|
// Check if we asked for `any'
|
2012-06-24 23:57:20 +00:00
|
|
|
if (wrq->flags == 0) {
|
2009-06-13 11:38:31 +00:00
|
|
|
// Just send an empty SSID list
|
|
|
|
memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
|
2013-10-15 19:46:40 +00:00
|
|
|
memset(pMgmt->abyDesireBSSID, 0xFF, 6);
|
2013-10-15 19:46:41 +00:00
|
|
|
PRINT_K("set essid to 'any'\n");
|
2012-06-24 23:57:39 +00:00
|
|
|
// Unknown desired AP, so here need not associate??
|
2012-06-24 23:56:15 +00:00
|
|
|
return 0;
|
2009-06-13 11:38:31 +00:00
|
|
|
} else {
|
|
|
|
// Set the SSID
|
|
|
|
memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
|
2012-06-24 23:56:15 +00:00
|
|
|
pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID;
|
|
|
|
pItemSSID->byElementID = WLAN_EID_SSID;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
|
|
|
memcpy(pItemSSID->abySSID, extra, wrq->length);
|
2012-11-24 14:50:00 +00:00
|
|
|
if (pItemSSID->abySSID[wrq->length] == '\0') {
|
2013-10-15 19:46:40 +00:00
|
|
|
if (wrq->length > 0)
|
2012-11-24 14:50:00 +00:00
|
|
|
pItemSSID->len = wrq->length;
|
2012-06-24 23:57:48 +00:00
|
|
|
} else {
|
2012-06-24 23:56:15 +00:00
|
|
|
pItemSSID->len = wrq->length;
|
2012-06-24 23:57:48 +00:00
|
|
|
}
|
2013-10-15 19:46:41 +00:00
|
|
|
PRINT_K("set essid to %s\n", pItemSSID->abySSID);
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-06-24 23:57:27 +00:00
|
|
|
// mike: need clear desiredBSSID
|
2013-10-15 19:46:40 +00:00
|
|
|
if (pItemSSID->len == 0) {
|
2012-06-24 23:57:39 +00:00
|
|
|
memset(pMgmt->abyDesireBSSID, 0xFF, 6);
|
2012-06-24 23:56:15 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-06-24 23:57:27 +00:00
|
|
|
// Wext wil order another command of siwap to link
|
|
|
|
// with desired AP, so here need not associate??
|
2013-02-13 01:36:30 +00:00
|
|
|
if (pDevice->bWPASuppWextEnabled == true) {
|
2012-06-24 23:56:15 +00:00
|
|
|
/*******search if in hidden ssid mode ****/
|
2012-06-24 23:57:07 +00:00
|
|
|
PKnownBSS pCurr = NULL;
|
2013-02-26 01:32:51 +00:00
|
|
|
u8 abyTmpDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
|
2012-06-24 23:57:07 +00:00
|
|
|
unsigned ii;
|
|
|
|
unsigned uSameBssidNum = 0;
|
|
|
|
|
2012-06-24 23:57:39 +00:00
|
|
|
memcpy(abyTmpDesireSSID, pMgmt->abyDesireSSID, sizeof(abyTmpDesireSSID));
|
2012-06-24 23:57:07 +00:00
|
|
|
pCurr = BSSpSearchBSSList(pDevice, NULL,
|
|
|
|
abyTmpDesireSSID,
|
2012-06-24 23:57:39 +00:00
|
|
|
pDevice->eConfigPHYMode);
|
2012-06-24 23:57:07 +00:00
|
|
|
|
2012-06-24 23:57:39 +00:00
|
|
|
if (pCurr == NULL) {
|
2012-06-24 23:57:07 +00:00
|
|
|
PRINT_K("SIOCSIWESSID:hidden ssid site survey before associate.......\n");
|
2012-06-24 23:57:13 +00:00
|
|
|
vResetCommandTimer((void *)pDevice);
|
2012-06-24 23:57:07 +00:00
|
|
|
pMgmt->eScanType = WMAC_SCAN_ACTIVE;
|
2012-06-24 23:57:13 +00:00
|
|
|
bScheduleCommand((void *)pDevice,
|
2012-06-24 23:57:07 +00:00
|
|
|
WLAN_CMD_BSSID_SCAN,
|
|
|
|
pMgmt->abyDesireSSID);
|
2012-06-24 23:57:13 +00:00
|
|
|
bScheduleCommand((void *)pDevice,
|
2012-06-24 23:57:07 +00:00
|
|
|
WLAN_CMD_SSID,
|
|
|
|
pMgmt->abyDesireSSID);
|
2012-06-24 23:57:48 +00:00
|
|
|
} else { // mike: to find out if that desired SSID is a
|
2012-06-24 23:57:27 +00:00
|
|
|
// hidden-ssid AP, by means of judging if there
|
|
|
|
// are two same BSSID exist in list ?
|
2012-06-24 23:57:07 +00:00
|
|
|
for (ii = 0; ii < MAX_BSS_NUM; ii++) {
|
|
|
|
if (pMgmt->sBSSList[ii].bActive &&
|
Staging: Convert uses of compare_ether_addr to ether_addr_equal
Preliminary to removing compare_ether_addr altogether:
Use the new bool function ether_addr_equal to add
some clarity and reduce the likelihood for misuse
of compare_ether_addr for sorting.
Additionally:
Used is_zero_ether_addr, removed now unused variable
Converted uses of &foo[0] to foo
Done via cocci script: (and a little typing)
$ cat compare_ether_addr.cocci
@@
expression a,b;
@@
- !compare_ether_addr(a, b)
+ ether_addr_equal(a, b)
@@
expression a,b;
@@
- compare_ether_addr(a, b)
+ !ether_addr_equal(a, b)
@@
expression a,b;
@@
- !ether_addr_equal(a, b) == 0
+ ether_addr_equal(a, b)
@@
expression a,b;
@@
- !ether_addr_equal(a, b) != 0
+ !ether_addr_equal(a, b)
@@
expression a,b;
@@
- ether_addr_equal(a, b) == 0
+ !ether_addr_equal(a, b)
@@
expression a,b;
@@
- ether_addr_equal(a, b) != 0
+ ether_addr_equal(a, b)
@@
expression a,b;
@@
- !!ether_addr_equal(a, b)
+ ether_addr_equal(a, b)
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-01 19:15:47 +00:00
|
|
|
ether_addr_equal(pMgmt->sBSSList[ii].abyBSSID,
|
|
|
|
pCurr->abyBSSID)) {
|
2012-06-24 23:57:07 +00:00
|
|
|
uSameBssidNum++;
|
|
|
|
}
|
|
|
|
}
|
2012-06-24 23:57:27 +00:00
|
|
|
if (uSameBssidNum >= 2) { // hit: desired AP is in hidden ssid mode!!!
|
2012-06-24 23:57:07 +00:00
|
|
|
PRINT_K("SIOCSIWESSID:hidden ssid directly associate.......\n");
|
2012-06-24 23:57:13 +00:00
|
|
|
vResetCommandTimer((void *)pDevice);
|
2012-06-24 23:57:27 +00:00
|
|
|
pMgmt->eScanType = WMAC_SCAN_PASSIVE; // this scan type, you'll submit scan result!
|
2012-06-24 23:57:13 +00:00
|
|
|
bScheduleCommand((void *)pDevice,
|
2012-06-24 23:56:15 +00:00
|
|
|
WLAN_CMD_BSSID_SCAN,
|
|
|
|
pMgmt->abyDesireSSID);
|
2012-06-24 23:57:13 +00:00
|
|
|
bScheduleCommand((void *)pDevice,
|
2012-06-24 23:56:15 +00:00
|
|
|
WLAN_CMD_SSID,
|
|
|
|
pMgmt->abyDesireSSID);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-10-15 19:46:41 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set essid = %s\n", pItemSSID->abySSID);
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
2012-06-24 23:57:48 +00:00
|
|
|
if (pDevice->flags & DEVICE_FLAGS_OPENED)
|
2013-02-13 01:36:30 +00:00
|
|
|
pDevice->bCommit = true;
|
2012-06-24 23:57:48 +00:00
|
|
|
|
2009-06-13 11:38:31 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2012-06-24 23:57:27 +00:00
|
|
|
* Wireless Handler: get essid
|
2009-06-13 11:38:31 +00:00
|
|
|
*/
|
2012-11-24 14:22:08 +00:00
|
|
|
int iwctl_giwessid(struct net_device *dev, struct iw_request_info *info,
|
|
|
|
union iwreq_data *wrqu, char *extra)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_private *pDevice = netdev_priv(dev);
|
2012-11-24 14:22:08 +00:00
|
|
|
struct iw_point *wrq = &wrqu->essid;
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
2012-06-24 23:56:43 +00:00
|
|
|
PWLAN_IE_SSID pItemSSID;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-11-24 14:22:08 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWESSID\n");
|
|
|
|
|
|
|
|
if (pMgmt == NULL)
|
|
|
|
return -EFAULT;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-06-24 23:57:27 +00:00
|
|
|
// Note: if wrq->u.data.flags != 0, we should get the relevant
|
|
|
|
// SSID from the SSID list...
|
2009-06-13 11:38:31 +00:00
|
|
|
|
|
|
|
// Get the current SSID
|
2012-06-24 23:56:15 +00:00
|
|
|
pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID;
|
2012-06-24 23:57:39 +00:00
|
|
|
memcpy(extra, pItemSSID->abySSID, pItemSSID->len);
|
2009-06-13 11:38:31 +00:00
|
|
|
extra[pItemSSID->len] = '\0';
|
2010-08-03 23:25:50 +00:00
|
|
|
|
2013-10-15 19:46:41 +00:00
|
|
|
wrq->length = pItemSSID->len;
|
2009-06-13 11:38:31 +00:00
|
|
|
wrq->flags = 1; // active
|
2012-11-24 14:22:08 +00:00
|
|
|
|
|
|
|
return 0;
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2012-06-24 23:57:27 +00:00
|
|
|
* Wireless Handler: set data rate
|
2009-06-13 11:38:31 +00:00
|
|
|
*/
|
2012-06-24 23:56:05 +00:00
|
|
|
int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info,
|
2012-11-24 14:22:08 +00:00
|
|
|
union iwreq_data *wrqu, char *extra)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_private *pDevice = netdev_priv(dev);
|
2012-11-24 14:22:08 +00:00
|
|
|
struct iw_param *wrq = &wrqu->bitrate;
|
2012-06-24 23:56:15 +00:00
|
|
|
int rc = 0;
|
2012-06-24 23:56:43 +00:00
|
|
|
u8 brate = 0;
|
|
|
|
int i;
|
2013-02-26 01:32:51 +00:00
|
|
|
u8 abySupportedRates[13] = {
|
2012-06-24 23:56:43 +00:00
|
|
|
0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48,
|
|
|
|
0x60, 0x6C, 0x90
|
|
|
|
};
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2013-10-15 19:46:41 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRATE\n");
|
2012-06-24 23:56:15 +00:00
|
|
|
if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) {
|
|
|
|
rc = -EINVAL;
|
|
|
|
return rc;
|
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-06-24 23:57:27 +00:00
|
|
|
// First: get a valid bit rate value
|
2009-06-13 11:38:31 +00:00
|
|
|
|
|
|
|
// Which type of value
|
2012-06-24 23:57:39 +00:00
|
|
|
if ((wrq->value < 13) && (wrq->value >= 0)) {
|
2009-06-13 11:38:31 +00:00
|
|
|
// Setting by rate index
|
|
|
|
// Find value in the magic rate table
|
|
|
|
brate = wrq->value;
|
|
|
|
} else {
|
|
|
|
// Setting by frequency value
|
2012-06-24 23:57:39 +00:00
|
|
|
u8 normvalue = (u8)(wrq->value/500000);
|
2009-06-13 11:38:31 +00:00
|
|
|
|
|
|
|
// Check if rate is valid
|
2012-06-24 23:57:39 +00:00
|
|
|
for (i = 0; i < 13; i++) {
|
2012-06-24 23:57:20 +00:00
|
|
|
if (normvalue == abySupportedRates[i]) {
|
2009-06-13 11:38:31 +00:00
|
|
|
brate = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// -1 designed the max rate (mostly auto mode)
|
2012-06-24 23:57:20 +00:00
|
|
|
if (wrq->value == -1) {
|
2009-06-13 11:38:31 +00:00
|
|
|
// Get the highest available rate
|
2012-06-24 23:57:39 +00:00
|
|
|
for (i = 0; i < 13; i++) {
|
2012-06-24 23:57:20 +00:00
|
|
|
if (abySupportedRates[i] == 0)
|
2009-06-13 11:38:31 +00:00
|
|
|
break;
|
|
|
|
}
|
2012-06-24 23:57:20 +00:00
|
|
|
if (i != 0)
|
2009-06-13 11:38:31 +00:00
|
|
|
brate = i - 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
// Check that it is valid
|
|
|
|
// brate is index of abySupportedRates[]
|
2013-10-15 19:46:40 +00:00
|
|
|
if (brate > 13) {
|
2009-06-13 11:38:31 +00:00
|
|
|
rc = -EINVAL;
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Now, check if we want a fixed or auto value
|
2012-06-24 23:57:20 +00:00
|
|
|
if (wrq->fixed != 0) {
|
2009-06-13 11:38:31 +00:00
|
|
|
// Fixed mode
|
|
|
|
// One rate, fixed
|
2013-02-13 01:36:30 +00:00
|
|
|
pDevice->bFixRate = true;
|
2012-06-24 23:57:39 +00:00
|
|
|
if ((pDevice->byBBType == BB_TYPE_11B) && (brate > 3)) {
|
2012-06-24 23:56:15 +00:00
|
|
|
pDevice->uConnectionRate = 3;
|
2012-06-24 23:57:48 +00:00
|
|
|
} else {
|
2012-06-24 23:56:15 +00:00
|
|
|
pDevice->uConnectionRate = brate;
|
2013-10-15 19:46:41 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fixed to Rate %d\n", pDevice->uConnectionRate);
|
2012-06-24 23:56:15 +00:00
|
|
|
}
|
2012-07-08 22:58:52 +00:00
|
|
|
} else {
|
2013-02-13 01:36:29 +00:00
|
|
|
pDevice->bFixRate = false;
|
2012-06-24 23:56:15 +00:00
|
|
|
pDevice->uConnectionRate = 13;
|
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2012-06-24 23:57:27 +00:00
|
|
|
* Wireless Handler: get data rate
|
2009-06-13 11:38:31 +00:00
|
|
|
*/
|
2012-11-24 14:22:08 +00:00
|
|
|
int iwctl_giwrate(struct net_device *dev, struct iw_request_info *info,
|
|
|
|
union iwreq_data *wrqu, char *extra)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_private *pDevice = netdev_priv(dev);
|
2012-11-24 14:22:08 +00:00
|
|
|
struct iw_param *wrq = &wrqu->bitrate;
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-11-24 14:22:08 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRATE\n");
|
|
|
|
|
|
|
|
if (pMgmt == NULL)
|
|
|
|
return -EFAULT;
|
|
|
|
|
2012-06-24 23:56:15 +00:00
|
|
|
{
|
2013-02-26 01:32:51 +00:00
|
|
|
u8 abySupportedRates[13] = {
|
2012-06-24 23:56:43 +00:00
|
|
|
0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30,
|
|
|
|
0x48, 0x60, 0x6C, 0x90
|
|
|
|
};
|
2012-06-24 23:56:15 +00:00
|
|
|
int brate = 0;
|
2012-06-24 23:56:43 +00:00
|
|
|
|
2009-06-13 11:38:31 +00:00
|
|
|
if (pDevice->uConnectionRate < 13) {
|
2012-06-24 23:56:15 +00:00
|
|
|
brate = abySupportedRates[pDevice->uConnectionRate];
|
2012-06-24 23:57:48 +00:00
|
|
|
} else {
|
2012-06-24 23:56:15 +00:00
|
|
|
if (pDevice->byBBType == BB_TYPE_11B)
|
|
|
|
brate = 0x16;
|
|
|
|
if (pDevice->byBBType == BB_TYPE_11G)
|
|
|
|
brate = 0x6C;
|
|
|
|
if (pDevice->byBBType == BB_TYPE_11A)
|
|
|
|
brate = 0x6C;
|
|
|
|
}
|
|
|
|
if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
|
|
|
|
if (pDevice->byBBType == BB_TYPE_11B)
|
|
|
|
brate = 0x16;
|
|
|
|
if (pDevice->byBBType == BB_TYPE_11G)
|
|
|
|
brate = 0x6C;
|
|
|
|
if (pDevice->byBBType == BB_TYPE_11A)
|
|
|
|
brate = 0x6C;
|
|
|
|
}
|
2013-10-15 19:46:41 +00:00
|
|
|
if (pDevice->uConnectionRate == 13)
|
2012-06-24 23:56:15 +00:00
|
|
|
brate = abySupportedRates[pDevice->wCurrentRate];
|
|
|
|
wrq->value = brate * 500000;
|
|
|
|
// If more than one rate, set auto
|
2013-02-13 01:36:30 +00:00
|
|
|
if (pDevice->bFixRate == true)
|
|
|
|
wrq->fixed = true;
|
2012-06-24 23:56:15 +00:00
|
|
|
}
|
2012-11-24 14:22:08 +00:00
|
|
|
|
|
|
|
return 0;
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2012-06-24 23:57:27 +00:00
|
|
|
* Wireless Handler: set rts threshold
|
2009-06-13 11:38:31 +00:00
|
|
|
*/
|
2012-11-24 14:22:08 +00:00
|
|
|
int iwctl_siwrts(struct net_device *dev, struct iw_request_info *info,
|
|
|
|
union iwreq_data *wrqu, char *extra)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_private *pDevice = netdev_priv(dev);
|
2012-11-24 14:22:08 +00:00
|
|
|
struct iw_param *wrq = &wrqu->rts;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2011-12-28 21:18:31 +00:00
|
|
|
if ((wrq->value < 0 || wrq->value > 2312) && !wrq->disabled)
|
|
|
|
return -EINVAL;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2011-12-28 21:18:31 +00:00
|
|
|
else if (wrq->disabled)
|
|
|
|
pDevice->wRTSThreshold = 2312;
|
|
|
|
else
|
|
|
|
pDevice->wRTSThreshold = wrq->value;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2012-06-24 23:57:27 +00:00
|
|
|
* Wireless Handler: get rts
|
2009-06-13 11:38:31 +00:00
|
|
|
*/
|
2012-06-24 23:56:05 +00:00
|
|
|
int iwctl_giwrts(struct net_device *dev, struct iw_request_info *info,
|
2012-11-24 14:22:08 +00:00
|
|
|
union iwreq_data *wrqu, char *extra)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_private *pDevice = netdev_priv(dev);
|
2012-11-24 14:22:08 +00:00
|
|
|
struct iw_param *wrq = &wrqu->rts;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-11-24 14:22:08 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRTS\n");
|
2009-06-13 11:38:31 +00:00
|
|
|
wrq->value = pDevice->wRTSThreshold;
|
|
|
|
wrq->disabled = (wrq->value >= 2312);
|
|
|
|
wrq->fixed = 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2012-06-24 23:57:27 +00:00
|
|
|
* Wireless Handler: set fragment threshold
|
2009-06-13 11:38:31 +00:00
|
|
|
*/
|
2012-06-24 23:56:05 +00:00
|
|
|
int iwctl_siwfrag(struct net_device *dev, struct iw_request_info *info,
|
2012-11-24 14:22:08 +00:00
|
|
|
union iwreq_data *wrqu, char *extra)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_private *pDevice = netdev_priv(dev);
|
2012-11-24 14:22:08 +00:00
|
|
|
struct iw_param *wrq = &wrqu->frag;
|
2012-06-24 23:56:15 +00:00
|
|
|
int rc = 0;
|
|
|
|
int fthr = wrq->value;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-11-24 14:22:08 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFRAG\n");
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-06-24 23:56:15 +00:00
|
|
|
if (wrq->disabled)
|
2009-06-13 11:38:31 +00:00
|
|
|
fthr = 2312;
|
2012-06-24 23:57:20 +00:00
|
|
|
if ((fthr < 256) || (fthr > 2312)) {
|
2009-06-13 11:38:31 +00:00
|
|
|
rc = -EINVAL;
|
2012-06-24 23:57:48 +00:00
|
|
|
} else {
|
2012-06-24 23:57:27 +00:00
|
|
|
fthr &= ~0x1; // Get an even value
|
2012-06-24 23:56:15 +00:00
|
|
|
pDevice->wFragmentationThreshold = (u16)fthr;
|
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2012-06-24 23:57:27 +00:00
|
|
|
* Wireless Handler: get fragment threshold
|
2009-06-13 11:38:31 +00:00
|
|
|
*/
|
2012-06-24 23:56:05 +00:00
|
|
|
int iwctl_giwfrag(struct net_device *dev, struct iw_request_info *info,
|
2012-11-24 14:22:08 +00:00
|
|
|
union iwreq_data *wrqu, char *extra)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_private *pDevice = netdev_priv(dev);
|
2012-11-24 14:22:08 +00:00
|
|
|
struct iw_param *wrq = &wrqu->frag;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-11-24 14:22:08 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFRAG\n");
|
2009-06-13 11:38:31 +00:00
|
|
|
wrq->value = pDevice->wFragmentationThreshold;
|
|
|
|
wrq->disabled = (wrq->value >= 2312);
|
|
|
|
wrq->fixed = 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2012-06-24 23:57:27 +00:00
|
|
|
* Wireless Handler: set retry threshold
|
2009-06-13 11:38:31 +00:00
|
|
|
*/
|
2012-06-24 23:56:05 +00:00
|
|
|
int iwctl_siwretry(struct net_device *dev, struct iw_request_info *info,
|
2012-11-24 14:22:08 +00:00
|
|
|
union iwreq_data *wrqu, char *extra)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_private *pDevice = netdev_priv(dev);
|
2012-11-24 14:22:08 +00:00
|
|
|
struct iw_param *wrq = &wrqu->retry;
|
2012-06-24 23:56:15 +00:00
|
|
|
int rc = 0;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-11-24 14:22:08 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRETRY\n");
|
2009-06-13 11:38:31 +00:00
|
|
|
|
|
|
|
if (wrq->disabled) {
|
|
|
|
rc = -EINVAL;
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (wrq->flags & IW_RETRY_LIMIT) {
|
2012-06-24 23:57:48 +00:00
|
|
|
if (wrq->flags & IW_RETRY_MAX) {
|
2009-06-13 11:38:31 +00:00
|
|
|
pDevice->byLongRetryLimit = wrq->value;
|
2012-06-24 23:57:48 +00:00
|
|
|
} else if (wrq->flags & IW_RETRY_MIN) {
|
2009-06-13 11:38:31 +00:00
|
|
|
pDevice->byShortRetryLimit = wrq->value;
|
2012-06-24 23:57:48 +00:00
|
|
|
} else {
|
2009-06-13 11:38:31 +00:00
|
|
|
// No modifier : set both
|
|
|
|
pDevice->byShortRetryLimit = wrq->value;
|
|
|
|
pDevice->byLongRetryLimit = wrq->value;
|
|
|
|
}
|
|
|
|
}
|
2012-06-24 23:57:48 +00:00
|
|
|
if (wrq->flags & IW_RETRY_LIFETIME)
|
2009-06-13 11:38:31 +00:00
|
|
|
pDevice->wMaxTransmitMSDULifetime = wrq->value;
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2012-06-24 23:57:27 +00:00
|
|
|
* Wireless Handler: get retry threshold
|
2009-06-13 11:38:31 +00:00
|
|
|
*/
|
2012-06-24 23:56:05 +00:00
|
|
|
int iwctl_giwretry(struct net_device *dev, struct iw_request_info *info,
|
2012-11-24 14:22:08 +00:00
|
|
|
union iwreq_data *wrqu, char *extra)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_private *pDevice = netdev_priv(dev);
|
2012-11-24 14:22:08 +00:00
|
|
|
struct iw_param *wrq = &wrqu->retry;
|
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRETRY\n");
|
2012-06-24 23:57:27 +00:00
|
|
|
wrq->disabled = 0; // Can't be disabled
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-06-24 23:57:27 +00:00
|
|
|
// Note: by default, display the min retry number
|
2012-06-24 23:57:20 +00:00
|
|
|
if ((wrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) {
|
2009-06-13 11:38:31 +00:00
|
|
|
wrq->flags = IW_RETRY_LIFETIME;
|
2012-06-24 23:57:27 +00:00
|
|
|
wrq->value = (int)pDevice->wMaxTransmitMSDULifetime; // ms
|
2012-06-24 23:57:20 +00:00
|
|
|
} else if ((wrq->flags & IW_RETRY_MAX)) {
|
2009-06-13 11:38:31 +00:00
|
|
|
wrq->flags = IW_RETRY_LIMIT | IW_RETRY_MAX;
|
|
|
|
wrq->value = (int)pDevice->byLongRetryLimit;
|
|
|
|
} else {
|
|
|
|
wrq->flags = IW_RETRY_LIMIT;
|
|
|
|
wrq->value = (int)pDevice->byShortRetryLimit;
|
2012-06-24 23:57:20 +00:00
|
|
|
if ((int)pDevice->byShortRetryLimit != (int)pDevice->byLongRetryLimit)
|
2009-06-13 11:38:31 +00:00
|
|
|
wrq->flags |= IW_RETRY_MIN;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2012-06-24 23:57:27 +00:00
|
|
|
* Wireless Handler: set encode mode
|
2009-06-13 11:38:31 +00:00
|
|
|
*/
|
2012-06-24 23:56:05 +00:00
|
|
|
int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info,
|
2012-11-24 14:22:08 +00:00
|
|
|
union iwreq_data *wrqu, char *extra)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_private *pDevice = netdev_priv(dev);
|
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
2012-11-24 14:22:08 +00:00
|
|
|
struct iw_point *wrq = &wrqu->encoding;
|
|
|
|
u32 dwKeyIndex = (u32)(wrq->flags & IW_ENCODE_INDEX);
|
2012-06-24 23:56:43 +00:00
|
|
|
int ii;
|
|
|
|
int uu;
|
|
|
|
int rc = 0;
|
2009-06-13 11:38:31 +00:00
|
|
|
int index = (wrq->flags & IW_ENCODE_INDEX);
|
|
|
|
|
2012-11-24 14:22:08 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWENCODE\n");
|
|
|
|
|
|
|
|
if (pMgmt == NULL)
|
|
|
|
return -EFAULT;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
|
|
|
// Check the size of the key
|
|
|
|
if (wrq->length > WLAN_WEP232_KEYLEN) {
|
|
|
|
rc = -EINVAL;
|
2012-06-24 23:56:15 +00:00
|
|
|
return rc;
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (dwKeyIndex > WLAN_WEP_NKEYS) {
|
|
|
|
rc = -EINVAL;
|
2012-06-24 23:56:15 +00:00
|
|
|
return rc;
|
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-06-24 23:56:15 +00:00
|
|
|
if (dwKeyIndex > 0)
|
2009-06-13 11:38:31 +00:00
|
|
|
dwKeyIndex--;
|
|
|
|
|
|
|
|
// Send the key to the card
|
|
|
|
if (wrq->length > 0) {
|
2012-07-08 22:58:36 +00:00
|
|
|
if (wrq->length == WLAN_WEP232_KEYLEN) {
|
2012-06-24 23:56:15 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 232 bit wep key\n");
|
2012-07-08 22:58:36 +00:00
|
|
|
} else if (wrq->length == WLAN_WEP104_KEYLEN) {
|
2012-06-24 23:56:15 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 104 bit wep key\n");
|
2012-06-24 23:57:48 +00:00
|
|
|
} else if (wrq->length == WLAN_WEP40_KEYLEN) {
|
2012-06-24 23:56:15 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 40 bit wep key, index= %d\n", (int)dwKeyIndex);
|
|
|
|
}
|
|
|
|
memset(pDevice->abyKey, 0, WLAN_WEP232_KEYLEN);
|
|
|
|
memcpy(pDevice->abyKey, extra, wrq->length);
|
|
|
|
|
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"abyKey: ");
|
2012-06-24 23:57:48 +00:00
|
|
|
for (ii = 0; ii < wrq->length; ii++)
|
2012-06-24 23:56:15 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pDevice->abyKey[ii]);
|
|
|
|
|
|
|
|
if (pDevice->flags & DEVICE_FLAGS_OPENED) {
|
|
|
|
spin_lock_irq(&pDevice->lock);
|
2012-06-24 23:57:39 +00:00
|
|
|
KeybSetDefaultKey(pDevice,
|
2012-06-24 23:56:15 +00:00
|
|
|
&(pDevice->sKey),
|
|
|
|
dwKeyIndex | (1 << 31),
|
2012-06-24 23:57:39 +00:00
|
|
|
wrq->length, NULL,
|
2012-06-24 23:56:15 +00:00
|
|
|
pDevice->abyKey,
|
2012-07-08 22:59:30 +00:00
|
|
|
KEY_CTL_WEP);
|
2012-06-24 23:56:15 +00:00
|
|
|
spin_unlock_irq(&pDevice->lock);
|
|
|
|
}
|
2013-02-26 01:32:51 +00:00
|
|
|
pDevice->byKeyIndex = (u8)dwKeyIndex;
|
2012-06-24 23:56:15 +00:00
|
|
|
pDevice->uKeyLength = wrq->length;
|
2013-02-13 01:36:30 +00:00
|
|
|
pDevice->bTransmitKey = true;
|
|
|
|
pDevice->bEncryptionEnable = true;
|
2012-06-24 23:56:15 +00:00
|
|
|
pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-06-24 23:57:27 +00:00
|
|
|
// Do we want to just set the transmit key index?
|
2012-06-24 23:57:48 +00:00
|
|
|
if (index < 4) {
|
2012-06-24 23:56:15 +00:00
|
|
|
pDevice->byKeyIndex = index;
|
2009-07-27 19:59:48 +00:00
|
|
|
} else if (!(wrq->flags & IW_ENCODE_MODE)) {
|
2012-06-24 23:56:15 +00:00
|
|
|
rc = -EINVAL;
|
|
|
|
return rc;
|
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
// Read the flags
|
2012-06-24 23:57:48 +00:00
|
|
|
if (wrq->flags & IW_ENCODE_DISABLED) {
|
2012-06-24 23:56:15 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable WEP function\n");
|
2013-02-13 01:36:29 +00:00
|
|
|
pMgmt->bShareKeyAlgorithm = false;
|
|
|
|
pDevice->bEncryptionEnable = false;
|
2012-06-24 23:56:15 +00:00
|
|
|
pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
|
|
|
|
if (pDevice->flags & DEVICE_FLAGS_OPENED) {
|
|
|
|
spin_lock_irq(&pDevice->lock);
|
|
|
|
for (uu = 0; uu < MAX_KEY_TABLE; uu++)
|
|
|
|
MACvDisableKeyEntry(pDevice, uu);
|
|
|
|
spin_unlock_irq(&pDevice->lock);
|
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
2012-06-24 23:57:20 +00:00
|
|
|
if (wrq->flags & IW_ENCODE_RESTRICTED) {
|
2012-06-24 23:56:15 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & ShareKey System\n");
|
2013-02-13 01:36:30 +00:00
|
|
|
pMgmt->bShareKeyAlgorithm = true;
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
2012-06-24 23:57:20 +00:00
|
|
|
if (wrq->flags & IW_ENCODE_OPEN) {
|
2012-06-24 23:56:15 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & Open System\n");
|
2013-02-13 01:36:29 +00:00
|
|
|
pMgmt->bShareKeyAlgorithm = false;
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
2012-06-24 23:57:39 +00:00
|
|
|
memset(pMgmt->abyDesireBSSID, 0xFF, 6);
|
2012-11-12 20:43:34 +00:00
|
|
|
|
2009-06-13 11:38:31 +00:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2012-06-24 23:56:05 +00:00
|
|
|
int iwctl_giwencode(struct net_device *dev, struct iw_request_info *info,
|
2012-11-24 14:22:08 +00:00
|
|
|
union iwreq_data *wrqu, char *extra)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_private *pDevice = netdev_priv(dev);
|
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
2012-11-24 14:22:08 +00:00
|
|
|
struct iw_point *wrq = &wrqu->encoding;
|
2009-06-13 11:38:31 +00:00
|
|
|
char abyKey[WLAN_WEP232_KEYLEN];
|
|
|
|
|
2012-06-24 23:56:43 +00:00
|
|
|
unsigned index = (unsigned)(wrq->flags & IW_ENCODE_INDEX);
|
|
|
|
PSKeyItem pKey = NULL;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWENCODE\n");
|
|
|
|
|
2012-11-24 14:22:08 +00:00
|
|
|
if (pMgmt == NULL)
|
|
|
|
return -EFAULT;
|
|
|
|
|
2012-06-24 23:57:48 +00:00
|
|
|
if (index > WLAN_WEP_NKEYS)
|
2009-06-13 11:38:31 +00:00
|
|
|
return -EINVAL;
|
2012-06-24 23:57:39 +00:00
|
|
|
if (index < 1) { // get default key
|
2012-06-24 23:57:48 +00:00
|
|
|
if (pDevice->byKeyIndex < WLAN_WEP_NKEYS)
|
2012-06-24 23:57:39 +00:00
|
|
|
index = pDevice->byKeyIndex;
|
2013-10-15 19:46:41 +00:00
|
|
|
else
|
2012-06-24 23:57:39 +00:00
|
|
|
index = 0;
|
2012-06-24 23:57:48 +00:00
|
|
|
} else {
|
2012-06-24 23:56:15 +00:00
|
|
|
index--;
|
2012-06-24 23:57:48 +00:00
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
|
|
|
|
memset(abyKey, 0, WLAN_WEP232_KEYLEN);
|
|
|
|
// Check encryption mode
|
|
|
|
wrq->flags = IW_ENCODE_NOKEY;
|
|
|
|
// Is WEP enabled ???
|
|
|
|
if (pDevice->bEncryptionEnable)
|
2012-06-24 23:57:39 +00:00
|
|
|
wrq->flags |= IW_ENCODE_ENABLED;
|
2009-06-13 11:38:31 +00:00
|
|
|
else
|
2012-06-24 23:57:39 +00:00
|
|
|
wrq->flags |= IW_ENCODE_DISABLED;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
|
|
|
if (pMgmt->bShareKeyAlgorithm)
|
2012-06-24 23:57:39 +00:00
|
|
|
wrq->flags |= IW_ENCODE_RESTRICTED;
|
2009-06-13 11:38:31 +00:00
|
|
|
else
|
2012-06-24 23:57:39 +00:00
|
|
|
wrq->flags |= IW_ENCODE_OPEN;
|
|
|
|
wrq->length = 0;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-06-24 23:57:39 +00:00
|
|
|
if ((index == 0) && (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled ||
|
2012-07-08 22:58:52 +00:00
|
|
|
pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled)) { // get wpa pairwise key
|
2012-06-24 23:57:39 +00:00
|
|
|
if (KeybGetKey(&(pDevice->sKey), pMgmt->abyCurrBSSID, 0xffffffff, &pKey)) {
|
2009-06-13 11:38:31 +00:00
|
|
|
wrq->length = pKey->uKeyLength;
|
2012-06-24 23:56:15 +00:00
|
|
|
memcpy(abyKey, pKey->abyKey, pKey->uKeyLength);
|
|
|
|
memcpy(extra, abyKey, WLAN_WEP232_KEYLEN);
|
|
|
|
}
|
2013-02-26 01:32:51 +00:00
|
|
|
} else if (KeybGetKey(&(pDevice->sKey), pDevice->abyBroadcastAddr, (u8)index, &pKey)) {
|
2012-06-24 23:56:15 +00:00
|
|
|
wrq->length = pKey->uKeyLength;
|
2012-06-24 23:57:39 +00:00
|
|
|
memcpy(abyKey, pKey->abyKey, pKey->uKeyLength);
|
|
|
|
memcpy(extra, abyKey, WLAN_WEP232_KEYLEN);
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
2012-06-24 23:57:39 +00:00
|
|
|
wrq->flags |= index + 1;
|
2009-06-13 11:38:31 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2012-06-24 23:57:27 +00:00
|
|
|
* Wireless Handler: set power mode
|
2009-06-13 11:38:31 +00:00
|
|
|
*/
|
2012-06-24 23:56:05 +00:00
|
|
|
int iwctl_siwpower(struct net_device *dev, struct iw_request_info *info,
|
2012-11-24 14:22:08 +00:00
|
|
|
union iwreq_data *wrqu, char *extra)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_private *pDevice = netdev_priv(dev);
|
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
2012-11-24 14:22:08 +00:00
|
|
|
struct iw_param *wrq = &wrqu->power;
|
2012-06-24 23:56:15 +00:00
|
|
|
int rc = 0;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-11-24 14:22:08 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER\n");
|
|
|
|
|
|
|
|
if (pMgmt == NULL)
|
|
|
|
return -EFAULT;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-06-24 23:56:15 +00:00
|
|
|
if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) {
|
|
|
|
rc = -EINVAL;
|
|
|
|
return rc;
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
2013-05-15 00:44:25 +00:00
|
|
|
spin_lock_irq(&pDevice->lock);
|
|
|
|
|
2009-06-13 11:38:31 +00:00
|
|
|
if (wrq->disabled) {
|
|
|
|
pDevice->ePSMode = WMAC_POWER_CAM;
|
|
|
|
PSvDisablePowerSaving(pDevice);
|
2013-05-15 00:44:25 +00:00
|
|
|
spin_unlock_irq(&pDevice->lock);
|
2009-06-13 11:38:31 +00:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
if ((wrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) {
|
2012-06-24 23:56:15 +00:00
|
|
|
pDevice->ePSMode = WMAC_POWER_FAST;
|
2012-06-24 23:57:13 +00:00
|
|
|
PSvEnablePowerSaving((void *)pDevice, pMgmt->wListenInterval);
|
2009-06-13 11:38:31 +00:00
|
|
|
|
|
|
|
} else if ((wrq->flags & IW_POWER_TYPE) == IW_POWER_PERIOD) {
|
2012-06-24 23:56:15 +00:00
|
|
|
pDevice->ePSMode = WMAC_POWER_FAST;
|
2012-06-24 23:57:13 +00:00
|
|
|
PSvEnablePowerSaving((void *)pDevice, pMgmt->wListenInterval);
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
2013-05-15 00:44:25 +00:00
|
|
|
|
|
|
|
spin_unlock_irq(&pDevice->lock);
|
|
|
|
|
2009-06-13 11:38:31 +00:00
|
|
|
switch (wrq->flags & IW_POWER_MODE) {
|
|
|
|
case IW_POWER_UNICAST_R:
|
2013-10-15 19:46:41 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_UNICAST_R\n");
|
2009-06-13 11:38:31 +00:00
|
|
|
rc = -EINVAL;
|
|
|
|
break;
|
|
|
|
case IW_POWER_ALL_R:
|
2013-10-15 19:46:41 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ALL_R\n");
|
2009-06-13 11:38:31 +00:00
|
|
|
rc = -EINVAL;
|
|
|
|
case IW_POWER_ON:
|
2013-10-15 19:46:41 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ON\n");
|
2009-06-13 11:38:31 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
rc = -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2012-06-24 23:57:27 +00:00
|
|
|
* Wireless Handler: get power mode
|
2009-06-13 11:38:31 +00:00
|
|
|
*/
|
2012-06-24 23:56:05 +00:00
|
|
|
int iwctl_giwpower(struct net_device *dev, struct iw_request_info *info,
|
2012-11-24 14:22:08 +00:00
|
|
|
union iwreq_data *wrqu, char *extra)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_private *pDevice = netdev_priv(dev);
|
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
2012-11-24 14:22:08 +00:00
|
|
|
struct iw_param *wrq = &wrqu->power;
|
2012-06-24 23:56:15 +00:00
|
|
|
int mode = pDevice->ePSMode;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-11-24 14:22:08 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWPOWER\n");
|
|
|
|
|
|
|
|
if (pMgmt == NULL)
|
|
|
|
return -EFAULT;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
|
|
|
if ((wrq->disabled = (mode == WMAC_POWER_CAM)))
|
2012-06-24 23:56:15 +00:00
|
|
|
return 0;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
|
|
|
if ((wrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) {
|
2012-11-24 14:50:00 +00:00
|
|
|
wrq->value = (int)((pMgmt->wListenInterval *
|
|
|
|
pMgmt->wCurrBeaconPeriod) / 100);
|
2009-06-13 11:38:31 +00:00
|
|
|
wrq->flags = IW_POWER_TIMEOUT;
|
|
|
|
} else {
|
2012-11-24 14:50:00 +00:00
|
|
|
wrq->value = (int)((pMgmt->wListenInterval *
|
|
|
|
pMgmt->wCurrBeaconPeriod) / 100);
|
2009-06-13 11:38:31 +00:00
|
|
|
wrq->flags = IW_POWER_PERIOD;
|
|
|
|
}
|
2012-11-24 14:50:00 +00:00
|
|
|
|
2009-06-13 11:38:31 +00:00
|
|
|
wrq->flags |= IW_POWER_ALL_R;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2012-06-24 23:57:27 +00:00
|
|
|
* Wireless Handler: get Sensitivity
|
2009-06-13 11:38:31 +00:00
|
|
|
*/
|
2012-06-24 23:56:05 +00:00
|
|
|
int iwctl_giwsens(struct net_device *dev, struct iw_request_info *info,
|
2012-11-24 14:22:08 +00:00
|
|
|
union iwreq_data *wrqu, char *extra)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_private *pDevice = netdev_priv(dev);
|
2012-11-24 14:22:08 +00:00
|
|
|
struct iw_param *wrq = &wrqu->sens;
|
2012-06-24 23:56:15 +00:00
|
|
|
long ldBm;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-11-24 14:22:08 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSENS\n");
|
2013-02-13 01:36:30 +00:00
|
|
|
if (pDevice->bLinkPass == true) {
|
2013-02-26 01:32:51 +00:00
|
|
|
RFvRSSITodBm(pDevice, (u8)(pDevice->uCurrRSSI), &ldBm);
|
2012-06-24 23:56:15 +00:00
|
|
|
wrq->value = ldBm;
|
2012-06-24 23:57:48 +00:00
|
|
|
} else {
|
2012-06-24 23:56:15 +00:00
|
|
|
wrq->value = 0;
|
2012-06-24 23:56:35 +00:00
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
wrq->disabled = (wrq->value == 0);
|
|
|
|
wrq->fixed = 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-06-24 23:56:05 +00:00
|
|
|
int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info,
|
2012-11-24 14:22:08 +00:00
|
|
|
union iwreq_data *wrqu, char *extra)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_private *pDevice = netdev_priv(dev);
|
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
2012-11-24 14:22:08 +00:00
|
|
|
struct iw_param *wrq = &wrqu->param;
|
2012-06-24 23:56:43 +00:00
|
|
|
int ret = 0;
|
2012-06-24 23:57:27 +00:00
|
|
|
static int wpa_version = 0; // must be static to save the last value, einsn liu
|
2012-06-24 23:56:43 +00:00
|
|
|
static int pairwise = 0;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-11-24 14:22:08 +00:00
|
|
|
if (pMgmt == NULL)
|
|
|
|
return -EFAULT;
|
|
|
|
|
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAUTH\n");
|
2009-06-13 11:38:31 +00:00
|
|
|
switch (wrq->flags & IW_AUTH_INDEX) {
|
|
|
|
case IW_AUTH_WPA_VERSION:
|
|
|
|
wpa_version = wrq->value;
|
2012-06-24 23:57:20 +00:00
|
|
|
if (wrq->value == IW_AUTH_WPA_VERSION_DISABLED) {
|
2012-06-24 23:56:15 +00:00
|
|
|
PRINT_K("iwctl_siwauth:set WPADEV to disable at 1??????\n");
|
2012-06-24 23:57:48 +00:00
|
|
|
} else if (wrq->value == IW_AUTH_WPA_VERSION_WPA) {
|
2012-06-24 23:56:15 +00:00
|
|
|
PRINT_K("iwctl_siwauth:set WPADEV to WPA1******\n");
|
2012-06-24 23:57:48 +00:00
|
|
|
} else {
|
2012-06-24 23:56:15 +00:00
|
|
|
PRINT_K("iwctl_siwauth:set WPADEV to WPA2******\n");
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case IW_AUTH_CIPHER_PAIRWISE:
|
|
|
|
pairwise = wrq->value;
|
2012-06-24 23:57:39 +00:00
|
|
|
PRINT_K("iwctl_siwauth:set pairwise=%d\n", pairwise);
|
2013-10-15 19:46:40 +00:00
|
|
|
if (pairwise == IW_AUTH_CIPHER_CCMP) {
|
2009-06-13 11:38:31 +00:00
|
|
|
pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled;
|
2012-06-24 23:57:48 +00:00
|
|
|
} else if (pairwise == IW_AUTH_CIPHER_TKIP) {
|
2009-06-13 11:38:31 +00:00
|
|
|
pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled;
|
2010-08-03 02:35:57 +00:00
|
|
|
} else if (pairwise == IW_AUTH_CIPHER_WEP40 ||
|
2012-06-24 23:56:15 +00:00
|
|
|
pairwise == IW_AUTH_CIPHER_WEP104) {
|
2009-06-13 11:38:31 +00:00
|
|
|
pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
|
2012-06-24 23:57:48 +00:00
|
|
|
} else if (pairwise == IW_AUTH_CIPHER_NONE) {
|
2012-06-24 23:57:27 +00:00
|
|
|
// do nothing, einsn liu
|
2012-06-24 23:57:48 +00:00
|
|
|
} else {
|
|
|
|
pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
|
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
break;
|
|
|
|
case IW_AUTH_CIPHER_GROUP:
|
2012-06-24 23:57:39 +00:00
|
|
|
PRINT_K("iwctl_siwauth:set GROUP=%d\n", wrq->value);
|
2012-06-24 23:57:20 +00:00
|
|
|
if (wpa_version == IW_AUTH_WPA_VERSION_DISABLED)
|
2009-06-13 11:38:31 +00:00
|
|
|
break;
|
2012-06-24 23:57:48 +00:00
|
|
|
if (pairwise == IW_AUTH_CIPHER_NONE) {
|
2012-07-08 22:58:52 +00:00
|
|
|
if (wrq->value == IW_AUTH_CIPHER_CCMP)
|
2009-06-13 11:38:31 +00:00
|
|
|
pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled;
|
2012-07-08 22:58:52 +00:00
|
|
|
else
|
2009-06-13 11:38:31 +00:00
|
|
|
pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case IW_AUTH_KEY_MGMT:
|
2013-10-15 19:46:40 +00:00
|
|
|
PRINT_K("iwctl_siwauth(wpa_version=%d):set KEY_MGMT=%d\n", wpa_version, wrq->value);
|
|
|
|
if (wpa_version == IW_AUTH_WPA_VERSION_WPA2) {
|
2012-06-24 23:57:20 +00:00
|
|
|
if (wrq->value == IW_AUTH_KEY_MGMT_PSK)
|
2009-06-13 11:38:31 +00:00
|
|
|
pMgmt->eAuthenMode = WMAC_AUTH_WPA2PSK;
|
|
|
|
else pMgmt->eAuthenMode = WMAC_AUTH_WPA2;
|
2012-06-24 23:57:39 +00:00
|
|
|
} else if (wpa_version == IW_AUTH_WPA_VERSION_WPA) {
|
2013-10-15 19:46:40 +00:00
|
|
|
if (wrq->value == 0) {
|
2009-06-13 11:38:31 +00:00
|
|
|
pMgmt->eAuthenMode = WMAC_AUTH_WPANONE;
|
2012-06-24 23:57:48 +00:00
|
|
|
} else if (wrq->value == IW_AUTH_KEY_MGMT_PSK)
|
2009-06-13 11:38:31 +00:00
|
|
|
pMgmt->eAuthenMode = WMAC_AUTH_WPAPSK;
|
2012-06-24 23:57:48 +00:00
|
|
|
} else {
|
|
|
|
pMgmt->eAuthenMode = WMAC_AUTH_WPA;
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case IW_AUTH_TKIP_COUNTERMEASURES:
|
2012-06-24 23:57:27 +00:00
|
|
|
break; /* FIXME */
|
2009-06-13 11:38:31 +00:00
|
|
|
case IW_AUTH_DROP_UNENCRYPTED:
|
|
|
|
break;
|
|
|
|
case IW_AUTH_80211_AUTH_ALG:
|
2012-06-24 23:57:39 +00:00
|
|
|
PRINT_K("iwctl_siwauth:set AUTH_ALG=%d\n", wrq->value);
|
2012-06-24 23:57:48 +00:00
|
|
|
if (wrq->value == IW_AUTH_ALG_OPEN_SYSTEM)
|
2013-02-13 01:36:29 +00:00
|
|
|
pMgmt->bShareKeyAlgorithm = false;
|
2012-06-24 23:57:48 +00:00
|
|
|
else if (wrq->value == IW_AUTH_ALG_SHARED_KEY)
|
2013-02-13 01:36:30 +00:00
|
|
|
pMgmt->bShareKeyAlgorithm = true;
|
2009-06-13 11:38:31 +00:00
|
|
|
break;
|
|
|
|
case IW_AUTH_WPA_ENABLED:
|
|
|
|
break;
|
|
|
|
case IW_AUTH_RX_UNENCRYPTED_EAPOL:
|
|
|
|
break;
|
|
|
|
case IW_AUTH_ROAMING_CONTROL:
|
|
|
|
ret = -EOPNOTSUPP;
|
|
|
|
break;
|
|
|
|
case IW_AUTH_PRIVACY_INVOKED:
|
|
|
|
pDevice->bEncryptionEnable = !!wrq->value;
|
2013-02-13 01:36:29 +00:00
|
|
|
if (pDevice->bEncryptionEnable == false) {
|
2009-06-13 11:38:31 +00:00
|
|
|
wpa_version = 0;
|
|
|
|
pairwise = 0;
|
|
|
|
pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
|
2013-02-13 01:36:29 +00:00
|
|
|
pMgmt->bShareKeyAlgorithm = false;
|
2009-06-13 11:38:31 +00:00
|
|
|
pMgmt->eAuthenMode = WMAC_AUTH_OPEN;
|
2012-06-24 23:56:15 +00:00
|
|
|
PRINT_K("iwctl_siwauth:set WPADEV to disaable at 2?????\n");
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2012-11-24 14:22:08 +00:00
|
|
|
PRINT_K("iwctl_siwauth: not supported %x\n", wrq->flags);
|
2009-06-13 11:38:31 +00:00
|
|
|
ret = -EOPNOTSUPP;
|
|
|
|
break;
|
|
|
|
}
|
2012-06-24 23:56:15 +00:00
|
|
|
return ret;
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
2012-06-24 23:56:05 +00:00
|
|
|
int iwctl_giwauth(struct net_device *dev, struct iw_request_info *info,
|
2012-11-24 14:22:08 +00:00
|
|
|
union iwreq_data *wrqu, char *extra)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
}
|
|
|
|
|
2012-06-24 23:56:05 +00:00
|
|
|
int iwctl_siwgenie(struct net_device *dev, struct iw_request_info *info,
|
2012-11-24 14:22:08 +00:00
|
|
|
union iwreq_data *wrqu, char *extra)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_private *pDevice = netdev_priv(dev);
|
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
2012-11-24 14:22:08 +00:00
|
|
|
struct iw_point *wrq = &wrqu->data;
|
2012-06-24 23:56:43 +00:00
|
|
|
int ret = 0;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-11-24 14:22:08 +00:00
|
|
|
if (pMgmt == NULL)
|
|
|
|
return -EFAULT;
|
|
|
|
|
2013-10-15 19:46:40 +00:00
|
|
|
if (wrq->length) {
|
2012-06-24 23:57:39 +00:00
|
|
|
if ((wrq->length < 2) || (extra[1] + 2 != wrq->length)) {
|
2009-06-13 11:38:31 +00:00
|
|
|
ret = -EINVAL;
|
|
|
|
goto out;
|
|
|
|
}
|
2013-10-15 19:46:40 +00:00
|
|
|
if (wrq->length > MAX_WPA_IE_LEN) {
|
2009-06-13 11:38:31 +00:00
|
|
|
ret = -ENOMEM;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
memset(pMgmt->abyWPAIE, 0, MAX_WPA_IE_LEN);
|
2014-01-13 16:23:30 +00:00
|
|
|
|
|
|
|
memcpy(pMgmt->abyWPAIE, extra, wrq->length);
|
2009-06-13 11:38:31 +00:00
|
|
|
pMgmt->wWPAIELen = wrq->length;
|
2012-07-08 22:58:52 +00:00
|
|
|
} else {
|
2009-06-13 11:38:31 +00:00
|
|
|
memset(pMgmt->abyWPAIE, 0, MAX_WPA_IE_LEN);
|
|
|
|
pMgmt->wWPAIELen = 0;
|
|
|
|
}
|
|
|
|
|
2012-06-24 23:57:27 +00:00
|
|
|
out: // not completely ...not necessary in wpa_supplicant 0.5.8
|
2010-08-16 16:26:36 +00:00
|
|
|
return ret;
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
2012-06-24 23:56:05 +00:00
|
|
|
int iwctl_giwgenie(struct net_device *dev, struct iw_request_info *info,
|
2012-11-24 14:22:08 +00:00
|
|
|
union iwreq_data *wrqu, char *extra)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_private *pDevice = netdev_priv(dev);
|
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
2012-11-24 14:22:08 +00:00
|
|
|
struct iw_point *wrq = &wrqu->data;
|
2012-06-24 23:56:43 +00:00
|
|
|
int ret = 0;
|
2009-06-13 11:38:31 +00:00
|
|
|
int space = wrq->length;
|
|
|
|
|
2012-11-24 14:22:08 +00:00
|
|
|
if (pMgmt == NULL)
|
|
|
|
return -EFAULT;
|
|
|
|
|
2009-06-13 11:38:31 +00:00
|
|
|
wrq->length = 0;
|
2012-06-24 23:57:48 +00:00
|
|
|
if (pMgmt->wWPAIELen > 0) {
|
2009-06-13 11:38:31 +00:00
|
|
|
wrq->length = pMgmt->wWPAIELen;
|
2014-01-13 16:25:51 +00:00
|
|
|
|
|
|
|
if (pMgmt->wWPAIELen <= space)
|
|
|
|
memcpy(extra, pMgmt->abyWPAIE, pMgmt->wWPAIELen);
|
|
|
|
else
|
2009-06-13 11:38:31 +00:00
|
|
|
ret = -E2BIG;
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2012-06-24 23:56:05 +00:00
|
|
|
int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info,
|
2012-11-24 14:22:08 +00:00
|
|
|
union iwreq_data *wrqu, char *extra)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_private *pDevice = netdev_priv(dev);
|
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
2012-11-24 14:22:08 +00:00
|
|
|
struct iw_point *wrq = &wrqu->encoding;
|
2009-06-13 11:38:31 +00:00
|
|
|
struct iw_encode_ext *ext = (struct iw_encode_ext*)extra;
|
2013-10-15 19:46:40 +00:00
|
|
|
struct viawget_wpa_param *param = NULL;
|
2012-06-24 23:57:27 +00:00
|
|
|
// original member
|
2012-06-24 23:56:15 +00:00
|
|
|
wpa_alg alg_name;
|
2012-06-24 23:56:43 +00:00
|
|
|
u8 addr[6];
|
|
|
|
int key_idx;
|
2012-06-24 23:57:39 +00:00
|
|
|
int set_tx = 0;
|
2012-06-24 23:56:43 +00:00
|
|
|
u8 seq[IW_ENCODE_SEQ_MAX_SIZE];
|
2012-06-24 23:56:15 +00:00
|
|
|
u8 key[64];
|
2012-06-24 23:56:43 +00:00
|
|
|
size_t seq_len = 0;
|
|
|
|
size_t key_len = 0;
|
2012-06-24 23:56:15 +00:00
|
|
|
u8 *buf;
|
|
|
|
u8 key_array[64];
|
2012-06-24 23:56:43 +00:00
|
|
|
int ret = 0;
|
2012-06-24 23:56:15 +00:00
|
|
|
|
2012-11-11 14:23:31 +00:00
|
|
|
PRINT_K("SIOCSIWENCODEEXT......\n");
|
2012-06-24 23:56:15 +00:00
|
|
|
|
2012-11-24 14:22:08 +00:00
|
|
|
if (pMgmt == NULL)
|
|
|
|
return -EFAULT;
|
|
|
|
|
2013-09-23 19:30:42 +00:00
|
|
|
if (!(pDevice->flags & DEVICE_FLAGS_OPENED))
|
|
|
|
return -ENODEV;
|
|
|
|
|
2012-11-11 14:23:31 +00:00
|
|
|
buf = kzalloc(sizeof(struct viawget_wpa_param), GFP_KERNEL);
|
2012-06-24 23:56:15 +00:00
|
|
|
if (buf == NULL)
|
|
|
|
return -ENOMEM;
|
2012-11-11 14:23:31 +00:00
|
|
|
|
2012-06-24 23:57:13 +00:00
|
|
|
param = (struct viawget_wpa_param *)buf;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-06-24 23:57:27 +00:00
|
|
|
// recover alg_name
|
2012-06-24 23:56:15 +00:00
|
|
|
switch (ext->alg) {
|
|
|
|
case IW_ENCODE_ALG_NONE:
|
|
|
|
alg_name = WPA_ALG_NONE;
|
2009-06-13 11:38:31 +00:00
|
|
|
break;
|
2012-06-24 23:56:15 +00:00
|
|
|
case IW_ENCODE_ALG_WEP:
|
|
|
|
alg_name = WPA_ALG_WEP;
|
2009-06-13 11:38:31 +00:00
|
|
|
break;
|
2012-06-24 23:56:15 +00:00
|
|
|
case IW_ENCODE_ALG_TKIP:
|
|
|
|
alg_name = WPA_ALG_TKIP;
|
2009-06-13 11:38:31 +00:00
|
|
|
break;
|
2012-06-24 23:56:15 +00:00
|
|
|
case IW_ENCODE_ALG_CCMP:
|
|
|
|
alg_name = WPA_ALG_CCMP;
|
2009-06-13 11:38:31 +00:00
|
|
|
break;
|
2012-06-24 23:56:15 +00:00
|
|
|
default:
|
2013-10-15 19:46:40 +00:00
|
|
|
PRINT_K("Unknown alg = %d\n", ext->alg);
|
|
|
|
ret = -ENOMEM;
|
2009-06-13 11:38:31 +00:00
|
|
|
goto error;
|
2012-06-24 23:56:15 +00:00
|
|
|
}
|
2012-06-24 23:57:27 +00:00
|
|
|
// recover addr
|
2012-06-24 23:56:15 +00:00
|
|
|
memcpy(addr, ext->addr.sa_data, ETH_ALEN);
|
2012-06-24 23:57:27 +00:00
|
|
|
// recover key_idx
|
2012-06-24 23:56:15 +00:00
|
|
|
key_idx = (wrq->flags&IW_ENCODE_INDEX) - 1;
|
2012-06-24 23:57:27 +00:00
|
|
|
// recover set_tx
|
2012-06-24 23:57:20 +00:00
|
|
|
if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY)
|
2012-06-24 23:56:15 +00:00
|
|
|
set_tx = 1;
|
2012-06-24 23:57:27 +00:00
|
|
|
// recover seq,seq_len
|
2012-06-24 23:57:20 +00:00
|
|
|
if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) {
|
2013-10-15 19:46:40 +00:00
|
|
|
seq_len = IW_ENCODE_SEQ_MAX_SIZE;
|
2012-06-24 23:56:15 +00:00
|
|
|
memcpy(seq, ext->rx_seq, seq_len);
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
2012-06-24 23:57:27 +00:00
|
|
|
// recover key,key_len
|
2012-06-24 23:57:20 +00:00
|
|
|
if (ext->key_len) {
|
2012-06-24 23:57:39 +00:00
|
|
|
key_len = ext->key_len;
|
2012-06-24 23:56:15 +00:00
|
|
|
memcpy(key, &ext->key[0], key_len);
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
2012-06-24 23:56:15 +00:00
|
|
|
memset(key_array, 0, 64);
|
2012-06-24 23:57:39 +00:00
|
|
|
if (key_len > 0) {
|
2012-06-24 23:56:15 +00:00
|
|
|
memcpy(key_array, key, key_len);
|
|
|
|
if (key_len == 32) {
|
|
|
|
// notice ! the oder
|
|
|
|
memcpy(&key_array[16], &key[24], 8);
|
|
|
|
memcpy(&key_array[24], &key[16], 8);
|
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************Translate iw_encode_ext to viawget_wpa_param****************/
|
2012-06-24 23:56:15 +00:00
|
|
|
memcpy(param->addr, addr, ETH_ALEN);
|
|
|
|
param->u.wpa_key.alg_name = (int)alg_name;
|
|
|
|
param->u.wpa_key.set_tx = set_tx;
|
|
|
|
param->u.wpa_key.key_index = key_idx;
|
|
|
|
param->u.wpa_key.key_len = key_len;
|
|
|
|
param->u.wpa_key.key = (u8 *)key_array;
|
|
|
|
param->u.wpa_key.seq = (u8 *)seq;
|
|
|
|
param->u.wpa_key.seq_len = seq_len;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-06-24 23:57:27 +00:00
|
|
|
/****set if current action is Network Manager count?? */
|
|
|
|
/****this method is so foolish,but there is no other way??? */
|
2012-06-24 23:57:20 +00:00
|
|
|
if (param->u.wpa_key.alg_name == WPA_ALG_NONE) {
|
2013-10-15 19:46:40 +00:00
|
|
|
if (param->u.wpa_key.key_index == 0) {
|
2013-02-13 01:36:30 +00:00
|
|
|
pDevice->bwextstep0 = true;
|
2012-06-24 23:56:15 +00:00
|
|
|
}
|
2013-02-13 01:36:30 +00:00
|
|
|
if ((pDevice->bwextstep0 == true) && (param->u.wpa_key.key_index == 1)) {
|
2013-02-13 01:36:29 +00:00
|
|
|
pDevice->bwextstep0 = false;
|
2013-02-13 01:36:30 +00:00
|
|
|
pDevice->bwextstep1 = true;
|
2012-06-24 23:56:15 +00:00
|
|
|
}
|
2013-02-13 01:36:30 +00:00
|
|
|
if ((pDevice->bwextstep1 == true) && (param->u.wpa_key.key_index == 2)) {
|
2013-02-13 01:36:29 +00:00
|
|
|
pDevice->bwextstep1 = false;
|
2013-02-13 01:36:30 +00:00
|
|
|
pDevice->bwextstep2 = true;
|
2012-06-24 23:56:15 +00:00
|
|
|
}
|
2013-02-13 01:36:30 +00:00
|
|
|
if ((pDevice->bwextstep2 == true) && (param->u.wpa_key.key_index == 3)) {
|
2013-02-13 01:36:29 +00:00
|
|
|
pDevice->bwextstep2 = false;
|
2013-02-13 01:36:30 +00:00
|
|
|
pDevice->bwextstep3 = true;
|
2012-06-24 23:56:15 +00:00
|
|
|
}
|
|
|
|
}
|
2013-02-13 01:36:30 +00:00
|
|
|
if (pDevice->bwextstep3 == true) {
|
2012-06-24 23:56:15 +00:00
|
|
|
PRINT_K("SIOCSIWENCODEEXT:Enable WPA WEXT SUPPORT!!!!!\n");
|
2013-02-13 01:36:29 +00:00
|
|
|
pDevice->bwextstep0 = false;
|
|
|
|
pDevice->bwextstep1 = false;
|
|
|
|
pDevice->bwextstep2 = false;
|
|
|
|
pDevice->bwextstep3 = false;
|
2013-02-13 01:36:30 +00:00
|
|
|
pDevice->bWPASuppWextEnabled = true;
|
2012-06-24 23:57:39 +00:00
|
|
|
memset(pMgmt->abyDesireBSSID, 0xFF, 6);
|
|
|
|
KeyvInitTable(pDevice, &pDevice->sKey);
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
2012-06-24 23:57:27 +00:00
|
|
|
/*******/
|
2012-06-24 23:56:15 +00:00
|
|
|
spin_lock_irq(&pDevice->lock);
|
2012-11-24 14:56:09 +00:00
|
|
|
ret = wpa_set_keys(pDevice, param);
|
2012-06-24 23:56:15 +00:00
|
|
|
spin_unlock_irq(&pDevice->lock);
|
2009-06-13 11:38:31 +00:00
|
|
|
|
|
|
|
error:
|
2012-11-11 14:23:31 +00:00
|
|
|
kfree(buf);
|
2009-06-13 11:38:31 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2012-06-24 23:56:05 +00:00
|
|
|
int iwctl_giwencodeext(struct net_device *dev, struct iw_request_info *info,
|
2012-11-24 14:22:08 +00:00
|
|
|
union iwreq_data *wrqu, char *extra)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2012-06-24 23:56:15 +00:00
|
|
|
return -EOPNOTSUPP;
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
2012-06-24 23:56:05 +00:00
|
|
|
int iwctl_siwmlme(struct net_device *dev, struct iw_request_info *info,
|
2012-11-24 14:22:08 +00:00
|
|
|
union iwreq_data *wrqu, char *extra)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2012-12-10 22:12:07 +00:00
|
|
|
struct vnt_private *pDevice = netdev_priv(dev);
|
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
2009-06-13 11:38:31 +00:00
|
|
|
struct iw_mlme *mlme = (struct iw_mlme *)extra;
|
|
|
|
int ret = 0;
|
|
|
|
|
2012-11-24 14:22:08 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWMLME\n");
|
|
|
|
|
|
|
|
if (pMgmt == NULL)
|
|
|
|
return -EFAULT;
|
|
|
|
|
2012-06-24 23:57:48 +00:00
|
|
|
if (memcmp(pMgmt->abyCurrBSSID, mlme->addr.sa_data, ETH_ALEN)) {
|
2009-06-13 11:38:31 +00:00
|
|
|
ret = -EINVAL;
|
|
|
|
return ret;
|
|
|
|
}
|
2013-10-15 19:46:40 +00:00
|
|
|
switch (mlme->cmd) {
|
2009-06-13 11:38:31 +00:00
|
|
|
case IW_MLME_DEAUTH:
|
|
|
|
case IW_MLME_DISASSOC:
|
2013-02-13 01:36:30 +00:00
|
|
|
if (pDevice->bLinkPass == true) {
|
2012-06-24 23:56:15 +00:00
|
|
|
PRINT_K("iwctl_siwmlme--->send DISASSOCIATE\n");
|
2012-07-08 22:58:36 +00:00
|
|
|
bScheduleCommand((void *)pDevice, WLAN_CMD_DISASSOCIATE,
|
2012-06-24 23:56:15 +00:00
|
|
|
NULL);
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ret = -EOPNOTSUPP;
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2012-11-24 14:22:08 +00:00
|
|
|
static int iwctl_config_commit(struct net_device *dev,
|
|
|
|
struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
|
|
|
|
{
|
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "SIOCSIWCOMMIT\n");
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-06-24 23:56:43 +00:00
|
|
|
static const iw_handler iwctl_handler[] = {
|
2012-11-24 14:22:08 +00:00
|
|
|
IW_HANDLER(SIOCSIWCOMMIT, iwctl_config_commit),
|
|
|
|
IW_HANDLER(SIOCGIWNAME, iwctl_giwname),
|
|
|
|
IW_HANDLER(SIOCSIWFREQ, iwctl_siwfreq),
|
|
|
|
IW_HANDLER(SIOCGIWFREQ, iwctl_giwfreq),
|
|
|
|
IW_HANDLER(SIOCSIWMODE, iwctl_siwmode),
|
|
|
|
IW_HANDLER(SIOCGIWMODE, iwctl_giwmode),
|
|
|
|
IW_HANDLER(SIOCGIWSENS, iwctl_giwsens),
|
|
|
|
IW_HANDLER(SIOCGIWRANGE, iwctl_giwrange),
|
|
|
|
IW_HANDLER(SIOCSIWAP, iwctl_siwap),
|
|
|
|
IW_HANDLER(SIOCGIWAP, iwctl_giwap),
|
|
|
|
IW_HANDLER(SIOCSIWMLME, iwctl_siwmlme),
|
|
|
|
IW_HANDLER(SIOCGIWAPLIST, iwctl_giwaplist),
|
|
|
|
IW_HANDLER(SIOCSIWSCAN, iwctl_siwscan),
|
|
|
|
IW_HANDLER(SIOCGIWSCAN, iwctl_giwscan),
|
|
|
|
IW_HANDLER(SIOCSIWESSID, iwctl_siwessid),
|
|
|
|
IW_HANDLER(SIOCGIWESSID, iwctl_giwessid),
|
|
|
|
IW_HANDLER(SIOCSIWRATE, iwctl_siwrate),
|
|
|
|
IW_HANDLER(SIOCGIWRATE, iwctl_giwrate),
|
|
|
|
IW_HANDLER(SIOCSIWRTS, iwctl_siwrts),
|
|
|
|
IW_HANDLER(SIOCGIWRTS, iwctl_giwrts),
|
|
|
|
IW_HANDLER(SIOCSIWFRAG, iwctl_siwfrag),
|
|
|
|
IW_HANDLER(SIOCGIWFRAG, iwctl_giwfrag),
|
|
|
|
IW_HANDLER(SIOCSIWRETRY, iwctl_siwretry),
|
|
|
|
IW_HANDLER(SIOCGIWRETRY, iwctl_giwretry),
|
|
|
|
IW_HANDLER(SIOCSIWENCODE, iwctl_siwencode),
|
|
|
|
IW_HANDLER(SIOCGIWENCODE, iwctl_giwencode),
|
|
|
|
IW_HANDLER(SIOCSIWPOWER, iwctl_siwpower),
|
|
|
|
IW_HANDLER(SIOCGIWPOWER, iwctl_giwpower),
|
|
|
|
IW_HANDLER(SIOCSIWGENIE, iwctl_siwgenie),
|
|
|
|
IW_HANDLER(SIOCGIWGENIE, iwctl_giwgenie),
|
|
|
|
IW_HANDLER(SIOCSIWAUTH, iwctl_siwauth),
|
|
|
|
IW_HANDLER(SIOCGIWAUTH, iwctl_giwauth),
|
|
|
|
IW_HANDLER(SIOCSIWENCODEEXT, iwctl_siwencodeext),
|
|
|
|
IW_HANDLER(SIOCGIWENCODEEXT, iwctl_giwencodeext)
|
2009-06-13 11:38:31 +00:00
|
|
|
};
|
|
|
|
|
2012-06-24 23:56:43 +00:00
|
|
|
static const iw_handler iwctl_private_handler[] = {
|
2012-06-24 23:57:27 +00:00
|
|
|
NULL, // SIOCIWFIRSTPRIV
|
2009-06-13 11:38:31 +00:00
|
|
|
};
|
|
|
|
|
2012-06-24 23:56:43 +00:00
|
|
|
const struct iw_handler_def iwctl_handler_def = {
|
2012-06-24 23:57:39 +00:00
|
|
|
.get_wireless_stats = &iwctl_get_wireless_stats,
|
2012-11-24 14:22:08 +00:00
|
|
|
.num_standard = ARRAY_SIZE(iwctl_handler),
|
2012-06-24 23:57:39 +00:00
|
|
|
.num_private = 0,
|
|
|
|
.num_private_args = 0,
|
2012-11-24 14:22:08 +00:00
|
|
|
.standard = iwctl_handler,
|
2012-06-24 23:57:39 +00:00
|
|
|
.private = NULL,
|
|
|
|
.private_args = NULL,
|
2009-06-13 11:38:31 +00:00
|
|
|
};
|