netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2]d80211: fix wpa_supplicant reassoc problem
@ 2006-08-25  8:32 Hong Liu
  2006-08-30 16:57 ` Jiri Benc
  0 siblings, 1 reply; 4+ messages in thread
From: Hong Liu @ 2006-08-25  8:32 UTC (permalink / raw)
  To: jbenc; +Cc: netdev

[-- Attachment #1: Type: text/plain, Size: 408 bytes --]

After key negotiation completed using wpa_supplicant, wpa_supplicant
can't reassoc with the AP if we reboot the AP. It always fails at the
4-way handshake.
The problem is the key info is not cleared correctly. Thus when
wpa_supplicant send the EAPOL-KEY packet, the d80211 stack finds the old
key and uses it to encrypt the packet.

The patch removes the sta_info when we disassociate with AP.

Thanks,
Hong

[-- Attachment #2: d80211-fix-wpa-reassoc-problem-git.patch --]
[-- Type: text/x-patch, Size: 1396 bytes --]

diff --git a/net/d80211/ieee80211_sta.c b/net/d80211/ieee80211_sta.c
index 8caf352..2144b34 100644
--- a/net/d80211/ieee80211_sta.c
+++ b/net/d80211/ieee80211_sta.c
@@ -739,6 +739,14 @@ static void ieee80211_associated(struct 
 		wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL);
 		mod_timer(&ifsta->timer,
 			  jiffies + IEEE80211_MONITORING_INTERVAL + 30 * HZ);
+
+		sta = sta_info_get(local, ifsta->bssid);
+		if (sta) {
+			sta_info_free(sta, 0);
+			sta_info_put(sta);
+		}
+
+		ifsta->probereq_poll = 0;
 	} else {
 		mod_timer(&ifsta->timer,
 			  jiffies + IEEE80211_MONITORING_INTERVAL);
diff --git a/net/d80211/sta_info.c b/net/d80211/sta_info.c
index 7f5febe..8902816 100644
--- a/net/d80211/sta_info.c
+++ b/net/d80211/sta_info.c
@@ -197,6 +197,12 @@ #ifdef CONFIG_D80211_VERBOSE_DEBUG
 	       local->mdev->name, MAC_ARG(sta->addr));
 #endif /* CONFIG_D80211_VERBOSE_DEBUG */
 
+	if (sta->key) {
+		ieee80211_key_sysfs_remove(sta->key);
+		ieee80211_key_free(sta->key);
+		sta->key = NULL;
+	}
+
 	rate_control_remove_sta_attrs(local, sta->rate_ctrl_priv, &sta->kobj);
 	ieee80211_sta_sysfs_remove(sta);
 
@@ -244,8 +250,6 @@ void sta_info_free(struct sta_info *sta,
 				kfree(key);
 			}
 		}
-		ieee80211_key_free(sta->key);
-		sta->key = NULL;
 	} else if (sta->key_idx_compression != HW_KEY_IDX_INVALID) {
 		struct ieee80211_key_conf conf;
 		memset(&conf, 0, sizeof(conf));

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2]d80211: fix wpa_supplicant reassoc problem
  2006-08-25  8:32 [PATCH 1/2]d80211: fix wpa_supplicant reassoc problem Hong Liu
@ 2006-08-30 16:57 ` Jiri Benc
  2006-09-01  3:37   ` Hong Liu
  0 siblings, 1 reply; 4+ messages in thread
From: Jiri Benc @ 2006-08-30 16:57 UTC (permalink / raw)
  To: Hong Liu; +Cc: netdev, John W. Linville

On Fri, 25 Aug 2006 16:32:08 +0800, Hong Liu wrote:
> After key negotiation completed using wpa_supplicant, wpa_supplicant
> can't reassoc with the AP if we reboot the AP. It always fails at the
> 4-way handshake.
> The problem is the key info is not cleared correctly. Thus when
> wpa_supplicant send the EAPOL-KEY packet, the d80211 stack finds the old
> key and uses it to encrypt the packet.
> 
> The patch removes the sta_info when we disassociate with AP.

Please:
- add proper Signed-off-by line
- do not send patches as an attachment
- Cc: John Linville <linville@tuxdriver.com> as well as me on d80211
  patches

> diff --git a/net/d80211/ieee80211_sta.c b/net/d80211/ieee80211_sta.c
> index 8caf352..2144b34 100644
> --- a/net/d80211/ieee80211_sta.c
> +++ b/net/d80211/ieee80211_sta.c
> @@ -739,6 +739,14 @@ static void ieee80211_associated(struct 
>  		wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL);
>  		mod_timer(&ifsta->timer,
>  			  jiffies + IEEE80211_MONITORING_INTERVAL + 30 * HZ);
> +
> +		sta = sta_info_get(local, ifsta->bssid);
> +		if (sta) {
> +			sta_info_free(sta, 0);
> +			sta_info_put(sta);
> +		}
> +
> +		ifsta->probereq_poll = 0;

Wouldn't it be better to move this into the 'else' branch of previous
'if' statement (i.e. just before sta_info_put call in the
ieee80211_associated function)?

Thanks,

 Jiri

-- 
Jiri Benc
SUSE Labs

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2]d80211: fix wpa_supplicant reassoc problem
  2006-08-30 16:57 ` Jiri Benc
@ 2006-09-01  3:37   ` Hong Liu
  2006-09-21 19:21     ` Jiri Benc
  0 siblings, 1 reply; 4+ messages in thread
From: Hong Liu @ 2006-09-01  3:37 UTC (permalink / raw)
  To: Jiri Benc; +Cc: netdev, John W. Linville

On Thu, 2006-08-31 at 00:57, Jiri Benc wrote:
> On Fri, 25 Aug 2006 16:32:08 +0800, Hong Liu wrote:
> > After key negotiation completed using wpa_supplicant, wpa_supplicant
> > can't reassoc with the AP if we reboot the AP. It always fails at the
> > 4-way handshake.
> > The problem is the key info is not cleared correctly. Thus when
> > wpa_supplicant send the EAPOL-KEY packet, the d80211 stack finds the old
> > key and uses it to encrypt the packet.
> >
> > The patch removes the sta_info when we disassociate with AP.
> 
> Please:
> - add proper Signed-off-by line
> - do not send patches as an attachment
> - Cc: John Linville <linville@tuxdriver.com> as well as me on d80211
>   patches
> 
> > diff --git a/net/d80211/ieee80211_sta.c b/net/d80211/ieee80211_sta.c
> > index 8caf352..2144b34 100644
> > --- a/net/d80211/ieee80211_sta.c
> > +++ b/net/d80211/ieee80211_sta.c
> > @@ -739,6 +739,14 @@ static void ieee80211_associated(struct
> >               wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL);
> >               mod_timer(&ifsta->timer,
> >                         jiffies + IEEE80211_MONITORING_INTERVAL + 30 * HZ);
> > +
> > +             sta = sta_info_get(local, ifsta->bssid);
> > +             if (sta) {
> > +                     sta_info_free(sta, 0);
> > +                     sta_info_put(sta);
> > +             }
> > +
> > +             ifsta->probereq_poll = 0;
> 
> Wouldn't it be better to move this into the 'else' branch of previous
> 'if' statement (i.e. just before sta_info_put call in the
> ieee80211_associated function)?
> 

Rework the patch according to Jiri's comments.

Signed-off-by: Hong Liu <hong.liu@intel.com>

diff --git a/net/d80211/ieee80211_sta.c b/net/d80211/ieee80211_sta.c
index a933d92..557ba17 100644
--- a/net/d80211/ieee80211_sta.c
+++ b/net/d80211/ieee80211_sta.c
@@ -710,6 +710,8 @@ static void ieee80211_associated(struct 
 				       "range\n",
 				       dev->name, MAC_ARG(ifsta->bssid));
 				disassoc = 1;
+				sta_info_free(sta, 0);
+				ifsta->probereq_poll = 0;
 			} else {
 				ieee80211_send_probe_req(dev, ifsta->bssid,
 							 local->scan_ssid,
diff --git a/net/d80211/sta_info.c b/net/d80211/sta_info.c
index 622b234..5edbd0c 100644
--- a/net/d80211/sta_info.c
+++ b/net/d80211/sta_info.c
@@ -197,6 +197,12 @@ #ifdef CONFIG_D80211_VERBOSE_DEBUG
 	       local->mdev->name, MAC_ARG(sta->addr));
 #endif /* CONFIG_D80211_VERBOSE_DEBUG */
 
+	if (sta->key) {
+		ieee80211_key_sysfs_remove(sta->key);
+		ieee80211_key_free(sta->key);
+		sta->key = NULL;
+	}
+
 	rate_control_remove_sta_attrs(local, sta->rate_ctrl_priv, &sta->kobj);
 	ieee80211_sta_sysfs_remove(sta);
 
@@ -244,8 +250,6 @@ void sta_info_free(struct sta_info *sta,
 				kfree(key);
 			}
 		}
-		ieee80211_key_free(sta->key);
-		sta->key = NULL;
 	} else if (sta->key_idx_compression != HW_KEY_IDX_INVALID) {
 		struct ieee80211_key_conf conf;
 		memset(&conf, 0, sizeof(conf));

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2]d80211: fix wpa_supplicant reassoc problem
  2006-09-01  3:37   ` Hong Liu
@ 2006-09-21 19:21     ` Jiri Benc
  0 siblings, 0 replies; 4+ messages in thread
From: Jiri Benc @ 2006-09-21 19:21 UTC (permalink / raw)
  To: Hong Liu; +Cc: netdev, John W. Linville

On Fri, 01 Sep 2006 11:37:37 +0800, Hong Liu wrote:
> Rework the patch according to Jiri's comments.

Applied to my tree. Thanks for the patch!

 Jiri

-- 
Jiri Benc
SUSE Labs

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-09-21 19:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-25  8:32 [PATCH 1/2]d80211: fix wpa_supplicant reassoc problem Hong Liu
2006-08-30 16:57 ` Jiri Benc
2006-09-01  3:37   ` Hong Liu
2006-09-21 19:21     ` Jiri Benc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).