3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 13:02:44 +01:00

nl80211util: Parse NL80211_ATTR_REG_ALPHA2 attrs

This commit is contained in:
Andrew Zaborowski 2020-04-23 18:24:34 +02:00 committed by Denis Kenzior
parent 59cc1e27c2
commit 0f3f0086ae

View File

@ -63,6 +63,19 @@ static bool extract_name(const void *data, uint16_t len, void *o)
return true;
}
static bool extract_2_chars(const void *data, uint16_t len, void *o)
{
char *out = o;
const char *in = data;
if (len != 3 || in[2] != 0)
return false;
out[0] = in[0];
out[1] = in[1];
return true;
}
static bool extract_mac(const void *data, uint16_t len, void *o)
{
const uint8_t **out = o;
@ -118,6 +131,8 @@ static attr_handler handler_for_type(enum nl80211_attrs type)
case NL80211_ATTR_IFNAME:
case NL80211_ATTR_WIPHY_NAME:
return extract_name;
case NL80211_ATTR_REG_ALPHA2:
return extract_2_chars;
case NL80211_ATTR_MAC:
return extract_mac;
case NL80211_ATTR_ACK: