1 From 8a6a7112e5b1391018531f6b6c317f8870e0fcb6 Mon Sep 17 00:00:00 2001
2 From: Daniel Golle <daniel@makrotopia.org>
3 Date: Thu, 3 May 2018 13:12:28 +0200
4 Subject: [PATCH 1/2] Revert "wpa_supplicant: Increase authentication timeout
7 This reverts commit 37547ad63c9df61ce6899675028594da2527efef.
9 wpa_supplicant/events.c | 95 ++++---------------------------
10 wpa_supplicant/wpa_supplicant.c | 20 -------
11 wpa_supplicant/wpa_supplicant_i.h | 3 -
12 3 files changed, 10 insertions(+), 108 deletions(-)
14 --- a/wpa_supplicant/events.c
15 +++ b/wpa_supplicant/events.c
16 @@ -3776,81 +3776,6 @@ static void wpa_supplicant_event_port_au
20 -static unsigned int wpas_event_cac_ms(const struct wpa_supplicant *wpa_s,
26 - for (i = 0; i < wpa_s->hw.num_modes; i++) {
27 - const struct hostapd_hw_modes *mode = &wpa_s->hw.modes[i];
29 - for (j = 0; j < mode->num_channels; j++) {
30 - const struct hostapd_channel_data *chan;
32 - chan = &mode->channels[j];
33 - if (chan->freq == freq)
34 - return chan->dfs_cac_ms;
42 -static void wpas_event_dfs_cac_started(struct wpa_supplicant *wpa_s,
43 - struct dfs_event *radar)
45 -#if defined(NEED_AP_MLME) && defined(CONFIG_AP)
46 - if (wpa_s->ap_iface) {
47 - wpas_ap_event_dfs_cac_started(wpa_s, radar);
49 -#endif /* NEED_AP_MLME && CONFIG_AP */
51 - unsigned int cac_time = wpas_event_cac_ms(wpa_s, radar->freq);
53 - cac_time /= 1000; /* convert from ms to sec */
55 - cac_time = 10 * 60; /* max timeout: 10 minutes */
57 - /* Restart auth timeout: CAC time added to initial timeout */
58 - wpas_auth_timeout_restart(wpa_s, cac_time);
63 -static void wpas_event_dfs_cac_finished(struct wpa_supplicant *wpa_s,
64 - struct dfs_event *radar)
66 -#if defined(NEED_AP_MLME) && defined(CONFIG_AP)
67 - if (wpa_s->ap_iface) {
68 - wpas_ap_event_dfs_cac_finished(wpa_s, radar);
70 -#endif /* NEED_AP_MLME && CONFIG_AP */
72 - /* Restart auth timeout with original value after CAC is
74 - wpas_auth_timeout_restart(wpa_s, 0);
79 -static void wpas_event_dfs_cac_aborted(struct wpa_supplicant *wpa_s,
80 - struct dfs_event *radar)
82 -#if defined(NEED_AP_MLME) && defined(CONFIG_AP)
83 - if (wpa_s->ap_iface) {
84 - wpas_ap_event_dfs_cac_aborted(wpa_s, radar);
86 -#endif /* NEED_AP_MLME && CONFIG_AP */
88 - /* Restart auth timeout with original value after CAC is
90 - wpas_auth_timeout_restart(wpa_s, 0);
95 static void wpa_supplicant_event_assoc_auth(struct wpa_supplicant *wpa_s,
96 union wpa_event_data *data)
98 @@ -4298,25 +4223,25 @@ void wpa_supplicant_event(void *ctx, enu
99 wpas_ap_event_dfs_radar_detected(wpa_s,
102 - case EVENT_DFS_NOP_FINISHED:
104 - wpas_ap_event_dfs_cac_nop_finished(wpa_s,
107 -#endif /* NEED_AP_MLME */
108 -#endif /* CONFIG_AP */
109 case EVENT_DFS_CAC_STARTED:
111 - wpas_event_dfs_cac_started(wpa_s, &data->dfs_event);
112 + wpas_ap_event_dfs_cac_started(wpa_s, &data->dfs_event);
114 case EVENT_DFS_CAC_FINISHED:
116 - wpas_event_dfs_cac_finished(wpa_s, &data->dfs_event);
117 + wpas_ap_event_dfs_cac_finished(wpa_s, &data->dfs_event);
119 case EVENT_DFS_CAC_ABORTED:
121 - wpas_event_dfs_cac_aborted(wpa_s, &data->dfs_event);
122 + wpas_ap_event_dfs_cac_aborted(wpa_s, &data->dfs_event);
124 + case EVENT_DFS_NOP_FINISHED:
126 + wpas_ap_event_dfs_cac_nop_finished(wpa_s,
129 +#endif /* NEED_AP_MLME */
130 +#endif /* CONFIG_AP */
131 case EVENT_RX_MGMT: {
133 const struct ieee80211_mgmt *mgmt;
134 --- a/wpa_supplicant/wpa_supplicant.c
135 +++ b/wpa_supplicant/wpa_supplicant.c
136 @@ -243,30 +243,10 @@ void wpa_supplicant_req_auth_timeout(str
137 wpa_dbg(wpa_s, MSG_DEBUG, "Setting authentication timeout: %d sec "
138 "%d usec", sec, usec);
139 eloop_cancel_timeout(wpa_supplicant_timeout, wpa_s, NULL);
140 - wpa_s->last_auth_timeout_sec = sec;
141 eloop_register_timeout(sec, usec, wpa_supplicant_timeout, wpa_s, NULL);
146 - * wpas_auth_timeout_restart - Restart and change timeout for authentication
147 - * @wpa_s: Pointer to wpa_supplicant data
148 - * @sec_diff: difference in seconds applied to original timeout value
150 -void wpas_auth_timeout_restart(struct wpa_supplicant *wpa_s, int sec_diff)
152 - int new_sec = wpa_s->last_auth_timeout_sec + sec_diff;
154 - if (eloop_is_timeout_registered(wpa_supplicant_timeout, wpa_s, NULL)) {
155 - wpa_dbg(wpa_s, MSG_DEBUG,
156 - "Authentication timeout restart: %d sec", new_sec);
157 - eloop_cancel_timeout(wpa_supplicant_timeout, wpa_s, NULL);
158 - eloop_register_timeout(new_sec, 0, wpa_supplicant_timeout,
165 * wpa_supplicant_cancel_auth_timeout - Cancel authentication timeout
166 * @wpa_s: Pointer to wpa_supplicant data
167 --- a/wpa_supplicant/wpa_supplicant_i.h
168 +++ b/wpa_supplicant/wpa_supplicant_i.h
169 @@ -1182,8 +1182,6 @@ struct wpa_supplicant {
170 /* RIC elements for FT protocol */
171 struct wpabuf *ric_ies;
173 - int last_auth_timeout_sec;
176 struct dl_list dpp_bootstrap; /* struct dpp_bootstrap_info */
177 struct dl_list dpp_configurator; /* struct dpp_configurator */
178 @@ -1258,7 +1256,6 @@ void wpa_supplicant_initiate_eapol(struc
179 void wpa_clear_keys(struct wpa_supplicant *wpa_s, const u8 *addr);
180 void wpa_supplicant_req_auth_timeout(struct wpa_supplicant *wpa_s,
182 -void wpas_auth_timeout_restart(struct wpa_supplicant *wpa_s, int sec_diff);
183 void wpa_supplicant_reinit_autoscan(struct wpa_supplicant *wpa_s);
184 void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s,
185 enum wpa_states state);