/* System Includes */
-#include <linux/version.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <asm/bitops.h>
#include <asm/uaccess.h>
#include <asm/byteorder.h>
+#include <linux/if_ether.h>
/*================================================================*/
/* Project Includes */
-#include "version.h"
#include "wlan_compat.h"
#include "p80211types.h"
static int p80211wext_giwessid(netdevice_t *dev,
struct iw_request_info *info,
struct iw_point *data, char *essid);
-/* compatibility to wireless extensions */
-#ifdef WIRELESS_EXT
-static UINT8 p80211_mhz_to_channel(UINT16 mhz)
+static u8 p80211_mhz_to_channel(u16 mhz)
{
if (mhz >= 5000) {
return ((mhz - 5000) / 5);
return 0;
}
-static UINT16 p80211_channel_to_mhz(UINT8 ch, int dot11a)
+static u16 p80211_channel_to_mhz(u8 ch, int dot11a)
{
if (ch == 0)
2412, 2417, 2422, 2427, 2432, 2437, 2442,
2447, 2452, 2457, 2462, 2467, 2472, 2484
};
-#define NUM_CHANNELS (sizeof(p80211wext_channel_freq) / sizeof(p80211wext_channel_freq[0]))
+#define NUM_CHANNELS ARRAY_SIZE(p80211wext_channel_freq)
/* steal a spare bit to store the shared/opensystems state. should default to open if not set */
#define HOSTWEP_SHAREDKEY BIT3
-static int p80211wext_dorequest(wlandevice_t *wlandev, UINT32 did, UINT32 data)
+static int p80211wext_dorequest(wlandevice_t *wlandev, u32 did, u32 data)
{
p80211msg_dot11req_mibset_t msg;
p80211item_uint32_t mibitem;
mibitem.did = did;
mibitem.data = data;
memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
- result = p80211req_dorequest(wlandev, (UINT8*)&msg);
+ result = p80211req_dorequest(wlandev, (u8*)&msg);
DBFEXIT;
return result;
memcpy(msg.ssid.data.data, ssid, data.length);
msg.ssid.data.len = data.length;
- result = p80211req_dorequest(wlandev, (UINT8*)&msg);
+ result = p80211req_dorequest(wlandev, (u8*)&msg);
if (result) {
err = -EFAULT;
msg.msgcode = DIDmsg_dot11req_mibget;
mibitem.did = DIDmib_dot11phy_dot11PhyDSSSTable_dot11CurrentChannel;
memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
- result = p80211req_dorequest(wlandev, (UINT8*)&msg);
+ result = p80211req_dorequest(wlandev, (u8*)&msg);
if (result) {
err = -EFAULT;
mibitem.data = p80211_mhz_to_channel(freq->m);
memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
- result = p80211req_dorequest(wlandev, (UINT8*)&msg);
+ result = p80211req_dorequest(wlandev, (u8*)&msg);
if (result) {
err = -EFAULT;
}
/* Set Operation mode to the PORT TYPE RID */
-
-#warning "get rid of p2mib here"
-
msg.msgcode = DIDmsg_dot11req_mibset;
mibitem.did = DIDmib_p2_p2Static_p2CnfPortType;
mibitem.data = (*mode == IW_MODE_ADHOC) ? 0 : 1;
memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
- result = p80211req_dorequest(wlandev, (UINT8*)&msg);
+ result = p80211req_dorequest(wlandev, (u8*)&msg);
if (result)
err = -EFAULT;
DBFENTER;
+ i = (erq->flags & IW_ENCODE_INDEX) - 1;
+ erq->flags = 0;
+
if (wlandev->hostwep & HOSTWEP_PRIVACYINVOKED)
- erq->flags = IW_ENCODE_ENABLED;
+ erq->flags |= IW_ENCODE_ENABLED;
else
- erq->flags = IW_ENCODE_DISABLED;
+ erq->flags |= IW_ENCODE_DISABLED;
if (wlandev->hostwep & HOSTWEP_EXCLUDEUNENCRYPTED)
erq->flags |= IW_ENCODE_RESTRICTED;
int err = 0;
int result = 0;
- int enable = 0;
int i;
DBFENTER;
else
i--;
- result = p80211wext_dorequest(wlandev, DIDmib_dot11smt_dot11PrivacyTable_dot11WEPDefaultKeyID, i);
+ /* Set current key number only if no keys are given */
+ if (erq->flags & IW_ENCODE_NOKEY) {
+ result = p80211wext_dorequest(wlandev, DIDmib_dot11smt_dot11PrivacyTable_dot11WEPDefaultKeyID, i);
- if (result) {
- err = -EFAULT;
- goto exit;
- }
- else {
- enable = 1;
+ if (result) {
+ err = -EFAULT;
+ goto exit;
+ }
}
- }
- else {
- // Do not thing when no Key Index
+ } else {
+ // Use defaultkey if no Key Index
+ i = wlandev->hostwep & HOSTWEP_DEFAULTKEY_MASK;
}
/* Check if there is no key information in the iwconfig request */
- if((erq->flags & IW_ENCODE_NOKEY) == 0 && enable == 1) {
+ if((erq->flags & IW_ENCODE_NOKEY) == 0 ) {
/*------------------------------------------------------------
* If there is WEP Key for setting, check the Key Information
msg.msgcode = DIDmsg_dot11req_mibset;
memcpy(&msg.mibattribute.data, &pstr, sizeof(pstr));
- result = p80211req_dorequest(wlandev, (UINT8*)&msg);
+ result = p80211req_dorequest(wlandev, (u8*)&msg);
if (result) {
err = -EFAULT;
/* Check the PrivacyInvoked flag */
if (erq->flags & IW_ENCODE_DISABLED) {
result = p80211wext_dorequest(wlandev, DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked, P80211ENUM_truth_false);
- }
- else if((erq->flags & IW_ENCODE_ENABLED) || enable == 1) {
+ } else {
result = p80211wext_dorequest(wlandev, DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked, P80211ENUM_truth_true);
}
goto exit;
}
- /* Check the ExcludeUnencrypted flag */
+ /* The security mode may be open or restricted, and its meaning
+ depends on the card used. With most cards, in open mode no
+ authentication is used and the card may also accept non-
+ encrypted sessions, whereas in restricted mode only encrypted
+ sessions are accepted and the card will use authentication if
+ available.
+ */
if (erq->flags & IW_ENCODE_RESTRICTED) {
result = p80211wext_dorequest(wlandev, DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted, P80211ENUM_truth_true);
}
msg.ssid.data.len = length;
WLAN_LOG_DEBUG(1,"autojoin_ssid for %s \n",essid);
- result = p80211req_dorequest(wlandev, (UINT8*)&msg);
+ result = p80211req_dorequest(wlandev, (u8*)&msg);
WLAN_LOG_DEBUG(1,"autojoin_ssid %d\n",result);
if (result) {
msg.msgcode = DIDmsg_dot11req_mibget;
mibitem.did = DIDmib_p2_p2MAC_p2CurrentTxRate;
memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
- result = p80211req_dorequest(wlandev, (UINT8*)&msg);
+ result = p80211req_dorequest(wlandev, (u8*)&msg);
if (result) {
err = -EFAULT;
rrq->disabled = 0;
rrq->value = 0;
-#define HFA384x_RATEBIT_1 ((UINT16)1)
-#define HFA384x_RATEBIT_2 ((UINT16)2)
-#define HFA384x_RATEBIT_5dot5 ((UINT16)4)
-#define HFA384x_RATEBIT_11 ((UINT16)8)
+#define HFA384x_RATEBIT_1 ((u16)1)
+#define HFA384x_RATEBIT_2 ((u16)2)
+#define HFA384x_RATEBIT_5dot5 ((u16)4)
+#define HFA384x_RATEBIT_11 ((u16)8)
switch (mibitem.data) {
case HFA384x_RATEBIT_1:
msg.msgcode = DIDmsg_dot11req_mibget;
mibitem.did = DIDmib_dot11mac_dot11OperationTable_dot11RTSThreshold;
memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
- result = p80211req_dorequest(wlandev, (UINT8*)&msg);
+ result = p80211req_dorequest(wlandev, (u8*)&msg);
if (result) {
err = -EFAULT;
mibitem.data = rts->value;
memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
- result = p80211req_dorequest(wlandev, (UINT8*)&msg);
+ result = p80211req_dorequest(wlandev, (u8*)&msg);
if (result) {
err = -EFAULT;
msg.msgcode = DIDmsg_dot11req_mibget;
mibitem.did = DIDmib_dot11mac_dot11OperationTable_dot11FragmentationThreshold;
memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
- result = p80211req_dorequest(wlandev, (UINT8*)&msg);
+ result = p80211req_dorequest(wlandev, (u8*)&msg);
if (result) {
err = -EFAULT;
mibitem.data = frag->value;
memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
- result = p80211req_dorequest(wlandev, (UINT8*)&msg);
+ result = p80211req_dorequest(wlandev, (u8*)&msg);
if (result) {
err = -EFAULT;
p80211msg_dot11req_mibset_t msg;
int result;
int err = 0;
- UINT16 shortretry, longretry, lifetime;
+ u16 shortretry, longretry, lifetime;
DBFENTER;
mibitem.did = DIDmib_dot11mac_dot11OperationTable_dot11ShortRetryLimit;
memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
- result = p80211req_dorequest(wlandev, (UINT8*)&msg);
+ result = p80211req_dorequest(wlandev, (u8*)&msg);
if (result) {
err = -EFAULT;
mibitem.did = DIDmib_dot11mac_dot11OperationTable_dot11LongRetryLimit;
memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
- result = p80211req_dorequest(wlandev, (UINT8*)&msg);
+ result = p80211req_dorequest(wlandev, (u8*)&msg);
if (result) {
err = -EFAULT;
mibitem.did = DIDmib_dot11mac_dot11OperationTable_dot11MaxTransmitMSDULifetime;
memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
- result = p80211req_dorequest(wlandev, (UINT8*)&msg);
+ result = p80211req_dorequest(wlandev, (u8*)&msg);
if (result) {
err = -EFAULT;
mibitem.data = rrq->value /= 1024;
memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
- result = p80211req_dorequest(wlandev, (UINT8*)&msg);
+ result = p80211req_dorequest(wlandev, (u8*)&msg);
if (result) {
err = -EFAULT;
mibitem.data = rrq->value;
memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
- result = p80211req_dorequest(wlandev, (UINT8*)&msg);
+ result = p80211req_dorequest(wlandev, (u8*)&msg);
if (result) {
err = -EFAULT;
mibitem.data = rrq->value;
memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
- result = p80211req_dorequest(wlandev, (UINT8*)&msg);
+ result = p80211req_dorequest(wlandev, (u8*)&msg);
if (result) {
err = -EFAULT;
}
msg.msgcode = DIDmsg_dot11req_mibset;
-
- switch (rrq->value) {
-
- case 1 : mibitem.did = DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel1; break;
- case 2 : mibitem.did = DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel2; break;
- case 3 : mibitem.did = DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel3; break;
- case 4 : mibitem.did = DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel4; break;
- case 5 : mibitem.did = DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel5; break;
- case 6 : mibitem.did = DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel6; break;
- case 7 : mibitem.did = DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel7; break;
- case 8 : mibitem.did = DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel8; break;
- default: mibitem.did = DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel8; break;
- }
-
+ mibitem.did = DIDmib_dot11phy_dot11PhyTxPowerTable_dot11CurrentTxPowerLevel;
+ if (rrq->fixed == 0)
+ mibitem.data = 30;
+ else
+ mibitem.data = rrq->value;
memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
- result = p80211req_dorequest(wlandev, (UINT8*)&msg);
+ result = p80211req_dorequest(wlandev, (u8*)&msg);
if (result) {
err = -EFAULT;
mibitem.did = DIDmib_dot11phy_dot11PhyTxPowerTable_dot11CurrentTxPowerLevel;
memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
- result = p80211req_dorequest(wlandev, (UINT8*)&msg);
+ result = p80211req_dorequest(wlandev, (u8*)&msg);
if (result) {
err = -EFAULT;
msg.maxchanneltime.data = 250;
msg.minchanneltime.data = 200;
- result = p80211req_dorequest(wlandev, (UINT8*)&msg);
+ result = p80211req_dorequest(wlandev, (u8*)&msg);
if (result)
err = prism2_result2err (msg.resultcode.data);
msg.msgcode = DIDmsg_dot11req_scan_results;
msg.bssindex.data = i;
- result = p80211req_dorequest(wlandev, (UINT8*)&msg);
+ result = p80211req_dorequest(wlandev, (u8*)&msg);
if ((result != 0) ||
(msg.resultcode.data != P80211ENUM_resultcode_success)) {
break;
break;
}
msg.msgcode = DIDmsg_dot11req_mibset;
- result = p80211req_dorequest(wlandev,(UINT8*)&msg);
+ result = p80211req_dorequest(wlandev,(u8*)&msg);
WLAN_LOG_DEBUG(1,"result (%d)\n",result);
}
return result;
(iw_handler) NULL, /* SIOCGIWAPLIST */
(iw_handler) p80211wext_siwscan, /* SIOCSIWSCAN */
(iw_handler) p80211wext_giwscan, /* SIOCGIWSCAN */
- (iw_handler) NULL, /* null */ /* SIOCSIWSCAN */
- (iw_handler) NULL, /* null */ /* SIOCGIWSCAN */
(iw_handler) p80211wext_siwessid, /* SIOCSIWESSID */
(iw_handler) p80211wext_giwessid, /* SIOCGIWESSID */
(iw_handler) NULL, /* SIOCSIWNICKN */
};
struct iw_handler_def p80211wext_handler_def = {
- .num_standard = sizeof(p80211wext_handlers) / sizeof(iw_handler),
+ .num_standard = ARRAY_SIZE(p80211wext_handlers),
.num_private = 0,
.num_private_args = 0,
.standard = p80211wext_handlers,
/* Send the association state first */
data.ap_addr.sa_family = ARPHRD_ETHER;
if (assoc) {
- memcpy(data.ap_addr.sa_data, wlandev->bssid, WLAN_ADDR_LEN);
+ memcpy(data.ap_addr.sa_data, wlandev->bssid, ETH_ALEN);
} else {
- memset(data.ap_addr.sa_data, 0, WLAN_ADDR_LEN);
+ memset(data.ap_addr.sa_data, 0, ETH_ALEN);
}
if (wlan_wext_write)
}
-#endif /* compatibility to wireless extensions */
-
-