aboutsummaryrefslogtreecommitdiffstats
path: root/src/drivers
diff options
context:
space:
mode:
authorEliad Peller <eliad@wizery.com>2012-07-30 00:13:06 +0300
committerArik Nemtsov <arik@wizery.com>2012-08-02 13:03:07 +0300
commit7a7697575823dddb81482414c8d77d0e74507a9c (patch)
tree32f9fff89cccd11c9df4afb980b798974f4933a0 /src/drivers
parentdb520b6dcea24d031a7f8ab15c582d5c8393673f (diff)
downloadexternal_wpa_supplicant_8_ti-7a7697575823dddb81482414c8d77d0e74507a9c.zip
external_wpa_supplicant_8_ti-7a7697575823dddb81482414c8d77d0e74507a9c.tar.gz
external_wpa_supplicant_8_ti-7a7697575823dddb81482414c8d77d0e74507a9c.tar.bz2
add set/cancel_priority calls
implement set_priority/cancel_priority functions, and call them in the appropriate places in the STA connection flow. Signed-off-by: Eliad Peller <eliad@wizery.com>
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/driver.h3
-rw-r--r--src/drivers/driver_nl80211.c68
2 files changed, 71 insertions, 0 deletions
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 3933165..5fef4d0 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -2046,6 +2046,9 @@ struct wpa_driver_ops {
*/
int (*cancel_remain_on_channel)(void *priv);
+ int (*set_priority)(void *priv);
+ int (*cancel_priority)(void *priv);
+
/**
* probe_req_report - Request Probe Request frames to be indicated
* @priv: Private driver interface data
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index a06f6f1..93dbec4 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -237,6 +237,7 @@ struct wpa_driver_nl80211_data {
unsigned int disabled_11b_rates:1;
unsigned int pending_remain_on_chan:1;
+ unsigned int pending_priority:1;
unsigned int in_interface_list:1;
unsigned int device_ap_sme:1;
unsigned int poll_command_supported:1;
@@ -8306,6 +8307,71 @@ nla_put_failure:
return -1;
}
+static int wpa_driver_nl80211_set_priority(void *priv)
+{
+ struct i802_bss *bss = priv;
+ struct wpa_driver_nl80211_data *drv = bss->drv;
+ struct nl_msg *msg;
+ int ret;
+
+ msg = nlmsg_alloc();
+ if (!msg)
+ return -1;
+
+ nl80211_cmd(drv, msg, 0, NL80211_CMD_SET_PRIORITY);
+
+ NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex);
+
+ ret = send_and_recv_msgs(drv, msg, NULL, NULL);
+ msg = NULL;
+ if (ret == 0) {
+ wpa_printf(MSG_DEBUG, "nl80211: set priority");
+ drv->pending_priority = 1;
+ return 0;
+ }
+ wpa_printf(MSG_DEBUG, "nl80211: Failed to set priority: %d (%s)",
+ ret, strerror(-ret));
+nla_put_failure:
+ nlmsg_free(msg);
+ return -1;
+}
+
+static int wpa_driver_nl80211_cancel_priority(void *priv)
+{
+ struct i802_bss *bss = priv;
+ struct wpa_driver_nl80211_data *drv = bss->drv;
+ struct nl_msg *msg;
+ int ret;
+
+ if (!drv->pending_priority) {
+ wpa_printf(MSG_DEBUG, "nl80211: No pending priority "
+ "to cancel");
+ return -1;
+ }
+
+ wpa_printf(MSG_DEBUG, "nl80211: Cancel priority");
+
+ msg = nlmsg_alloc();
+ if (!msg)
+ return -1;
+
+ nl80211_cmd(drv, msg, 0, NL80211_CMD_CANCEL_PRIORITY);
+
+ NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex);
+
+ ret = send_and_recv_msgs(drv, msg, NULL, NULL);
+ msg = NULL;
+ if (ret == 0) {
+ drv->pending_remain_on_chan = 0;
+ return 0;
+ }
+ wpa_printf(MSG_DEBUG, "nl80211: Failed to cancel priority: %d (%s)",
+ ret, strerror(-ret));
+nla_put_failure:
+ nlmsg_free(msg);
+ return -1;
+}
+
static int wpa_driver_nl80211_probe_req_report(void *priv, int report)
{
@@ -9158,6 +9224,8 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.remain_on_channel = wpa_driver_nl80211_remain_on_channel,
.cancel_remain_on_channel =
wpa_driver_nl80211_cancel_remain_on_channel,
+ .set_priority = wpa_driver_nl80211_set_priority,
+ .cancel_priority = wpa_driver_nl80211_cancel_priority,
.probe_req_report = wpa_driver_nl80211_probe_req_report,
.deinit_ap = wpa_driver_nl80211_deinit_ap,
.deinit_p2p_cli = wpa_driver_nl80211_deinit_p2p_cli,