From 43d5e89fac9baaed1d1ad81b880ead74c7315b2b Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Tue, 18 Jun 2024 09:58:50 -0700 Subject: [PATCH] scan: fixed flush flag parsing Parsing the flush flag for external scans was not done correctly as it was not parsing the ATTR_SCAN_FLAGS but instead the flag bitmap. Fix this by parsing the flags attribute, then checking if the bit is set. --- src/scan.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/scan.c b/src/scan.c index d3f0ad31..55d560d4 100644 --- a/src/scan.c +++ b/src/scan.c @@ -2021,16 +2021,14 @@ static struct scan_context *scan_context_new(uint64_t wdev_id) static bool scan_parse_flush_flag_from_msg(struct l_genl_msg *msg) { - struct l_genl_attr attr; - uint16_t type, len; - const void *data; + uint32_t flags; - if (!l_genl_attr_init(&attr, msg)) + if (nl80211_parse_attrs(msg, NL80211_ATTR_SCAN_FLAGS, &flags, + NL80211_ATTR_UNSPEC) < 0) return false; - while (l_genl_attr_next(&attr, &type, &len, &data)) - if (type == NL80211_SCAN_FLAG_FLUSH) - return true; + if (flags & NL80211_SCAN_FLAG_FLUSH) + return true; return false; }