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

Sreenath Sharma sreenats
Mon Aug 5 23:42:58 PDT 2013


The main intention of this patch is to retrieve driver capabilities only
once the interface is UP, similar to the older approach before P2P_DEVICE
integration. This approach will help devices which can retrieve the
capabilities from firmware only once the interface is UP.

v3: Applied v2 changes on top of v1
v2: Fixed hostapd compilation issue

Please discard v2 and v1 patches.

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

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index e674d9d..06e5b4f 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4011,6 +4011,30 @@ 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;
 
+#ifndef HOSTAPD
+	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);
+	}
+#endif /* HOSTAPD */
+
 	if (wpa_driver_nl80211_capa(drv))
 		return -1;
 
@@ -4018,9 +4042,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 +4060,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