d80211: fix wpa_supplicant reassoc problem
Subsystems (2)
PATCH 1/2 d80211: fix wpa_supplicant reassoc problem
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
net/d80211/ieee80211_sta.c +8 -0
@@ -739,6 +739,14 @@ static void ieee80211_associated(structwireless_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 );
net/d80211/sta_info.c +6 -2
@@ -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));
Quoted 8 lines · Hong Liu
After key negotiation completed using
wpa_supplicant,wpa_supplicantcan'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 whenwpa_supplicantsend the EAPOL-KEY packet, the d80211 stack finds the old key and uses it to encrypt the packet.The patch removes the
sta_infowhen we disassociate with AP.
Please:
- add proper Signed-off-by line
- do not send patches as an attachment
- Cc: John Linville <[email protected]> as well as me on d80211 patches
Quoted 6 lines
net/d80211/ieee80211_sta.c +0
-0@@ -739,6 +739,14 @@ static void ieee80211_associated(structwireless_send_event (dev,SIOCGIWAP , &wrqu,NULL );
net/d80211/ieee80211_sta.c static void ieee80211_associated(struct · line 749
Quoted 10 lines
net/d80211/ieee80211_sta.c +8
-0mod_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
Signature · 2 lines
Jiri Benc SUSE Labs
Quoted 28 lines · Jiri Benc
Quoted 8 lines · Hong Liu
After key negotiation completed using
wpa_supplicant,wpa_supplicantcan'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 whenwpa_supplicantsend the EAPOL-KEY packet, the d80211 stack finds the old key and uses it to encrypt the packet.The patch removes the
sta_infowhen we disassociate with AP.Please:
- add proper Signed-off-by line
- do not send patches as an attachment
- Cc: John Linville <[email protected]> as well as me on d80211 patchesQuoted 12 lines
net/d80211/ieee80211_sta.c +4
-0@@ -739,6 +739,14 @@ static void ieee80211_associated(structwireless_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 );
Quoted 9 lines
net/d80211/ieee80211_sta.c static void ieee80211_associated(struct · line 749
Quoted 4 lines
net/d80211/ieee80211_sta.c +4
-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_putcall in theieee80211_associatedfunction)?
Rework the patch according to Jiri's comments.
net/d80211/ieee80211_sta.c +2 -0
@@ -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,
net/d80211/sta_info.c +6 -2
@@ -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));
Jiri Benc
AppliedQuoted 1 line · Hong Liu
Rework the patch according to Jiri's comments.
Applied to my tree. Thanks for the patch!
Jiri
Signature · 2 lines
Jiri Benc SUSE Labs