commit 16cc2386f136a0b46ad12ea51f09e9655f517c3a
parent c32495cf035e4c99e5ede0291d22648bf54fc65b
Author: Andrew Zaborowski <andrew.zaborowski@intel.com>
Date: Fri, 7 Feb 2020 12:39:10 +0100
nl80211util: Handle NL80211_ATTR_ACK flag in parser
If this attribute is included in the nl80211_parse_attrs parameters, set
the corresponding bool to true if flag was present and false if not.
Diffstat:
1 file changed, 15 insertions(+), 0 deletions(-)
diff --git a/src/nl80211util.c b/src/nl80211util.c
@@ -96,6 +96,14 @@ static bool extract_uint32(const void *data, uint16_t len, void *o)
return true;
}
+static bool extract_flag(const void *data, uint16_t len, void *o)
+{
+ if (len != 0)
+ return false;
+
+ return true;
+}
+
static attr_handler handler_for_type(enum nl80211_attrs type)
{
switch (type) {
@@ -112,6 +120,8 @@ static attr_handler handler_for_type(enum nl80211_attrs type)
return extract_name;
case NL80211_ATTR_MAC:
return extract_mac;
+ case NL80211_ATTR_ACK:
+ return extract_flag;
default:
break;
}
@@ -190,6 +200,11 @@ int nl80211_parse_attrs(struct l_genl_msg *msg, int tag, ...)
for (e = l_queue_get_entries(entries); e; e = e->next) {
entry = e->data;
+ if (entry->handler == extract_flag) {
+ *(bool *) entry->data = entry->present;
+ continue;
+ }
+
if (entry->present)
continue;