Patchwork P2P: fix P2P Device handling when starting with RF-kill blocked.

login
register
mail settings
Submitter Ilan Peer
Date March 3, 2014, 12:53 p.m.
Message ID <1393851204-964-5-git-send-email-ilan.peer@intel.com>
Download mbox | patch
Permalink /patch/325808/
State Accepted
Headers show

Comments

Ilan Peer - March 3, 2014, 12:53 p.m.
From: Moshe Benji <Moshe.Benji@intel.com>

On RF-kill, we should not request the kernel to start a P2P device.

In addition, we should call i802_set_iface_flags() both for a P2P
interface and any other interface instead of calling a dedicated
function for each.

Signed-off-by: Moshe Benji <Moshe.Benji@intel.com>
---
 src/drivers/driver_nl80211.c |   29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)
Jouni Malinen - March 11, 2014, 7:24 p.m.
On Mon, Mar 03, 2014 at 02:53:21PM +0200, Ilan Peer wrote:
> On RF-kill, we should not request the kernel to start a P2P device.
> 
> In addition, we should call i802_set_iface_flags() both for a P2P
> interface and any other interface instead of calling a dedicated
> function for each.

Thanks, applied.

Patch

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index c509170..6df0a84 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4621,26 +4621,25 @@  wpa_driver_nl80211_finish_drv_init(struct wpa_driver_nl80211_data *drv,
 		return -1;
 	}
 
-	if (nlmode == NL80211_IFTYPE_P2P_DEVICE) {
-		int ret = nl80211_set_p2pdev(bss, 1);
-		if (ret < 0)
-			wpa_printf(MSG_ERROR, "nl80211: Could not start P2P device");
+	if (nlmode == NL80211_IFTYPE_P2P_DEVICE)
 		nl80211_get_macaddr(bss);
-		return ret;
-	}
 
-	if (linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 1)) {
-		if (rfkill_is_blocked(drv->rfkill)) {
-			wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable "
-				   "interface '%s' due to rfkill",
-				   bss->ifname);
-			drv->if_disabled = 1;
-			send_rfkill_event = 1;
-		} else {
+	if (!rfkill_is_blocked(drv->rfkill)) {
+		int ret = i802_set_iface_flags(bss, 1);
+		if (ret) {
 			wpa_printf(MSG_ERROR, "nl80211: Could not set "
 				   "interface '%s' UP", bss->ifname);
-			return -1;
+			return ret;
 		}
+		if (nlmode == NL80211_IFTYPE_P2P_DEVICE)
+			return ret;
+	} else {
+		wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable "
+			   "interface '%s' due to rfkill", bss->ifname);
+		if (nlmode == NL80211_IFTYPE_P2P_DEVICE)
+			return 0;
+		drv->if_disabled = 1;
+		send_rfkill_event = 1;
 	}
 
 	if (!drv->hostapd)