[PATCH v2 1/1] hostapd: Fix reference to correct driver capability flag

Vinayak Yadawad vinayak.yadawad at broadcom.com
Wed Nov 22 01:19:52 PST 2023


Current change fixes reference to the appropriate driver
capability flags2. Additional debug prints are added for the
purpose of debuggability.

Signed-off-by: Vinayak Yadawad <vinayak.yadawad at broadcom.com>
---
v1->v2: More bug fixes identified
---
 src/ap/drv_callbacks.c          |  2 +-
 src/drivers/driver_nl80211.c    | 24 ++++++++++++++++--------
 wpa_supplicant/events.c         |  2 +-
 wpa_supplicant/wpa_supplicant.c |  2 +-
 4 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c
index e58cb9f52..7c79f0672 100644
--- a/src/ap/drv_callbacks.c
+++ b/src/ap/drv_callbacks.c
@@ -775,7 +775,7 @@ skip_wpa_check:
 
 #ifdef CONFIG_OWE
 	if ((hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_OWE) &&
-	    !(iface->drv_flags & WPA_DRIVER_FLAGS2_OWE_OFFLOAD_AP) &&
+	    !(iface->drv_flags2 & WPA_DRIVER_FLAGS2_OWE_OFFLOAD_AP) &&
 	    wpa_auth_sta_key_mgmt(sta->wpa_sm) == WPA_KEY_MGMT_OWE &&
 	    elems.owe_dh) {
 		u8 *npos;
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index ac63e6405..bce9220de 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -5111,17 +5111,25 @@ static int wpa_driver_nl80211_set_ap(void *priv,
 		goto fail;
 
 	if ((params->key_mgmt_suites & WPA_KEY_MGMT_PSK) &&
-	    (drv->capa.flags & WPA_DRIVER_FLAGS2_4WAY_HANDSHAKE_AP_PSK) &&
-	    params->psk_len &&
-	    nla_put(msg, NL80211_ATTR_PMK, params->psk_len, params->psk))
-		goto fail;
+	    (drv->capa.flags2 & WPA_DRIVER_FLAGS2_4WAY_HANDSHAKE_AP_PSK) &&
+	    params->psk_len) {
+		if (nla_put(msg, NL80211_ATTR_PMK, params->psk_len, params->psk)) {
+			wpa_printf(MSG_ERROR, "nl80211: Setting PSK failed");
+			goto fail;
+		} else
+			wpa_printf(MSG_DEBUG, "nl80211: Setting PSK for offload");
+	}
 
 	if (wpa_key_mgmt_sae(params->key_mgmt_suites) &&
 	    (drv->capa.flags2 & WPA_DRIVER_FLAGS2_SAE_OFFLOAD_AP) &&
-	    params->sae_password &&
-	    nla_put(msg, NL80211_ATTR_SAE_PASSWORD,
-		    os_strlen(params->sae_password), params->sae_password))
-		goto fail;
+	    params->sae_password) {
+		if (nla_put(msg, NL80211_ATTR_SAE_PASSWORD,
+		    os_strlen(params->sae_password), params->sae_password)) {
+			wpa_printf(MSG_ERROR, "nl80211: Setting SAE password failed");
+			goto fail;
+		} else
+			wpa_printf(MSG_DEBUG, "nl80211: SAE password for offload");
+	}
 
 	if (params->key_mgmt_suites & WPA_KEY_MGMT_IEEE8021X_NO_WPA &&
 	    (!params->pairwise_ciphers ||
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 0e5b6c6a8..372d0535e 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -3376,7 +3376,7 @@ static int wpa_supplicant_event_associnfo(struct wpa_supplicant *wpa_s,
 
 #ifdef CONFIG_OWE
 	if (wpa_s->key_mgmt == WPA_KEY_MGMT_OWE &&
-	    !(wpa_s->drv_flags & WPA_DRIVER_FLAGS2_OWE_OFFLOAD_STA) &&
+	    !(wpa_s->drv_flags2 & WPA_DRIVER_FLAGS2_OWE_OFFLOAD_STA) &&
 	    (!bssid_known ||
 	     owe_process_assoc_resp(wpa_s->wpa,
 				    wpa_s->valid_links ?
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index a292f05da..38399d640 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -3617,7 +3617,7 @@ static u8 * wpas_populate_assoc_ies(
 #endif /* CONFIG_TESTING_OPTIONS */
 	if (algs == WPA_AUTH_ALG_OPEN &&
 	    ssid->key_mgmt == WPA_KEY_MGMT_OWE &&
-	    !(wpa_s->drv_flags & WPA_DRIVER_FLAGS2_OWE_OFFLOAD_STA)) {
+	    !(wpa_s->drv_flags2 & WPA_DRIVER_FLAGS2_OWE_OFFLOAD_STA)) {
 		struct wpabuf *owe_ie;
 		u16 group;
 
-- 
2.32.0

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4218 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.infradead.org/pipermail/hostap/attachments/20231122/ce2c2499/attachment.p7s>


More information about the Hostap mailing list