Wireless Daemon for Linux
 help / color / mirror / Atom feed
* [PATCH 1/7] netdev: use nl80211_parse_attrs for deauth event
@ 2024-06-25 13:06 James Prestwood
  2024-06-25 13:06 ` [PATCH 2/7] nl80211util: use nl80211_parse_attrs/nested for get_key_seq James Prestwood
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: James Prestwood @ 2024-06-25 13:06 UTC (permalink / raw)
  To: iwd; +Cc: James Prestwood

Especially for parsing a single attribute, nl80211_parse_attrs
makes the most sense to use here.
---
 src/netdev.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/src/netdev.c b/src/netdev.c
index 5b79d267..bada1ab5 100644
--- a/src/netdev.c
+++ b/src/netdev.c
@@ -1328,12 +1328,10 @@ static void netdev_cmd_disconnect_cb(struct l_genl_msg *msg, void *user_data)
 static void netdev_deauthenticate_event(struct l_genl_msg *msg,
 							struct netdev *netdev)
 {
-	struct l_genl_attr attr;
-	uint16_t type, len;
-	const void *data;
 	const struct mmpdu_header *hdr = NULL;
 	const struct mmpdu_deauthentication *deauth;
 	uint16_t reason_code;
+	struct iovec iov;
 
 	l_debug("");
 
@@ -1349,17 +1347,11 @@ static void netdev_deauthenticate_event(struct l_genl_msg *msg,
 	 * deauthenticating immediately afterwards
 	 */
 
-	if (L_WARN_ON(!l_genl_attr_init(&attr, msg)))
+	if (L_WARN_ON(nl80211_parse_attrs(msg, NL80211_ATTR_FRAME, &iov,
+						NL80211_ATTR_UNSPEC) < 0))
 		return;
 
-	while (l_genl_attr_next(&attr, &type, &len, &data)) {
-		switch (type) {
-		case NL80211_ATTR_FRAME:
-			hdr = mpdu_validate(data, len);
-			break;
-		}
-	}
-
+	hdr = mpdu_validate(iov.iov_base, iov.iov_len);
 	if (L_WARN_ON(!hdr))
 		return;
 
-- 
2.34.1


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

end of thread, other threads:[~2024-06-26 14:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-25 13:06 [PATCH 1/7] netdev: use nl80211_parse_attrs for deauth event James Prestwood
2024-06-25 13:06 ` [PATCH 2/7] nl80211util: use nl80211_parse_attrs/nested for get_key_seq James Prestwood
2024-06-25 13:06 ` [PATCH 3/7] netdev: reuse NETDEV_EVENT_{AUTHENTICATING,ASSOCIATING} James Prestwood
2024-06-26 14:43   ` Denis Kenzior
2024-06-25 13:06 ` [PATCH 4/7] station: add auth/assoc debug events James Prestwood
2024-06-25 13:06 ` [PATCH 5/7] auto-t: add test for deauth after authentication James Prestwood
2024-06-25 13:06 ` [PATCH 6/7] station: add debug event prior to sending an FT-auth frame James Prestwood
2024-06-25 13:06 ` [PATCH 7/7] auto-t: add test for a deauth coming in during an FT-roam James Prestwood

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