mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-21 22:09:23 +01:00
netdev: use nl80211_parse_attrs for deauth event
Especially for parsing a single attribute, nl80211_parse_attrs makes the most sense to use here.
This commit is contained in:
parent
3fd5250c0d
commit
5c824cc24e
16
src/netdev.c
16
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,
|
static void netdev_deauthenticate_event(struct l_genl_msg *msg,
|
||||||
struct netdev *netdev)
|
struct netdev *netdev)
|
||||||
{
|
{
|
||||||
struct l_genl_attr attr;
|
|
||||||
uint16_t type, len;
|
|
||||||
const void *data;
|
|
||||||
const struct mmpdu_header *hdr = NULL;
|
const struct mmpdu_header *hdr = NULL;
|
||||||
const struct mmpdu_deauthentication *deauth;
|
const struct mmpdu_deauthentication *deauth;
|
||||||
uint16_t reason_code;
|
uint16_t reason_code;
|
||||||
|
struct iovec iov;
|
||||||
|
|
||||||
l_debug("");
|
l_debug("");
|
||||||
|
|
||||||
@ -1349,17 +1347,11 @@ static void netdev_deauthenticate_event(struct l_genl_msg *msg,
|
|||||||
* deauthenticating immediately afterwards
|
* 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;
|
return;
|
||||||
|
|
||||||
while (l_genl_attr_next(&attr, &type, &len, &data)) {
|
hdr = mpdu_validate(iov.iov_base, iov.iov_len);
|
||||||
switch (type) {
|
|
||||||
case NL80211_ATTR_FRAME:
|
|
||||||
hdr = mpdu_validate(data, len);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (L_WARN_ON(!hdr))
|
if (L_WARN_ON(!hdr))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user