nl80211: Add roaming policy update using QCA vendor command

This allows updating roaming policy for drivers that select the BSS
internally so that wpa_supplicant (based on bssid parameter
configuration) and the driver remain in sync.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2014-09-11 15:54:57 +03:00 committed by Jouni Malinen
parent 0ef023e478
commit 0800f9ee6c
2 changed files with 72 additions and 3 deletions

View file

@ -307,6 +307,7 @@ struct wpa_driver_nl80211_data {
unsigned int start_iface_up:1;
unsigned int test_use_roc_tx:1;
unsigned int ignore_deauth_event:1;
unsigned int roaming_vendor_cmd_avail:1;
unsigned int dfs_vendor_cmd_avail:1;
unsigned int have_low_prio_scan:1;
@ -3869,9 +3870,14 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
continue;
}
vinfo = nla_data(nl);
if (vinfo->subcmd ==
QCA_NL80211_VENDOR_SUBCMD_DFS_CAPABILITY)
switch (vinfo->subcmd) {
case QCA_NL80211_VENDOR_SUBCMD_ROAMING:
drv->roaming_vendor_cmd_avail = 1;
break;
case QCA_NL80211_VENDOR_SUBCMD_DFS_CAPABILITY:
drv->dfs_vendor_cmd_avail = 1;
break;
}
wpa_printf(MSG_DEBUG, "nl80211: Supported vendor command: vendor_id=0x%x subcmd=%u",
vinfo->vendor_id, vinfo->subcmd);
@ -12380,6 +12386,50 @@ nla_put_failure:
}
static int nl80211_roaming(void *priv, int allowed, const u8 *bssid)
{
struct i802_bss *bss = priv;
struct wpa_driver_nl80211_data *drv = bss->drv;
struct nl_msg *msg;
struct nlattr *params;
wpa_printf(MSG_DEBUG, "nl80211: Roaming policy: allowed=%d", allowed);
if (!drv->roaming_vendor_cmd_avail) {
wpa_printf(MSG_DEBUG,
"nl80211: Ignore roaming policy change since driver does not provide command for setting it");
return -1;
}
msg = nlmsg_alloc();
if (!msg)
return -ENOMEM;
nl80211_cmd(drv, msg, 0, NL80211_CMD_VENDOR);
NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex);
NLA_PUT_U32(msg, NL80211_ATTR_VENDOR_ID, OUI_QCA);
NLA_PUT_U32(msg, NL80211_ATTR_VENDOR_SUBCMD,
QCA_NL80211_VENDOR_SUBCMD_ROAMING);
params = nla_nest_start(msg, NL80211_ATTR_VENDOR_DATA);
if (!params)
goto nla_put_failure;
NLA_PUT_U32(msg, QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY,
allowed ? QCA_ROAMING_ALLOWED_WITHIN_ESS :
QCA_ROAMING_NOT_ALLOWED);
if (bssid)
NLA_PUT(msg, QCA_WLAN_VENDOR_ATTR_MAC_ADDR, ETH_ALEN, bssid);
nla_nest_end(msg, params);
return send_and_recv_msgs(drv, msg, NULL, NULL);
nla_put_failure:
nlmsg_free(msg);
return -1;
}
const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.name = "nl80211",
.desc = "Linux nl80211/cfg80211",
@ -12471,4 +12521,5 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.vendor_cmd = nl80211_vendor_cmd,
.set_qos_map = nl80211_set_qos_map,
.set_wowlan = nl80211_set_wowlan,
.roaming = nl80211_roaming,
};