diff mbox series

mac80211: fix regression in sta connection monitor

Message ID 20200921154545.91971-1-nbd@nbd.name (mailing list archive)
State Superseded
Delegated to: Johannes Berg
Headers show
Series mac80211: fix regression in sta connection monitor | expand

Commit Message

Felix Fietkau Sept. 21, 2020, 3:45 p.m. UTC
When the nulldata frame was acked, the probe send count needs to be reset,
otherwise it will keep increasing until the connection is considered dead,
even though it fine.

Fixes: 9abf4e49830d ("mac80211: optimize station connection monitor")
Reported-by: Georgi Valkov <gvalkov@abv.bg>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 net/mac80211/mlme.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Georgi Valkov Sept. 22, 2020, 7:28 a.m. UTC | #1
Hi Felix!

In the original code before the regression, as well as in the fix I proposed, probe_send_count was always reset if ack is true, while in your fix it will not be reset when non-null frames are received. The connection failed again after 10 hours and the STA remained offline for two minutes instead of two seconds. I should also note that I spent multiple days testing the fix I proposed and I had no disconnects. Please revise your fix again!


// my fix
void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata,
			     struct ieee80211_hdr *hdr, bool ack, u16 tx_time)
{
	ieee80211_sta_tx_wmm_ac_notify(sdata, hdr, tx_time);

	if (ieee80211_is_any_nullfunc(hdr->frame_control) &&
	    sdata->u.mgd.probe_send_count > 0) {
		if (ack)
			sdata->u.mgd.probe_send_count = 0;
		else
			sdata->u.mgd.nullfunc_failed = true;
		ieee80211_queue_work(&sdata->local->hw, &sdata->work);
		return;
	}

	if (ack)
		sdata->u.mgd.probe_send_count = 0;
}


// commit 1c6d45644a54e50b6445bbc63eff1ae34b2f1e2e
void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata,
			     struct ieee80211_hdr *hdr, bool ack, u16 tx_time)
{
	ieee80211_sta_tx_wmm_ac_notify(sdata, hdr, tx_time);

	if (!ieee80211_is_any_nullfunc(hdr->frame_control) ||
	    !sdata->u.mgd.probe_send_count)
		return;

	if (ack)
		sdata->u.mgd.probe_send_count = 0;
	else
		sdata->u.mgd.nullfunc_failed = true;
	ieee80211_queue_work(&sdata->local->hw, &sdata->work);
}


[STA: excerpt from the kernel log]
[   37.473147] jffs2_scan_eraseblock(): End of filesystem marker found at 0x0
[   37.587678] jffs2_build_filesystem(): unlocking the mtd device...
[   37.587722] done.
[   37.596129] jffs2_build_filesystem(): erasing all blocks after the end marker...
[   37.964664] br-lan: port 1(eth0.1) entered forwarding state
[   37.978167] br-lan: topology change detected, propagating
[   37.984273] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[   38.744745] ath: EEPROM regdomain: 0x8348
[   38.744752] ath: EEPROM indicates we should expect a country code
[   38.744759] ath: doing EEPROM country->regdmn map search
[   38.744764] ath: country maps to regdmn code: 0x3a
[   38.744769] ath: Country alpha2 being used: US
[   38.744772] ath: Regpair used: 0x3a
[   38.744778] ath: regdomain 0x8348 dynamically updated by user
[   39.468663] br-lan: port 2(tap_su) entered learning state
[   41.377031] br-lan: port 3(wifi) entered blocking state
[   41.382487] br-lan: port 3(wifi) entered disabled state
[   41.388183] device wifi entered promiscuous mode
[   41.484626] br-lan: port 2(tap_su) entered forwarding state
[   41.490410] br-lan: topology change detected, propagating
[   41.954884] wifi: authenticate with 60:38:e0:xx:xx:xx
[   41.974243] wifi: send auth to 60:38:e0:xx:xx:xx (try 1/3)
[   41.986584] wifi: authenticated
[   42.044684] wifi: associate with 60:38:e0:xx:xx:xx (try 1/3)
[   42.070584] wifi: RX AssocResp from 60:38:e0:xx:xx:xx (capab=0x431 status=0 aid=1)
[   42.078755] wifi: associated
[   42.093218] IPv6: ADDRCONF(NETDEV_CHANGE): wifi: link becomes ready
[   42.099926] br-lan: port 3(wifi) entered blocking state
[   42.105375] br-lan: port 3(wifi) entered listening state
[   44.140622] br-lan: port 3(wifi) entered learning state
[   46.156627] br-lan: port 3(wifi) entered forwarding state
[   46.162225] br-lan: topology change detected, sending tcn bpdu
[   66.065901] done.
[   66.067921] jffs2: notice: (1973) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[   66.371947] overlayfs: upper fs does not support tmpfile.
[   96.686235] sh (2348): drop_caches: 3
[36276.157356] wifi: deauthenticated from 60:38:e0:xx:xx:xx (Reason: 16=GROUP_KEY_HANDSHAKE_TIMEOUT)
[36276.166733] br-lan: port 3(wifi) entered disabled state
[36276.172265] br-lan: topology change detected, propagating
[36277.143206] wifi: authenticate with 60:38:e0:xx:xx:xx
[36277.162537] wifi: send auth to 60:38:e0:xx:xx:xx (try 1/3)
[36277.207635] wifi: authenticated
[36277.212374] wifi: associate with 60:38:e0:xx:xx:xx (try 1/3)
[36277.236924] wifi: RX AssocResp from 60:38:e0:xx:xx:xx (capab=0x431 status=0 aid=1)
[36277.245086] wifi: associated
[36277.272020] br-lan: port 3(wifi) entered blocking state
[36277.277472] br-lan: port 3(wifi) entered listening state
[36279.304356] br-lan: port 3(wifi) entered learning state
[36281.320494] br-lan: port 3(wifi) entered forwarding state
[36281.326089] br-lan: topology change detected, sending tcn bpdu
[36301.769911] br-lan: port 3(wifi) neighbor 7fff.60:38:e0:xx:xx:xy lost
[36301.776587] br-lan: topology change detected, propagating
[36577.165274] wifi: disassociated from 60:38:e0:xx:xx:xx (Reason: 4=DISASSOC_DUE_TO_INACTIVITY)
[36577.174238] br-lan: port 3(wifi) entered disabled state
[36577.228788] wifi: authenticate with 60:38:e0:xx:xx:xx
[36577.248147] wifi: send auth to 60:38:e0:xx:xx:xx (try 1/3)
[36577.255054] wifi: authenticated
[36577.259806] wifi: associate with 60:38:e0:xx:xx:xx (try 1/3)
[36577.285353] wifi: RX AssocResp from 60:38:e0:xx:xx:xx (capab=0x431 status=0 aid=1)
[36577.293521] wifi: associated
[36577.303805] br-lan: port 3(wifi) entered blocking state
[36577.309234] br-lan: port 3(wifi) entered listening state
[36579.323849] br-lan: port 3(wifi) entered learning state
[36581.339975] br-lan: port 3(wifi) entered forwarding state
[36581.345571] br-lan: topology change detected, sending tcn bpdu


[STA: excerpt from the system log]
Tue Sep 22 09:24:16 2020 daemon.notice wpa_supplicant[1436]: wifi: WPA: Group rekeying completed with 60:38:e0:xx:xx:xx [GTK=CCMP]
Tue Sep 22 09:24:20 2020 kern.info kernel: [36276.157356] wifi: deauthenticated from 60:38:e0:xx:xx:xx (Reason: 16=GROUP_KEY_HANDSHAKE_TIMEOUT)
Tue Sep 22 09:24:20 2020 kern.info kernel: [36276.166733] br-lan: port 3(wifi) entered disabled state
Tue Sep 22 09:24:20 2020 kern.info kernel: [36276.172265] br-lan: topology change detected, propagating
Tue Sep 22 09:24:20 2020 daemon.notice netifd: Network device 'wifi' link is down
Tue Sep 22 09:24:20 2020 daemon.notice wpa_supplicant[1436]: wifi: CTRL-EVENT-DISCONNECTED bssid=60:38:e0:xx:xx:xx reason=16
Tue Sep 22 09:24:21 2020 daemon.notice wpa_supplicant[1436]: wifi: SME: Trying to authenticate with 60:38:e0:xx:xx:xx (SSID='wifi' freq=2432 MHz)
Tue Sep 22 09:24:21 2020 kern.info kernel: [36277.143206] wifi: authenticate with 60:38:e0:xx:xx:xx
Tue Sep 22 09:24:21 2020 kern.info kernel: [36277.162537] wifi: send auth to 60:38:e0:xx:xx:xx (try 1/3)
Tue Sep 22 09:24:21 2020 daemon.notice wpa_supplicant[1436]: wifi: Trying to associate with 60:38:e0:xx:xx:xx (SSID='wifi' freq=2432 MHz)
Tue Sep 22 09:24:21 2020 kern.info kernel: [36277.207635] wifi: authenticated
Tue Sep 22 09:24:21 2020 kern.info kernel: [36277.212374] wifi: associate with 60:38:e0:xx:xx:xx (try 1/3)
Tue Sep 22 09:24:22 2020 kern.info kernel: [36277.236924] wifi: RX AssocResp from 60:38:e0:xx:xx:xx (capab=0x431 status=0 aid=1)
Tue Sep 22 09:24:22 2020 kern.info kernel: [36277.245086] wifi: associated
Tue Sep 22 09:24:22 2020 daemon.notice netifd: Network device 'wifi' link is up
Tue Sep 22 09:24:22 2020 daemon.notice wpa_supplicant[1436]: wifi: Associated with 60:38:e0:xx:xx:xx
Tue Sep 22 09:24:22 2020 daemon.notice wpa_supplicant[1436]: wifi: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
Tue Sep 22 09:24:22 2020 daemon.notice wpa_supplicant[1436]: wifi: WPA: Key negotiation completed with 60:38:e0:xx:xx:xx [PTK=CCMP GTK=CCMP]
Tue Sep 22 09:24:22 2020 daemon.notice wpa_supplicant[1436]: wifi: CTRL-EVENT-CONNECTED - Connection to 60:38:e0:xx:xx:xx completed [id=0 id_str=]
Tue Sep 22 09:24:22 2020 kern.info kernel: [36277.272020] br-lan: port 3(wifi) entered blocking state
Tue Sep 22 09:24:22 2020 kern.info kernel: [36277.277472] br-lan: port 3(wifi) entered listening state
Tue Sep 22 09:24:24 2020 kern.info kernel: [36279.304356] br-lan: port 3(wifi) entered learning state
Tue Sep 22 09:24:26 2020 kern.info kernel: [36281.320494] br-lan: port 3(wifi) entered forwarding state
Tue Sep 22 09:24:26 2020 kern.info kernel: [36281.326089] br-lan: topology change detected, sending tcn bpdu
Tue Sep 22 09:24:46 2020 kern.info kernel: [36301.769911] br-lan: port 3(wifi) neighbor 7fff.60:38:e0:xx:xx:xy lost
Tue Sep 22 09:24:46 2020 kern.info kernel: [36301.776587] br-lan: topology change detected, propagating
Tue Sep 22 09:29:21 2020 kern.info kernel: [36577.165274] wifi: disassociated from 60:38:e0:xx:xx:xx (Reason: 4=DISASSOC_DUE_TO_INACTIVITY)
Tue Sep 22 09:29:21 2020 kern.info kernel: [36577.174238] br-lan: port 3(wifi) entered disabled state
Tue Sep 22 09:29:21 2020 daemon.notice netifd: Network device 'wifi' link is down
Tue Sep 22 09:29:21 2020 daemon.notice wpa_supplicant[1436]: wifi: CTRL-EVENT-DISCONNECTED bssid=60:38:e0:xx:xx:xx reason=4
Tue Sep 22 09:29:21 2020 daemon.notice wpa_supplicant[1436]: wifi: SME: Trying to authenticate with 60:38:e0:xx:xx:xx (SSID='wifi' freq=2432 MHz)
Tue Sep 22 09:29:22 2020 kern.info kernel: [36577.228788] wifi: authenticate with 60:38:e0:xx:xx:xx
Tue Sep 22 09:29:22 2020 kern.info kernel: [36577.248147] wifi: send auth to 60:38:e0:xx:xx:xx (try 1/3)
Tue Sep 22 09:29:22 2020 kern.info kernel: [36577.255054] wifi: authenticated
Tue Sep 22 09:29:22 2020 daemon.notice wpa_supplicant[1436]: wifi: Trying to associate with 60:38:e0:xx:xx:xx (SSID='wifi' freq=2432 MHz)
Tue Sep 22 09:29:22 2020 kern.info kernel: [36577.259806] wifi: associate with 60:38:e0:xx:xx:xx (try 1/3)
Tue Sep 22 09:29:22 2020 kern.info kernel: [36577.285353] wifi: RX AssocResp from 60:38:e0:xx:xx:xx (capab=0x431 status=0 aid=1)
Tue Sep 22 09:29:22 2020 kern.info kernel: [36577.293521] wifi: associated
Tue Sep 22 09:29:22 2020 daemon.notice wpa_supplicant[1436]: wifi: Associated with 60:38:e0:xx:xx:xx
Tue Sep 22 09:29:22 2020 daemon.notice wpa_supplicant[1436]: wifi: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
Tue Sep 22 09:29:22 2020 daemon.notice netifd: Network device 'wifi' link is up
Tue Sep 22 09:29:22 2020 daemon.notice wpa_supplicant[1436]: wifi: WPA: Key negotiation completed with 60:38:e0:xx:xx:xx [PTK=CCMP GTK=CCMP]
Tue Sep 22 09:29:22 2020 daemon.notice wpa_supplicant[1436]: wifi: CTRL-EVENT-CONNECTED - Connection to 60:38:e0:xx:xx:xx completed [id=0 id_str=]
Tue Sep 22 09:29:22 2020 kern.info kernel: [36577.303805] br-lan: port 3(wifi) entered blocking state
Tue Sep 22 09:29:22 2020 kern.info kernel: [36577.309234] br-lan: port 3(wifi) entered listening state
Tue Sep 22 09:29:24 2020 kern.info kernel: [36579.323849] br-lan: port 3(wifi) entered learning state
Tue Sep 22 09:29:26 2020 kern.info kernel: [36581.339975] br-lan: port 3(wifi) entered forwarding state
Tue Sep 22 09:29:26 2020 kern.info kernel: [36581.345571] br-lan: topology change detected, sending tcn bpdu


[AP: excerpt from the kernel log]
[86442.373359] ieee80211 phy1: staid 1 deleted
[86448.496264] ieee80211 phy1: staid 1 deleted


[PC: ping -t 192.168.zzz.1]
Reply from 192.168.zzz.1: bytes=32 time=6ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=2ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=2ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=2ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=2ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=2ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=6ms TTL=64
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.

Ping statistics for 192.168.zzz.1:
    Packets: Sent = 29750, Received = 29745, Lost = 5 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 242ms, Average = 2ms
Control-Break
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.7: Destination host unreachable.
Reply from 192.168.zzz.1: bytes=32 time=2996ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=44ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=504ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=503ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=504ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=503ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=504ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=504ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=505ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=503ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=502ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=301ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=507ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=5ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=2ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=2ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=2ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=2ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=2ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=2ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=3ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=2ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=2ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=2ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=2ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=2ms TTL=64
Reply from 192.168.zzz.1: bytes=32 time=3ms TTL=64

Ping statistics for 192.168.zzz.1:
    Packets: Sent = 29820, Received = 29815, Lost = 5 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 2996ms, Average = 3ms


> On 2020-09-21, at 6:45 PM, Felix Fietkau <nbd@nbd.name> wrote:
> 
> When the nulldata frame was acked, the probe send count needs to be reset,
> otherwise it will keep increasing until the connection is considered dead,
> even though it fine.
> 
> Fixes: 9abf4e49830d ("mac80211: optimize station connection monitor")
> Reported-by: Georgi Valkov <gvalkov@abv.bg>
> Signed-off-by: Felix Fietkau <nbd@nbd.name>
> ---
> net/mac80211/mlme.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
> index 50a9b9025725..7c04d8e30482 100644
> --- a/net/mac80211/mlme.c
> +++ b/net/mac80211/mlme.c
> @@ -2508,7 +2508,9 @@ void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata,
> 	    !sdata->u.mgd.probe_send_count)
> 		return;
> 
> -	if (!ack)
> +	if (ack)
> +		sdata->u.mgd.probe_send_count = 0;
> +	else
> 		sdata->u.mgd.nullfunc_failed = true;
> 	ieee80211_queue_work(&sdata->local->hw, &sdata->work);
> }
> -- 
> 2.28.0
> 
>
Felix Fietkau Sept. 22, 2020, 8:56 a.m. UTC | #2
On 2020-09-22 09:28, Georgi Valkov wrote:
> Hi Felix!
> 
> In the original code before the regression, as well as in the fix I
> proposed, probe_send_count was always reset if ack is true, while in
> your fix it will not be reset when non-null frames are received. The
> connection failed again after 10 hours and the STA remained offline for
> two minutes instead of two seconds. I should also note that I spent
> multiple days testing the fix I proposed and I had no disconnects.
> Please revise your fix again!
Thanks for the info. Handling non-null frames in that function is
incomplete, because it does not cover the 802.3 tx status path.
I'll make v2 patch that checks the timestamp of the last ACK in
ieee80211_sta_work instead.

- Felix
Georgi Valkov Oct. 1, 2020, 1:59 p.m. UTC | #3
Hi Felix!

I can confirm that the original regression is now fully resolved in v3 of your patch.
Further testing showed that the second issue: group key handshake failed (RSN) after 4 tries is unrelated. Apparently OpenWRT does not support group rekeying when WDS is used, so it always fails and should be disabled: option wpa_group_rekey ‘0’.

Please excuse me for taking your time with the unrelated issue. There was no way for me to know that, since the disconnect remained, and it may take up to 24 hours to detect.

Thank you for your help!
Georgi

> On 2020-09-22, at 11:56 AM, Felix Fietkau <nbd@nbd.name> wrote:
> 
> On 2020-09-22 09:28, Georgi Valkov wrote:
>> Hi Felix!
>> 
>> In the original code before the regression, as well as in the fix I
>> proposed, probe_send_count was always reset if ack is true, while in
>> your fix it will not be reset when non-null frames are received. The
>> connection failed again after 10 hours and the STA remained offline for
>> two minutes instead of two seconds. I should also note that I spent
>> multiple days testing the fix I proposed and I had no disconnects.
>> Please revise your fix again!
> Thanks for the info. Handling non-null frames in that function is
> incomplete, because it does not cover the 802.3 tx status path.
> I'll make v2 patch that checks the timestamp of the last ACK in
> ieee80211_sta_work instead.
> 
> - Felix
>
diff mbox series

Patch

diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 50a9b9025725..7c04d8e30482 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -2508,7 +2508,9 @@  void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata,
 	    !sdata->u.mgd.probe_send_count)
 		return;
 
-	if (!ack)
+	if (ack)
+		sdata->u.mgd.probe_send_count = 0;
+	else
 		sdata->u.mgd.nullfunc_failed = true;
 	ieee80211_queue_work(&sdata->local->hw, &sdata->work);
 }