Re: [PATCH v2] 802.11n IBSS: wlan0 stops receiving packets due to aggregation after sender reboot

From: Johannes Berg
Date: Mon Oct 28 2019 - 08:21:26 EST

On Fri, 2019-10-25 at 12:21 +0200, Krzysztof HaÅasa wrote:
> Fix a bug where the mac80211 RX aggregation code sets a new aggregation
> "session" at the remote station's request, but the head_seq_num
> (the sequence number the receiver expects to receive) isn't reset.
> Spotted on a pair of AR9580 in IBSS mode.
> Signed-off-by: Krzysztof Halasa <khalasa@xxxxxxx>
> diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c
> index 4d1c335e06e5..67733bd61297 100644
> --- a/net/mac80211/agg-rx.c
> +++ b/net/mac80211/agg-rx.c
> @@ -354,10 +354,13 @@ void ___ieee80211_start_rx_ba_session(struct sta_info *sta,
> */
> rcu_read_lock();
> tid_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[tid]);
> - if (tid_rx && tid_rx->timeout == timeout)
> + if (tid_rx && tid_rx->timeout == timeout) {
> + tid_rx->ssn = start_seq_num;
> + tid_rx->head_seq_num = start_seq_num;

This is wrong, this is the case of *updating an existing session*, we
must not reset the head SN then.

I think you just got very lucky (or unlucky) to have the same dialog
token, because we start from 0 - maybe we should initialize it to a
random value to flush out such issues.

Really what I think probably happened is that one of your stations lost
the connection to the other, and didn't tell it about it in any way - so
the other kept all the status alive.

I suspect to make all this work well we need to not only have the fixes
I made recently to actually send and parse deauth frames, but also to
even send an auth and reset the state when we receive that, so if we
move out of range and even the deauth frame is lost, we can still reset

In any case, this is not the right approach - we need to handle the
"lost connection" case better I suspect, but since you don't say what
really happened I don't really know that that's what you're seeing.