Patchwork nl80211: Driver capability retrieval only once the interface is UP

login
register
mail settings
Submitter Sreenath
Date July 25, 2013, 7:16 a.m.
Message ID <20130725071641.GA7105@sreenath-Precision-M4700>
Download mbox | patch
Permalink /patch/261596/
State Superseded
Headers show

Comments

Sreenath - July 25, 2013, 7:16 a.m.
Retrieve driver capablities only once the interface is UP, similar to the
older approach before P2P_DEVICE integration.

Signed-hostap: Sreenath Sharma <sreenats@broadcom.com>
---
 src/drivers/driver_nl80211.c |   42 ++++++++++++++++++++++--------------------
 1 file changed, 22 insertions(+), 20 deletions(-)

Patch

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 83d4a23..16e66f8 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4011,6 +4011,28 @@  wpa_driver_nl80211_finish_drv_init(struct wpa_driver_nl80211_data *drv)
 	dynamic_if = dynamic_if || drv->global->if_add_wdevid_set;
 	drv->global->if_add_wdevid_set = 0;
 
+	if (dynamic_if)
+		nlmode = nl80211_get_ifmode(bss);
+
+	if (nlmode != NL80211_IFTYPE_P2P_DEVICE) {
+		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 {
+				wpa_printf(MSG_ERROR, "nl80211: Could not set "
+					   "interface '%s' UP", bss->ifname);
+				return -1;
+			}
+		}
+
+		netlink_send_oper_ifla(drv->global->netlink, drv->ifindex,
+					       1, IF_OPER_DORMANT);
+	}
+
 	if (wpa_driver_nl80211_capa(drv))
 		return -1;
 
@@ -4018,9 +4040,6 @@  wpa_driver_nl80211_finish_drv_init(struct wpa_driver_nl80211_data *drv)
 		   bss->ifname, drv->phyname);
 
 #ifndef HOSTAPD
-	if (dynamic_if)
-		nlmode = nl80211_get_ifmode(bss);
-
 	/*
 	 * Make sure the interface starts up in station mode unless this is a
 	 * dynamically added interface (e.g., P2P) that was already configured
@@ -4039,23 +4058,6 @@  wpa_driver_nl80211_finish_drv_init(struct wpa_driver_nl80211_data *drv)
 		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 {
-			wpa_printf(MSG_ERROR, "nl80211: Could not set "
-				   "interface '%s' UP", bss->ifname);
-			return -1;
-		}
-	}
-
-	netlink_send_oper_ifla(drv->global->netlink, drv->ifindex,
-			       1, IF_OPER_DORMANT);
 #endif /* HOSTAPD */
 
 	if (linux_get_ifhwaddr(drv->global->ioctl_sock, bss->ifname,