mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2025-01-17 18:34:03 -05:00
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:
parent
0ef023e478
commit
0800f9ee6c
@ -32,6 +32,13 @@ enum qca_radiotap_vendor_ids {
|
|||||||
*
|
*
|
||||||
* @QCA_NL80211_VENDOR_SUBCMD_TEST: Test command/event
|
* @QCA_NL80211_VENDOR_SUBCMD_TEST: Test command/event
|
||||||
*
|
*
|
||||||
|
* @QCA_NL80211_VENDOR_SUBCMD_ROAMING: Set roaming policy for drivers that use
|
||||||
|
* internal BSS-selection. This command uses
|
||||||
|
* @QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY to specify the new roaming policy
|
||||||
|
* for the current connection (i.e., changes policy set by the nl80211
|
||||||
|
* Connect command). @QCA_WLAN_VENDOR_ATTR_MAC_ADDR may optionally be
|
||||||
|
* included to indicate which BSS to use in case roaming is disabled.
|
||||||
|
*
|
||||||
* @QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY: Recommendation of frequency
|
* @QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY: Recommendation of frequency
|
||||||
* ranges to avoid to reduce issues due to interference or internal
|
* ranges to avoid to reduce issues due to interference or internal
|
||||||
* co-existence information in the driver. The event data structure is
|
* co-existence information in the driver. The event data structure is
|
||||||
@ -47,7 +54,8 @@ enum qca_radiotap_vendor_ids {
|
|||||||
enum qca_nl80211_vendor_subcmds {
|
enum qca_nl80211_vendor_subcmds {
|
||||||
QCA_NL80211_VENDOR_SUBCMD_UNSPEC = 0,
|
QCA_NL80211_VENDOR_SUBCMD_UNSPEC = 0,
|
||||||
QCA_NL80211_VENDOR_SUBCMD_TEST = 1,
|
QCA_NL80211_VENDOR_SUBCMD_TEST = 1,
|
||||||
/* subcmds 2..9 not yet allocated */
|
/* subcmds 2..8 not yet allocated */
|
||||||
|
QCA_NL80211_VENDOR_SUBCMD_ROAMING = 9,
|
||||||
QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY = 10,
|
QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY = 10,
|
||||||
QCA_NL80211_VENDOR_SUBCMD_DFS_CAPABILITY = 11,
|
QCA_NL80211_VENDOR_SUBCMD_DFS_CAPABILITY = 11,
|
||||||
QCA_NL80211_VENDOR_SUBCMD_NAN = 12,
|
QCA_NL80211_VENDOR_SUBCMD_NAN = 12,
|
||||||
@ -66,9 +74,19 @@ enum qca_wlan_vendor_attr {
|
|||||||
QCA_WLAN_VENDOR_ATTR_STATS_EXT = 3,
|
QCA_WLAN_VENDOR_ATTR_STATS_EXT = 3,
|
||||||
/* used by QCA_NL80211_VENDOR_SUBCMD_STATS_EXT */
|
/* used by QCA_NL80211_VENDOR_SUBCMD_STATS_EXT */
|
||||||
QCA_WLAN_VENDOR_ATTR_IFINDEX = 4,
|
QCA_WLAN_VENDOR_ATTR_IFINDEX = 4,
|
||||||
|
/* used by QCA_NL80211_VENDOR_SUBCMD_ROAMING, u32 with values defined
|
||||||
|
* by enum qca_roaming_policy. */
|
||||||
|
QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY = 5,
|
||||||
|
QCA_WLAN_VENDOR_ATTR_MAC_ADDR = 6,
|
||||||
/* keep last */
|
/* keep last */
|
||||||
QCA_WLAN_VENDOR_ATTR_AFTER_LAST,
|
QCA_WLAN_VENDOR_ATTR_AFTER_LAST,
|
||||||
QCA_WLAN_VENDOR_ATTR_MAX = QCA_WLAN_VENDOR_ATTR_AFTER_LAST - 1,
|
QCA_WLAN_VENDOR_ATTR_MAX = QCA_WLAN_VENDOR_ATTR_AFTER_LAST - 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
enum qca_roaming_policy {
|
||||||
|
QCA_ROAMING_NOT_ALLOWED,
|
||||||
|
QCA_ROAMING_ALLOWED_WITHIN_ESS,
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* QCA_VENDOR_H */
|
#endif /* QCA_VENDOR_H */
|
||||||
|
@ -307,6 +307,7 @@ struct wpa_driver_nl80211_data {
|
|||||||
unsigned int start_iface_up:1;
|
unsigned int start_iface_up:1;
|
||||||
unsigned int test_use_roc_tx:1;
|
unsigned int test_use_roc_tx:1;
|
||||||
unsigned int ignore_deauth_event:1;
|
unsigned int ignore_deauth_event:1;
|
||||||
|
unsigned int roaming_vendor_cmd_avail:1;
|
||||||
unsigned int dfs_vendor_cmd_avail:1;
|
unsigned int dfs_vendor_cmd_avail:1;
|
||||||
unsigned int have_low_prio_scan:1;
|
unsigned int have_low_prio_scan:1;
|
||||||
|
|
||||||
@ -3869,9 +3870,14 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
vinfo = nla_data(nl);
|
vinfo = nla_data(nl);
|
||||||
if (vinfo->subcmd ==
|
switch (vinfo->subcmd) {
|
||||||
QCA_NL80211_VENDOR_SUBCMD_DFS_CAPABILITY)
|
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;
|
drv->dfs_vendor_cmd_avail = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
wpa_printf(MSG_DEBUG, "nl80211: Supported vendor command: vendor_id=0x%x subcmd=%u",
|
wpa_printf(MSG_DEBUG, "nl80211: Supported vendor command: vendor_id=0x%x subcmd=%u",
|
||||||
vinfo->vendor_id, vinfo->subcmd);
|
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 = {
|
const struct wpa_driver_ops wpa_driver_nl80211_ops = {
|
||||||
.name = "nl80211",
|
.name = "nl80211",
|
||||||
.desc = "Linux nl80211/cfg80211",
|
.desc = "Linux nl80211/cfg80211",
|
||||||
@ -12471,4 +12521,5 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
|
|||||||
.vendor_cmd = nl80211_vendor_cmd,
|
.vendor_cmd = nl80211_vendor_cmd,
|
||||||
.set_qos_map = nl80211_set_qos_map,
|
.set_qos_map = nl80211_set_qos_map,
|
||||||
.set_wowlan = nl80211_set_wowlan,
|
.set_wowlan = nl80211_set_wowlan,
|
||||||
|
.roaming = nl80211_roaming,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user