[wpa-supplicant] How to control association timeout?

Jouni Malinen jkmaline at cc.hut.fi
Wed Nov 1 00:11:43 EST 2006


On Mon, Oct 30, 2006 at 04:40:45PM +0100, Marc Haber wrote:

> I am using wpa_supplicant on Debian sid (version 0.5.5-2) with current
> kernel and an ipw2200 interface. I am frequenly moving between my own
> wireless LAN (WPA-PSK) and the wireless LAN at my girlfriend's place
> (WEP-128 with hidden ssid). Here my wpa_supplicant.conf:

> ap_scan=2

> network={
>         ssid="<mine>"
> }

> network={
>         ssid="<hers>"
>         scan_ssid=1
> }

> At her place, my notebook first tries to associate to my home wireless
> LAN for 60 seconds before moving on to her wireless LAN, where the
> association succeeds immediately.
> 
> How can I shorten that time to, say, 5 seconds?

One way of doing this would be to use ap_scan=1 with a driver that
supports scan_ssid=1, but since ipw2200 is not such a driver, that
answer is probably not very helpful..

There is no configuration option for this in wpa_supplicant at the
moment. If you are willing to change source code and rebuild
wpa_supplicant, you can change this by modifying
wpa_supplicant_associate() function in wpa_supplicant.c. This timeout is
set in following code:

               /* Timeout for IEEE 802.11 authentication and association */
                int timeout;
                if (assoc_failed)
                        timeout = 5;
                else if (wpa_s->conf->ap_scan == 1)
                        timeout = 10;
                else
                        timeout = 60;
                wpa_supplicant_req_auth_timeout(wpa_s, timeout, 0);

That 60 there is the timeout for ap_scan=2 case.


I don't know whether I would really like to make this configuration,
though. I would rather consider ap_scan=2 mode with multiple enabled
network blocks as a special case that request scanning of multiple SSIDs
before trying to associate with the first network. One problem with this
is, though, that most drivers do not have such functionality and
wpa_supplicant would need to try to associate with each network first
with minimal timeout (just couple of seconds) in order to get them
included in the scan results. After each association attempt, scan
results would be collected and merged together. Only after this, the
best AP (based on security policy and/or priority configuration) would
be selected and wpa_supplicant would try to associate with it using a
longer timeout.

This is not exactly ideal, since with multiple networks in the
configuration and a dualband WLAN card, the initial scanning process
could take ages.. Still, this could speed up the connection quite a bit,
if the only available network happens to be the last one in the in
ap_scan=2 case..

It should also be possible to optimize this by assuming that each
network without scan_ssid=1 is sending out its SSID (i.e., does not need
a specific per-SSID scan). In that case, the scan process would start
with one scan for all SSIDs and the try-quick-association loop would
only go through the network blocks with scan_ssid=1. This would likely
be the fastest solution that is likely to work with most drivers.
 
-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the HostAP mailing list