[PATCH] wpa_supplicant: abort scan after removing all networks

David Spinadel david.spinadel
Wed Oct 10 06:37:36 PDT 2012


Change-Id: I737848dabed49d961985845f2e86f717c2926f0c
Signed-off-by: David Spinadel <david.spinadel at intel.com>
Reviewed-on: http://git-mwg.jer.intel.com/gerrit/3585
Reviewed-by: Jenkins
Tested-by: Jenkins
Reviewed-by: Max Stepanov <Max.Stepanov at intel.com>
Tested-by: Max Stepanov <Max.Stepanov at intel.com>
---
 wpa_supplicant/ctrl_iface.c             |    7 +++++++
 wpa_supplicant/dbus/dbus_new_handlers.c |    8 ++++++++
 wpa_supplicant/dbus/dbus_old_handlers.c |    5 +++++
 wpa_supplicant/wps_supplicant.c         |    5 +++++
 4 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index d8e4864..0eeb9ec 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -2085,6 +2085,8 @@ static int wpa_supplicant_ctrl_iface_remove_network(
        /* cmd: "<network id>" or "all" */
        if (os_strcmp(cmd, "all") =3D=3D 0) {
                wpa_printf(MSG_DEBUG, "CTRL_IFACE: REMOVE_NETWORK all");
+               wpa_supplicant_cancel_sched_scan(wpa_s);
+               wpa_supplicant_cancel_scan(wpa_s);
                ssid =3D wpa_s->conf->ssid;
                while (ssid) {
                        struct wpa_ssid *remove_ssid =3D ssid;
@@ -2142,6 +2144,11 @@ static int wpa_supplicant_ctrl_iface_remove_network(
                return -1;
        }

+       if (!wpa_s->conf->ssid) {
+               wpa_supplicant_cancel_sched_scan(wpa_s);
+               wpa_supplicant_cancel_scan(wpa_s);
+       }
+
        return 0;
 }

diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c b/wpa_supplicant/dbus/=
dbus_new_handlers.c
index 00378be..9422b24 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers.c
+++ b/wpa_supplicant/dbus/dbus_new_handlers.c
@@ -1525,6 +1525,11 @@ DBusMessage * wpas_dbus_handler_remove_network(DBusM=
essage *message,
                wpa_supplicant_deauthenticate(wpa_s,
                                              WLAN_REASON_DEAUTH_LEAVING);

+       if (!wpa_s->conf->ssid) {
+               wpa_supplicant_cancel_sched_scan(wpa_s);
+               wpa_supplicant_cancel_scan(wpa_s);
+       }
+
 out:
        os_free(iface);
        os_free(net_id);
@@ -1538,6 +1543,9 @@ static void remove_network(void *arg, struct wpa_ssid=
 *ssid)

        wpas_notify_network_removed(wpa_s, ssid);

+       wpa_supplicant_cancel_sched_scan(wpa_s);
+       wpa_supplicant_cancel_scan(wpa_s);
+
        if (wpa_config_remove_network(wpa_s->conf, ssid->id) < 0) {
                wpa_printf(MSG_ERROR,
                           "wpas_dbus_handler_remove_all_networks[dbus]: "
diff --git a/wpa_supplicant/dbus/dbus_old_handlers.c b/wpa_supplicant/dbus/=
dbus_old_handlers.c
index e217a72..ff60f6e 100644
--- a/wpa_supplicant/dbus/dbus_old_handlers.c
+++ b/wpa_supplicant/dbus/dbus_old_handlers.c
@@ -870,6 +870,11 @@ DBusMessage * wpas_dbus_iface_remove_network(DBusMessa=
ge *message,
                                              WLAN_REASON_DEAUTH_LEAVING);
        reply =3D wpas_dbus_new_success_reply(message);

+       if (!wpa_s->conf->ssid) {
+               wpa_supplicant_cancel_sched_scan(wpa_s);
+               wpa_supplicant_cancel_scan(wpa_s);
+       }
+
 out:
        os_free(iface);
        os_free(net_id);
diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplican=
t.c
index dd48ab7..d8603fd 100644
--- a/wpa_supplicant/wps_supplicant.c
+++ b/wpa_supplicant/wps_supplicant.c
@@ -756,6 +756,11 @@ static void wpas_clear_wps(struct wpa_supplicant *wpa_=
s)
        }

        wpas_wps_clear_ap_info(wpa_s);
+
+       if (!wpa_s->conf->ssid) {
+               wpa_supplicant_cancel_sched_scan(wpa_s);
+               wpa_supplicant_cancel_scan(wpa_s);
+       }
 }


--
1.7.1

---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--_000_F781B6216F70FE49AB7B89F25E2F80C0BB552EHASMSX105gercorpi_
Content-Type: text/html; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii">
<meta name=3D"Generator" content=3D"Microsoft Exchange Server">
<!-- converted from rtf -->
<style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left:=
 #800000 2px solid; } --></style>
</head>
<body>
<font face=3D"Calibri" size=3D"2"><span style=3D"font-size:11pt;">
<div>From 8f3b462083bdca2a94d6af32547b7965fdffa9d6 Mon Sep 17 00:00:00 2001=
</div>
<div>From: David Spinadel <david.spinadel at intel.com></div>
<div>Date: Wed, 10 Oct 2012 15:37:36 +0200</div>
<div>Subject: [PATCH] wpa_supplicant: abort scan after removing all network=
s</div>
<div> </div>
<div>Change-Id: I737848dabed49d961985845f2e86f717c2926f0c</div>
<div>Signed-off-by: David Spinadel <david.spinadel at intel.com></div>
<div>Reviewed-on: <a href=3D"http://git-mwg.jer.intel.com/gerrit/3585">http=
://git-mwg.jer.intel.com/gerrit/3585</a></div>
<div>Reviewed-by: Jenkins</div>
<div>Tested-by: Jenkins</div>
<div>Reviewed-by: Max Stepanov <Max.Stepanov at intel.com></div>
<div>Tested-by: Max Stepanov <Max.Stepanov at intel.com></div>
<div>---</div>
<div> wpa_supplicant/ctrl_iface.c       =
      |    7 ++++&#=
43;++</div>
<div> wpa_supplicant/dbus/dbus_new_handlers.c |    8 +&#=
43;++++++</div>
<div> wpa_supplicant/dbus/dbus_old_handlers.c |    5 +&#=
43;+++</div>
<div> wpa_supplicant/wps_supplicant.c      &n=
bsp;  |    5 +++++</div>
<div> 4 files changed, 25 insertions(+), 0 deletions(-)</div>
<div> </div>
<div>diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c=
</div>
<div>index d8e4864..0eeb9ec 100644</div>
<div>--- a/wpa_supplicant/ctrl_iface.c</div>
<div>+++ b/wpa_supplicant/ctrl_iface.c</div>
<div>@@ -2085,6 +2085,8 @@ static int wpa_supplicant_ctrl_iface_remove_=
network(</div>
<div>        /* cmd: "<network i=
d>" or "all" */</div>
<div>        if (os_strcmp(cmd, "al=
l") =3D=3D 0) {</div>
<div>           &nbs=
p;    wpa_printf(MSG_DEBUG, "CTRL_IFACE: REMOVE_NETWORK=
 all");</div>
<div>+          &nbsp=
;    wpa_supplicant_cancel_sched_scan(wpa_s);</div>
<div>+          &nbsp=
;    wpa_supplicant_cancel_scan(wpa_s);</div>
<div>           &nbs=
p;    ssid =3D wpa_s->conf->ssid;</div>
<div>           &nbs=
p;    while (ssid) {</div>
<div>           &nbs=
p;            struct=
 wpa_ssid *remove_ssid =3D ssid;</div>
<div>@@ -2142,6 +2144,11 @@ static int wpa_supplicant_ctrl_iface_remove=
_network(</div>
<div>           &nbs=
p;    return -1;</div>
<div>        }</div>
<div> </div>
<div>+       if (!wpa_s->conf->ssid=
) {</div>
<div>+          &nbsp=
;    wpa_supplicant_cancel_sched_scan(wpa_s);</div>
<div>+          &nbsp=
;    wpa_supplicant_cancel_scan(wpa_s);</div>
<div>+       }</div>
<div>+</div>
<div>        return 0;</div>
<div> }</div>
<div> </div>
<div>diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c b/wpa_supplicant/=
dbus/dbus_new_handlers.c</div>
<div>index 00378be..9422b24 100644</div>
<div>--- a/wpa_supplicant/dbus/dbus_new_handlers.c</div>
<div>+++ b/wpa_supplicant/dbus/dbus_new_handlers.c</div>
<div>@@ -1525,6 +1525,11 @@ DBusMessage * wpas_dbus_handler_remove_netw=
ork(DBusMessage *message,</div>
<div>           &nbs=
p;    wpa_supplicant_deauthenticate(wpa_s,</div>
<div>           &nbs=
p;            &=
nbsp;           &nbs=
p;         WLAN_REASON_DEAUTH_LEAVI=
NG);</div>
<div> </div>
<div>+       if (!wpa_s->conf->ssid=
) {</div>
<div>+          &nbsp=
;    wpa_supplicant_cancel_sched_scan(wpa_s);</div>
<div>+          &nbsp=
;    wpa_supplicant_cancel_scan(wpa_s);</div>
<div>+       }</div>
<div>+</div>
<div> out:</div>
<div>        os_free(iface);</div>
<div>        os_free(net_id);</div>
<div>@@ -1538,6 +1543,9 @@ static void remove_network(void *arg, struct=
 wpa_ssid *ssid)</div>
<div> </div>
<div>        wpas_notify_network_removed=
(wpa_s, ssid);</div>
<div> </div>
<div>+       wpa_supplicant_cancel_sched_=
scan(wpa_s);</div>
<div>+       wpa_supplicant_cancel_scan(w=
pa_s);</div>
<div>+</div>
<div>        if (wpa_config_remove_netwo=
rk(wpa_s->conf, ssid->id) < 0) {</div>
<div>           &nbs=
p;    wpa_printf(MSG_ERROR,</div>
<div>           &nbs=
p;            &=
nbsp;  "wpas_dbus_handler_remove_all_networks[dbus]: "</div>
<div>diff --git a/wpa_supplicant/dbus/dbus_old_handlers.c b/wpa_supplicant/=
dbus/dbus_old_handlers.c</div>
<div>index e217a72..ff60f6e 100644</div>
<div>--- a/wpa_supplicant/dbus/dbus_old_handlers.c</div>
<div>+++ b/wpa_supplicant/dbus/dbus_old_handlers.c</div>
<div>@@ -870,6 +870,11 @@ DBusMessage * wpas_dbus_iface_remove_network(=
DBusMessage *message,</div>
<div>           &nbs=
p;            &=
nbsp;           &nbs=
p;         WLAN_REASON_DEAUTH_LEAVI=
NG);</div>
<div>        reply =3D wpas_dbus_new_suc=
cess_reply(message);</div>
<div> </div>
<div>+       if (!wpa_s->conf->ssid=
) {</div>
<div>+          &nbsp=
;    wpa_supplicant_cancel_sched_scan(wpa_s);</div>
<div>+          &nbsp=
;    wpa_supplicant_cancel_scan(wpa_s);</div>
<div>+       }</div>
<div>+</div>
<div> out:</div>
<div>        os_free(iface);</div>
<div>        os_free(net_id);</div>
<div>diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supp=
licant.c</div>
<div>index dd48ab7..d8603fd 100644</div>
<div>--- a/wpa_supplicant/wps_supplicant.c</div>
<div>+++ b/wpa_supplicant/wps_supplicant.c</div>
<div>@@ -756,6 +756,11 @@ static void wpas_clear_wps(struct wpa_supplic=
ant *wpa_s)</div>
<div>        }</div>
<div> </div>
<div>        wpas_wps_clear_ap_info(wpa_=
s);</div>
<div>+</div>
<div>+       if (!wpa_s->conf->ssid=
) {</div>
<div>+          &nbsp=
;    wpa_supplicant_cancel_sched_scan(wpa_s);</div>
<div>+          &nbsp=
;    wpa_supplicant_cancel_scan(wpa_s);</div>
<div>+       }</div>
<div> }</div>
<div> </div>
<div> </div>
<div>--</div>
<div>1.7.1</div>
<div> </div>
</span></font>
<p>---------------------------------------------------------------------<br>
Intel Israel (74) Limited</p>

<p>This e-mail and any attachments may contain confidential material for<br>
the sole use of the intended recipient(s). Any review or distribution<br>
by others is strictly prohibited. If you are not the intended<br>
recipient, please contact the sender and delete all copies.</p></body>
</html>

--_000_F781B6216F70FE49AB7B89F25E2F80C0BB552EHASMSX105gercorpi_--




More information about the Hostap mailing list