Subject: Re: [PATCH] softmac: Fix handling of authentication failure

From: Larry Finger <[email-masked]>
Date: Thu, 01 Jun 2006 21:43:01 -0500

Daniel Drake wrote:
> My router blew up earlier, but exhibited some interesting behaviour during
> its dying moments. It was broadcasting beacons but wouldn't respond to
> any authentication requests.
>
> I noticed that softmac wasn't playing nice with this, as I couldn't make it try
> to connect to other networks after it had timed out authenticating to my ill
> router.
>
> To resolve this, I modified the softmac event/notify API to pass the event
> code to the callback, so that callbacks being notified from
> IEEE80211SOFTMAC_EVENT_ANY masks can make some judgement. In this case, the
> ieee80211softmac_assoc callback needs to make a decision based upon whether
> the association passed or failed.
>
> Signed-off-by: Daniel Drake <[email-masked]>
> Acked-by: Johannes Berg <[email-masked]>
--snip--

> Index: linux/net/ieee80211/softmac/ieee80211softmac_assoc.c
> ===================================================================
> --- linux.orig/net/ieee80211/softmac/ieee80211softmac_assoc.c
> +++ linux/net/ieee80211/softmac/ieee80211softmac_assoc.c
> @@ -164,12 +164,28 @@ network_matches_request(struct ieee80211
>  }
>  
>  static void
> -ieee80211softmac_assoc_notify(struct net_device *dev, void *context)
> +ieee80211softmac_assoc_notify_scan(struct net_device *dev, int event_type, void *context)
>  {
>  	struct ieee80211softmac_device *mac = ieee80211_priv(dev);
>  	ieee80211softmac_assoc_work((void*)mac);
>  }
>  
> +static void
> +ieee80211softmac_assoc_notify_auth(struct net_device *dev, int event_type, void *context)
> +{
> +	struct ieee80211softmac_device *mac = ieee80211_priv(dev);
> +
> +	switch (event_type) {
> +	case IEEE80211SOFTMAC_EVENT_AUTHENTICATED:
> +		ieee80211softmac_assoc_work((void*)mac);
> +		break;
> +	case IEEE80211SOFTMAC_EVENT_AUTH_FAILED:
> +	case IEEE80211SOFTMAC_EVENT_AUTH_TIMEOUT:
> +		ieee80211softmac_disassoc(mac);
>   
This statement fails to compile on my system using Linus' tree, because 
ieee80211softmac_disassoc needs a second argument - the reason. It seems 
as if WLAN_REASON_PREV_AUTH_NOT_VALID would be appropriate.

Larry