mesh: Sync plink state with kernel

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>
This commit is contained in:
Masashi Honma 2015-01-22 14:22:16 +09:00 committed by Jouni Malinen
parent 467775c5ac
commit 871ff0b746
3 changed files with 13 additions and 5 deletions

View file

@ -193,6 +193,11 @@ static void mesh_mpm_init_link(struct wpa_supplicant *wpa_s,
sta->my_lid = llid; sta->my_lid = llid;
sta->peer_lid = 0; 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; sta->plink_state = PLINK_LISTEN;
} }
@ -348,8 +353,8 @@ fail:
/* configure peering state in ours and driver's station entry */ /* configure peering state in ours and driver's station entry */
static void void wpa_mesh_set_plink_state(struct wpa_supplicant *wpa_s,
wpa_mesh_set_plink_state(struct wpa_supplicant *wpa_s, struct sta_info *sta, struct sta_info *sta,
enum mesh_plink_state state) enum mesh_plink_state state)
{ {
struct hostapd_sta_add_params params; struct hostapd_sta_add_params params;
@ -417,7 +422,7 @@ static void plink_timer(void *eloop_ctx, void *user_data)
/* confirm timer */ /* confirm timer */
if (!reason) if (!reason)
reason = WLAN_REASON_MESH_CONFIRM_TIMEOUT; 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, eloop_register_timeout(conf->dot11MeshHoldingTimeout / 1000,
(conf->dot11MeshHoldingTimeout % 1000) * 1000, (conf->dot11MeshHoldingTimeout % 1000) * 1000,
plink_timer, wpa_s, sta); plink_timer, wpa_s, sta);

View file

@ -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_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_auth_peer(struct wpa_supplicant *wpa_s, const u8 *addr);
void mesh_mpm_free_sta(struct sta_info *sta); 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 #ifdef CONFIG_MESH

View file

@ -41,7 +41,7 @@ void mesh_auth_timer(void *eloop_ctx, void *user_data)
mesh_rsn_auth_sae_sta(wpa_s, sta); mesh_rsn_auth_sae_sta(wpa_s, sta);
} else { } else {
/* block the STA if exceeded the number of attempts */ /* 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->state = SAE_NOTHING;
} }
sta->sae_auth_retry++; sta->sae_auth_retry++;