[PATCH] nl80211: Driver capability retrieval only once the interface is UP

Sreenath Sharma sreenats
Thu Jul 25 00:16:41 PDT 2013


Retrieve driver capablities only once the interface is UP, similar to the
older approach before P2P_DEVICE integration.

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

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,
-- 
1.7.9.5





More information about the Hostap mailing list