[RFC 1/3] driver: use separate field for P2P capability flags

Arend van Spriel arend
Sat Jan 12 08:28:17 PST 2013


The number of driver flags seems to be steadily increasing so it
might be a good idea to make some room separating the P2P specific
capability flags.

Cc: David Spinadel <david.spinadel at intel.com>
Cc: Johannes Berg <johannes at sipsolutions.net>
Cc: Greg Goldman <ggoldman at broadcom.com>
Signed-hostap: Arend van Spriel <arend at broadcom.com>
---
 src/drivers/driver.h                    |   62 ++++++++++++++++---------------
 src/drivers/driver_nl80211.c            |    8 ++--
 src/drivers/driver_test.c               |    8 ++--
 wpa_supplicant/dbus/dbus_new_handlers.c |    2 +-
 wpa_supplicant/p2p_supplicant.c         |   58 ++++++++++++++---------------
 wpa_supplicant/wpa_supplicant.c         |    3 +-
 wpa_supplicant/wpa_supplicant_i.h       |    1 +
 7 files changed, 73 insertions(+), 69 deletions(-)

diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 7ee71aa..4a9db01 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -793,57 +793,59 @@ struct wpa_driver_capa {
 #define WPA_DRIVER_FLAGS_AP		0x00000040
 /* Driver needs static WEP key setup after association has been completed */
 #define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE	0x00000080
-/* Driver takes care of P2P management operations */
-#define WPA_DRIVER_FLAGS_P2P_MGMT	0x00000100
-/* Driver supports concurrent P2P operations */
-#define WPA_DRIVER_FLAGS_P2P_CONCURRENT	0x00000200
-/*
- * Driver uses the initial interface as a dedicated management interface, i.e.,
- * it cannot be used for P2P group operations or non-P2P purposes.
- */
-#define WPA_DRIVER_FLAGS_P2P_DEDICATED_INTERFACE	0x00000400
 /* This interface is P2P capable (P2P Device, GO, or P2P Client */
-#define WPA_DRIVER_FLAGS_P2P_CAPABLE	0x00000800
+#define WPA_DRIVER_FLAGS_P2P_CAPABLE	0x00000100
 /* Driver supports concurrent operations on multiple channels */
-#define WPA_DRIVER_FLAGS_MULTI_CHANNEL_CONCURRENT	0x00001000
-/*
- * Driver uses the initial interface for P2P management interface and non-P2P
- * purposes (e.g., connect to infra AP), but this interface cannot be used for
- * P2P group operations.
- */
-#define WPA_DRIVER_FLAGS_P2P_MGMT_AND_NON_P2P		0x00002000
+#define WPA_DRIVER_FLAGS_MULTI_CHANNEL_CONCURRENT	0x00000200
 /*
  * Driver is known to use sane error codes, i.e., when it indicates that
  * something (e.g., association) fails, there was indeed a failure and the
  * operation does not end up getting completed successfully later.
  */
-#define WPA_DRIVER_FLAGS_SANE_ERROR_CODES		0x00004000
+#define WPA_DRIVER_FLAGS_SANE_ERROR_CODES		0x00000400
 /* Driver supports off-channel TX */
-#define WPA_DRIVER_FLAGS_OFFCHANNEL_TX			0x00008000
+#define WPA_DRIVER_FLAGS_OFFCHANNEL_TX			0x00000800
 /* Driver indicates TX status events for EAPOL Data frames */
-#define WPA_DRIVER_FLAGS_EAPOL_TX_STATUS		0x00010000
+#define WPA_DRIVER_FLAGS_EAPOL_TX_STATUS		0x00001000
 /* Driver indicates TX status events for Deauth/Disassoc frames */
-#define WPA_DRIVER_FLAGS_DEAUTH_TX_STATUS		0x00020000
+#define WPA_DRIVER_FLAGS_DEAUTH_TX_STATUS		0x00002000
 /* Driver supports roaming (BSS selection) in firmware */
-#define WPA_DRIVER_FLAGS_BSS_SELECTION			0x00040000
+#define WPA_DRIVER_FLAGS_BSS_SELECTION			0x00004000
 /* Driver supports operating as a TDLS peer */
-#define WPA_DRIVER_FLAGS_TDLS_SUPPORT			0x00080000
+#define WPA_DRIVER_FLAGS_TDLS_SUPPORT			0x00008000
 /* Driver requires external TDLS setup/teardown/discovery */
-#define WPA_DRIVER_FLAGS_TDLS_EXTERNAL_SETUP		0x00100000
+#define WPA_DRIVER_FLAGS_TDLS_EXTERNAL_SETUP		0x00010000
 /* Driver indicates support for Probe Response offloading in AP mode */
-#define WPA_DRIVER_FLAGS_PROBE_RESP_OFFLOAD		0x00200000
+#define WPA_DRIVER_FLAGS_PROBE_RESP_OFFLOAD		0x00020000
 /* Driver supports U-APSD in AP mode */
-#define WPA_DRIVER_FLAGS_AP_UAPSD			0x00400000
+#define WPA_DRIVER_FLAGS_AP_UAPSD			0x00040000
 /* Driver supports inactivity timer in AP mode */
-#define WPA_DRIVER_FLAGS_INACTIVITY_TIMER		0x00800000
+#define WPA_DRIVER_FLAGS_INACTIVITY_TIMER		0x00080000
 /* Driver expects user space implementation of MLME in AP mode */
-#define WPA_DRIVER_FLAGS_AP_MLME			0x01000000
+#define WPA_DRIVER_FLAGS_AP_MLME			0x00100000
 /* Driver supports SAE with user space SME */
-#define WPA_DRIVER_FLAGS_SAE				0x02000000
+#define WPA_DRIVER_FLAGS_SAE				0x00200000
 /* Driver makes use of OBSS scan mechanism in wpa_supplicant */
-#define WPA_DRIVER_FLAGS_OBSS_SCAN			0x04000000
+#define WPA_DRIVER_FLAGS_OBSS_SCAN			0x00400000
 	unsigned int flags;
 
+/* Driver takes care of P2P management operations */
+#define WPA_DRIVER_FLAGS_P2P_MGMT	0x00000001
+/* Driver supports concurrent P2P operations */
+#define WPA_DRIVER_FLAGS_P2P_CONCURRENT	0x00000002
+/*
+ * Driver uses the initial interface as a dedicated management interface, i.e.,
+ * it cannot be used for P2P group operations or non-P2P purposes.
+ */
+#define WPA_DRIVER_FLAGS_P2P_DEDICATED_INTERFACE	0x00000004
+/*
+ * Driver uses the initial interface for P2P management interface and non-P2P
+ * purposes (e.g., connect to infra AP), but this interface cannot be used for
+ * P2P group operations.
+ */
+#define WPA_DRIVER_FLAGS_P2P_MGMT_AND_NON_P2P		0x00000008
+	unsigned int p2p_flags;
+
 	int max_scan_ssids;
 	int max_sched_scan_ssids;
 	int sched_scan_supported;
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 37b6be9..5275185 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -2636,8 +2636,8 @@ broken_combination:
 	if (p2p_concurrent) {
 		wpa_printf(MSG_DEBUG, "nl80211: Use separate P2P group "
 			   "interface (driver advertised support)");
-		capa->flags |= WPA_DRIVER_FLAGS_P2P_CONCURRENT;
-		capa->flags |= WPA_DRIVER_FLAGS_P2P_MGMT_AND_NON_P2P;
+		capa->p2p_flags |= WPA_DRIVER_FLAGS_P2P_CONCURRENT;
+		capa->p2p_flags |= WPA_DRIVER_FLAGS_P2P_MGMT_AND_NON_P2P;
 
 		if (p2p_multichan_concurrent) {
 			wpa_printf(MSG_DEBUG, "nl80211: Enable multi-channel "
@@ -8736,8 +8736,8 @@ static int nl80211_set_param(void *priv, const char *param)
 
 		wpa_printf(MSG_DEBUG, "nl80211: Use separate P2P group "
 			   "interface");
-		drv->capa.flags |= WPA_DRIVER_FLAGS_P2P_CONCURRENT;
-		drv->capa.flags |= WPA_DRIVER_FLAGS_P2P_MGMT_AND_NON_P2P;
+		drv->capa.p2p_flags |= WPA_DRIVER_FLAGS_P2P_CONCURRENT;
+		drv->capa.p2p_flags |= WPA_DRIVER_FLAGS_P2P_MGMT_AND_NON_P2P;
 	}
 #endif /* CONFIG_P2P */
 
diff --git a/src/drivers/driver_test.c b/src/drivers/driver_test.c
index bd65dd8..ffd5939 100644
--- a/src/drivers/driver_test.c
+++ b/src/drivers/driver_test.c
@@ -2481,12 +2481,12 @@ static int wpa_driver_test_get_capa(void *priv, struct wpa_driver_capa *capa)
 	capa->auth = WPA_DRIVER_AUTH_OPEN |
 		WPA_DRIVER_AUTH_SHARED |
 		WPA_DRIVER_AUTH_LEAP;
-	if (drv->p2p)
-		capa->flags |= WPA_DRIVER_FLAGS_P2P_MGMT;
 	capa->flags |= WPA_DRIVER_FLAGS_AP;
-	capa->flags |= WPA_DRIVER_FLAGS_P2P_CONCURRENT;
-	capa->flags |= WPA_DRIVER_FLAGS_P2P_DEDICATED_INTERFACE;
 	capa->flags |= WPA_DRIVER_FLAGS_P2P_CAPABLE;
+	if (drv->p2p)
+		capa->p2p_flags |= WPA_DRIVER_FLAGS_P2P_MGMT;
+	capa->p2p_flags |= WPA_DRIVER_FLAGS_P2P_CONCURRENT;
+	capa->p2p_flags |= WPA_DRIVER_FLAGS_P2P_DEDICATED_INTERFACE;
 	capa->max_scan_ssids = 2;
 	capa->max_remain_on_chan = 60000;
 
diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c b/wpa_supplicant/dbus/dbus_new_handlers.c
index 5e06932..20f1ffc 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers.c
+++ b/wpa_supplicant/dbus/dbus_new_handlers.c
@@ -2233,7 +2233,7 @@ dbus_bool_t wpas_dbus_getter_capabilities(DBusMessageIter *iter,
 				goto nomem;
 		}
 
-		if (capa.flags & (WPA_DRIVER_FLAGS_P2P_CAPABLE)) {
+		if (capa.p2p_flags & (WPA_DRIVER_FLAGS_P2P_CAPABLE)) {
 			if (!wpa_dbus_dict_string_array_add_element(
 				    &iter_array, "p2p"))
 				goto nomem;
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index 0a09b00..6b22e12 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -701,7 +701,7 @@ static void wpas_p2p_send_action_tx_status(struct wpa_supplicant *wpa_s,
 
 	if (wpa_s->global->p2p == NULL || wpa_s->global->p2p_disabled)
 		return;
-	if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
+	if (wpa_s->drv_p2p_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
 		return;
 
 	switch (result) {
@@ -1068,7 +1068,7 @@ static void wpas_p2p_group_formation_timeout(void *eloop_ctx,
 	wpa_printf(MSG_DEBUG, "P2P: Group Formation timed out");
 	if (wpa_s->global->p2p)
 		p2p_group_formation_failed(wpa_s->global->p2p);
-	else if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
+	else if (wpa_s->drv_p2p_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
 		wpa_drv_p2p_group_formation_failed(wpa_s);
 	wpas_group_formation_completed(wpa_s, 0);
 }
@@ -1923,7 +1923,7 @@ void wpas_sd_response(void *ctx, const u8 *sa, u16 update_indic,
 u64 wpas_p2p_sd_request(struct wpa_supplicant *wpa_s, const u8 *dst,
 			const struct wpabuf *tlvs)
 {
-	if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
+	if (wpa_s->drv_p2p_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
 		return wpa_drv_p2p_sd_request(wpa_s, dst, tlvs);
 	if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL)
 		return 0;
@@ -2035,7 +2035,7 @@ u64 wpas_p2p_sd_request_wifi_display(struct wpa_supplicant *wpa_s,
 
 int wpas_p2p_sd_cancel_request(struct wpa_supplicant *wpa_s, u64 req)
 {
-	if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
+	if (wpa_s->drv_p2p_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
 		return wpa_drv_p2p_sd_cancel_request(wpa_s, req);
 	if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL)
 		return -1;
@@ -2048,7 +2048,7 @@ void wpas_p2p_sd_response(struct wpa_supplicant *wpa_s, int freq,
 			  const u8 *dst, u8 dialog_token,
 			  const struct wpabuf *resp_tlvs)
 {
-	if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT) {
+	if (wpa_s->drv_p2p_flags & WPA_DRIVER_FLAGS_P2P_MGMT) {
 		wpa_drv_p2p_sd_response(wpa_s, freq, dst, dialog_token,
 					resp_tlvs);
 		return;
@@ -2062,7 +2062,7 @@ void wpas_p2p_sd_response(struct wpa_supplicant *wpa_s, int freq,
 
 void wpas_p2p_sd_service_update(struct wpa_supplicant *wpa_s)
 {
-	if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT) {
+	if (wpa_s->drv_p2p_flags & WPA_DRIVER_FLAGS_P2P_MGMT) {
 		wpa_drv_p2p_service_update(wpa_s);
 		return;
 	}
@@ -2819,7 +2819,7 @@ int wpas_p2p_init(struct wpa_global *global, struct wpa_supplicant *wpa_s)
 	if (global->p2p)
 		return 0;
 
-	if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT) {
+	if (wpa_s->drv_p2p_flags & WPA_DRIVER_FLAGS_P2P_MGMT) {
 		struct p2p_params params;
 
 		wpa_printf(MSG_DEBUG, "P2P: Use driver-based P2P management");
@@ -2928,7 +2928,7 @@ int wpas_p2p_init(struct wpa_global *global, struct wpa_supplicant *wpa_s)
 	os_memcpy(p2p.sec_dev_type, wpa_s->conf->sec_device_type,
 		  p2p.num_sec_dev_types * WPS_DEV_TYPE_LEN);
 
-	p2p.concurrent_operations = !!(wpa_s->drv_flags &
+	p2p.concurrent_operations = !!(wpa_s->drv_p2p_flags &
 				       WPA_DRIVER_FLAGS_P2P_CONCURRENT);
 
 	p2p.max_peers = 100;
@@ -3046,12 +3046,12 @@ static int wpas_p2p_create_iface(struct wpa_supplicant *wpa_s)
 {
 	if (wpa_s->conf->p2p_no_group_iface)
 		return 0; /* separate interface disabled per configuration */
-	if (wpa_s->drv_flags &
+	if (wpa_s->drv_p2p_flags &
 	    (WPA_DRIVER_FLAGS_P2P_DEDICATED_INTERFACE |
 	     WPA_DRIVER_FLAGS_P2P_MGMT_AND_NON_P2P))
 		return 1; /* P2P group requires a new interface in every case
 			   */
-	if (!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_CONCURRENT))
+	if (!(wpa_s->drv_p2p_flags & WPA_DRIVER_FLAGS_P2P_CONCURRENT))
 		return 0; /* driver does not support concurrent operations */
 	if (wpa_s->global->ifaces->next)
 		return 1; /* more that one interface already in use */
@@ -3071,7 +3071,7 @@ static int wpas_p2p_start_go_neg(struct wpa_supplicant *wpa_s,
 	if (persistent_group && wpa_s->conf->persistent_reconnect)
 		persistent_group = 2;
 
-	if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT) {
+	if (wpa_s->drv_p2p_flags & WPA_DRIVER_FLAGS_P2P_MGMT) {
 		return wpa_drv_p2p_connect(wpa_s, peer_addr, wps_method,
 					   go_intent, own_interface_addr,
 					   force_freq, persistent_group);
@@ -3102,7 +3102,7 @@ static int wpas_p2p_auth_go_neg(struct wpa_supplicant *wpa_s,
 	if (persistent_group && wpa_s->conf->persistent_reconnect)
 		persistent_group = 2;
 
-	if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
+	if (wpa_s->drv_p2p_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
 		return -1;
 
 	return p2p_authorize(wpa_s->global->p2p, peer_addr, wps_method,
@@ -3753,7 +3753,7 @@ static int wpas_p2p_listen_start(struct wpa_supplicant *wpa_s,
 	if (timeout > wpa_s->max_remain_on_chan)
 		timeout = wpa_s->max_remain_on_chan;
 
-	if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
+	if (wpa_s->drv_p2p_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
 		return wpa_drv_p2p_listen(wpa_s, timeout);
 
 	return p2p_listen(wpa_s->global->p2p, timeout);
@@ -4182,7 +4182,7 @@ struct p2p_group * wpas_p2p_group_init(struct wpa_supplicant *wpa_s,
 	struct p2p_group *group;
 	struct p2p_group_config *cfg;
 
-	if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
+	if (wpa_s->drv_p2p_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
 		return NULL;
 	if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL)
 		return NULL;
@@ -4252,7 +4252,7 @@ void wpas_p2p_wps_success(struct wpa_supplicant *wpa_s, const u8 *peer_addr,
 	}
 	if (wpa_s->global->p2p)
 		p2p_wps_success_cb(wpa_s->global->p2p, peer_addr);
-	else if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
+	else if (wpa_s->drv_p2p_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
 		wpa_drv_wps_success_cb(wpa_s, peer_addr);
 	wpas_group_formation_completed(wpa_s, 1);
 }
@@ -4314,7 +4314,7 @@ int wpas_p2p_prov_disc(struct wpa_supplicant *wpa_s, const u8 *peer_addr,
 		return 0;
 	}
 
-	if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT) {
+	if (wpa_s->drv_p2p_flags & WPA_DRIVER_FLAGS_P2P_MGMT) {
 		return wpa_drv_p2p_prov_disc_req(wpa_s, peer_addr,
 						 config_methods,
 						 use == WPAS_P2P_PD_FOR_JOIN);
@@ -4355,7 +4355,7 @@ int wpas_p2p_find(struct wpa_supplicant *wpa_s, unsigned int timeout,
 	wpas_p2p_clear_pending_action_tx(wpa_s);
 	wpa_s->p2p_long_listen = 0;
 
-	if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
+	if (wpa_s->drv_p2p_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
 		return wpa_drv_p2p_find(wpa_s, timeout, type);
 
 	if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL ||
@@ -4378,7 +4378,7 @@ static int wpas_p2p_stop_find_oper(struct wpa_supplicant *wpa_s)
 	eloop_cancel_timeout(wpas_p2p_join_scan, wpa_s, NULL);
 	wpa_s->global->p2p_cb_on_scan_complete = 0;
 
-	if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT) {
+	if (wpa_s->drv_p2p_flags & WPA_DRIVER_FLAGS_P2P_MGMT) {
 		wpa_drv_p2p_stop_find(wpa_s);
 		return 1;
 	}
@@ -4535,7 +4535,7 @@ int wpas_p2p_reject(struct wpa_supplicant *wpa_s, const u8 *addr)
 {
 	wpa_s->p2p_long_listen = 0;
 
-	if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
+	if (wpa_s->drv_p2p_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
 		return wpa_drv_p2p_reject(wpa_s, addr);
 
 	if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL)
@@ -4579,7 +4579,7 @@ int wpas_p2p_invite(struct wpa_supplicant *wpa_s, const u8 *peer_addr,
 	}
 	wpa_s->pending_invite_ssid_id = ssid->id;
 
-	if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
+	if (wpa_s->drv_p2p_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
 		return wpa_drv_p2p_invite(wpa_s, peer_addr, role, bssid,
 					  ssid->ssid, ssid->ssid_len,
 					  go_dev_addr, 1);
@@ -4644,7 +4644,7 @@ int wpas_p2p_invite_group(struct wpa_supplicant *wpa_s, const char *ifname,
 	}
 	wpa_s->parent->pending_invite_ssid_id = -1;
 
-	if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
+	if (wpa_s->drv_p2p_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
 		return wpa_drv_p2p_invite(wpa_s, peer_addr, role, bssid,
 					  ssid->ssid, ssid->ssid_len,
 					  go_dev_addr, persistent);
@@ -4734,7 +4734,7 @@ done:
 int wpas_p2p_presence_req(struct wpa_supplicant *wpa_s, u32 duration1,
 			  u32 interval1, u32 duration2, u32 interval2)
 {
-	if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
+	if (wpa_s->drv_p2p_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
 		return -1;
 	if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL)
 		return -1;
@@ -4753,7 +4753,7 @@ int wpas_p2p_presence_req(struct wpa_supplicant *wpa_s, u32 duration1,
 int wpas_p2p_ext_listen(struct wpa_supplicant *wpa_s, unsigned int period,
 			unsigned int interval)
 {
-	if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
+	if (wpa_s->drv_p2p_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
 		return -1;
 
 	if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL)
@@ -4857,7 +4857,7 @@ int wpas_p2p_deauth_notif(struct wpa_supplicant *wpa_s, const u8 *bssid,
 {
 	if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL)
 		return 0;
-	if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
+	if (wpa_s->drv_p2p_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
 		return 0;
 
 	if (!locally_generated)
@@ -4886,7 +4886,7 @@ void wpas_p2p_disassoc_notif(struct wpa_supplicant *wpa_s, const u8 *bssid,
 {
 	if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL)
 		return;
-	if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
+	if (wpa_s->drv_p2p_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
 		return;
 
 	if (!locally_generated)
@@ -5032,7 +5032,7 @@ int wpas_p2p_set_cross_connect(struct wpa_supplicant *wpa_s, int enabled)
 {
 	if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL)
 		return -1;
-	if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
+	if (wpa_s->drv_p2p_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
 		return -1;
 
 	wpa_s->global->cross_connection = enabled;
@@ -5139,7 +5139,7 @@ static void wpas_p2p_cross_connect_setup(struct wpa_supplicant *wpa_s)
 	for (iface = wpa_s->global->ifaces; iface; iface = iface->next) {
 		if (iface == wpa_s)
 			continue;
-		if (iface->drv_flags &
+		if (iface->drv_p2p_flags &
 		    WPA_DRIVER_FLAGS_P2P_DEDICATED_INTERFACE)
 			continue;
 		if (iface->drv_flags & WPA_DRIVER_FLAGS_P2P_CAPABLE)
@@ -5296,7 +5296,7 @@ void wpas_p2p_update_best_channels(struct wpa_supplicant *wpa_s,
 				   int freq_24, int freq_5, int freq_overall)
 {
 	struct p2p_data *p2p = wpa_s->global->p2p;
-	if (p2p == NULL || (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT))
+	if (p2p == NULL || (wpa_s->drv_p2p_flags & WPA_DRIVER_FLAGS_P2P_MGMT))
 		return;
 	p2p_set_best_channels(p2p, freq_24, freq_5, freq_overall);
 }
@@ -5307,7 +5307,7 @@ int wpas_p2p_unauthorize(struct wpa_supplicant *wpa_s, const char *addr)
 	u8 peer[ETH_ALEN];
 	struct p2p_data *p2p = wpa_s->global->p2p;
 
-	if (p2p == NULL || (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT))
+	if (p2p == NULL || (wpa_s->drv_p2p_flags & WPA_DRIVER_FLAGS_P2P_MGMT))
 		return -1;
 
 	if (hwaddr_aton(addr, peer))
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 0fb4d0f..204b996 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -2326,7 +2326,7 @@ int wpa_supplicant_update_mac_addr(struct wpa_supplicant *wpa_s)
 		const u8 *addr = wpa_drv_get_mac_addr(wpa_s);
 		if (addr)
 			os_memcpy(wpa_s->own_addr, addr, ETH_ALEN);
-	} else if (!(wpa_s->drv_flags &
+	} else if (!(wpa_s->drv_p2p_flags &
 		     WPA_DRIVER_FLAGS_P2P_DEDICATED_INTERFACE)) {
 		l2_packet_deinit(wpa_s->l2);
 		wpa_s->l2 = l2_packet_init(wpa_s->ifname,
@@ -2893,6 +2893,7 @@ next_driver:
 	if (wpa_drv_get_capa(wpa_s, &capa) == 0) {
 		wpa_s->drv_capa_known = 1;
 		wpa_s->drv_flags = capa.flags;
+		wpa_s->drv_p2p_flags = capa.p2p_flags;
 		wpa_s->drv_enc = capa.enc;
 		wpa_s->probe_resp_offloads = capa.probe_resp_offloads;
 		wpa_s->max_scan_ssids = capa.max_scan_ssids;
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index 544977b..8deb9b7 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -450,6 +450,7 @@ struct wpa_supplicant {
 				  * finding a connection */
 
 	unsigned int drv_flags;
+	unsigned int drv_p2p_flags;
 	unsigned int drv_enc;
 
 	/*
-- 
1.7.10.4





More information about the Hostap mailing list