[PATCH v2] wext: handle mode switches correctly for mac80211

Dan Williams dcbw
Fri Sep 26 07:36:43 PDT 2008


On Tue, 2008-09-02 at 09:37 -0400, Dan Williams wrote:
> On Fri, 2008-08-29 at 12:57 -0400, Dan Williams wrote: 
> > On Wed, 2008-06-04 at 21:02 +0300, Jouni Malinen wrote:
> > > On Wed, Jun 04, 2008 at 01:36:23PM -0400, Dan Williams wrote:
> > > > Since mac80211 requires that the device be !IFF_UP to change the mode
> > > > (and I think the old prism54 fullmac driver does too), do that.  This
> > > > shouldn't harm fullmac devices since they can handle mode switches on
> > > > the fly and usually don't care about up/down that much.
> > > 
> > > Thanks! Applied.
> > 
> > A bug just got reported as a result of this for mac80211 drivers.
> > 
> > https://bugzilla.redhat.com/show_bug.cgi?id=459399
> > 
> > The basic problem is that since taking the device down clears the keys
> > from the driver on many mac80211-based cards, and since the mode gets
> > set _after_ the keys have been set in the driver, the keys get cleared
> > on a mode switch and the resulting association is wrong.  The report is
> > about ad-hoc mode specifically, but this could happen when switching
> > from adhoc back to managed mode.
> > 
> > Fabrice suggested using WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC for the
> > driver, but it seems to me that setting the mode as _early_ as possible
> > is the best thing to do.  Perhaps create another driver hook for
> > set_mode and call that (if needed) very early in
> > wpa_supplicant_associate() around line 924:
> > 
> > 	/* Starting new association, so clear the possibly used WPA IE from the
> > 	 * previous association. */
> > 	wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, NULL, 0);
> > 
> > +	wpa_drv_set_mode(wpa_s, ssid->mode);
> > 
> > #ifdef IEEE8021X_EAPOL
> > 	if (ssid->key_mgmt & WPA_KEY_MGMT_IEEE8021X_NO_WPA) {
> > 		if (ssid->leap) {
> > 
> > I can't think of a reason why setting the mode first isn't the right
> > thing to do in the first place.  Thoughts?  I'll cook up a patch for
> > this if it sounds OK.
> 
> Two patches attached, the "big" patch moves every driver over to
> set_mode(), while the "small" patch just adds the hook and moves the
> nl80211 and wext drivers over.

Ping?  Back from travel yet Jouni?

Dan





More information about the Hostap mailing list