linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: dragoran <drago01@gmail.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: Dan Williams <dcbw@redhat.com>, Zhu Yi <yi.zhu@intel.com>,
	linux-wireless@vger.kernel.org,
	ipw3945-devel <ipw3945-devel@lists.sourceforge.net>,
	"John W. Linville" <linville@tuxdriver.com>,
	Jouni Malinen <j@w1.fi>, Jean Tourrilhes <jt@hpl.hp.com>
Subject: [PATCH] Re: [ipw3945-devel] iwl3945/mac80211 cannot connect to dynamic wep network
Date: Fri, 26 Oct 2007 12:32:30 +0200	[thread overview]
Message-ID: <4721C23E.501@gmail.com> (raw)
In-Reply-To: <1193318969.6092.19.camel@johannes.berg>

Johannes Berg wrote:
> On Wed, 2007-10-24 at 11:07 -0400, Dan Williams wrote:
>   
>
>> Could you educate me a bit more about the problem if you've got a bit of
>> time?
>>     
>
> As much as I've understood, the problem comes from the privacy mismatch
> function returning non-zero. This means that wpa_supplicant doesn't set
> IW_AUTH_KEY_MGMT_802_1X because if you check the function then the
> key_manegement_enabled variable is checked first thing.
>
>   
I can't verify it right now (won't have access to the dynamic wep ap for 
~10 days), but I tryed to find out whats wrong by reading the code 
(wpa_supplicant and mac80211).



ieee80211_ioctl_siwauth in ieee80211_ioctl.c sets the 
key_management_enabled variable if the value passed to the ioctl is not 
0 to true:
sdata->u.sta.key_management_enabled = !!data->value;
why !!data->value ?  that should be the same as data->value ...

later its in the array ieee80211_handler (same file)
(iw_handler) ieee80211_ioctl_siwauth,        /* SIOCSIWAUTH */

now to wpa_supplicant:
wpa_driver_wext_keymgmt2wext in driver_wext.c  returns 
IW_AUTH_KEY_MGMT_802_1 (which is defined as 1) (when dynamic wep is 
used) wpa_driver_wext_set_auth_param than passes the value using 
ioctl(drv->ioctl_sock, SIOCSIWAUTH, &iwr) to mac80211.

ieee80211_privacy_mismatch checks for
if (!ifsta || (ifsta->flags & IEEE80211_STA_MIXED_CELL) ||
        ifsta->key_management_enabled)

and returns 0 because ifsta->key_management_enabled  true in this case 
!!1 -> 1
so the attached patch should fix it by doing !data->value (which would 
result in ifsta->key_management_enabled to be 0 here and therefor 
ieee80211_privacy_mismatch won't return 0).

so the problem is that it returns 0 when ifsta->key_management_enabled 
is enabled (resturns 0 for dynamic wep).

the attached (untested!) patch (against 2.6.24-rc1) should fix it:
(I will build a kernel and test with static wep later today to see if I 
broke something)

also please correct me if I am completly wrong.

---

Fix handling of key_management_enabled to make dynamic wep work.

Signed-off-by: Adel Gadllah <adel.gadllah@gmx.net>
---
diff -upNr linux-2.6.23.orign/net/mac80211/ieee80211_ioctl.c 
linux-2.6.23/net/mac80211/ieee80211_ioctl.c
--- linux-2.6.23.orign/net/mac80211/ieee80211_ioctl.c    2007-10-26 
11:14:00.000000000 +0200
+++ linux-2.6.23/net/mac80211/ieee80211_ioctl.c    2007-10-26 
12:23:25.000000000 +0200
@@ -938,7 +938,7 @@ static int ieee80211_ioctl_siwauth(struc
              * that has privacy enabled regardless of not
              * having a key.
              */
-            sdata->u.sta.key_management_enabled = !!data->value;
+            sdata->u.sta.key_management_enabled = data->value;
         }
         break;
     case IW_AUTH_80211_AUTH_ALG:
diff -upNr linux-2.6.23.orign/net/mac80211/ieee80211_sta.c 
linux-2.6.23/net/mac80211/ieee80211_sta.c
--- linux-2.6.23.orign/net/mac80211/ieee80211_sta.c    2007-10-26 
11:14:00.000000000 +0200
+++ linux-2.6.23/net/mac80211/ieee80211_sta.c    2007-10-26 
12:23:35.000000000 +0200
@@ -707,7 +707,7 @@ static int ieee80211_privacy_mismatch(st
     int res = 0;
 
     if (!ifsta || (ifsta->flags & IEEE80211_STA_MIXED_CELL) ||
-        ifsta->key_management_enabled)
+        !ifsta->key_management_enabled)
         return 0;
 
     bss = ieee80211_rx_bss_get(dev, ifsta->bssid, local->hw.conf.channel,





  parent reply	other threads:[~2007-10-26 10:32 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-23  7:54 iwl3945/mac80211 cannot connect to dynamic wep network dragoran
2007-10-23  8:14 ` [ipw3945-devel] " Zhu Yi
2007-10-23  8:56   ` dragoran
2007-10-23 14:07   ` Dan Williams
2007-10-23 17:37     ` Johannes Berg
2007-10-24 15:07       ` Dan Williams
2007-10-25 13:29         ` Johannes Berg
2007-10-25 13:49           ` Dan Williams
2007-10-25 13:57             ` Johannes Berg
2007-10-28  5:18               ` Dan Williams
2007-10-28 10:28                 ` Johannes Berg
2007-10-28 17:36                   ` Jouni Malinen
2007-10-28 17:54                     ` Johannes Berg
2007-10-28 18:49                       ` Jouni Malinen
2007-10-29 14:42                         ` Johannes Berg
2007-10-26 10:32           ` dragoran [this message]
2007-10-26 10:43             ` [PATCH] " Johannes Berg
2007-10-26 10:53               ` dragoran
2007-10-26 10:43           ` [PATCH] fix dynamic wep dragoran
2007-10-26 10:55             ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4721C23E.501@gmail.com \
    --to=drago01@gmail.com \
    --cc=dcbw@redhat.com \
    --cc=ipw3945-devel@lists.sourceforge.net \
    --cc=j@w1.fi \
    --cc=johannes@sipsolutions.net \
    --cc=jt@hpl.hp.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=yi.zhu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).