Where is the network selection code?

Dan Williams dcbw at redhat.com
Mon Sep 11 08:42:04 PDT 2017


On Fri, 2017-09-08 at 22:32 -0700, Kevin Zheng wrote:
> Hi,
> 
> I've been looking in the developer documentation
> (https://w1.fi/wpa_supplicant/devel/code_structure.html),
> particularly
> the pages for the wpa_supplicant core, and I can't find where the
> logic
> is for network selection based on configuration and scan results.
> 
> Can anyone familiar with the code point me to where I should look?
> 
> Please "reply all" to me as I'm not subscribed to the list.

events.c, _wpa_supplicant_event_scan_results() is where the chain
starts.  Which eventually gets you to wpa_supplicant_pick_network() and
wpa_supplicant_select_bss().

That picks the best network from the scan list, which may not be your
currently associated AP even if the connection is pretty good.

So after figuring out the best network,
wpa_supplicant_select_network_from_last_scan() calls
wpa_supplicant_need_to_roam() which decide whether the "best" BSS is so
much better than the current BSS that we should switch to it.

Dan



More information about the Hostap mailing list