mirror of
				https://git.kernel.org/pub/scm/network/wireless/iwd.git
				synced 2025-10-31 13:17:25 +01:00 
			
		
		
		
	station: reorder AP roam logic
There are a few checks that can be done prior to parsing the request, in addition the explicit check for preparing_roam was removed since this is taken care of by station_cannot_roam().
This commit is contained in:
		
							parent
							
								
									8d224624fc
								
							
						
					
					
						commit
						f3b31e48e0
					
				| @ -2763,6 +2763,31 @@ static void station_ap_directed_roam(struct station *station, | ||||
| 	if (station_cannot_roam(station)) | ||||
| 		return; | ||||
| 
 | ||||
| 	if (station->state != STATION_STATE_CONNECTED) { | ||||
| 		l_debug("roam: unexpected AP directed roam -- ignore"); | ||||
| 		return; | ||||
| 	} | ||||
| 
 | ||||
| 	/*
 | ||||
| 	 * Sanitize the frame to check that it is from our current AP. | ||||
| 	 * | ||||
| 	 * 802.11-2020 Section 9.3.3.1 about Address2: | ||||
| 	 * "If the STA is an AP with dot11MultiBSSDImplemented set to false, | ||||
| 	 * then this address is the BSSID." | ||||
| 	 * | ||||
| 	 * Address3: | ||||
| 	 * "If the STA is an AP or PCP, the Address 3 field is the same as the | ||||
| 	 * Address 2 field." | ||||
| 	 * | ||||
| 	 * For now check that Address2 & Address3 is the same as the connected | ||||
| 	 * BSS address. | ||||
| 	 */ | ||||
| 	if (memcmp(hdr->address_2, station->connected_bss, ETH_ALEN) || | ||||
| 			memcmp(hdr->address_2, hdr->address_3, ETH_ALEN)) { | ||||
| 		l_debug("roam: AP directed roam not from our AP -- ignore"); | ||||
| 		return; | ||||
| 	} | ||||
| 
 | ||||
| 	if (body_len < 7) | ||||
| 		goto format_error; | ||||
| 
 | ||||
| @ -2816,36 +2841,6 @@ static void station_ap_directed_roam(struct station *station, | ||||
| 		pos += url_len; | ||||
| 	} | ||||
| 
 | ||||
| 	if (station->state != STATION_STATE_CONNECTED) { | ||||
| 		l_debug("roam: unexpected AP directed roam -- ignore"); | ||||
| 		return; | ||||
| 	} | ||||
| 
 | ||||
| 	/*
 | ||||
| 	 * Sanitize the frame to check that it is from our current AP. | ||||
| 	 * | ||||
| 	 * 802.11-2020 Section 9.3.3.1 about Address2: | ||||
| 	 * "If the STA is an AP with dot11MultiBSSDImplemented set to false, | ||||
| 	 * then this address is the BSSID." | ||||
| 	 * | ||||
| 	 * Address3: | ||||
| 	 * "If the STA is an AP or PCP, the Address 3 field is the same as the | ||||
| 	 * Address 2 field." | ||||
| 	 * | ||||
| 	 * For now check that Address2 & Address3 is the same as the connected | ||||
| 	 * BSS address. | ||||
| 	 */ | ||||
| 	if (memcmp(hdr->address_2, station->connected_bss, ETH_ALEN) || | ||||
| 			memcmp(hdr->address_2, hdr->address_3, ETH_ALEN)) { | ||||
| 		l_debug("roam: AP directed roam not from our AP -- ignore"); | ||||
| 		return; | ||||
| 	} | ||||
| 
 | ||||
| 	if (station->preparing_roam) { | ||||
| 		l_debug("roam: roam attempt already in progress -- ignore"); | ||||
| 		return; | ||||
| 	} | ||||
| 
 | ||||
| 	station->ap_directed_roaming = true; | ||||
| 	station->preparing_roam = true; | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 James Prestwood
						James Prestwood