Hi,
The attached patch changes the acx_ioctl_{get,set}_encode functions to use
the 80211 stack in the kernel, so they become mere wrappers.Signed-off-by: Carlos Martin <[EMAIL PROTECTED]> cmn -- Carlos Martín http://www.cmartin.tk "Erdbeben? Sicherlich etwas, das mit Erdberen zu tun hat." -- me, paraphrased
diff --git a/ioctl.c b/ioctl.c
index 1502938..041f165 100644
--- a/ioctl.c
+++ b/ioctl.c
@@ -1007,87 +1007,7 @@ acx_ioctl_set_encode(
union iwreq_data *wrqu,
char *extra)
{
- struct iw_point *dwrq = &wrqu->encoding;
- acx_device_t *adev = ndev2adev(ndev);
- int index;
- int result;
-
- FN_ENTER;
-
- log(L_IOCTL, "set encoding flags=0x%04X, size=%d, key: %s\n",
- dwrq->flags, dwrq->length, extra ? "set" : "No key");
-
- acx_sem_lock(adev);
-
- index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
-
- if (dwrq->length > 0) {
- /* if index is 0 or invalid, use default key */
- if ((index < 0) || (index > 3))
- index = (int)adev->ieee->sec.active_key;
-
- if (0 == (dwrq->flags & IW_ENCODE_NOKEY)) {
- if (dwrq->length > 29)
- dwrq->length = 29; /* restrict it */
-
- if (dwrq->length > 13) {
- /* 29*8 == 232, WEP256 */
- adev->ieee->sec.key_sizes[index] = 29;
- } else if (dwrq->length > 5) {
- /* 13*8 == 104bit, WEP128 */
- adev->ieee->sec.key_sizes[index] = 13;
- } else if (dwrq->length > 0) {
- /* 5*8 == 40bit, WEP64 */
- adev->ieee->sec.key_sizes[index] = 5;
- } else {
- /* disable key */
- adev->ieee->sec.key_sizes[index] = 0;
- }
-
- memset(adev->ieee->sec.keys[index], 0,
- sizeof(adev->ieee->sec.keys[index]));
- memcpy(adev->ieee->sec.keys[index], extra, dwrq->length);
- }
- } else {
- /* set transmit key */
- if ((index >= 0) && (index <= 3))
- adev->ieee->sec.active_key = index;
- else if (0 == (dwrq->flags & IW_ENCODE_MODE)) {
- /* complain if we were not just setting
- * the key mode */
- result = -EINVAL;
- goto end_unlock;
- }
- }
-
- adev->ieee->sec.enabled = !(dwrq->flags & IW_ENCODE_DISABLED);
-
- if (dwrq->flags & IW_ENCODE_OPEN) {
- adev->ieee->sec.auth_mode = WLAN_AUTH_OPEN;
-
- } else if (dwrq->flags & IW_ENCODE_RESTRICTED) {
- adev->ieee->sec.auth_mode = WLAN_AUTH_SHARED_KEY;
- }
-
- /* set flag to make sure the card WEP settings get updated */
- SET_BIT(adev->set_mask, GETSET_WEP);
-
- log(L_IOCTL, "len=%d, key at 0x%p, flags=0x%X\n",
- dwrq->length, extra, dwrq->flags);
-
- for (index = 0; index <= 3; index++) {
- if (adev->ieee->sec.key_sizes[index]) {
- log(L_IOCTL, "index=%d, size=%d, key at 0x%p\n",
- adev->ieee->sec.active_key,
- (int) adev->ieee->sec.key_sizes[index],
- adev->ieee->sec.keys[index]);
- }
- }
- result = -EINPROGRESS;
-
-end_unlock:
- acx_sem_unlock(adev);
-
+ int result = ieee80211_wx_set_encode(netdev_priv(ndev), info, wrqu, extra);
FN_EXIT1(result);
return result;
}
@@ -1103,35 +1023,9 @@ acx_ioctl_get_encode(
union iwreq_data *wrqu,
char *extra)
{
- struct iw_point *dwrq = &wrqu->encoding;
- acx_device_t *adev = ndev2adev(ndev);
- int index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
-
- FN_ENTER;
-
- if (adev->ieee->sec.enabled == 0) {
- dwrq->flags = IW_ENCODE_DISABLED;
- } else {
- if ((index < 0) || (index > 3))
- index = (int)adev->ieee->sec.active_key;
-
- dwrq->flags = (adev->ieee->sec.auth_mode == WLAN_AUTH_SHARED_KEY) ?
- IW_ENCODE_RESTRICTED : IW_ENCODE_OPEN;
- dwrq->length = adev->ieee->sec.key_sizes[index];
-
- memcpy(extra, adev->ieee->sec.keys[index],
- adev->ieee->sec.key_sizes[index]);
- }
-
- /* set the current index */
- SET_BIT(dwrq->flags, index + 1);
-
- log(L_IOCTL, "len=%d, key=%p, flags=0x%X\n",
- dwrq->length, dwrq->pointer,
- dwrq->flags);
-
- FN_EXIT1(OK);
- return OK;
+ int result = ieee80211_wx_get_encode(netdev_priv(ndev), info, wrqu, extra);
+ FN_EXIT1(result);
+ return result;
}
pgpcyfI2QGiu6.pgp
Description: PGP signature
