Message ID | 538FB72AA9C7314998FCE2FB41335C5A208413CE9C@EXMB02.eu.tieto.com |
---|---|
State | Changes Requested |
Headers | show |
On Fri, Apr 27, 2012 at 03:26:38PM +0300, Bartosz.Markowski@tieto.com wrote: > When AP signal level is poor, and we lose connection due to e.g. > beacon losses, there's a chance we will try to auto-reconnect to > this AP right after and whole sequence will repeat multiple times. > > This patch adds an option for users to set signal level threshold in > .conf file and skip auto-reconnect, at least until the signal pass > this threshold. > diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c > @@ -717,6 +717,13 @@ static struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s, > + if (wpa_s->reassociated_connection && > + wpa_s->conf->reauth_threshold && > + (bss->level < wpa_s->conf->reauth_threshold)) { > + wpa_dbg(wpa_s, MSG_DEBUG, " skip - signal to low"); > + continue; > + } That wpa_s->reassociated_connection does not work for figuring out whether this is a reconnection since it does not seem to be cleared anywhere (well, ignoring the AP-mode-disable case). I'm actually tempted to just remove it now that I went through how it is used.. In other words, this would prevent connection below the reauth_threshold limit even in cases where this is an initial connection to a network. Was that the purpose of this change or was this supposed to only remove the continued attempts to reconnect after getting disconnected?
Hi Jouni,
Intention was to prevent the continued attempts to reconnect after getting disconnected, e.g. on a network border.
Regards,
Bartosz
-----Original Message-----
From: hostap-bounces@lists.shmoo.com [mailto:hostap-bounces@lists.shmoo.com] On Behalf Of Jouni Malinen
Sent: 24 czerwca 2012 00:18
To: hostap@lists.shmoo.com
Subject: Re: [PATCH] Adds signal threshold option for auto-reconnect scenarios
That wpa_s->reassociated_connection does not work for figuring out whether this is a reconnection since it does not seem to be cleared anywhere (well, ignoring the AP-mode-disable case). I'm actually tempted to just remove it now that I went through how it is used..
In other words, this would prevent connection below the reauth_threshold limit even in cases where this is an initial connection to a network.
Was that the purpose of this change or was this supposed to only remove the continued attempts to reconnect after getting disconnected?
diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c index c423bc3..669fe5c 100644 --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c @@ -2492,6 +2492,7 @@ struct wpa_config * wpa_config_alloc_empty(const char *ctrl_interface, config->bss_expiration_scan_count = DEFAULT_BSS_EXPIRATION_SCAN_COUNT; config->max_num_sta = DEFAULT_MAX_NUM_STA; config->access_network_type = DEFAULT_ACCESS_NETWORK_TYPE; + config->reauth_threshold = DEFAULT_REAUTH_THRESHOLD; if (ctrl_interface) config->ctrl_interface = os_strdup(ctrl_interface); @@ -2872,7 +2873,8 @@ static const struct global_parse_data global_fields[] = { { INT_RANGE(disassoc_low_ack, 0, 1), 0 }, { INT_RANGE(interworking, 0, 1), 0 }, { FUNC(hessid), 0 }, - { INT_RANGE(access_network_type, 0, 15), 0 } + { INT_RANGE(access_network_type, 0, 15), 0 }, + { INT(reauth_threshold), 0} }; #undef FUNC diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h index eca0d0f..eaa3808 100644 --- a/wpa_supplicant/config.h +++ b/wpa_supplicant/config.h @@ -23,6 +23,7 @@ #define DEFAULT_BSS_EXPIRATION_SCAN_COUNT 2 #define DEFAULT_MAX_NUM_STA 128 #define DEFAULT_ACCESS_NETWORK_TYPE 15 +#define DEFAULT_REAUTH_THRESHOLD 0 #include "config_ssid.h" #include "wps/wps.h" @@ -611,6 +612,11 @@ struct wpa_config { * Homogeneous ESS. This is used only if interworking is enabled. */ u8 hessid[ETH_ALEN]; + + /** + * reauth_threshold - Reauthentication signal threshold. + */ + int reauth_threshold; }; diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c index 3a4c35f..ce99dfe 100644 --- a/wpa_supplicant/config_file.c +++ b/wpa_supplicant/config_file.c @@ -845,6 +845,8 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config) fprintf(f, "access_network_type=%d\n", config->access_network_type); #endif /* CONFIG_INTERWORKING */ + if (config->reauth_threshold != DEFAULT_REAUTH_THRESHOLD) + fprintf(f, "reauth_threshold=%d", config->reauth_threshold); } #endif /* CONFIG_NO_CONFIG_WRITE */ diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index da9cf2b..21b4841 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -717,6 +717,13 @@ static struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s, continue; } + if (wpa_s->reassociated_connection && + wpa_s->conf->reauth_threshold && + (bss->level < wpa_s->conf->reauth_threshold)) { + wpa_dbg(wpa_s, MSG_DEBUG, " skip - signal to low"); + continue; + } + #ifdef CONFIG_P2P /* * TODO: skip the AP if its P2P IE has Group Formation
When AP signal level is poor, and we lose connection due to e.g. beacon losses, there's a chance we will try to auto-reconnect to this AP right after and whole sequence will repeat multiple times. This patch adds an option for users to set signal level threshold in .conf file and skip auto-reconnect, at least until the signal pass this threshold. Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com> --- wpa_supplicant/config.c | 4 +++- wpa_supplicant/config.h | 6 ++++++ wpa_supplicant/config_file.c | 2 ++ wpa_supplicant/events.c | 7 +++++++ 4 files changed, 18 insertions(+), 1 deletions(-)