From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 910FB374186 for ; Wed, 22 Jul 2026 07:07:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784704061; cv=none; b=ghtMxUaF7DmtO5RTdTZgAA4sAnJpVaPr7ev49TX1pK8+khddP0TodlUA0WmKHxQYc+8N5Pnk9R1x3nw/5N3cEbAYAI2bzq1BbENfqtic4J41VQ4iPHB2sS5gygEzT7wBG131DBqPxrFWUyaViYggg/QfZRaReUtg1r9cc8KWNjc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784704061; c=relaxed/simple; bh=bodMFi7taOfL3wl99o5rWGxnp/aWxE/BQmjmBdSLFd4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ijgl8EjNy4w4457piHNrH46hsNnt7+KletKkJoJUB/pU+pQN+dLkOk1jHR7w9uUZVYDuv2yD6CUrQs0ls/NFxmFIm2j2//FlLxjjo68BiiqvNtYCRUgJMvdLvC7qMWEHsR4GPpIm9GnJc0w9OvFZXLqa/gXhMANnWX6ZwnfJpoA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=IwVnzC/s; arc=none smtp.client-ip=209.85.128.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IwVnzC/s" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-4953de5be0aso44216765e9.0 for ; Wed, 22 Jul 2026 00:07:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784704058; x=1785308858; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=A0tVSkx36GeNpI9z5aZsGTmDHitm0/Nzvhk8+wS4DA8=; b=IwVnzC/svibWAJkTm2ybKD+0cxIn6wFG3ooerFSDe0PIBJEN5FgXgAg9fCM2tiiGZP bEjnwPl9mf/bkLa8FmtN0iKluxXrPca8yeO3y7xK0a70/ZdJdhA0/Aydmgt31UrlkaA2 VU8vvXdDdjhNEJlUqR0GOftkd+krsEzs7sdgnmtGGkb4AmrVNhNKRjNL/YXH6VAhK/4y uCH4BTxp++13kUbLQsXWJF5Do+TEbIz1+7Db5fNocmPUIIaZjyzYOxvwpNo0l1NGBlpn fdvKogzI17znGd6dCkFtb83Bq+R9/DB3VAS7hMk/flri+iKZ4JLTyvk/Yd+WEcaS5qmB zrrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784704058; x=1785308858; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=A0tVSkx36GeNpI9z5aZsGTmDHitm0/Nzvhk8+wS4DA8=; b=XhU9edt2f7hoBvD6ZQXcL5EXk5+xLM+q3WJnaYK5PhGemvegjbva0uuVEl3jBUTK27 cf5H5MHwiXRcIy6J6+dowRMYvVC4XpiRXm73cbGN4ql1zTOCJD8gsg3FKFRplNMNKGW2 mFk5tSuhNm5w3Xy7JW/FCFetZY9i0lepdnwhirRXT5rOPPJh5IdtMNHAq+8yXMeqXa1W zv8+Sd4v24XrKez734D686rZJo6++F+7ifAxTEpav8miaPPJNPrGyn8nP0tyTDvU/ms5 SZDByTZVW83GyH4wuRKj4C32GhGK0vtH1eUaH5mz/PBHfrF/jRleOKO4Eoqwyi4cplys IgIA== X-Forwarded-Encrypted: i=1; AHgh+RoYu8ukYWhfmld44juVIdj48kRJvjGLQ30VBrMjNBjfu5r/1wCeJyPLV+npaIBOiKvhK066qE5yMLG8aUY=@vger.kernel.org X-Gm-Message-State: AOJu0YwIlLEz0RdrrClscN6+sXsvbI2sgUG4eWieG7z37RRguZYYZ93u sCLVYZn4jp0q/9dVr4GV+82CNoPAqA96aGv92aWQtUhtPlvpR+ZaXoN3 X-Gm-Gg: AR+sD12R+sJv9cpidqxr6DoXqjmYSboV4q9OEG7SUclZRN3XNZ8kLU1X5uhRLnOmIDS SXkRewJQDigUBKLQj2jGnWpXA9dT5UjEQnuf1iXhnn7tWJhtPGQNzwmvPxRAGn3yjkZ20tCxsCg /qY7bTM0O8BO+Y4hDsoKsLR3TAOkIyZLr8tiKNwIkVEGNruy9Bg0fnrrpKLcQEQ2Tp7EkAljgK2 nqOXAxyKrLE5+oE4+JDIBo8xmwxX8xrCwWlTn/NRC5ZVvUxLA/T9jIhYJWZEnz4+6Yp/t6KYP2X 7y3edMgz6urZjwChOudbGpA69cD0B6P5nfY8sqoLoN4aOCSK5/QXcuwWUB6cK2Dxs5scokrWqZe ENYIoFvvkYl+Wkr53ViUFmG/YDNDuGny4yIFPKQPWTqppR1jPP8LZqP1k3cIsrP6M+O3g5ZqZxs bocjBixag4orx+yYjiEgxH86rJUw== X-Received: by 2002:a05:600c:b8d:b0:493:a613:56b2 with SMTP id 5b1f17b1804b1-4954a3d0d5fmr255278905e9.8.1784704057580; Wed, 22 Jul 2026 00:07:37 -0700 (PDT) Received: from localhost ([102.128.173.0]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4956b72fac1sm28231115e9.1.2026.07.22.00.07.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jul 2026 00:07:37 -0700 (PDT) From: Louis Kotze To: Johannes Berg Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, loukot@gmail.com Subject: [PATCH v3 0/2] wifi: cfg80211: say why the auth/assoc BSS lookup failed Date: Wed, 22 Jul 2026 09:07:32 +0200 Message-ID: <20260722070734.3612581-1-loukot@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The BSS lookup for an authentication or association request can fail because no scan entry exists, because the entry is expired, or because the entry's use_for flags forbid the requested use. All three currently produce the same generic (or no) diagnostic, which wpa_supplicant relays verbatim as the only hint a user gets when e.g. an MLO association degrades to fewer links. Patch 1 makes __cfg80211_get_bss() record the reason via an optional extack while it walks the BSS table, and wires the auth and assoc paths up to it. Patch 2 adds a KUnit test for the reported reasons. Still demonstrated end-to-end in a mac80211_hwsim VM: an unpatched wpa_supplicant failing an MLD reassociation on a stale per-link BSS now logs "nl80211: kernel reports: BSS not found in scan results" plus the failing link, instead of the generic message. v3: address Johannes' review of v2: use GENL_SET_ERR_MSG for the -EINVAL messages in nl80211_assoc_bss(); comment why the bare NL_SET_BAD_ATTR is enough there (the lookup already set the specific message); comment that the identity checks in the walk must precede the expired/unusable classification; report a combined message when matching entries were rejected for different reasons instead of preferring one of them; drop the "scan again" instruction so the messages are purely descriptive; keep the original argument wrapping at the nl80211_associate() call site so only the new argument shows in the diff. v2: per Johannes' feedback on v1, capture the reason inside __cfg80211_get_bss() during the single bss_lock walk instead of a separate re-walk helper; cover the previously silent authentication path; add the KUnit test. Louis Kotze (2): wifi: cfg80211: say why the auth/assoc BSS lookup failed wifi: cfg80211: tests: check BSS lookup failure reasons include/net/cfg80211.h | 7 ++- net/wireless/nl80211.c | 27 +++++---- net/wireless/scan.c | 44 +++++++++++--- net/wireless/tests/scan.c | 121 +++++++++++++++++++++++++++++++++++++- 4 files changed, 178 insertions(+), 21 deletions(-) base-commit: 69bd85e933c617a84fa54fcc80e628e98afdc45d -- 2.55.0