3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2025-01-03 10:32:33 +01:00

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.
This commit is contained in:
Andrew Zaborowski 2020-02-07 12:39:10 +01:00 committed by Denis Kenzior
parent c32495cf03
commit 16cc2386f1

View File

@ -96,6 +96,14 @@ static bool extract_uint32(const void *data, uint16_t len, void *o)
return true; 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) static attr_handler handler_for_type(enum nl80211_attrs type)
{ {
switch (type) { switch (type) {
@ -112,6 +120,8 @@ static attr_handler handler_for_type(enum nl80211_attrs type)
return extract_name; return extract_name;
case NL80211_ATTR_MAC: case NL80211_ATTR_MAC:
return extract_mac; return extract_mac;
case NL80211_ATTR_ACK:
return extract_flag;
default: default:
break; 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) { for (e = l_queue_get_entries(entries); e; e = e->next) {
entry = e->data; entry = e->data;
if (entry->handler == extract_flag) {
*(bool *) entry->data = entry->present;
continue;
}
if (entry->present) if (entry->present)
continue; continue;