aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant
diff options
context:
space:
mode:
authorEyal Shapira <eyal@wizery.com>2012-10-24 17:47:30 +0200
committerEyal Shapira <eyal@wizery.com>2012-10-29 11:14:09 +0200
commit80a505accfd177de92259660b3e619822664263f (patch)
tree350c39be529628322deb8eef7f9e60a5c8bac054 /wpa_supplicant
parent76efd31da240ea7204fbb507259680c822b23c8d (diff)
downloadexternal_wpa_supplicant_8_ti-80a505accfd177de92259660b3e619822664263f.zip
external_wpa_supplicant_8_ti-80a505accfd177de92259660b3e619822664263f.tar.gz
external_wpa_supplicant_8_ti-80a505accfd177de92259660b3e619822664263f.tar.bz2
Don't disable and select new network if SETBAND didn't change (ANDROID)
Current SETBAND would trigger network selection and as part of this a scan attempt. This is not required in case SETBAND didn't change the existing setting. In Android which sends SETBAND immediately after WiFi startup this would trigger needless scan attempts which would usually fail with -EBUSY as another framework triggers scan was already going on. The retry mechanism would then attempt further scans every 1 sec. Signed-off-by: Eyal Shapira <eyal@wizery.com>
Diffstat (limited to 'wpa_supplicant')
-rw-r--r--wpa_supplicant/ctrl_iface.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 0f5f431..4f0aa33 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -4193,6 +4193,7 @@ static int wpa_supplicant_driver_cmd(struct wpa_supplicant *wpa_s, char *cmd,
ret = pno_stop(wpa_s);
else if (os_strncasecmp(cmd, "SETBAND ", 8) == 0) {
int val = atoi(cmd + 8);
+ uint setband = 0;
/*
* Use driver_cmd for drivers that support it, but ignore the
* return value since scan requests from wpa_supplicant will
@@ -4203,20 +4204,29 @@ static int wpa_supplicant_driver_cmd(struct wpa_supplicant *wpa_s, char *cmd,
wpa_drv_driver_cmd(wpa_s, cmd, buf, buflen);
ret = 0;
if (val == 0)
- wpa_s->setband = WPA_SETBAND_AUTO;
+ setband = WPA_SETBAND_AUTO;
else if (val == 1)
- wpa_s->setband = WPA_SETBAND_5G;
+ setband = WPA_SETBAND_5G;
else if (val == 2)
- wpa_s->setband = WPA_SETBAND_2G;
- else
+ setband = WPA_SETBAND_2G;
+ else {
ret = -1;
+ goto out;
+ }
+
+ if (wpa_s->setband == setband) {
+ wpa_printf(MSG_DEBUG, "Same setband as before");
+ goto out;
+ }
+ wpa_s->setband = setband;
if (wpa_s->current_bss && !wpa_bss_in_current_band(wpa_s, wpa_s->current_bss))
wpa_supplicant_disable_network(wpa_s, wpa_s->current_ssid);
wpa_supplicant_select_network(wpa_s, NULL);
} else
ret = wpa_drv_driver_cmd(wpa_s, cmd, buf, buflen);
+out:
if (ret == 0)
ret = sprintf(buf, "%s\n", "OK");
return ret;