How to clear scan cache.

Dan Williams dcbw
Fri Jan 11 05:46:16 PST 2008


On Fri, 2008-01-11 at 07:31 +0530, Raghavendra. S wrote:
> Hi,
> 
>  In my case, I will enable wpa supplicant and in wpa_cli I issue
> "SCAN" command. Then I will sleep for 5-7 seconds. Later I will issue
> "SCAN_RESULT" command to get scan result.
> 
> Here I have few  doubts?
> 
> 1. what is the optimal value for this sleep?

If wpa_supplicant's control interface doesn't give you a notification of
new scan results (it really should if it doesn't), then you can use
netlink to monitor the wireless driver's event stream and look for
SIOCGIWSCAN events.  That means the driver has found new access points.

Or, if you don't want to watch netlink (it's not trivial code to do so)
then use a value of around 7 - 10 seconds to be sure.

> 2. In  wpa_ctrl_request(ctrl_conn, "SCAN_RESULTS",
>                      os_strlen("SCAN_RESULTS"), scanbuf, &len, NULL);
> 
>   Currently in wpa_cli size of "scanbuf" is defined as char array of
> 2048 bytes. So it will hardly accomodate scan result for 15-16 APs.
> 
>  Can I increase this size from 2048 to higher value? say 3072, so that
> it can hold 24-25 scanned AP information?

Yeah, probably.  That looks like a limitation of the socket-based
control interface.

Dan

> 3. I have following config file for scan
> 
> # cat /tmp/wpa_supplicant.conf.tmp
> ctrl_interface=/var/run/wpa_supplicant
> ap_scan=1
> 
> network={
>                 bssid=00:00:00:00:00:00
>                 key_mgmt=NONE
> }
> 
> This will never connect to any AP, but will remain in scan state. Is
> there any issue in using this kind of configuration?
> 
> 
> -Raghu.
> 
> 
> On 1/10/08, Dan Williams <dcbw at redhat.com> wrote:
> > On Thu, 2008-01-10 at 14:42 +0530, Raghavendra. S wrote:
> > > Hi All,
> > >
> > >  Can any body tell me how to clear scan cache?
> >
> > Any particular reason you'd want to do this?  Scan results should be
> > expired fairly quickly anyway, like a matter of seconds.  The drivers
> > themselves may cache scan results for up to 15 seconds.
> >
> > Dan
> >
> >
> >
> 
> 




More information about the Hostap mailing list