From patchwork Sat Sep 26 05:39:57 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: hc86862997@gmail.com X-Patchwork-Id: 2314458 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=XyN/LyLh; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=ngSWDnHt; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hwRGJ01Xpz1xvt for ; Thu, 01 Oct 2026 19:20:23 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From: MIME-Version:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=1hP/YIk8QLriIflUjOaeRN24Q1n6sP9SrRHVjd82zIM=; b=XyN /LyLh8Pdysha/ZnPVpKM/tNA7B8XOqe1WGRukwIKqx8TvLN6Ow2uSrdYia/ZsEcMLOv64N4U//nK6 2adUjkVZR1i7pCsZ6Vj+sBCrd2laUy7TEypwSpNQJmlLm0OBFD7EgvSm6PBpochTRwI6asVwDw8O1 bgJH8gqfzydykBrQeI8pbqat82fnSoaC/WY/nVcVpriHugyW/kVy7wB++YT7fSiy7ZyLKmsBFqAEM oBJuF5Si9XzTz49EyCnq8SrZSyHNPw2Q8eoGrYaijB+cYslfr0XwbO4Sg8Jb0yQTt1ujWXn7thu8J PDlWhiE3AhsRadr3X7CztIf4Ykfu0uQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCCwR-00000008L5h-1JbH; Thu, 01 Oct 2026 09:19:03 +0000 Received: from mail-ed2-x0f.google.com ([2a00:1450:4864:33::f]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1xAUVM-0000000Fb60-0pLP for hostap@lists.infradead.org; Sat, 26 Sep 2026 15:40:01 +0000 Received: by mail-ed2-x0f.google.com with SMTP id 4fb4d7f45d1cf-6aa1da63791so2591508a12.1 for ; Sat, 26 Sep 2026 08:39:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1790437198; cv=none; d=google.com; s=arc-20260327; b=Sl2csGY6f+sRwlH9QF2ocLxblI24kof0McqPnzSO+RLK9rQG2+c5qFHMgXC2DEnLVQ tRNb5QeA+ogGws0oOu1hSA9/3qgJqiQN/Gjk38d/6fx5TM9E6QSowHMs9PvkractPo35 gNoQA0vjM7vIUq89m7QVyYqPbPSqNUdU8pOniP04xKpHYlCfVQv7UCUzMQanN4H/jD7Q YdVhftRGRJ5AFnoAbiJZtU0mEdb9DspaS00fMQH/YDgQTIhPE+x6jXh2eX9aDbSb2AdG jolgo+THrivoxTK7bSYJ4EJd1Vmmq+QzSCfs+tu0hWi6mHcARKBkjf9RY6CrOoUDPMt/ Xp2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=to:subject:message-id:date:from:mime-version:dkim-signature; bh=jqt+MEeJAJQzhl80WTXCtT8u/yKLZrUlfJkCGtdv0TM=; fh=RepBDIVbUTRsjfbrO/5AjcaOU1JdnBduCNdRP0Vpu7Q=; b=kGk41qzAQun10pmr6hDnqprPgA0N0Nb2eiXiNnoG/The2i3ZMt+Lkz7xo0moPr988k VmENtUBrUfC2LVxOmNSTtVtGIHJzY/Bj/UjRsgQAAPKlcPUihVMIgcmHp8I3vhH150q+ EY2r6/s/ZQL4onPYwz44AtHz+mIvOaWEFL+d2kYbC0RVwU1oH/ZSA1lhQ8BwWIA5Xs9J HyTbViCbhDwRNP34WszWzJVeWDCYhsE2mkuz8XPwlM++9sLozc0hgL8HyN0FQZ6WZ8ZV XPDrVbY0BTTf4rIArNKq7DHMnljMwl2mn/9FMEACjo/vzP5KK7d+xHMaDI3Ftkvxxk+s KLnA==; darn=lists.infradead.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790437198; x=1791041998; darn=lists.infradead.org; h=content-type:to:subject:message-id:date:from:mime-version:from:to :cc:subject:date:message-id:reply-to:content-type; bh=jqt+MEeJAJQzhl80WTXCtT8u/yKLZrUlfJkCGtdv0TM=; b=ngSWDnHtgm54SsrnAzPr+M8wfWEkXO7Y1QnyVormhI2z3uzWVhuAqgL8vXyuGM8xMZ XsCVGai7rpRRH70F7gcn+bzH++LyDHRgshjUA6QumNhkY1qMhCx4QA+veYgpgbGzv+Uh 5NPuGIYm3Ajd+obSfrdLWhW8UpH0GDCuPekxOXbRL7fmq03wTA0IsPn5CTI6ncQFaJGt bgbnzLFBt4BE9L885ZveuO/T8EC7o7Ju4jjHOwDHlyswF5RNg+JiwKYOnJ9GyzUQp9FW wExB2Umyr9X2DJkhRSbiC1SeQzRQgicRRppKTNBtRH19dhD5+alVAtJWGzU9G2FWqEKt M3Zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790437198; x=1791041998; h=content-type:to:subject:message-id:date:from:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=jqt+MEeJAJQzhl80WTXCtT8u/yKLZrUlfJkCGtdv0TM=; b=PQHUBvCgt+vDWTtbK6RpAqkdjUzU2TXQyIIUIGyaHsoIk52Iv4JUwLCOhX6D8s/MbS L2gxBrvHXR7KMj4k50mKAmyxGT+jsvPBB3OO5J0dXFBG2SP1YFKwYcpzOnYt5+wt6u6M yLdSj64m/mgVxZb3sNTg1Hk3PnUT/JvygclzlTy3N5zFyCoXnNYyuKy7UHgRhVPG2d5+ fsvsYvTiEr1DFc2UokTYSCQCrov0kV80KqMEREQ2MVe3ghITnW/Iw74LLYHL3J76esxC KmItXk2IRTqShVawDIjJyQbJtmaUdoMzt8Pwy8AJvTUF5YfNYcrSGnpSNzO7hvZu7KhG vQeg== X-Gm-Message-State: AFq9FYLYgoj0ZUfolDOLwy+kjm4GzJTlz514uS7XHQy2PNFauAb1YbfY nUzFxr7UPowZSEroXwWrf2/3CPrMfxZZ8D2enO59pTLOtb13p5JsAjLWvsNKe4j1x/RvIie6jlf L6c3KIwgGAZQEY11WgNh5Snjw0R+vuYXksdE7mjY= X-Gm-Gg: AYBFou2h/VGMo2F38tmR1qu6UpRaGBa6+kEU+heKA0h1ZOkxr8KH6+QhmzmuDHZmq3R tzMn7zEnYQiKRX0w6f5/L58sa3IUIofoa+s0Syp1KixC0k/R3oGEufiDXwUqEGNWWC/9Eckhwnl /pEPbZhiylMVAMCcGqFaFXUm0Ibsf49aQQHxzA7DoLgk+YDbuchK0LZ6HGqDXpIAvX5wF1wEilm OqzTcBlLaSr8oxJ/IAi9MMUhXDFp9FVVi1C7o4yD6yH6shiOx70ODZTPzrF13j+54Pjks999KLl rx0xTeZ2YxLBB/lygc5yTQKcIkU3pZaC38fx6jwCBQ2y9C4r84zFpQ== X-Received: by 2002:a05:6402:1f04:b0:6a7:ee54:f897 with SMTP id 4fb4d7f45d1cf-6aac8f5c00bmr7862947a12.27.1790437197915; Sat, 26 Sep 2026 08:39:57 -0700 (PDT) Received: from 77377267392 named unknown by gmailapi.google.com with HTTPREST; Sat, 26 Sep 2026 08:39:57 -0700 Received: from 77377267392 named unknown by gmailapi.google.com with HTTPREST; Sat, 26 Sep 2026 08:39:57 -0700 MIME-Version: 1.0 From: hc86862997@gmail.com Date: Sat, 26 Sep 2026 08:39:57 -0700 X-Gm-Features: AclHuK-O-St0K0Cq3CFmWJ5eGS_uO1McSFSvEBvn4qO0h5Yg1OoWwEp_eEgjREA Message-ID: Subject: [PATCH] ap: never disconnect idle stations sooner than ap_max_inactivity To: hostap@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260926_084000_262615_45255001 X-CRM114-Status: GOOD ( 11.25 ) X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Hi, hostapd adopts the client-advertised BSS Max Idle Period from the (re)association request and lets it override the AP-wide ap_max_inactivity, in two places: - ap_handle_timer(): if (sta->max_idle_period) max_inactivity = (sta->max_idle_period * 1024 + 999) / 1000; - ap_sta_alloc(): the same computation for the initial timer registration. Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [hc86862997(at)gmail.com] 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit [hc86862997(at)gmail.com] -0.0 DMARC_PASS DMARC pass policy X-Mailman-Approved-At: Thu, 01 Oct 2026 02:19:02 -0700 X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Hi, hostapd adopts the client-advertised BSS Max Idle Period from the (re)association request and lets it override the AP-wide ap_max_inactivity, in two places: - ap_handle_timer(): if (sta->max_idle_period) max_inactivity = (sta->max_idle_period * 1024 + 999) / 1000; - ap_sta_alloc(): the same computation for the initial timer registration. Some clients (Apple) advertise a short BSS Max Idle Period (~20 units, about 20 s) for power saving - they expect the AP to buffer frames for them, not to be disconnected. The result is deterministic: with the screen off (idle), the client is removed exactly 20 s after association: deauthenticated due to inactivity (timer DEAUTH/REMOVE) Raising ap_max_inactivity has no effect for such clients because the adoption overwrites it - we verified 20-second kicks with ap_max_inactivity=86400 present in the running configuration (MT7996 AP-MLD, hostapd 831364bf). Clients without the element keep using the AP-wide timeout, which is why the bug looks client-specific. Fix: never disconnect a station sooner than the AP-wide ap_max_inactivity - floor the adopted value in both places. Verification: an Apple MLO client left idle with the screen off was previously kicked at exactly 20 s on every attempt; with this patch it stays associated indefinitely. Clients that do not advertise BSS Max Idle Period are unaffected. (Also reported to OpenWrt: https://github.com/openwrt/openwrt/issues/25416 ) Signed-off-by: line from the author or copyright holder of the patch to --- src/ap/sta_info.c | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) } sta->supported_rates_len = i; - if (sta->max_idle_period) - max_inactivity = (sta->max_idle_period * 1024 + 999) / 1000; + if (sta->max_idle_period) { + /* + * Never disconnect a station sooner than the AP-wide + * ap_max_inactivity: some clients (e.g. Apple) advertise a + * short BSS Max Idle Period for power saving and expect + * buffered keep-alives, not disassociation. Adopting the + * value as-is made idle stations get kicked ~20s after + * association when the data poll went unanswered. + */ + int adopted = (sta->max_idle_period * 1024 + 999) / 1000; + + if (adopted < max_inactivity) + adopted = max_inactivity; + max_inactivity = adopted; + } if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_INACTIVITY_TIMER)) { wpa_printf(MSG_DEBUG, "%s: register ap_handle_timer timeout " --- a/src/ap/sta_info.c +++ b/src/ap/sta_info.c @@ -631,8 +631,22 @@ return; } - if (sta->max_idle_period) - max_inactivity = (sta->max_idle_period * 1024 + 999) / 1000; + if (sta->max_idle_period) { + /* + * Never disconnect a station sooner than the AP-wide + * ap_max_inactivity: some clients (e.g. Apple) advertise a + * short BSS Max Idle Period for power saving and expect + * buffered keep-alives, not disassociation. Adopting the + * value as-is made idle stations get kicked ~20s after + * association when the data poll went unanswered. + */ + int adopted = (sta->max_idle_period * 1024 + 999) / 1000; + + if (adopted < max_inactivity) + adopted = max_inactivity; + max_inactivity = adopted; + } if ((sta->flags & WLAN_STA_ASSOC) && (sta->timeout_next == STA_NULLFUNC || @@ -945,8 +959,22 @@