Wireless Daemon for Linux
 help / color / mirror / Atom feed
* [PATCH 1/5] nl80211util: Handle NL80211_ATTR_ACK flag in parser
@ 2020-02-07 11:39 Andrew Zaborowski
  2020-02-07 11:39 ` [PATCH 2/5] frame-xchg: Add new groups to watch_groups list Andrew Zaborowski
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Andrew Zaborowski @ 2020-02-07 11:39 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 1457 bytes --]

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.
---
 src/nl80211util.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/nl80211util.c b/src/nl80211util.c
index c4942809..fa9abc1e 100644
--- 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;
 	}
@@ -124,6 +134,7 @@ struct attr_entry {
 	void *data;
 	attr_handler handler;
 	bool present : 1;
+	bool flag : 1;
 };
 
 int nl80211_parse_attrs(struct l_genl_msg *msg, int tag, ...)
@@ -190,6 +201,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;
 
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-02-07 21:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-07 11:39 [PATCH 1/5] nl80211util: Handle NL80211_ATTR_ACK flag in parser Andrew Zaborowski
2020-02-07 11:39 ` [PATCH 2/5] frame-xchg: Add new groups to watch_groups list Andrew Zaborowski
2020-02-07 21:38   ` Denis Kenzior
2020-02-07 11:39 ` [PATCH 3/5] frame-xchg: Try to call a handler only once per frame Andrew Zaborowski
2020-02-07 11:39 ` [PATCH 4/5] frame-xchg: Use both group_id and wdev_id when removing group Andrew Zaborowski
2020-02-07 21:42   ` Denis Kenzior
2020-02-07 11:39 ` [PATCH 5/5] frame-xchg: Add a frame exchange API Andrew Zaborowski
2020-02-07 21:28 ` [PATCH 1/5] nl80211util: Handle NL80211_ATTR_ACK flag in parser Denis Kenzior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox