Configuring wpa_supplicant to only scan, not connect?

Dan Williams dcbw
Thu Sep 9 10:02:09 PDT 2010


On Wed, 2010-09-08 at 17:25 -0700, JoSH Lehan wrote:
> Hello there.
> 
> I've had good success running wpa_supplicant, it gets on the air and
> associates nicely.
> 
> However, there's a situation I'd like to do: scan *only*, without
> connecting to anything.
> 
> Basically, I want to run wpa_supplicant and gather scan results from
> it with wpa_cli.
> 
> This works fine, now, with this minimal configuration file that sets
> it wide-open, and connects to the first wide-open AP that it sees:
> 
> network={
> key_mgmt=NONE
> }
> 
> However, it has the unwanted side effect of making an association, if
> an unsecured AP is within range.
> 
> Is there a better way to configure it to scan only, and not to attempt
> any connections?  I could fake up a random SSID/key that would never
> succeed, but that might have other unwanted side effects.

You'll need to use a control interface, either D-Bus or the socket-based
one.  If you don't give the supplicant any networks, by default it won't
keep scanning because there's nothing to connect to, so why bother
scanning.  It doesn't scan on a timer if there aren't any networks
configured.

But with the control interface (again, eitehr D-Bus or the socket one or
wpacli) you can start it up without any configured networks, and then
your app can periodically issue a "scan" request which causes the
supplicant to scan and deliver results back to you via that control
interface.

Dan




More information about the Hostap mailing list