aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/services/hostapd/patches/0001-Revert-wpa_supplicant-Increase-authentication-timeou.patch
blob: 8d9cd456d576ffa064065d7f9bf4bf753e487d04 (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
From 8a6a7112e5b1391018531f6b6c317f8870e0fcb6 Mon Sep 17 00:00:00 2001
From: Daniel Golle <daniel@makrotopia.org>
Date: Thu, 3 May 2018 13:12:28 +0200
Subject: [PATCH 1/2] Revert "wpa_supplicant: Increase authentication timeout
 if CAC is started"

This reverts commit 37547ad63c9df61ce6899675028594da2527efef.
---
 wpa_supplicant/events.c           | 95 ++++---------------------------
 wpa_supplicant/wpa_supplicant.c   | 20 -------
 wpa_supplicant/wpa_supplicant_i.h |  3 -
 3 files changed, 10 insertions(+), 108 deletions(-)

--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -3776,81 +3776,6 @@ static void wpa_supplicant_event_port_au
 }
 
 
-static unsigned int wpas_event_cac_ms(const struct wpa_supplicant *wpa_s,
-				      int freq)
-{
-	size_t i;
-	int j;
-
-	for (i = 0; i < wpa_s->hw.num_modes; i++) {
-		const struct hostapd_hw_modes *mode = &wpa_s->hw.modes[i];
-
-		for (j = 0; j < mode->num_channels; j++) {
-			const struct hostapd_channel_data *chan;
-
-			chan = &mode->channels[j];
-			if (chan->freq == freq)
-				return chan->dfs_cac_ms;
-		}
-	}
-
-	return 0;
-}
-
-
-static void wpas_event_dfs_cac_started(struct wpa_supplicant *wpa_s,
-				       struct dfs_event *radar)
-{
-#if defined(NEED_AP_MLME) && defined(CONFIG_AP)
-	if (wpa_s->ap_iface) {
-		wpas_ap_event_dfs_cac_started(wpa_s, radar);
-	} else
-#endif /* NEED_AP_MLME && CONFIG_AP */
-	{
-		unsigned int cac_time = wpas_event_cac_ms(wpa_s, radar->freq);
-
-		cac_time /= 1000; /* convert from ms to sec */
-		if (!cac_time)
-			cac_time = 10 * 60; /* max timeout: 10 minutes */
-
-		/* Restart auth timeout: CAC time added to initial timeout */
-		wpas_auth_timeout_restart(wpa_s, cac_time);
-	}
-}
-
-
-static void wpas_event_dfs_cac_finished(struct wpa_supplicant *wpa_s,
-					struct dfs_event *radar)
-{
-#if defined(NEED_AP_MLME) && defined(CONFIG_AP)
-	if (wpa_s->ap_iface) {
-		wpas_ap_event_dfs_cac_finished(wpa_s, radar);
-	} else
-#endif /* NEED_AP_MLME && CONFIG_AP */
-	{
-		/* Restart auth timeout with original value after CAC is
-		 * finished */
-		wpas_auth_timeout_restart(wpa_s, 0);
-	}
-}
-
-
-static void wpas_event_dfs_cac_aborted(struct wpa_supplicant *wpa_s,
-				       struct dfs_event *radar)
-{
-#if defined(NEED_AP_MLME) && defined(CONFIG_AP)
-	if (wpa_s->ap_iface) {
-		wpas_ap_event_dfs_cac_aborted(wpa_s, radar);
-	} else
-#endif /* NEED_AP_MLME && CONFIG_AP */
-	{
-		/* Restart auth timeout with original value after CAC is
-		 * aborted */
-		wpas_auth_timeout_restart(wpa_s, 0);
-	}
-}
-
-
 static void wpa_supplicant_event_assoc_auth(struct wpa_supplicant *wpa_s,
 					    union wpa_event_data *data)
 {
@@ -4298,25 +4223,25 @@ void wpa_supplicant_event(void *ctx, enu
 			wpas_ap_event_dfs_radar_detected(wpa_s,
 							 &data->dfs_event);
 		break;
-	case EVENT_DFS_NOP_FINISHED:
-		if (data)
-			wpas_ap_event_dfs_cac_nop_finished(wpa_s,
-							   &data->dfs_event);
-		break;
-#endif /* NEED_AP_MLME */
-#endif /* CONFIG_AP */
 	case EVENT_DFS_CAC_STARTED:
 		if (data)
-			wpas_event_dfs_cac_started(wpa_s, &data->dfs_event);
+			wpas_ap_event_dfs_cac_started(wpa_s, &data->dfs_event);
 		break;
 	case EVENT_DFS_CAC_FINISHED:
 		if (data)
-			wpas_event_dfs_cac_finished(wpa_s, &data->dfs_event);
+			wpas_ap_event_dfs_cac_finished(wpa_s, &data->dfs_event);
 		break;
 	case EVENT_DFS_CAC_ABORTED:
 		if (data)
-			wpas_event_dfs_cac_aborted(wpa_s, &data->dfs_event);
+			wpas_ap_event_dfs_cac_aborted(wpa_s, &data->dfs_event);
+		break;
+	case EVENT_DFS_NOP_FINISHED:
+		if (data)
+			wpas_ap_event_dfs_cac_nop_finished(wpa_s,
+							   &data->dfs_event);
 		break;
+#endif /* NEED_AP_MLME */
+#endif /* CONFIG_AP */
 	case EVENT_RX_MGMT: {
 		u16 fc, stype;
 		const struct ieee80211_mgmt *mgmt;
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -243,30 +243,10 @@ void wpa_supplicant_req_auth_timeout(str
 	wpa_dbg(wpa_s, MSG_DEBUG, "Setting authentication timeout: %d sec "
 		"%d usec", sec, usec);
 	eloop_cancel_timeout(wpa_supplicant_timeout, wpa_s, NULL);
-	wpa_s->last_auth_timeout_sec = sec;
 	eloop_register_timeout(sec, usec, wpa_supplicant_timeout, wpa_s, NULL);
 }
 
 
-/*
- * wpas_auth_timeout_restart - Restart and change timeout for authentication
- * @wpa_s: Pointer to wpa_supplicant data
- * @sec_diff: difference in seconds applied to original timeout value
- */
-void wpas_auth_timeout_restart(struct wpa_supplicant *wpa_s, int sec_diff)
-{
-	int new_sec = wpa_s->last_auth_timeout_sec + sec_diff;
-
-	if (eloop_is_timeout_registered(wpa_supplicant_timeout, wpa_s, NULL)) {
-		wpa_dbg(wpa_s, MSG_DEBUG,
-			"Authentication timeout restart: %d sec", new_sec);
-		eloop_cancel_timeout(wpa_supplicant_timeout, wpa_s, NULL);
-		eloop_register_timeout(new_sec, 0, wpa_supplicant_timeout,
-				       wpa_s, NULL);
-	}
-}
-
-
 /**
  * wpa_supplicant_cancel_auth_timeout - Cancel authentication timeout
  * @wpa_s: Pointer to wpa_supplicant data
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -1182,8 +1182,6 @@ struct wpa_supplicant {
 	/* RIC elements for FT protocol */
 	struct wpabuf *ric_ies;
 
-	int last_auth_timeout_sec;
-
 #ifdef CONFIG_DPP
 	struct dl_list dpp_bootstrap; /* struct dpp_bootstrap_info */
 	struct dl_list dpp_configurator; /* struct dpp_configurator */
@@ -1258,7 +1256,6 @@ void wpa_supplicant_initiate_eapol(struc
 void wpa_clear_keys(struct wpa_supplicant *wpa_s, const u8 *addr);
 void wpa_supplicant_req_auth_timeout(struct wpa_supplicant *wpa_s,
 				     int sec, int usec);
-void wpas_auth_timeout_restart(struct wpa_supplicant *wpa_s, int sec_diff);
 void wpa_supplicant_reinit_autoscan(struct wpa_supplicant *wpa_s);
 void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s,
 			      enum wpa_states state);