[PATCH] don't bring the interface down if WoWLAN is enabled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 src/drivers/driver.h            |  7 +++++++
 src/drivers/driver_nl80211.c    | 38 ++++++++++++++++++++++++++++++++++++++
 wpa_supplicant/wpa_supplicant.c |  7 ++++++-
 3 files changed, 51 insertions(+), 1 deletion(-)

diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index fc2593e..4c54987 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -3164,6 +3164,13 @@ struct wpa_driver_ops {
 				unsigned int val);
 
 	/**
+	 * get_wowlan - Get wake-on-wireless status
+	 * @priv: Private driver interface data
+	 * Returns: 1 if enabled, 0 if not
+	 */
+	int (*get_wowlan)(void *priv);
+
+	/**
 	 * set_wowlan - Set wake-on-wireless triggers
 	 * @priv: Private driver interface data
 	 * @triggers: wowlan triggers
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index bceeba2..fafbf2c 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -8613,6 +8613,43 @@ static int nl80211_set_qos_map(void *priv, const u8 *qos_map_set,
 }
 
 
+static int get_wowlan_handler(struct nl_msg *msg, void *arg)
+{
+	struct nlattr *tb[NL80211_ATTR_MAX + 1];
+	struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
+	int *wowlan_enabled = arg;
+
+	nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
+		  genlmsg_attrlen(gnlh, 0), NULL);
+
+	*wowlan_enabled = !!tb[NL80211_ATTR_WOWLAN_TRIGGERS];
+
+	return NL_SKIP;
+}
+
+
+static int nl80211_get_wowlan(void *priv)
+{
+	struct i802_bss *bss = priv;
+	struct wpa_driver_nl80211_data *drv = bss->drv;
+	struct nl_msg *msg;
+	int wowlan_enabled;
+
+	wpa_printf(MSG_DEBUG, "nl80211: Querying wowlan setting");
+
+	msg = nl80211_drv_msg(drv, 0, NL80211_CMD_GET_WOWLAN);
+
+	if (!send_and_recv_msgs(drv, msg, get_wowlan_handler, &wowlan_enabled)) {
+		wpa_printf(MSG_DEBUG, "WoWLAN is %s", wowlan_enabled ? "enabled" : "disabled");
+		if (wowlan_enabled)
+			return 1;
+	} else
+		wpa_printf(MSG_DEBUG, "nl80211: wowlan query failed");
+
+	return 0;
+}
+
+
 static int nl80211_set_wowlan(void *priv,
 			      const struct wowlan_triggers *triggers)
 {
@@ -10075,6 +10112,7 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
 #endif /* ANDROID */
 	.vendor_cmd = nl80211_vendor_cmd,
 	.set_qos_map = nl80211_set_qos_map,
+	.get_wowlan = nl80211_get_wowlan,
 	.set_wowlan = nl80211_set_wowlan,
 	.set_mac_addr = nl80211_set_mac_addr,
 #ifdef CONFIG_MESH
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index e65441d..da06200 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -5386,7 +5386,12 @@ int wpa_supplicant_remove_iface(struct wpa_global *global,
 		global->p2p_group_formation = NULL;
 	if (global->p2p_invite_group == wpa_s)
 		global->p2p_invite_group = NULL;
-	wpa_supplicant_deinit_iface(wpa_s, 1, terminate);
+
+	/* Don't bring the interface down if WoWLAN is enabled */
+	if (wpa_s->driver->get_wowlan && !wpa_s->driver->get_wowlan(wpa_s->drv_priv))
+		wpa_supplicant_deinit_iface(wpa_s, 1, terminate);
+	else
+		wpa_dbg(wpa_s, MSG_INFO, "Leaving up as WoWLAN is enabled");
 
 #ifdef CONFIG_MESH
 	if (mesh_if_created) {
-- 
2.9.3


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux