0110-mesh-consider-mesh-interface-on-dfs-event-handler.patch 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. From d0a0e1030005834b99225feb64ec3794d31beab0 Mon Sep 17 00:00:00 2001
  2. From: Peter Oh <[email protected]>
  3. Date: Thu, 12 Apr 2018 02:49:07 -0700
  4. Subject: [PATCH 10/15] mesh: consider mesh interface on dfs event handler
  5. Once mesh starts supporting DFS channels, it has to handle DFS related events
  6. from drivers, hence add mesh interface to the check list.
  7. Signed-off-by: Peter Oh <[email protected]>
  8. ---
  9. wpa_supplicant/ap.c | 55 ++++++++++++++++++++++++++++++++---------
  10. wpa_supplicant/events.c | 1 +
  11. 2 files changed, 44 insertions(+), 12 deletions(-)
  12. --- a/wpa_supplicant/ap.c
  13. +++ b/wpa_supplicant/ap.c
  14. @@ -1328,13 +1328,18 @@ int ap_ctrl_iface_chanswitch(struct wpa_
  15. void wpas_ap_ch_switch(struct wpa_supplicant *wpa_s, int freq, int ht,
  16. int offset, int width, int cf1, int cf2)
  17. {
  18. + struct hostapd_iface *iface = wpa_s->ap_iface;
  19. +
  20. if (!wpa_s->ap_iface)
  21. - return;
  22. + if (!wpa_s->ifmsh)
  23. + return;
  24. + else
  25. + iface = wpa_s->ifmsh;
  26. wpa_s->assoc_freq = freq;
  27. if (wpa_s->current_ssid)
  28. wpa_s->current_ssid->frequency = freq;
  29. - hostapd_event_ch_switch(wpa_s->ap_iface->bss[0], freq, ht,
  30. + hostapd_event_ch_switch(iface->bss[0], freq, ht,
  31. offset, width, cf1, cf2);
  32. }
  33. @@ -1531,10 +1536,15 @@ int wpas_ap_pmksa_cache_add_external(str
  34. void wpas_event_dfs_radar_detected(struct wpa_supplicant *wpa_s,
  35. struct dfs_event *radar)
  36. {
  37. + struct hostapd_iface *iface = wpa_s->ap_iface;
  38. +
  39. if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
  40. - return;
  41. + if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
  42. + return;
  43. + else
  44. + iface = wpa_s->ifmsh;
  45. wpa_printf(MSG_DEBUG, "DFS radar detected on %d MHz", radar->freq);
  46. - hostapd_dfs_radar_detected(wpa_s->ap_iface, radar->freq,
  47. + hostapd_dfs_radar_detected(iface, radar->freq,
  48. radar->ht_enabled, radar->chan_offset,
  49. radar->chan_width,
  50. radar->cf1, radar->cf2);
  51. @@ -1544,10 +1554,15 @@ void wpas_event_dfs_radar_detected(struc
  52. void wpas_event_dfs_cac_started(struct wpa_supplicant *wpa_s,
  53. struct dfs_event *radar)
  54. {
  55. + struct hostapd_iface *iface = wpa_s->ap_iface;
  56. +
  57. if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
  58. - return;
  59. + if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
  60. + return;
  61. + else
  62. + iface = wpa_s->ifmsh;
  63. wpa_printf(MSG_DEBUG, "DFS CAC started on %d MHz", radar->freq);
  64. - hostapd_dfs_start_cac(wpa_s->ap_iface, radar->freq,
  65. + hostapd_dfs_start_cac(iface, radar->freq,
  66. radar->ht_enabled, radar->chan_offset,
  67. radar->chan_width, radar->cf1, radar->cf2);
  68. }
  69. @@ -1556,10 +1571,16 @@ void wpas_event_dfs_cac_started(struct w
  70. void wpas_event_dfs_cac_finished(struct wpa_supplicant *wpa_s,
  71. struct dfs_event *radar)
  72. {
  73. + struct hostapd_iface *iface = wpa_s->ap_iface;
  74. +
  75. if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
  76. - return;
  77. + if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
  78. + return;
  79. + else
  80. + iface = wpa_s->ifmsh;
  81. +
  82. wpa_printf(MSG_DEBUG, "DFS CAC finished on %d MHz", radar->freq);
  83. - hostapd_dfs_complete_cac(wpa_s->ap_iface, 1, radar->freq,
  84. + hostapd_dfs_complete_cac(iface, 1, radar->freq,
  85. radar->ht_enabled, radar->chan_offset,
  86. radar->chan_width, radar->cf1, radar->cf2);
  87. }
  88. @@ -1568,10 +1589,15 @@ void wpas_event_dfs_cac_finished(struct
  89. void wpas_event_dfs_cac_aborted(struct wpa_supplicant *wpa_s,
  90. struct dfs_event *radar)
  91. {
  92. + struct hostapd_iface *iface = wpa_s->ap_iface;
  93. +
  94. if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
  95. - return;
  96. + if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
  97. + return;
  98. + else
  99. + iface = wpa_s->ifmsh;
  100. wpa_printf(MSG_DEBUG, "DFS CAC aborted on %d MHz", radar->freq);
  101. - hostapd_dfs_complete_cac(wpa_s->ap_iface, 0, radar->freq,
  102. + hostapd_dfs_complete_cac(iface, 0, radar->freq,
  103. radar->ht_enabled, radar->chan_offset,
  104. radar->chan_width, radar->cf1, radar->cf2);
  105. }
  106. @@ -1580,10 +1606,15 @@ void wpas_event_dfs_cac_aborted(struct w
  107. void wpas_event_dfs_cac_nop_finished(struct wpa_supplicant *wpa_s,
  108. struct dfs_event *radar)
  109. {
  110. + struct hostapd_iface *iface = wpa_s->ap_iface;
  111. +
  112. if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
  113. - return;
  114. + if (!wpa_s->ifmsh || !wpa_s->ifmsh->bss[0])
  115. + return;
  116. + else
  117. + iface = wpa_s->ifmsh;
  118. wpa_printf(MSG_DEBUG, "DFS NOP finished on %d MHz", radar->freq);
  119. - hostapd_dfs_nop_finished(wpa_s->ap_iface, radar->freq,
  120. + hostapd_dfs_nop_finished(iface, radar->freq,
  121. radar->ht_enabled, radar->chan_offset,
  122. radar->chan_width, radar->cf1, radar->cf2);
  123. }
  124. --- a/wpa_supplicant/events.c
  125. +++ b/wpa_supplicant/events.c
  126. @@ -4168,6 +4168,7 @@ void wpa_supplicant_event(void *ctx, enu
  127. if (wpa_s->current_ssid->mode == WPAS_MODE_AP ||
  128. wpa_s->current_ssid->mode == WPAS_MODE_P2P_GO ||
  129. + wpa_s->current_ssid->mode == WPAS_MODE_MESH ||
  130. wpa_s->current_ssid->mode ==
  131. WPAS_MODE_P2P_GROUP_FORMATION) {
  132. wpas_ap_ch_switch(wpa_s, data->ch_switch.freq,