diff mbox

[1/3] mesh: Sync plink state with kernel

Message ID 1421904138-6385-1-git-send-email-masashi.honma@gmail.com
State Accepted
Headers show

Commit Message

Masashi Honma Jan. 22, 2015, 5:22 a.m. UTC
The plink_state exists both wpa_supplicant and kernel. Synchronize them with
wpa_mesh_set_plink_state().

Signed-off-by: Kenzoh Nishikawa <Kenzoh.Nishikawa@jp.sony.com>
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
---
 wpa_supplicant/mesh_mpm.c | 12 ++++++++----
 wpa_supplicant/mesh_mpm.h |  3 +++
 wpa_supplicant/mesh_rsn.c |  2 +-
 3 files changed, 12 insertions(+), 5 deletions(-)

Comments

Jouni Malinen Jan. 27, 2015, 6:28 p.m. UTC | #1
On Thu, Jan 22, 2015 at 02:22:16PM +0900, Masashi Honma wrote:
> The plink_state exists both wpa_supplicant and kernel. Synchronize them with
> wpa_mesh_set_plink_state().

Just to make sure I understood correctly.. Is this patch 1/3 still
needed and only the patches 2/3 and 3/3 are dropped (with the two
patches from Bob to be used instead)?
Bob Copeland Jan. 27, 2015, 7:19 p.m. UTC | #2
On Tue, Jan 27, 2015 at 08:28:16PM +0200, Jouni Malinen wrote:
> On Thu, Jan 22, 2015 at 02:22:16PM +0900, Masashi Honma wrote:
> > The plink_state exists both wpa_supplicant and kernel. Synchronize them with
> > wpa_mesh_set_plink_state().
> 
> Just to make sure I understood correctly.. Is this patch 1/3 still
> needed and only the patches 2/3 and 3/3 are dropped (with the two
> patches from Bob to be used instead)?

I believe this patch can be included - while it's not necessary for
correct operation, it shouldn't cause any issues and will allow "iw
mesh0 station dump" to show correct states (kernel shouldn't care what the
states actually are).
Masashi Honma Jan. 27, 2015, 11:51 p.m. UTC | #3
2015-01-28 4:19 GMT+09:00 Bob Copeland <me@bobcopeland.com>:
> I believe this patch can be included - while it's not necessary for
> correct operation, it shouldn't cause any issues and will allow "iw
> mesh0 station dump" to show correct states (kernel shouldn't care what the
> states actually are).

I agree with Bob.
Jouni Malinen Jan. 28, 2015, 11:15 a.m. UTC | #4
On Thu, Jan 22, 2015 at 02:22:16PM +0900, Masashi Honma wrote:
> The plink_state exists both wpa_supplicant and kernel. Synchronize them with
> wpa_mesh_set_plink_state().

Thanks, applied.
diff mbox

Patch

diff --git a/wpa_supplicant/mesh_mpm.c b/wpa_supplicant/mesh_mpm.c
index 4a259ff..51f82f5 100644
--- a/wpa_supplicant/mesh_mpm.c
+++ b/wpa_supplicant/mesh_mpm.c
@@ -193,6 +193,10 @@  static void mesh_mpm_init_link(struct wpa_supplicant *wpa_s,
 
 	sta->my_lid = llid;
 	sta->peer_lid = 0;
+	/**
+	 * We do not use wpa_mesh_set_plink_state() here.
+	 * Because there is no entry in kernel yet.
+	 */
 	sta->plink_state = PLINK_LISTEN;
 }
 
@@ -348,9 +352,9 @@  fail:
 
 
 /* configure peering state in ours and driver's station entry */
-static void
-wpa_mesh_set_plink_state(struct wpa_supplicant *wpa_s, struct sta_info *sta,
-			 enum mesh_plink_state state)
+void wpa_mesh_set_plink_state(struct wpa_supplicant *wpa_s,
+			      struct sta_info *sta,
+			      enum mesh_plink_state state)
 {
 	struct hostapd_sta_add_params params;
 	int ret;
@@ -417,7 +421,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);
diff --git a/wpa_supplicant/mesh_mpm.h b/wpa_supplicant/mesh_mpm.h
index 2f7f6a7..7ebaef0 100644
--- a/wpa_supplicant/mesh_mpm.h
+++ b/wpa_supplicant/mesh_mpm.h
@@ -15,6 +15,9 @@  void wpa_mesh_new_mesh_peer(struct wpa_supplicant *wpa_s, const u8 *addr,
 void mesh_mpm_deinit(struct wpa_supplicant *wpa_s, struct hostapd_iface *ifmsh);
 void mesh_mpm_auth_peer(struct wpa_supplicant *wpa_s, const u8 *addr);
 void mesh_mpm_free_sta(struct sta_info *sta);
+void wpa_mesh_set_plink_state(struct wpa_supplicant *wpa_s,
+			      struct sta_info *sta,
+			      enum mesh_plink_state state);
 
 #ifdef CONFIG_MESH
 
diff --git a/wpa_supplicant/mesh_rsn.c b/wpa_supplicant/mesh_rsn.c
index aee325a..da4cb03 100644
--- a/wpa_supplicant/mesh_rsn.c
+++ b/wpa_supplicant/mesh_rsn.c
@@ -41,7 +41,7 @@  void mesh_auth_timer(void *eloop_ctx, void *user_data)
 			mesh_rsn_auth_sae_sta(wpa_s, sta);
 		} else {
 			/* block the STA if exceeded the number of attempts */
-			sta->plink_state = PLINK_BLOCKED;
+			wpa_mesh_set_plink_state(wpa_s, sta, PLINK_BLOCKED);
 			sta->sae->state = SAE_NOTHING;
 		}
 		sta->sae_auth_retry++;