diff mbox

[1/2] mesh: Ignore crowded peer

Message ID 20160619101909.GA20682@w1.fi
State Not Applicable
Headers show

Commit Message

Jouni Malinen June 19, 2016, 10:19 a.m. UTC
On Tue, Jun 14, 2016 at 12:31:15PM +0900, Masashi Honma wrote:
> The "Accepting Additional Mesh Peerings bit == 0" means the peer can not accept
> any more peer. So suppress to open the connection to the peer.

It looks like this breaks the wpas_mesh_reconnect hwsim test case by
triggering a mac80211 bug in counting established plinks.. If I
understood the design correctly, mac80211 misses a call to decrement the
counter if a mesh STA entry is deleted by user space when plink_state ==
NL80211_PLINK_ESTAB. Something like this may be needed in mac80211 to
fix this:

Comments

Masashi Honma June 20, 2016, 1:45 a.m. UTC | #1
On 2016年06月19日 19:19, Jouni Malinen wrote:
> It looks like this breaks the wpas_mesh_reconnect hwsim test case by
> triggering a mac80211 bug in counting established plinks.. If I
> understood the design correctly, mac80211 misses a call to decrement the
> counter if a mesh STA entry is deleted by user space when plink_state ==
> NL80211_PLINK_ESTAB. Something like this may be needed in mac80211 to
> fix this:
Nice catch ! Thank you !
diff mbox

Patch

diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index 21b1fdf..9a8ffe9 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -148,14 +148,16 @@  u32 mesh_accept_plinks_update(struct ieee80211_sub_if_data *sdata)
 void mesh_sta_cleanup(struct sta_info *sta)
 {
 	struct ieee80211_sub_if_data *sdata = sta->sdata;
-	u32 changed;
+	u32 changed = 0;
 
 	/*
 	 * maybe userspace handles peer allocation and peering, but in either
 	 * case the beacon is still generated by the kernel and we might need
 	 * an update.
 	 */
-	changed = mesh_accept_plinks_update(sdata);
+	if (sta->mesh->plink_state == NL80211_PLINK_ESTAB)
+		changed |= mesh_plink_dec_estab_count(sdata);
+	changed |= mesh_accept_plinks_update(sdata);
 	if (!sdata->u.mesh.user_mpm) {
 		changed |= mesh_plink_deactivate(sta);
 		del_timer_sync(&sta->mesh->plink_timer);