3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-21 22:09:23 +01:00

nl80211util: add key type/idx to nl80211_parse_attrs

This commit is contained in:
James Prestwood 2022-11-01 13:17:45 -07:00 committed by Denis Kenzior
parent 53469c5c0d
commit 9f1fa53aae

View File

@ -139,6 +139,17 @@ static bool extract_nested(const void *data, uint16_t len, void *o)
return true;
}
static bool extract_u8(const void *data, uint16_t len, void *o)
{
uint8_t *out = o;
if (len != 1)
return false;
*out = l_get_u8(data);
return true;
}
static attr_handler handler_for_type(enum nl80211_attrs type)
{
switch (type) {
@ -146,6 +157,7 @@ static attr_handler handler_for_type(enum nl80211_attrs type)
return extract_ifindex;
case NL80211_ATTR_WIPHY:
case NL80211_ATTR_IFTYPE:
case NL80211_ATTR_KEY_TYPE:
return extract_uint32;
case NL80211_ATTR_WDEV:
case NL80211_ATTR_COOKIE:
@ -170,6 +182,8 @@ static attr_handler handler_for_type(enum nl80211_attrs type)
return extract_iovec;
case NL80211_ATTR_WIPHY_BANDS:
return extract_nested;
case NL80211_ATTR_KEY_IDX:
return extract_u8;
default:
break;
}