From 885097125ccbd9b1e18479c90e6b772ecab014eb Mon Sep 17 00:00:00 2001 From: Yu Wang Date: Wed, 8 Jul 2020 02:18:47 +0800 Subject: [PATCH] mesh: Fix peer link counting when removing a mesh peer When removing a mesh peer with control interface commands (ACCEPT_ACL DEL_MAC/DENY_ACL ADD_MAC/MESH_PEER_REMOVE) the plink count was not decreased from its last connection. This resulted in peer link count leakage and wpa_supplicant rejecting the connections after reaching max_peer_links (default: 99). Fix this by decreasing the plink count when removing a mesh peer which is in PLINK_ESTAB state. Signed-off-by: Yu Wang --- wpa_supplicant/mesh_mpm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wpa_supplicant/mesh_mpm.c b/wpa_supplicant/mesh_mpm.c index ea62abf5b..3abbe09d0 100644 --- a/wpa_supplicant/mesh_mpm.c +++ b/wpa_supplicant/mesh_mpm.c @@ -533,6 +533,8 @@ 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) + hapd->num_plinks--; 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,