mirror of
				https://github.com/Telecominfraproject/wlan-ap.git
				synced 2025-10-31 02:17:58 +00:00 
			
		
		
		
	hostapd: correctly set the sta->psk_id on 6G band
Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
		| @@ -606,12 +606,13 @@ | |||||||
|  	for (pw = hapd->conf->sae_passwords; pw; pw = pw->next) { |  	for (pw = hapd->conf->sae_passwords; pw; pw = pw->next) { | ||||||
|  		if (!is_broadcast_ether_addr(pw->peer_addr) && |  		if (!is_broadcast_ether_addr(pw->peer_addr) && | ||||||
|  		    os_memcmp(pw->peer_addr, sta->addr, ETH_ALEN) != 0) |  		    os_memcmp(pw->peer_addr, sta->addr, ETH_ALEN) != 0) | ||||||
| @@ -519,6 +525,31 @@ static const char * sae_get_password(str | @@ -519,6 +525,33 @@ static const char * sae_get_password(str | ||||||
|  		pt = hapd->conf->ssid.pt; |  		pt = hapd->conf->ssid.pt; | ||||||
|  	} |  	} | ||||||
|   |   | ||||||
| +use_sta_psk: | +use_sta_psk: | ||||||
| +	if (!password && sta) { | +	if (!password && sta) { | ||||||
|  | +		sta->psk_idx = 0; | ||||||
| +		for (psk = sta->psk; psk; psk = psk->next) { | +		for (psk = sta->psk; psk; psk = psk->next) { | ||||||
| +			if (!psk->is_passphrase) | +			if (!psk->is_passphrase) | ||||||
| +				continue; | +				continue; | ||||||
| @@ -620,6 +621,7 @@ | |||||||
| +			if (!sta->use_sta_psk) | +			if (!sta->use_sta_psk) | ||||||
| +				break; | +				break; | ||||||
| + | + | ||||||
|  | +			sta->psk_idx = 1; | ||||||
| +			if (sta->sae_pt) { | +			if (sta->sae_pt) { | ||||||
| +				pt = sta->sae_pt; | +				pt = sta->sae_pt; | ||||||
| +				break; | +				break; | ||||||
| @@ -638,7 +640,7 @@ | |||||||
|  	if (pw_entry) |  	if (pw_entry) | ||||||
|  		*pw_entry = pw; |  		*pw_entry = pw; | ||||||
|  	if (s_pt) |  	if (s_pt) | ||||||
| @@ -3698,6 +3729,12 @@ static void handle_auth(struct hostapd_d | @@ -3698,6 +3731,12 @@ static void handle_auth(struct hostapd_d | ||||||
|  		goto fail; |  		goto fail; | ||||||
|  	} |  	} | ||||||
|   |   | ||||||
| @@ -686,14 +688,14 @@ | |||||||
|  	char *radius_cui; /* Chargeable-User-Identity from RADIUS */ |  	char *radius_cui; /* Chargeable-User-Identity from RADIUS */ | ||||||
| --- a/src/ap/wpa_auth_glue.c | --- a/src/ap/wpa_auth_glue.c | ||||||
| +++ b/src/ap/wpa_auth_glue.c | +++ b/src/ap/wpa_auth_glue.c | ||||||
| @@ -337,6 +337,7 @@ static const u8 * hostapd_wpa_auth_get_p | @@ -355,6 +355,7 @@ static const u8 * hostapd_wpa_auth_get_p | ||||||
|  	struct sta_info *sta = ap_get_sta(hapd, addr); |  	} | ||||||
|  	const u8 *psk; |  #endif /* CONFIG_SAE */ | ||||||
|   |   | ||||||
| +	sta->psk_idx = 0; | +	sta->psk_idx = 0; | ||||||
|  	if (vlan_id) |  #ifdef CONFIG_OWE | ||||||
|  		*vlan_id = 0; |  	if ((hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_OWE) && | ||||||
|  	if (psk_len) |  	    sta && sta->owe_pmk) { | ||||||
| @@ -381,12 +382,17 @@ static const u8 * hostapd_wpa_auth_get_p | @@ -381,12 +382,17 @@ static const u8 * hostapd_wpa_auth_get_p | ||||||
|  	 * returned psk which should not be returned again. |  	 * returned psk which should not be returned again. | ||||||
|  	 * logic list (all hostapd_get_psk; all sta->psk) |  	 * logic list (all hostapd_get_psk; all sta->psk) | ||||||
|   | |||||||
| @@ -665,12 +665,13 @@ as adding/removing interfaces. | |||||||
|  	for (pw = hapd->conf->sae_passwords; pw; pw = pw->next) { |  	for (pw = hapd->conf->sae_passwords; pw; pw = pw->next) { | ||||||
|  		if (!is_broadcast_ether_addr(pw->peer_addr) && |  		if (!is_broadcast_ether_addr(pw->peer_addr) && | ||||||
|  		    os_memcmp(pw->peer_addr, sta->addr, ETH_ALEN) != 0) |  		    os_memcmp(pw->peer_addr, sta->addr, ETH_ALEN) != 0) | ||||||
| @@ -573,12 +578,28 @@ static const char * sae_get_password(str | @@ -573,12 +578,30 @@ static const char * sae_get_password(str | ||||||
|  		pt = hapd->conf->ssid.pt; |  		pt = hapd->conf->ssid.pt; | ||||||
|  	} |  	} | ||||||
|   |   | ||||||
| +use_sta_psk: | +use_sta_psk: | ||||||
|  	if (!password) { |  	if (!password) { | ||||||
|  | +		sta->psk_idx = 0; | ||||||
|  		for (psk = sta->psk; psk; psk = psk->next) { |  		for (psk = sta->psk; psk; psk = psk->next) { | ||||||
| -			if (psk->is_passphrase) { | -			if (psk->is_passphrase) { | ||||||
| -				password = psk->passphrase; | -				password = psk->passphrase; | ||||||
| @@ -680,6 +681,7 @@ as adding/removing interfaces. | |||||||
| +			if (!sta->use_sta_psk) | +			if (!sta->use_sta_psk) | ||||||
| +				break; | +				break; | ||||||
| +#ifdef CONFIG_SAE | +#ifdef CONFIG_SAE | ||||||
|  | +			sta->psk_idx = 1; | ||||||
| +			if (sta->sae_pt) { | +			if (sta->sae_pt) { | ||||||
| +				pt = sta->sae_pt; | +				pt = sta->sae_pt; | ||||||
|  				break; |  				break; | ||||||
| @@ -696,7 +698,7 @@ as adding/removing interfaces. | |||||||
|  		} |  		} | ||||||
|  	} |  	} | ||||||
|   |   | ||||||
| @@ -3097,6 +3118,12 @@ static void handle_auth(struct hostapd_d | @@ -3097,6 +3120,12 @@ static void handle_auth(struct hostapd_d | ||||||
|  		goto fail; |  		goto fail; | ||||||
|  	} |  	} | ||||||
|   |   | ||||||
| @@ -746,14 +748,14 @@ as adding/removing interfaces. | |||||||
|  	char *radius_cui; /* Chargeable-User-Identity from RADIUS */ |  	char *radius_cui; /* Chargeable-User-Identity from RADIUS */ | ||||||
| --- a/src/ap/wpa_auth_glue.c | --- a/src/ap/wpa_auth_glue.c | ||||||
| +++ b/src/ap/wpa_auth_glue.c | +++ b/src/ap/wpa_auth_glue.c | ||||||
| @@ -341,6 +341,7 @@ static const u8 * hostapd_wpa_auth_get_p | @@ -361,6 +361,7 @@ static const u8 * hostapd_wpa_auth_get_p | ||||||
|  	struct sta_info *sta = ap_get_sta(hapd, addr); |  	} | ||||||
|  	const u8 *psk; |  #endif /* CONFIG_SAE */ | ||||||
|   |   | ||||||
| +	sta->psk_idx = 0; | +	sta->psk_idx = 0; | ||||||
|  	if (vlan_id) |  #ifdef CONFIG_OWE | ||||||
|  		*vlan_id = 0; |  	if ((hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_OWE) && | ||||||
|  	if (psk_len) |  	    sta && sta->owe_pmk) { | ||||||
| @@ -387,13 +388,18 @@ static const u8 * hostapd_wpa_auth_get_p | @@ -387,13 +388,18 @@ static const u8 * hostapd_wpa_auth_get_p | ||||||
|  	 * returned psk which should not be returned again. |  	 * returned psk which should not be returned again. | ||||||
|  	 * logic list (all hostapd_get_psk; all sta->psk) |  	 * logic list (all hostapd_get_psk; all sta->psk) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 John Crispin
					John Crispin