[PATCH] wpa_supplicant: abort scan after removing all networks

David Spinadel david.spinadel at intel.com
Wed Oct 10 09:37:36 EDT 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 &lt;david.spinadel at intel.com&gt;</div>
<div>Date: Wed, 10 Oct 2012 15:37:36 &#43;0200</div>
<div>Subject: [PATCH] wpa_supplicant: abort scan after removing all network=
s</div>
<div>&nbsp;</div>
<div>Change-Id: I737848dabed49d961985845f2e86f717c2926f0c</div>
<div>Signed-off-by: David Spinadel &lt;david.spinadel at intel.com&gt;</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 &lt;Max.Stepanov at intel.com&gt;</div>
<div>Tested-by: Max Stepanov &lt;Max.Stepanov at intel.com&gt;</div>
<div>---</div>
<div> wpa_supplicant/ctrl_iface.c&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp; 7 &#43;&#43;&#43;&#43;&#=
43;&#43;&#43;</div>
<div> wpa_supplicant/dbus/dbus_new_handlers.c |&nbsp;&nbsp;&nbsp; 8 &#43;&#=
43;&#43;&#43;&#43;&#43;&#43;&#43;</div>
<div> wpa_supplicant/dbus/dbus_old_handlers.c |&nbsp;&nbsp;&nbsp; 5 &#43;&#=
43;&#43;&#43;&#43;</div>
<div> wpa_supplicant/wps_supplicant.c&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp; |&nbsp;&nbsp;&nbsp; 5 &#43;&#43;&#43;&#43;&#43;</div>
<div> 4 files changed, 25 insertions(&#43;), 0 deletions(-)</div>
<div>&nbsp;</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>&#43;&#43;&#43; b/wpa_supplicant/ctrl_iface.c</div>
<div>@@ -2085,6 &#43;2085,8 @@ static int wpa_supplicant_ctrl_iface_remove_=
network(</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* cmd: &quot;&lt;network i=
d&gt;&quot; or &quot;all&quot; */</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (os_strcmp(cmd, &quot;al=
l&quot;) =3D=3D 0) {</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp; wpa_printf(MSG_DEBUG, &quot;CTRL_IFACE: REMOVE_NETWORK=
 all&quot;);</div>
<div>&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp; wpa_supplicant_cancel_sched_scan(wpa_s);</div>
<div>&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp; wpa_supplicant_cancel_scan(wpa_s);</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp; ssid =3D wpa_s-&gt;conf-&gt;ssid;</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp; while (ssid) {</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; struct=
 wpa_ssid *remove_ssid =3D ssid;</div>
<div>@@ -2142,6 &#43;2144,11 @@ static int wpa_supplicant_ctrl_iface_remove=
_network(</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp; return -1;</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</div>
<div>&nbsp;</div>
<div>&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!wpa_s-&gt;conf-&gt;ssid=
) {</div>
<div>&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp; wpa_supplicant_cancel_sched_scan(wpa_s);</div>
<div>&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp; wpa_supplicant_cancel_scan(wpa_s);</div>
<div>&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</div>
<div>&#43;</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 0;</div>
<div> }</div>
<div>&nbsp;</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>&#43;&#43;&#43; b/wpa_supplicant/dbus/dbus_new_handlers.c</div>
<div>@@ -1525,6 &#43;1525,11 @@ DBusMessage * wpas_dbus_handler_remove_netw=
ork(DBusMessage *message,</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp; wpa_supplicant_deauthenticate(wpa_s,</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WLAN_REASON_DEAUTH_LEAVI=
NG);</div>
<div>&nbsp;</div>
<div>&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!wpa_s-&gt;conf-&gt;ssid=
) {</div>
<div>&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp; wpa_supplicant_cancel_sched_scan(wpa_s);</div>
<div>&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp; wpa_supplicant_cancel_scan(wpa_s);</div>
<div>&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</div>
<div>&#43;</div>
<div> out:</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; os_free(iface);</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; os_free(net_id);</div>
<div>@@ -1538,6 &#43;1543,9 @@ static void remove_network(void *arg, struct=
 wpa_ssid *ssid)</div>
<div>&nbsp;</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wpas_notify_network_removed=
(wpa_s, ssid);</div>
<div>&nbsp;</div>
<div>&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wpa_supplicant_cancel_sched_=
scan(wpa_s);</div>
<div>&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wpa_supplicant_cancel_scan(w=
pa_s);</div>
<div>&#43;</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (wpa_config_remove_netwo=
rk(wpa_s-&gt;conf, ssid-&gt;id) &lt; 0) {</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp; wpa_printf(MSG_ERROR,</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp; &quot;wpas_dbus_handler_remove_all_networks[dbus]: &quot;</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>&#43;&#43;&#43; b/wpa_supplicant/dbus/dbus_old_handlers.c</div>
<div>@@ -870,6 &#43;870,11 @@ DBusMessage * wpas_dbus_iface_remove_network(=
DBusMessage *message,</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WLAN_REASON_DEAUTH_LEAVI=
NG);</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reply =3D wpas_dbus_new_suc=
cess_reply(message);</div>
<div>&nbsp;</div>
<div>&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!wpa_s-&gt;conf-&gt;ssid=
) {</div>
<div>&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp; wpa_supplicant_cancel_sched_scan(wpa_s);</div>
<div>&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp; wpa_supplicant_cancel_scan(wpa_s);</div>
<div>&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</div>
<div>&#43;</div>
<div> out:</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; os_free(iface);</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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>&#43;&#43;&#43; b/wpa_supplicant/wps_supplicant.c</div>
<div>@@ -756,6 &#43;756,11 @@ static void wpas_clear_wps(struct wpa_supplic=
ant *wpa_s)</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</div>
<div>&nbsp;</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wpas_wps_clear_ap_info(wpa_=
s);</div>
<div>&#43;</div>
<div>&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!wpa_s-&gt;conf-&gt;ssid=
) {</div>
<div>&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp; wpa_supplicant_cancel_sched_scan(wpa_s);</div>
<div>&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp; wpa_supplicant_cancel_scan(wpa_s);</div>
<div>&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</div>
<div> }</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>--</div>
<div>1.7.1</div>
<div>&nbsp;</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