-static int i802_sta_set_flags(void *priv, const u8 *addr,
- int total_flags, int flags_or, int flags_and)
-{
- struct wpa_driver_nl80211_data *drv = priv;
- struct nl_msg *msg, *flags = NULL;
-
- msg = nlmsg_alloc();
- if (!msg)
- return -ENOMEM;
-
- flags = nlmsg_alloc();
- if (!flags) {
- nlmsg_free(msg);
- return -ENOMEM;
- }
-
- genlmsg_put(msg, 0, 0, genl_family_get_id(drv->nl80211), 0,
- 0, NL80211_CMD_SET_STATION, 0);
-
- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX,
- if_nametoindex(drv->ifname));
- NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, addr);
-
- if (total_flags & WLAN_STA_AUTHORIZED)
- NLA_PUT_FLAG(flags, NL80211_STA_FLAG_AUTHORIZED);
-
- if (total_flags & WLAN_STA_WMM)
- NLA_PUT_FLAG(flags, NL80211_STA_FLAG_WME);
-
- if (total_flags & WLAN_STA_SHORT_PREAMBLE)
- NLA_PUT_FLAG(flags, NL80211_STA_FLAG_SHORT_PREAMBLE);
-
- if (total_flags & WLAN_STA_MFP)
- NLA_PUT_FLAG(flags, NL80211_STA_FLAG_MFP);
-
- if (nla_put_nested(msg, NL80211_ATTR_STA_FLAGS, flags))
- goto nla_put_failure;
-
- nlmsg_free(flags);
-
- return send_and_recv_msgs(drv, msg, NULL, NULL);
- nla_put_failure:
- nlmsg_free(flags);
- return -ENOBUFS;
-}
-
-