[PATCH] Use correct BSSID for deauth/disconnect in mac80211 EALREADY workaround

Johannes Berg johannes
Fri Sep 28 03:36:45 PDT 2012

On Fri, 2012-09-28 at 09:52 +0200, Mykyta Iziumtsev wrote:

> >> @@ -4658,7 +4660,7 @@ retry:
> >>                       wpa_printf(MSG_DEBUG, "nl80211: Retry authentication "
> >>                                  "after forced deauthentication");
> >>                       wpa_driver_nl80211_deauthenticate(
> >> -                             bss, params->bssid,
> >> +                             bss, prev_auth_bssid,
> >>                               WLAN_REASON_PREV_AUTH_NOT_VALID);
> >>                       nlmsg_free(msg);
> >>                       goto retry;
> >
> > I'm not convinced this is correct. If cfg80211 returns -EALREADY, it
> > means "already authenticated with this BSS". So it seems using
> > params->bssid here would be correct in order to re-authenticate.
> >
> > The case where we can't authenticate because it's already authenticated
> > with more APs than it would like to track will return -ENOSPC. Note like
> > I said, starting from kernel 3.4 all this went away.
> This code is actually workaround for older versions of mac80211 returning
> -EALREADY when we're already connected to some BSS. Please refer to
> commit 6d6f4bb87f33278aed133875d0d561eb55d7ae59 in hostap.git .

Yes, I know.

> So, we should expect -EALREADY not only in "already authenticated with this BSS"
> case, but in "already authenticated with *any* BSS" case.

No, that's not true.

> Of course, mac80211 doesn't have this problem any more when userspace
> SME is in use, but it still returns -EALREADY when "connect" API is used
> (in compat-wireless-3.2.5-1).

Well you're not modifying the CONNECT API use though, you're modifying
the AUTHENTICATE API in a way that actually breaks the -EALREADY

I could see a bit of value in doing the clear_state_mismatch()
workaround if you get -EALREADY or -ENOSPC, but what you're doing here
seems to break it.


More information about the Hostap mailing list