[PATCH] To address SELECT_NETWORK command for an already associated Network
Jithu Jance
jithu
Fri Sep 30 02:30:34 PDT 2011
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.
---
wpa_supplicant/wpa_supplicant.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index d2e29c0..7e50834 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -1628,9 +1628,16 @@ void wpa_supplicant_select_network(struct wpa_supplicant *wpa_s,
struct wpa_ssid *other_ssid;
- if (ssid && ssid != wpa_s->current_ssid && wpa_s->current_ssid)
- wpa_supplicant_disassociate(
- wpa_s, WLAN_REASON_DEAUTH_LEAVING);
+ if (ssid && wpa_s->current_ssid) {
+ if(ssid != wpa_s->current_ssid) {
+ wpa_supplicant_disassociate(
+ wpa_s, WLAN_REASON_DEAUTH_LEAVING);
+ } else {
+ wpa_printf(MSG_DEBUG, "Already associated to "
+ "selected network. Do nothing.");
+ return;
+ }
+ }
/*
* Mark all other networks disabled or mark all networks enabled if no
--
1.7.4.1
- Jithu Jance.
More information about the Hostap
mailing list