nl80211: Add support for NL80211_ATTR_STA_FLAGS2
For now, the old code using NL80211_ATTR_STA_FLAGS is left in for backwards compatibility with older kernel versions. It may be removed eventually when most users are expected to be running with new enough kernel version.
This commit is contained in:
parent
a652fc1a24
commit
7e76ee9c45
1 changed files with 27 additions and 0 deletions
|
@ -2988,12 +2988,30 @@ static int wpa_driver_nl80211_hapd_send_eapol(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static u32 sta_flags_nl80211(int flags)
|
||||||
|
{
|
||||||
|
u32 f = 0;
|
||||||
|
|
||||||
|
if (flags & WLAN_STA_AUTHORIZED)
|
||||||
|
f |= BIT(NL80211_STA_FLAG_AUTHORIZED);
|
||||||
|
if (flags & WLAN_STA_WMM)
|
||||||
|
f |= BIT(NL80211_STA_FLAG_WME);
|
||||||
|
if (flags & WLAN_STA_SHORT_PREAMBLE)
|
||||||
|
f |= BIT(NL80211_STA_FLAG_SHORT_PREAMBLE);
|
||||||
|
if (flags & WLAN_STA_MFP)
|
||||||
|
f |= BIT(NL80211_STA_FLAG_MFP);
|
||||||
|
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int wpa_driver_nl80211_sta_set_flags(void *priv, const u8 *addr,
|
static int wpa_driver_nl80211_sta_set_flags(void *priv, const u8 *addr,
|
||||||
int total_flags, int flags_or,
|
int total_flags, int flags_or,
|
||||||
int flags_and)
|
int flags_and)
|
||||||
{
|
{
|
||||||
struct wpa_driver_nl80211_data *drv = priv;
|
struct wpa_driver_nl80211_data *drv = priv;
|
||||||
struct nl_msg *msg, *flags = NULL;
|
struct nl_msg *msg, *flags = NULL;
|
||||||
|
struct nl80211_sta_flag_update upd;
|
||||||
|
|
||||||
msg = nlmsg_alloc();
|
msg = nlmsg_alloc();
|
||||||
if (!msg)
|
if (!msg)
|
||||||
|
@ -3012,6 +3030,10 @@ static int wpa_driver_nl80211_sta_set_flags(void *priv, const u8 *addr,
|
||||||
if_nametoindex(drv->ifname));
|
if_nametoindex(drv->ifname));
|
||||||
NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, addr);
|
NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, addr);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Backwards compatibility version using NL80211_ATTR_STA_FLAGS. This
|
||||||
|
* can be removed eventually.
|
||||||
|
*/
|
||||||
if (total_flags & WLAN_STA_AUTHORIZED)
|
if (total_flags & WLAN_STA_AUTHORIZED)
|
||||||
NLA_PUT_FLAG(flags, NL80211_STA_FLAG_AUTHORIZED);
|
NLA_PUT_FLAG(flags, NL80211_STA_FLAG_AUTHORIZED);
|
||||||
|
|
||||||
|
@ -3027,6 +3049,11 @@ static int wpa_driver_nl80211_sta_set_flags(void *priv, const u8 *addr,
|
||||||
if (nla_put_nested(msg, NL80211_ATTR_STA_FLAGS, flags))
|
if (nla_put_nested(msg, NL80211_ATTR_STA_FLAGS, flags))
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
|
|
||||||
|
os_memset(&upd, 0, sizeof(upd));
|
||||||
|
upd.mask = sta_flags_nl80211(flags_or | ~flags_and);
|
||||||
|
upd.set = sta_flags_nl80211(flags_or);
|
||||||
|
NLA_PUT(msg, NL80211_ATTR_STA_FLAGS2, sizeof(upd), &upd);
|
||||||
|
|
||||||
nlmsg_free(flags);
|
nlmsg_free(flags);
|
||||||
|
|
||||||
return send_and_recv_msgs(drv, msg, NULL, NULL);
|
return send_and_recv_msgs(drv, msg, NULL, NULL);
|
||||||
|
|
Loading…
Reference in a new issue