[PATCH 1/9] nl80211: log offset and attribute type for nl80211 errors
Benjamin Berg
benjamin at sipsolutions.net
Fri Jul 18 04:00:57 PDT 2025
From: Benjamin Berg <benjamin.berg at intel.com>
This information is easy to provide and it can be useful if the kernel
rejects an operation.
Signed-off-by: Benjamin Berg <benjamin.berg at intel.com>
---
src/drivers/driver_nl80211.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 0cc5b4b0e1..c330140065 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -391,17 +391,26 @@ static int error_handler(struct sockaddr_nl *nla, struct nlmsgerr *err,
len, (char *) nla_data(tb[NLMSGERR_ATTR_MSG]));
}
- if (!err_args->err_info)
- return NL_SKIP;
-
- /* Check if it was a per-link error report */
-
+ /* Done if the the problematic attribute was not specified */
if (!tb[NLMSGERR_ATTR_OFFS] ||
os_memcmp(orig_nlh, &err->msg, sizeof(err->msg)) != 0)
return NL_SKIP;
offset = nla_get_u32(tb[NLMSGERR_ATTR_OFFS]);
+ if (offset < orig_nlh->nlmsg_len) {
+ struct nlattr *orig_attr =
+ (void *) ((unsigned char *) orig_nlh + offset);
+
+ wpa_printf(MSG_DEBUG,
+ "nl80211: kernel reports error at offset %u, attribute type %d",
+ offset, nla_type(orig_attr));
+ }
+
+ /* Resolve problematic link if err_info is not NULL */
+ if (!err_args->err_info)
+ return NL_SKIP;
+
mlo_links = nlmsg_find_attr(orig_nlh, GENL_HDRLEN,
NL80211_ATTR_MLO_LINKS);
if (!mlo_links)
--
2.50.0
More information about the Hostap
mailing list