eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

commit 3b937424db9009e3978fdcb1295f25088ffc48b6
parent d5770368792a7f2c012df1ed7c9881076268b830
Author: Denis Kenzior <denkenz@gmail.com>
Date:   Fri, 25 Oct 2019 13:46:58 -0500

nl80211util: Ensure all entries are parsed

The current logic did not make sure that each entry provided was
actually parsed.  Also add a sanity check to make sure that no duplicate
parsing occurs.

Diffstat:
Msrc/nl80211util.c | 19+++++++++++++++++++
1 file changed, 19 insertions(+), 0 deletions(-)

diff --git a/src/nl80211util.c b/src/nl80211util.c @@ -110,6 +110,7 @@ struct attr_entry { uint16_t type; void *data; attr_handler handler; + bool present : 1; }; int nl80211_parse_attrs(struct l_genl_msg *msg, int tag, ...) @@ -158,10 +159,28 @@ int nl80211_parse_attrs(struct l_genl_msg *msg, int tag, ...) if (!e) continue; + if (entry->present) { + ret = -EALREADY; + goto done; + } + if (!entry->handler(data, len, entry->data)) { ret = -EINVAL; goto done; } + + entry->present = true; + } + + ret = -ENOENT; + + for (e = l_queue_get_entries(entries); e; e = e->next) { + entry = e->data; + + if (entry->present) + continue; + + goto done; } ret = 0;