Fix MESH-PEER-DISCONNECTED message logic on control iface
When using mesh we have incoherent MESH-PEER-CONNECTED/MESH-PEER-DISCONNECTED messages when we restart one of the devices without disconnecting it first. Sometimes we have the right behavior, a peer disconnect and then a peer connect, sometimes we only have a a peer connected without a peer disconnected first, and sometimes we have nothing at all. As the plink count seem to be correctly tracked and because we only send the connected event on plink count increase, lets send the peer disconnected event on plink count decrease. Signed-off-by: Nicolas Escande <nico.escande@gmail.com>
This commit is contained in:
parent
d986e87023
commit
bd37f86155
1 changed files with 10 additions and 2 deletions
|
@ -561,8 +561,11 @@ static int mesh_mpm_plink_close(struct hostapd_data *hapd, struct sta_info *sta,
|
|||
int reason = WLAN_REASON_MESH_PEERING_CANCELLED;
|
||||
|
||||
if (sta) {
|
||||
if (sta->plink_state == PLINK_ESTAB)
|
||||
if (sta->plink_state == PLINK_ESTAB) {
|
||||
hapd->num_plinks--;
|
||||
wpa_msg(wpa_s, MSG_INFO, MESH_PEER_DISCONNECTED MACSTR,
|
||||
MAC2STR(sta->addr));
|
||||
}
|
||||
wpa_mesh_set_plink_state(wpa_s, sta, PLINK_HOLDING);
|
||||
mesh_mpm_send_plink_action(wpa_s, sta, PLINK_CLOSE, reason);
|
||||
wpa_printf(MSG_DEBUG, "MPM closing plink sta=" MACSTR,
|
||||
|
@ -1428,8 +1431,13 @@ void mesh_mpm_action_rx(struct wpa_supplicant *wpa_s,
|
|||
/* called by ap_free_sta */
|
||||
void mesh_mpm_free_sta(struct hostapd_data *hapd, struct sta_info *sta)
|
||||
{
|
||||
if (sta->plink_state == PLINK_ESTAB)
|
||||
struct wpa_supplicant *wpa_s = hapd->iface->owner;
|
||||
|
||||
if (sta->plink_state == PLINK_ESTAB) {
|
||||
hapd->num_plinks--;
|
||||
wpa_msg(wpa_s, MSG_INFO, MESH_PEER_DISCONNECTED MACSTR,
|
||||
MAC2STR(sta->addr));
|
||||
}
|
||||
eloop_cancel_timeout(plink_timer, ELOOP_ALL_CTX, sta);
|
||||
eloop_cancel_timeout(mesh_auth_timer, ELOOP_ALL_CTX, sta);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue