WPA Supplicant: attempt to connect only once

Jouni Malinen j
Mon Sep 29 02:59:06 PDT 2008


On Mon, Sep 01, 2008 at 01:24:00PM +0800, Soh Kam Yung wrote:

> I am writing a program to control wpa_supplicant via the control
> interface and have a question.
> 
> Is there a setting that controls how many times wpa_supplicant will
> try to associate with a network?  If yes, can this be set to one?

There is no such option in the current version.

> At present, I am seeing multiple "Trying to associate..." ...
> "CTRL-EVENT-DISCONNECTED ..." messages when I attempt to associate
> with a network (using the "ENABLE_NETWORK" command).  This may happen,
> for example, if the wrong passphrase is used to connect to a WPA-PSK
> network.

Yes, the current version tries to continue to find a suitable network as
long as there are any enabled networks.

> I would like to control the number of times this happens in my application.
> 
> If this is not possible, I suppose I can 'hack it' by sending a
> "DISABLE_NETWORK" command after I see the "CTRL-EVENT-DISCONNECTED"
> message.

That's the mechanism designed to stop wpa_supplicant from trying to find
the network. I'm not sure whether a number of attempts would be a
generic solution for what you are trying to do since there are different
types of results for the association attempt. For example, the AP might
not have been within range at all or something in the parameters
(including keys) could have been preventing a failed authentication, or
the AP could have rejected association for some other reason, etc.

If you think that adding a association count limit would be useful, I
would like to get more details on what it would be used for and how it
would handle cases of having multiple networks enabled in wpa_supplicant
configuration (i.e., would it be global or per network, etc.).

-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list