8d9cd456d576ffa064065d7f9bf4bf753e487d04
[openwrt/staging/luka.git] /
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
5 if CAC is started"
6
7 This reverts commit 37547ad63c9df61ce6899675028594da2527efef.
8 ---
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(-)
13
14 --- a/wpa_supplicant/events.c
15 +++ b/wpa_supplicant/events.c
16 @@ -3776,81 +3776,6 @@ static void wpa_supplicant_event_port_au
17 }
18
19
20 -static unsigned int wpas_event_cac_ms(const struct wpa_supplicant *wpa_s,
21 - int freq)
22 -{
23 - size_t i;
24 - int j;
25 -
26 - for (i = 0; i < wpa_s->hw.num_modes; i++) {
27 - const struct hostapd_hw_modes *mode = &wpa_s->hw.modes[i];
28 -
29 - for (j = 0; j < mode->num_channels; j++) {
30 - const struct hostapd_channel_data *chan;
31 -
32 - chan = &mode->channels[j];
33 - if (chan->freq == freq)
34 - return chan->dfs_cac_ms;
35 - }
36 - }
37 -
38 - return 0;
39 -}
40 -
41 -
42 -static void wpas_event_dfs_cac_started(struct wpa_supplicant *wpa_s,
43 - struct dfs_event *radar)
44 -{
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);
48 - } else
49 -#endif /* NEED_AP_MLME && CONFIG_AP */
50 - {
51 - unsigned int cac_time = wpas_event_cac_ms(wpa_s, radar->freq);
52 -
53 - cac_time /= 1000; /* convert from ms to sec */
54 - if (!cac_time)
55 - cac_time = 10 * 60; /* max timeout: 10 minutes */
56 -
57 - /* Restart auth timeout: CAC time added to initial timeout */
58 - wpas_auth_timeout_restart(wpa_s, cac_time);
59 - }
60 -}
61 -
62 -
63 -static void wpas_event_dfs_cac_finished(struct wpa_supplicant *wpa_s,
64 - struct dfs_event *radar)
65 -{
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);
69 - } else
70 -#endif /* NEED_AP_MLME && CONFIG_AP */
71 - {
72 - /* Restart auth timeout with original value after CAC is
73 - * finished */
74 - wpas_auth_timeout_restart(wpa_s, 0);
75 - }
76 -}
77 -
78 -
79 -static void wpas_event_dfs_cac_aborted(struct wpa_supplicant *wpa_s,
80 - struct dfs_event *radar)
81 -{
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);
85 - } else
86 -#endif /* NEED_AP_MLME && CONFIG_AP */
87 - {
88 - /* Restart auth timeout with original value after CAC is
89 - * aborted */
90 - wpas_auth_timeout_restart(wpa_s, 0);
91 - }
92 -}
93 -
94 -
95 static void wpa_supplicant_event_assoc_auth(struct wpa_supplicant *wpa_s,
96 union wpa_event_data *data)
97 {
98 @@ -4298,25 +4223,25 @@ void wpa_supplicant_event(void *ctx, enu
99 wpas_ap_event_dfs_radar_detected(wpa_s,
100 &data->dfs_event);
101 break;
102 - case EVENT_DFS_NOP_FINISHED:
103 - if (data)
104 - wpas_ap_event_dfs_cac_nop_finished(wpa_s,
105 - &data->dfs_event);
106 - break;
107 -#endif /* NEED_AP_MLME */
108 -#endif /* CONFIG_AP */
109 case EVENT_DFS_CAC_STARTED:
110 if (data)
111 - wpas_event_dfs_cac_started(wpa_s, &data->dfs_event);
112 + wpas_ap_event_dfs_cac_started(wpa_s, &data->dfs_event);
113 break;
114 case EVENT_DFS_CAC_FINISHED:
115 if (data)
116 - wpas_event_dfs_cac_finished(wpa_s, &data->dfs_event);
117 + wpas_ap_event_dfs_cac_finished(wpa_s, &data->dfs_event);
118 break;
119 case EVENT_DFS_CAC_ABORTED:
120 if (data)
121 - wpas_event_dfs_cac_aborted(wpa_s, &data->dfs_event);
122 + wpas_ap_event_dfs_cac_aborted(wpa_s, &data->dfs_event);
123 + break;
124 + case EVENT_DFS_NOP_FINISHED:
125 + if (data)
126 + wpas_ap_event_dfs_cac_nop_finished(wpa_s,
127 + &data->dfs_event);
128 break;
129 +#endif /* NEED_AP_MLME */
130 +#endif /* CONFIG_AP */
131 case EVENT_RX_MGMT: {
132 u16 fc, stype;
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);
142 }
143
144
145 -/*
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
149 - */
150 -void wpas_auth_timeout_restart(struct wpa_supplicant *wpa_s, int sec_diff)
151 -{
152 - int new_sec = wpa_s->last_auth_timeout_sec + sec_diff;
153 -
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,
159 - wpa_s, NULL);
160 - }
161 -}
162 -
163 -
164 /**
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;
172
173 - int last_auth_timeout_sec;
174 -
175 #ifdef CONFIG_DPP
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,
181 int sec, int usec);
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);