aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/services/hostapd/patches/470-survey_data_fallback.patch
blob: 4e40a87558949483954950f72d30ac30a17877e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
--- a/src/ap/acs.c
+++ b/src/ap/acs.c
@@ -292,18 +292,12 @@ static void acs_fail(struct hostapd_ifac
 static long double
 acs_survey_interference_factor(struct freq_survey *survey, s8 min_nf)
 {
-	long double factor, busy, total;
+	long double factor, busy = 0, total;
 
 	if (survey->filled & SURVEY_HAS_CHAN_TIME_BUSY)
 		busy = survey->channel_time_busy;
 	else if (survey->filled & SURVEY_HAS_CHAN_TIME_RX)
 		busy = survey->channel_time_rx;
-	else {
-		/* This shouldn't really happen as survey data is checked in
-		 * acs_sanity_check() */
-		wpa_printf(MSG_ERROR, "ACS: Survey data missing");
-		return 0;
-	}
 
 	total = survey->channel_time;
 
@@ -395,20 +389,19 @@ static int acs_usable_vht80_chan(struct
 static int acs_survey_is_sufficient(struct freq_survey *survey)
 {
 	if (!(survey->filled & SURVEY_HAS_NF)) {
+		survey->nf = -95;
 		wpa_printf(MSG_INFO, "ACS: Survey is missing noise floor");
-		return 0;
 	}
 
 	if (!(survey->filled & SURVEY_HAS_CHAN_TIME)) {
+		survey->channel_time = 0;
 		wpa_printf(MSG_INFO, "ACS: Survey is missing channel time");
-		return 0;
 	}
 
 	if (!(survey->filled & SURVEY_HAS_CHAN_TIME_BUSY) &&
 	    !(survey->filled & SURVEY_HAS_CHAN_TIME_RX)) {
 		wpa_printf(MSG_INFO,
 			   "ACS: Survey is missing RX and busy time (at least one is required)");
-		return 0;
 	}
 
 	return 1;