[PATCH 11/12] mesh: Send peering open frame again if beacon from listen state peer is received

Masashi Honma masashi.honma
Mon Nov 3 21:36:52 PST 2014


Signed-off-by: Kenzoh Nishikawa <Kenzoh.Nishikawa at jp.sony.com>
Signed-off-by: Masashi Honma <masashi.honma at gmail.com>
---
 wpa_supplicant/mesh_mpm.c | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/wpa_supplicant/mesh_mpm.c b/wpa_supplicant/mesh_mpm.c
index 4f86578..b76fab5 100644
--- a/wpa_supplicant/mesh_mpm.c
+++ b/wpa_supplicant/mesh_mpm.c
@@ -381,6 +381,7 @@ static void mesh_mpm_fsm_restart(struct wpa_supplicant *wpa_s,
 	wpa_mesh_set_plink_state(wpa_s, sta, PLINK_LISTEN);
 	sta->my_lid = sta->peer_lid = sta->mpm_close_reason = 0;
 	sta->mpm_retries = 0;
+	sta->flags &= ~WLAN_STA_ASSOC;
 }
 
 
@@ -411,7 +412,7 @@ static void plink_timer(void *eloop_ctx, void *user_data)
 		/* confirm timer */
 		if (!reason)
 			reason = WLAN_REASON_MESH_CONFIRM_TIMEOUT;
-		sta->plink_state = PLINK_HOLDING;
+		wpa_mesh_set_plink_state(wpa_s, sta, PLINK_HOLDING);
 		eloop_register_timeout(conf->dot11MeshHoldingTimeout / 1000,
 			(conf->dot11MeshHoldingTimeout % 1000) * 1000,
 			plink_timer, wpa_s, sta);
@@ -537,11 +538,12 @@ void wpa_mesh_new_mesh_peer(struct wpa_supplicant *wpa_s, const u8 *addr,
 	int ret = 0;
 
 	sta = ap_get_sta(data, addr);
-	if (!sta) {
-		sta = ap_sta_add(data, addr);
-		if (!sta)
-			return;
-	}
+	if (sta != NULL)
+		return;
+
+	sta = ap_sta_add(data, addr);
+	if (sta == NULL)
+		return;
 
 	/* initialize sta */
 	if (copy_supp_rates(wpa_s, sta, elems))
@@ -551,7 +553,7 @@ void wpa_mesh_new_mesh_peer(struct wpa_supplicant *wpa_s, const u8 *addr,
 
 #ifdef CONFIG_IEEE80211N
 	copy_sta_ht_capab(data, sta, elems->ht_capabilities,
-			elems->ht_capabilities_len);
+			  elems->ht_capabilities_len);
 	update_ht_state(data, sta);
 #endif /* CONFIG_IEEE80211N */
 
@@ -588,10 +590,15 @@ void wpa_mesh_new_mesh_peer(struct wpa_supplicant *wpa_s, const u8 *addr,
 		return;
 	}
 
-	if (conf->security == MESH_CONF_SEC_NONE)
-		mesh_mpm_plink_open(wpa_s, sta, PLINK_OPEN_SENT);
-	else
-		mesh_rsn_auth_sae_sta(wpa_s, sta);
+	if (sta->plink_state == PLINK_LISTEN) {
+		if (!sta->my_lid)
+			mesh_mpm_init_link(wpa_s, sta);
+		if (conf->security == MESH_CONF_SEC_NONE) {
+			mesh_mpm_plink_open(wpa_s, sta, PLINK_OPEN_SENT);
+		} else {
+			mesh_rsn_auth_sae_sta(wpa_s, sta);
+		}
+	}
 }
 
 
-- 
1.9.1




More information about the Hostap mailing list