0001-Revert-wpa_supplicant-Increase-authentication-timeou.patch 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. From 8a6a7112e5b1391018531f6b6c317f8870e0fcb6 Mon Sep 17 00:00:00 2001
  2. From: Daniel Golle <[email protected]>
  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. This reverts commit 37547ad63c9df61ce6899675028594da2527efef.
  7. ---
  8. wpa_supplicant/events.c | 95 ++++---------------------------
  9. wpa_supplicant/wpa_supplicant.c | 20 -------
  10. wpa_supplicant/wpa_supplicant_i.h | 3 -
  11. 3 files changed, 10 insertions(+), 108 deletions(-)
  12. --- a/wpa_supplicant/events.c
  13. +++ b/wpa_supplicant/events.c
  14. @@ -3776,81 +3776,6 @@ static void wpa_supplicant_event_port_au
  15. }
  16. -static unsigned int wpas_event_cac_ms(const struct wpa_supplicant *wpa_s,
  17. - int freq)
  18. -{
  19. - size_t i;
  20. - int j;
  21. -
  22. - for (i = 0; i < wpa_s->hw.num_modes; i++) {
  23. - const struct hostapd_hw_modes *mode = &wpa_s->hw.modes[i];
  24. -
  25. - for (j = 0; j < mode->num_channels; j++) {
  26. - const struct hostapd_channel_data *chan;
  27. -
  28. - chan = &mode->channels[j];
  29. - if (chan->freq == freq)
  30. - return chan->dfs_cac_ms;
  31. - }
  32. - }
  33. -
  34. - return 0;
  35. -}
  36. -
  37. -
  38. -static void wpas_event_dfs_cac_started(struct wpa_supplicant *wpa_s,
  39. - struct dfs_event *radar)
  40. -{
  41. -#if defined(NEED_AP_MLME) && defined(CONFIG_AP)
  42. - if (wpa_s->ap_iface) {
  43. - wpas_ap_event_dfs_cac_started(wpa_s, radar);
  44. - } else
  45. -#endif /* NEED_AP_MLME && CONFIG_AP */
  46. - {
  47. - unsigned int cac_time = wpas_event_cac_ms(wpa_s, radar->freq);
  48. -
  49. - cac_time /= 1000; /* convert from ms to sec */
  50. - if (!cac_time)
  51. - cac_time = 10 * 60; /* max timeout: 10 minutes */
  52. -
  53. - /* Restart auth timeout: CAC time added to initial timeout */
  54. - wpas_auth_timeout_restart(wpa_s, cac_time);
  55. - }
  56. -}
  57. -
  58. -
  59. -static void wpas_event_dfs_cac_finished(struct wpa_supplicant *wpa_s,
  60. - struct dfs_event *radar)
  61. -{
  62. -#if defined(NEED_AP_MLME) && defined(CONFIG_AP)
  63. - if (wpa_s->ap_iface) {
  64. - wpas_ap_event_dfs_cac_finished(wpa_s, radar);
  65. - } else
  66. -#endif /* NEED_AP_MLME && CONFIG_AP */
  67. - {
  68. - /* Restart auth timeout with original value after CAC is
  69. - * finished */
  70. - wpas_auth_timeout_restart(wpa_s, 0);
  71. - }
  72. -}
  73. -
  74. -
  75. -static void wpas_event_dfs_cac_aborted(struct wpa_supplicant *wpa_s,
  76. - struct dfs_event *radar)
  77. -{
  78. -#if defined(NEED_AP_MLME) && defined(CONFIG_AP)
  79. - if (wpa_s->ap_iface) {
  80. - wpas_ap_event_dfs_cac_aborted(wpa_s, radar);
  81. - } else
  82. -#endif /* NEED_AP_MLME && CONFIG_AP */
  83. - {
  84. - /* Restart auth timeout with original value after CAC is
  85. - * aborted */
  86. - wpas_auth_timeout_restart(wpa_s, 0);
  87. - }
  88. -}
  89. -
  90. -
  91. static void wpa_supplicant_event_assoc_auth(struct wpa_supplicant *wpa_s,
  92. union wpa_event_data *data)
  93. {
  94. @@ -4298,25 +4223,25 @@ void wpa_supplicant_event(void *ctx, enu
  95. wpas_ap_event_dfs_radar_detected(wpa_s,
  96. &data->dfs_event);
  97. break;
  98. - case EVENT_DFS_NOP_FINISHED:
  99. - if (data)
  100. - wpas_ap_event_dfs_cac_nop_finished(wpa_s,
  101. - &data->dfs_event);
  102. - break;
  103. -#endif /* NEED_AP_MLME */
  104. -#endif /* CONFIG_AP */
  105. case EVENT_DFS_CAC_STARTED:
  106. if (data)
  107. - wpas_event_dfs_cac_started(wpa_s, &data->dfs_event);
  108. + wpas_ap_event_dfs_cac_started(wpa_s, &data->dfs_event);
  109. break;
  110. case EVENT_DFS_CAC_FINISHED:
  111. if (data)
  112. - wpas_event_dfs_cac_finished(wpa_s, &data->dfs_event);
  113. + wpas_ap_event_dfs_cac_finished(wpa_s, &data->dfs_event);
  114. break;
  115. case EVENT_DFS_CAC_ABORTED:
  116. if (data)
  117. - wpas_event_dfs_cac_aborted(wpa_s, &data->dfs_event);
  118. + wpas_ap_event_dfs_cac_aborted(wpa_s, &data->dfs_event);
  119. + break;
  120. + case EVENT_DFS_NOP_FINISHED:
  121. + if (data)
  122. + wpas_ap_event_dfs_cac_nop_finished(wpa_s,
  123. + &data->dfs_event);
  124. break;
  125. +#endif /* NEED_AP_MLME */
  126. +#endif /* CONFIG_AP */
  127. case EVENT_RX_MGMT: {
  128. u16 fc, stype;
  129. const struct ieee80211_mgmt *mgmt;
  130. --- a/wpa_supplicant/wpa_supplicant.c
  131. +++ b/wpa_supplicant/wpa_supplicant.c
  132. @@ -243,30 +243,10 @@ void wpa_supplicant_req_auth_timeout(str
  133. wpa_dbg(wpa_s, MSG_DEBUG, "Setting authentication timeout: %d sec "
  134. "%d usec", sec, usec);
  135. eloop_cancel_timeout(wpa_supplicant_timeout, wpa_s, NULL);
  136. - wpa_s->last_auth_timeout_sec = sec;
  137. eloop_register_timeout(sec, usec, wpa_supplicant_timeout, wpa_s, NULL);
  138. }
  139. -/*
  140. - * wpas_auth_timeout_restart - Restart and change timeout for authentication
  141. - * @wpa_s: Pointer to wpa_supplicant data
  142. - * @sec_diff: difference in seconds applied to original timeout value
  143. - */
  144. -void wpas_auth_timeout_restart(struct wpa_supplicant *wpa_s, int sec_diff)
  145. -{
  146. - int new_sec = wpa_s->last_auth_timeout_sec + sec_diff;
  147. -
  148. - if (eloop_is_timeout_registered(wpa_supplicant_timeout, wpa_s, NULL)) {
  149. - wpa_dbg(wpa_s, MSG_DEBUG,
  150. - "Authentication timeout restart: %d sec", new_sec);
  151. - eloop_cancel_timeout(wpa_supplicant_timeout, wpa_s, NULL);
  152. - eloop_register_timeout(new_sec, 0, wpa_supplicant_timeout,
  153. - wpa_s, NULL);
  154. - }
  155. -}
  156. -
  157. -
  158. /**
  159. * wpa_supplicant_cancel_auth_timeout - Cancel authentication timeout
  160. * @wpa_s: Pointer to wpa_supplicant data
  161. --- a/wpa_supplicant/wpa_supplicant_i.h
  162. +++ b/wpa_supplicant/wpa_supplicant_i.h
  163. @@ -1182,8 +1182,6 @@ struct wpa_supplicant {
  164. /* RIC elements for FT protocol */
  165. struct wpabuf *ric_ies;
  166. - int last_auth_timeout_sec;
  167. -
  168. #ifdef CONFIG_DPP
  169. struct dl_list dpp_bootstrap; /* struct dpp_bootstrap_info */
  170. struct dl_list dpp_configurator; /* struct dpp_configurator */
  171. @@ -1258,7 +1256,6 @@ void wpa_supplicant_initiate_eapol(struc
  172. void wpa_clear_keys(struct wpa_supplicant *wpa_s, const u8 *addr);
  173. void wpa_supplicant_req_auth_timeout(struct wpa_supplicant *wpa_s,
  174. int sec, int usec);
  175. -void wpas_auth_timeout_restart(struct wpa_supplicant *wpa_s, int sec_diff);
  176. void wpa_supplicant_reinit_autoscan(struct wpa_supplicant *wpa_s);
  177. void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s,
  178. enum wpa_states state);