* [PATCH] acxsm: Change acx_ioctl_{get,set}_encode to use softmac
@ 2006-02-06 23:32 Carlos Martín
2006-02-07 6:20 ` Denis Vlasenko
0 siblings, 1 reply; 2+ messages in thread
From: Carlos Martín @ 2006-02-06 23:32 UTC (permalink / raw)
To: acx100-devel; +Cc: netdev
[-- Attachment #1.1: Type: text/plain, Size: 339 bytes --]
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 <carlos@cmartin.tk>
cmn
--
Carlos Martín http://www.cmartin.tk
"Erdbeben? Sicherlich etwas, das mit Erdberen zu tun hat." -- me, paraphrased
[-- Attachment #1.2: acx-ioctl-getset-encode-sm.patch --]
[-- Type: text/x-diff, Size: 3668 bytes --]
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;
}
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] acxsm: Change acx_ioctl_{get,set}_encode to use softmac
2006-02-06 23:32 [PATCH] acxsm: Change acx_ioctl_{get,set}_encode to use softmac Carlos Martín
@ 2006-02-07 6:20 ` Denis Vlasenko
0 siblings, 0 replies; 2+ messages in thread
From: Denis Vlasenko @ 2006-02-07 6:20 UTC (permalink / raw)
To: acx100-devel; +Cc: Carlos Martín, netdev
On Tuesday 07 February 2006 01:32, Carlos Martín wrote:
> 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 <carlos@cmartin.tk>
>
> 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&kid\x103432&bid#0486&dat\x121642
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-02-07 6:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-06 23:32 [PATCH] acxsm: Change acx_ioctl_{get,set}_encode to use softmac Carlos Martín
2006-02-07 6:20 ` Denis Vlasenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).