[PATCH] To address SELECT_NETWORK command for an already associated Network

Jithu Jance jithu
Sat Oct 1 11:44:45 PDT 2011


Thanks for pointing out the mistake. I have regenerated the patch in accordance with your suggestion. Please see whether its fine now.


Signed-off-by: Jithu Jance <jithu at broadcom.com>

---
 wpa_supplicant/wpa_supplicant.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 970d97a..dd3eec6 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -1660,6 +1660,14 @@ void wpa_supplicant_select_network(struct wpa_supplicant *wpa_s,
                if (was_disabled != other_ssid->disabled)
                        wpas_notify_network_enabled_changed(wpa_s, other_ssid);
        }
+
+       if (ssid && ssid == wpa_s->current_ssid && wpa_s->current_ssid) {
+               /* We are already associated to selected Network.*/
+               wpa_printf(MSG_DEBUG, "Already associated to "
+                               "selected network. Do nothing");
+               return;
+       }
+
        wpa_s->connect_without_scan = NULL;
        wpa_s->disconnected = 0;
        wpa_s->reassociate = 1;
-- 
1.7.4.1
 

________________________________________
From: Jouni Malinen [j at w1.fi]
Sent: Saturday, October 01, 2011 11:22 PM
To: Jithu Jance
Cc: hostap at lists.shmoo.com; Neeraj Kumar Garg
Subject: Re: [PATCH] To address SELECT_NETWORK command for an already associated Network

On Fri, Sep 30, 2011 at 02:30:34AM -0700, Jithu Jance wrote:
> For STA mode, SELECT_NETWORK doesn't address the scenario of an already associated network. If a selected network and currently associated network is same, wpa_supplicant currently keeps on "trying to associate" with the already associated network. In my opinion, either it should disassociate and then reconnect or shouldn't try to reconnect at all. The below patch will avoid reconnection, if it is already associated to the same network. Kindly review the patch and share your opinion.

I would be fine with avoiding the reconnection. However, this patch
changes the behavior in a way that may be unexpected, i.e., it does not
mark other networks disabled if the device happens to be connected with
the selected network. I don't think that this part should be made
conditional (i.e., the return on ssid && wpa_s->current_ssid == ssid
should be after the for loop).

--
Jouni Malinen                                            PGP id EFC895FA





More information about the Hostap mailing list