wpa_supplicant_select_bss error?

a.brooks2 at marathon-targets.com a.brooks2
Sun Dec 15 02:53:28 PST 2013


Hi,

I've been trying to track down why a client seems to connect to the 
(significantly) weaker of two access-points with identical SSIDs, and 
refuses to roam to the stronger one subsequently.

I think there might be an error in wpa_supplicant_select_bss:

static struct wpa_bss *
wpa_supplicant_select_bss(struct wpa_supplicant *wpa_s,
               struct wpa_ssid *group,
               struct wpa_ssid **selected_ssid)
{
     unsigned int i;

     wpa_dbg(wpa_s, MSG_DEBUG, "Selecting BSS from priority group %d",
         group->priority);

     for (i = 0; i < wpa_s->last_scan_res_used; i++) {
         struct wpa_bss *bss = wpa_s->last_scan_res[i];
         *selected_ssid = wpa_scan_res_match(wpa_s, i, bss, group);
         if (!*selected_ssid)
             continue;
         wpa_dbg(wpa_s, MSG_DEBUG, "   selected BSS " MACSTR
             " ssid='%s'",
             MAC2STR(bss->bssid),
             wpa_ssid_txt(bss->ssid, bss->ssid_len));
         return bss;
     }

     return NULL;
}


The loop returns on the first BSS it finds with the appropriate ssid.  
So the results depend on the order of the scan results.
In my case I have a client which happens to list the weaker BSS first, 
so it does the wrong thing.

I think this loop should find the best BSS instead.  I made this change 
and now my client happily connects to the correct BSS, and roams 
appropriately.

I can submit a patch but thought I'd ask the question first (this code 
seems to have been around for a while so I'm surprised no-one has found 
it if it is in fact a bug), let me know.



Cheers,

Alex



More information about the Hostap mailing list