[PATCH] WEXT: Suppress additional DISASSOCIATE events

Dmitry Shmidt dimitrysh
Wed Feb 24 13:19:37 PST 2010


Signed-off-by: Dmitry Shmidt <dimitrysh at google.com>
---
 src/drivers/driver_wext.c |   13 ++++++++++---
 src/drivers/driver_wext.h |    1 +
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/drivers/driver_wext.c b/src/drivers/driver_wext.c
index 2614f23..93db9d0 100644
--- a/src/drivers/driver_wext.c
+++ b/src/drivers/driver_wext.c
@@ -470,11 +470,14 @@ static void
wpa_driver_wext_event_wireless(struct wpa_driver_wext_data *drv,
 				drv->assoc_req_ies =3D NULL;
 				os_free(drv->assoc_resp_ies);
 				drv->assoc_resp_ies =3D NULL;
-				wpa_supplicant_event(drv->ctx, EVENT_DISASSOC,
-						     NULL);
-		=09
+				if (!drv->skip_disconnect) {
+					drv->skip_disconnect =3D 1;
+					wpa_supplicant_event(drv->ctx, EVENT_DISASSOC,
+							     NULL);
+				}
 			} else {
 				wpa_driver_wext_event_assoc_ies(drv);
+				drv->skip_disconnect =3D 0;
 				wpa_supplicant_event(drv->ctx, EVENT_ASSOC,
 						     NULL);
 			}
@@ -733,6 +736,8 @@ void * wpa_driver_wext_init(void *ctx, const char *ifna=
me)

 	drv->mlme_sock =3D -1;

+	drv->skip_disconnect =3D 0;
+
 	if (wpa_driver_wext_finish_drv_init(drv) < 0)
 		goto err3;

@@ -1880,6 +1885,8 @@ int wpa_driver_wext_associate(void *priv,

 	wpa_printf(MSG_DEBUG, "%s", __FUNCTION__);

+	drv->skip_disconnect =3D 0;
+
 	if (drv->cfg80211) {
 		/*
 		 * Stop cfg80211 from trying to associate before we are done
diff --git a/src/drivers/driver_wext.h b/src/drivers/driver_wext.h
index 602c7e1..559e890 100644
--- a/src/drivers/driver_wext.h
+++ b/src/drivers/driver_wext.h
@@ -43,6 +43,7 @@ struct wpa_driver_wext_data {
 	char mlmedev[IFNAMSIZ + 1];

 	int scan_complete_events;
+	int skip_disconnect;

 	int cfg80211; /* whether driver is using cfg80211 */
 };
--=20
1.6.2.2


On Wed, Feb 24, 2010 at 4:30 PM, Dan Williams <dcbw at redhat.com> wrote:
> On Wed, 2010-02-24 at 15:53 -0800, Dmitry Shmidt wrote:
>> Hi Dan,
>>
>> Thank you for the advice. Then I need to clear the flag in driver
>> association call as well, don't I?
>
> Well, if you can't do the patch to wpa_supplicant, then you could
> probably modify the driver to:
>
> 1) *not* send the zero-bssid IWAP event for deauthenticate, but still
> send the custom MLME event
> 2) *do* send the zero-bssid IWAP event for disassociate
>
> At least, that might work. =A0The supplicant should still see the custom
> MLME event and handle it correctly, but you won't get two IWAP events.
>
> Or, you could fix your connection manager not to care about this. =A0With
> WEXT, the connection manager should simply tell the supplicant to
> associate and start a timer. =A0If the supplicant doesn't signal CONNECTE=
D
> within that timeout, the connection has failed. =A0During that timer, you
> ignore IWAP events, because the these happen for transient auth failures
> that you don't care about, and the supplicant will keep retrying until
> your timeout fires.
>
> Dan
>
>> Dmitry
>>
>> On Wed, Feb 24, 2010 at 3:27 PM, Dan Williams <dcbw at redhat.com> wrote:
>> > On Wed, 2010-02-24 at 13:21 -0800, Dmitry Shmidt wrote:
>> >> Hi,
>> >>
>> >> How about this one:
>> >
>> > It may not be as safe as you think. =A0The zero-BSSID IWAP event also
>> > comes in when an association request has failed. =A0The patch you've s=
ent
>> > will suppress that valid case, and thus the supplicant and upper layer=
s
>> > will have no idea that the assoc request failed.
>> >
>> > You're really looking for the kind of event granularity that
>> > cfg80211/nl80211 bring to the table.
>> >
>> > Dan
>> >
>> >> From ab0662bbd4a507f6c97f80c6e7482f2ece266ef9 Mon Sep 17 00:00:00 200=
1
>> >> From: Dmitry Shmidt <dimitrysh at google.com>
>> >> Date: Wed, 24 Feb 2010 13:19:37 -0800
>> >> Subject: [PATCH] WEXT: Suppress additional DISASSOCIATE events
>> >>
>> >> Signed-off-by: Dmitry Shmidt <dimitrysh at google.com>
>> >> ---
>> >> =A0src/drivers/driver_wext.c | =A0 11 ++++++++---
>> >> =A0src/drivers/driver_wext.h | =A0 =A01 +
>> >> =A02 files changed, 9 insertions(+), 3 deletions(-)
>> >>
>> >> diff --git a/src/drivers/driver_wext.c b/src/drivers/driver_wext.c
>> >> index 2614f23..3e00fa5 100644
>> >> --- a/src/drivers/driver_wext.c
>> >> +++ b/src/drivers/driver_wext.c
>> >> @@ -470,11 +470,14 @@ static void
>> >> wpa_driver_wext_event_wireless(struct wpa_driver_wext_data *drv,
>> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 drv->asso=
c_req_ies =3D NULL;
>> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 os_free(d=
rv->assoc_resp_ies);
>> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 drv->asso=
c_resp_ies =3D NULL;
>> >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 wpa_supplic=
ant_event(drv->ctx, EVENT_DISASSOC,
>> >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0NULL);
>> >> -
>> >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!drv->s=
kip_disconnect) {
>> >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 drv->skip_disconnect =3D 1;
>> >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 wpa_supplicant_event(drv->ctx, EVENT_DISASSOC,
>> >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0NULL);
>> >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
>> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } else {
>> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 wpa_drive=
r_wext_event_assoc_ies(drv);
>> >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 drv->skip_d=
isconnect =3D 0;
>> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 wpa_suppl=
icant_event(drv->ctx, EVENT_ASSOC,
>> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0NULL);
>> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
>> >> @@ -733,6 +736,8 @@ void * wpa_driver_wext_init(void *ctx, const char=
 *ifname)
>> >>
>> >> =A0 =A0 =A0 drv->mlme_sock =3D -1;
>> >>
>> >> + =A0 =A0 drv->skip_disconnect =3D 0;
>> >> +
>> >> =A0 =A0 =A0 if (wpa_driver_wext_finish_drv_init(drv) < 0)
>> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto err3;
>> >>
>> >> diff --git a/src/drivers/driver_wext.h b/src/drivers/driver_wext.h
>> >> index 602c7e1..559e890 100644
>> >> --- a/src/drivers/driver_wext.h
>> >> +++ b/src/drivers/driver_wext.h
>> >> @@ -43,6 +43,7 @@ struct wpa_driver_wext_data {
>> >> =A0 =A0 =A0 char mlmedev[IFNAMSIZ + 1];
>> >>
>> >> =A0 =A0 =A0 int scan_complete_events;
>> >> + =A0 =A0 int skip_disconnect;
>> >>
>> >> =A0 =A0 =A0 int cfg80211; /* whether driver is using cfg80211 */
>> >> =A0};
>> >> _______________________________________________
>> >> HostAP mailing list
>> >> HostAP at lists.shmoo.com
>> >> http://lists.shmoo.com/mailman/listinfo/hostap
>> >
>> >
>> >
>
>
>

--001636d34035c4f2020480712693
Content-Type: application/octet-stream; 
	name="0001-WEXT-Suppress-additional-DISASSOCIATE-events.patch"
Content-Disposition: attachment; 
	filename="0001-WEXT-Suppress-additional-DISASSOCIATE-events.patch"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_g63wje0c0

RnJvbSA5OGUxMzJiNDkyMTIzMWIzNzRhZmJjY2Q2ZmJhOTI3ZDYxY2ZlMGZiIE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBEbWl0cnkgU2htaWR0IDxkaW1pdHJ5c2hAZ29vZ2xlLmNvbT4K
RGF0ZTogV2VkLCAyNCBGZWIgMjAxMCAxMzoxOTozNyAtMDgwMApTdWJqZWN0OiBbUEFUQ0hdIFdF
WFQ6IFN1cHByZXNzIGFkZGl0aW9uYWwgRElTQVNTT0NJQVRFIGV2ZW50cwoKU2lnbmVkLW9mZi1i
eTogRG1pdHJ5IFNobWlkdCA8ZGltaXRyeXNoQGdvb2dsZS5jb20+Ci0tLQogc3JjL2RyaXZlcnMv
ZHJpdmVyX3dleHQuYyB8ICAgMTMgKysrKysrKysrKy0tLQogc3JjL2RyaXZlcnMvZHJpdmVyX3dl
eHQuaCB8ICAgIDEgKwogMiBmaWxlcyBjaGFuZ2VkLCAxMSBpbnNlcnRpb25zKCspLCAzIGRlbGV0
aW9ucygtKQoKZGlmZiAtLWdpdCBhL3NyYy9kcml2ZXJzL2RyaXZlcl93ZXh0LmMgYi9zcmMvZHJp
dmVycy9kcml2ZXJfd2V4dC5jCmluZGV4IDI2MTRmMjMuLjkzZGI5ZDA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