diff options
Diffstat (limited to 'wpa_supplicant')
-rw-r--r-- | wpa_supplicant/ctrl_iface.c | 18 |
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; |