summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpizza <pizza>2008-03-24 20:58:30 +0000
committerpizza <pizza>2008-03-24 20:58:30 +0000
commit3598e4d67a55323259abb86cbf31a5047fc0cbfd (patch)
treeef38b882a749bccfd7ea731c3f28a61192cea5cd
parent6b3a6e94f76ea17ef2b3eeee12332df2c2bc4843 (diff)
downloadlinux-wlan-ng-3598e4d67a55323259abb86cbf31a5047fc0cbfd.tar.gz
linux-wlan-ng-3598e4d67a55323259abb86cbf31a5047fc0cbfd.tar.bz2
linux-wlan-ng-3598e4d67a55323259abb86cbf31a5047fc0cbfd.zip
Another patch from Richard Kennedy:
|Here the patch to return an error in the wext functions if the card |state != running. | |It doesn't stop the collision between the auto enable & udev startup |but I think it is worth having anyway. | |I left it returning UBUSY rather than UNODEV because NetworkManager puts |a nice "card is busy" message in the logs which is easy to understand. |But it doesn't make a lot of difference either way. | | |It also adds in a couple of missing DBFENTER / DBFEXIT
-rw-r--r--CHANGES4
-rw-r--r--src/p80211/p80211wext.c132
2 files changed, 129 insertions, 7 deletions
diff --git a/CHANGES b/CHANGES
index b5e0bc2..425e6c1 100644
--- a/CHANGES
+++ b/CHANGES
@@ -41,7 +41,9 @@
* Intersil Corporation as part of PRISM(R) chipset product development.
*
* --------------------------------------------------------------------
- - use round_jiffies wherever possible (Richard Kennedy)
+ - WEXT functions should return -EBUSY when the hardware is still
+ being initialized (Richard Kennedy)
+ - Use round_jiffies wherever possible (Richard Kennedy)
- Disallow ioctls from running until the hardware probe function has
finished. (Richard Kennedy)
- Fix userspace scripts to work on Fedora 8 (Chris Rankin)
diff --git a/src/p80211/p80211wext.c b/src/p80211/p80211wext.c
index d4157f4..fb01de1 100644
--- a/src/p80211/p80211wext.c
+++ b/src/p80211/p80211wext.c
@@ -144,8 +144,9 @@ static int qual_as_percent(int snr ) {
return 100;
}
-
-
+static inline int invalid_state(wlandevice_t *wlandev ) {
+ return wlandev->msdstate != WLAN_MSD_RUNNING;
+}
static int p80211wext_dorequest(wlandevice_t *wlandev, UINT32 did, UINT32 data)
{
@@ -176,6 +177,12 @@ static int p80211wext_autojoin(wlandevice_t *wlandev)
DBFENTER;
+ if ( invalid_state(wlandev) ) {
+ WLAN_LOG_DEBUG(1,"called from invalid state [%d]\n",wlandev->msdstate);
+ err = -EBUSY;
+ goto exit;
+ }
+
/* Get ESSID */
result = p80211wext_giwessid(wlandev->netdev, NULL, &data, ssid);
@@ -308,6 +315,12 @@ static int p80211wext_giwfreq(netdevice_t *dev,
int err = 0;
DBFENTER;
+ if ( invalid_state(wlandev) ) {
+ WLAN_LOG_DEBUG(1,"called from invalid state [%d]\n",wlandev->msdstate);
+ err = -EBUSY;
+ goto exit;
+ }
+
msg.msgcode = DIDmsg_dot11req_mibget;
mibitem.did = DIDmib_dot11phy_dot11PhyDSSSTable_dot11CurrentChannel;
@@ -347,6 +360,12 @@ static int p80211wext_siwfreq(netdevice_t *dev,
DBFENTER;
+ if ( invalid_state(wlandev) ) {
+ WLAN_LOG_DEBUG(1,"called from invalid state [%d]\n",wlandev->msdstate);
+ err = -EBUSY;
+ goto exit;
+ }
+
if (!wlan_wext_write) {
err = (-EOPNOTSUPP);
goto exit;
@@ -415,6 +434,11 @@ static int p80211wext_siwmode(netdevice_t *dev,
DBFENTER;
+ if ( invalid_state(wlandev) ) {
+ WLAN_LOG_DEBUG(1,"called from invalid state [%d]\n",wlandev->msdstate);
+ err = -EBUSY;
+ goto exit;
+ }
if (!wlan_wext_write) {
err = (-EOPNOTSUPP);
goto exit;
@@ -617,6 +641,12 @@ static int p80211wext_siwencode(netdevice_t *dev,
int i;
DBFENTER;
+ if ( invalid_state(wlandev) ) {
+ WLAN_LOG_DEBUG(1,"called from invalid state [%d]\n",wlandev->msdstate);
+ err = -EBUSY;
+ goto exit;
+ }
+
if (!wlan_wext_write) {
err = (-EOPNOTSUPP);
goto exit;
@@ -777,6 +807,11 @@ static int p80211wext_siwessid(netdevice_t *dev,
DBFENTER;
+ if ( invalid_state(wlandev) ) {
+ WLAN_LOG_DEBUG(1,"called from invalid state [%d]\n",wlandev->msdstate);
+ err = -EBUSY;
+ goto exit;
+ }
if (!wlan_wext_write) {
err = (-EOPNOTSUPP);
goto exit;
@@ -827,6 +862,11 @@ static int p80211wext_siwcommit(netdevice_t *dev,
DBFENTER;
+ if ( invalid_state(wlandev) ) {
+ WLAN_LOG_DEBUG(1,"called from invalid state [%d]\n",wlandev->msdstate);
+ err = -EBUSY;
+ goto exit;
+ }
if (!wlan_wext_write) {
err = (-EOPNOTSUPP);
goto exit;
@@ -853,6 +893,11 @@ static int p80211wext_giwrate(netdevice_t *dev,
DBFENTER;
+ if ( invalid_state(wlandev) ) {
+ WLAN_LOG_DEBUG(1,"called from invalid state [%d]\n",wlandev->msdstate);
+ err = -EBUSY;
+ goto exit;
+ }
msg.msgcode = DIDmsg_dot11req_mibget;
mibitem.did = DIDmib_p2_p2MAC_p2CurrentTxRate;
memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
@@ -907,6 +952,11 @@ static int p80211wext_giwrts(netdevice_t *dev,
DBFENTER;
+ if ( invalid_state(wlandev) ) {
+ WLAN_LOG_DEBUG(1,"called from invalid state [%d]\n",wlandev->msdstate);
+ err = -EBUSY;
+ goto exit;
+ }
msg.msgcode = DIDmsg_dot11req_mibget;
mibitem.did = DIDmib_dot11mac_dot11OperationTable_dot11RTSThreshold;
memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
@@ -941,6 +991,11 @@ static int p80211wext_siwrts(netdevice_t *dev,
DBFENTER;
+ if ( invalid_state(wlandev) ) {
+ WLAN_LOG_DEBUG(1,"called from invalid state [%d]\n",wlandev->msdstate);
+ err = -EBUSY;
+ goto exit;
+ }
if (!wlan_wext_write) {
err = (-EOPNOTSUPP);
goto exit;
@@ -978,6 +1033,11 @@ static int p80211wext_giwfrag(netdevice_t *dev,
DBFENTER;
+ if ( invalid_state(wlandev) ) {
+ WLAN_LOG_DEBUG(1,"called from invalid state [%d]\n",wlandev->msdstate);
+ err = -EBUSY;
+ goto exit;
+ }
msg.msgcode = DIDmsg_dot11req_mibget;
mibitem.did = DIDmib_dot11mac_dot11OperationTable_dot11FragmentationThreshold;
memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
@@ -1011,6 +1071,11 @@ static int p80211wext_siwfrag(netdevice_t *dev,
DBFENTER;
+ if ( invalid_state(wlandev) ) {
+ WLAN_LOG_DEBUG(1,"called from invalid state [%d]\n",wlandev->msdstate);
+ err = -EBUSY;
+ goto exit;
+ }
if (!wlan_wext_write) {
err = (-EOPNOTSUPP);
goto exit;
@@ -1061,6 +1126,11 @@ static int p80211wext_giwretry(netdevice_t *dev,
UINT16 shortretry, longretry, lifetime;
DBFENTER;
+ if ( invalid_state(wlandev) ) {
+ WLAN_LOG_DEBUG(1,"called from invalid state [%d]\n",wlandev->msdstate);
+ err = -EBUSY;
+ goto exit;
+ }
msg.msgcode = DIDmsg_dot11req_mibget;
mibitem.did = DIDmib_dot11mac_dot11OperationTable_dot11ShortRetryLimit;
@@ -1140,6 +1210,11 @@ static int p80211wext_siwretry(netdevice_t *dev,
DBFENTER;
+ if ( invalid_state(wlandev) ) {
+ WLAN_LOG_DEBUG(1,"called from invalid state [%d]\n",wlandev->msdstate);
+ err = -EBUSY;
+ goto exit;
+ }
if (!wlan_wext_write) {
err = (-EOPNOTSUPP);
goto exit;
@@ -1212,6 +1287,11 @@ static int p80211wext_siwtxpow(netdevice_t *dev,
DBFENTER;
+ if ( invalid_state(wlandev) ) {
+ WLAN_LOG_DEBUG(1,"called from invalid state [%d]\n",wlandev->msdstate);
+ err = -EBUSY;
+ goto exit;
+ }
if (!wlan_wext_write) {
err = (-EOPNOTSUPP);
goto exit;
@@ -1257,6 +1337,11 @@ static int p80211wext_giwtxpow(netdevice_t *dev,
DBFENTER;
+ if ( invalid_state(wlandev) ) {
+ WLAN_LOG_DEBUG(1,"called from invalid state [%d]\n",wlandev->msdstate);
+ err = -EBUSY;
+ goto exit;
+ }
msg.msgcode = DIDmsg_dot11req_mibget;
mibitem.did = DIDmib_dot11phy_dot11PhyTxPowerTable_dot11CurrentTxPowerLevel;
@@ -1392,6 +1477,11 @@ static int p80211wext_siwscan(netdevice_t *dev,
DBFENTER;
+ if ( invalid_state(wlandev) ) {
+ WLAN_LOG_DEBUG(1,"called from invalid state [%d]\n",wlandev->msdstate);
+ err = -EBUSY;
+ goto exit;
+ }
if (wlandev->macmode == WLAN_MACMODE_ESS_AP) {
WLAN_LOG_ERROR("Can't scan in AP mode\n");
err = (-EOPNOTSUPP);
@@ -1516,6 +1606,12 @@ static int p80211wext_giwscan(netdevice_t *dev,
DBFENTER;
+ if ( invalid_state(wlandev) ) {
+ WLAN_LOG_DEBUG(1,"called from invalid state [%d]\n",wlandev->msdstate);
+ err = -EBUSY;
+ goto exit;
+ }
+
/* Since wireless tools doesn't really have a way of passing how
* many scan results results there were back here, keep grabbing them
* until we fail.
@@ -1541,7 +1637,7 @@ static int p80211wext_giwscan(netdevice_t *dev,
if (result && !scan_good)
err = prism2_result2err (msg.resultcode.data);
-
+ exit:
DBFEXIT;
return err;
}
@@ -1565,6 +1661,13 @@ static int p80211wext_set_encodeext(struct net_device *dev,
struct iw_point *encoding = &wrqu->encoding;
int idx = encoding->flags & IW_ENCODE_INDEX;
+ DBFENTER;
+ if ( invalid_state(wlandev) ) {
+ WLAN_LOG_DEBUG(1,"called from invalid state [%d]\n",wlandev->msdstate);
+ result = -EBUSY;
+ goto exit;
+ }
+
WLAN_LOG_DEBUG(1,"set_encode_ext flags[%d] alg[%d] keylen[%d]\n",ext->ext_flags,(int)ext->alg,(int)ext->key_len);
@@ -1623,6 +1726,8 @@ static int p80211wext_set_encodeext(struct net_device *dev,
result = p80211req_dorequest(wlandev,(UINT8*)&msg);
WLAN_LOG_DEBUG(1,"result (%d)\n",result);
}
+ exit:
+ DBFEXIT;
return result;
}
@@ -1641,6 +1746,12 @@ static int p80211wext_get_encodeext(struct net_device *dev,
int idx;
DBFENTER;
+ if ( invalid_state(wlandev) ) {
+ WLAN_LOG_DEBUG(1,"called from invalid state [%d]\n",wlandev->msdstate);
+ result = -EBUSY;
+ goto exit;
+ }
+
WLAN_LOG_DEBUG(1,"get_encode_ext flags[%d] alg[%d] keylen[%d]\n",ext->ext_flags,(int)ext->alg,(int)ext->key_len);
@@ -1691,6 +1802,14 @@ static int p80211_wext_set_iwauth (struct net_device *dev,
struct iw_param *param = &wrqu->param;
int result =0;
+ DBFENTER;
+ if ( invalid_state(wlandev) ) {
+ WLAN_LOG_DEBUG(1,"called from invalid state [%d]\n",wlandev->msdstate);
+ result = -EBUSY;
+ goto exit;
+ }
+
+
WLAN_LOG_DEBUG(1,"set_iwauth flags[%d]\n",(int)param->flags & IW_AUTH_INDEX );
switch (param->flags & IW_AUTH_INDEX) {
@@ -1729,8 +1848,8 @@ static int p80211_wext_set_iwauth (struct net_device *dev,
break;
}
-
-
+ exit:
+ DBFEXIT;
return result;
}
@@ -1743,6 +1862,7 @@ static int p80211_wext_get_iwauth (struct net_device *dev,
struct iw_param *param = &wrqu->param;
int result =0;
+ DBFENTER;
WLAN_LOG_DEBUG(1,"get_iwauth flags[%d]\n",(int)param->flags & IW_AUTH_INDEX );
switch (param->flags & IW_AUTH_INDEX) {
@@ -1763,7 +1883,7 @@ static int p80211_wext_get_iwauth (struct net_device *dev,
break;
}
-
+ DBFEXIT;
return result;
}