Skip to contentSkip to conversation

acxsm: Change acx_ioctl_{get,set}_encode to use softmac

PATCH Applied Carlos Martín 2 participants 2 messages Feb 6, 2006 – Feb 7, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 acxsm: Change acx_ioctl_{get,set}_encode to use softmac

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.

cmn

Signature · 3 lines
Carlos Martín       http://www.cmartin.tk

"Erdbeben? Sicherlich etwas, das mit Erdberen zu tun hat." -- me, paraphrased
ioctl.c +4 -110
index 1502938..041f165 100644
@@ -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;
 }
 
 
#1 lore raw
Quoted 8 lines · Carlos Martín

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.

cmn

Applied, thanks!
--
vda

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642