mirror of
				https://git.kernel.org/pub/scm/network/wireless/iwd.git
				synced 2025-10-31 21:27:30 +01:00 
			
		
		
		
	scan: filter user-disabled bands for periodic scans.
To support user-disabled bands periodic scans need to specify a frequency list filtered by any bands that are disabled. This was needed in scan.c since periodic scans don't provide a frequency list in the scan request. If no bands are disabled the allowed freqs API should still result in the same scan behavior as if a frequency list is left out i.e. IWD just filters the frequencies as opposed to the kernel.
This commit is contained in:
		
							parent
							
								
									6463fa2561
								
							
						
					
					
						commit
						e83070e074
					
				
							
								
								
									
										36
									
								
								src/scan.c
									
									
									
									
									
								
							
							
						
						
									
										36
									
								
								src/scan.c
									
									
									
									
									
								
							| @ -987,9 +987,43 @@ static void scan_periodic_destroy(void *user_data) | ||||
| 	sc->sp.id = 0; | ||||
| } | ||||
| 
 | ||||
| static struct scan_freq_set *scan_periodic_get_freqs(struct scan_context *sc) | ||||
| { | ||||
| 	uint32_t band_mask = 0; | ||||
| 	struct scan_freq_set *freqs; | ||||
| 	const struct scan_freq_set *supported = | ||||
| 					wiphy_get_supported_freqs(sc->wiphy); | ||||
| 
 | ||||
| 	if (RANK_2G_FACTOR) | ||||
| 		band_mask |= BAND_FREQ_2_4_GHZ; | ||||
| 	if (RANK_5G_FACTOR) | ||||
| 		band_mask |= BAND_FREQ_5_GHZ; | ||||
| 	if (RANK_6G_FACTOR) | ||||
| 		band_mask |= BAND_FREQ_6_GHZ; | ||||
| 
 | ||||
| 	freqs = scan_freq_set_clone(supported, band_mask); | ||||
| 	if (scan_freq_set_isempty(freqs)) { | ||||
| 		scan_freq_set_free(freqs); | ||||
| 		freqs = NULL; | ||||
| 	} | ||||
| 
 | ||||
| 	return freqs; | ||||
| } | ||||
| 
 | ||||
| static bool scan_periodic_queue(struct scan_context *sc) | ||||
| { | ||||
| 	struct scan_parameters params = {}; | ||||
| 	struct scan_freq_set *freqs = scan_periodic_get_freqs(sc); | ||||
| 
 | ||||
| 	/*
 | ||||
| 	 * If this happens its due to the user disabling all bands. This will | ||||
| 	 * cause IWD to never issue another periodic scan so warn the user of | ||||
| 	 * this. | ||||
| 	 */ | ||||
| 	if (L_WARN_ON(!freqs)) | ||||
| 		return false; | ||||
| 
 | ||||
| 	params.freqs = freqs; | ||||
| 
 | ||||
| 	if (sc->sp.needs_active_scan && known_networks_has_hidden()) { | ||||
| 		params.randomize_mac_addr_hint = true; | ||||
| @ -1007,6 +1041,8 @@ static bool scan_periodic_queue(struct scan_context *sc) | ||||
| 					scan_periodic_notify, sc, | ||||
| 					scan_periodic_destroy); | ||||
| 
 | ||||
| 	scan_freq_set_free(freqs); | ||||
| 
 | ||||
| 	return sc->sp.id != 0; | ||||
| } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 James Prestwood
						James Prestwood