340-reload_freq_change.patch 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. --- a/src/ap/hostapd.c
  2. +++ b/src/ap/hostapd.c
  3. @@ -115,6 +115,28 @@ static void hostapd_reload_bss(struct ho
  4. #endif /* CONFIG_NO_RADIUS */
  5. ssid = &hapd->conf->ssid;
  6. +
  7. + hostapd_set_freq(hapd, hapd->iconf->hw_mode, hapd->iface->freq,
  8. + hapd->iconf->channel,
  9. + hapd->iconf->enable_edmg,
  10. + hapd->iconf->edmg_channel,
  11. + hapd->iconf->ieee80211n,
  12. + hapd->iconf->ieee80211ac,
  13. + hapd->iconf->ieee80211ax,
  14. + hapd->iconf->secondary_channel,
  15. + hostapd_get_oper_chwidth(hapd->iconf),
  16. + hostapd_get_oper_centr_freq_seg0_idx(hapd->iconf),
  17. + hostapd_get_oper_centr_freq_seg1_idx(hapd->iconf));
  18. +
  19. + if (hapd->iface->current_mode) {
  20. + if (hostapd_prepare_rates(hapd->iface, hapd->iface->current_mode)) {
  21. + wpa_printf(MSG_ERROR, "Failed to prepare rates table.");
  22. + hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
  23. + HOSTAPD_LEVEL_WARNING,
  24. + "Failed to prepare rates table.");
  25. + }
  26. + }
  27. +
  28. if (!ssid->wpa_psk_set && ssid->wpa_psk && !ssid->wpa_psk->next &&
  29. ssid->wpa_passphrase_set && ssid->wpa_passphrase) {
  30. /*
  31. @@ -216,6 +238,7 @@ int hostapd_reload_config(struct hostapd
  32. struct hostapd_data *hapd = iface->bss[0];
  33. struct hostapd_config *newconf, *oldconf;
  34. size_t j;
  35. + int i;
  36. if (iface->config_fname == NULL) {
  37. /* Only in-memory config in use - assume it has been updated */
  38. @@ -266,24 +289,20 @@ int hostapd_reload_config(struct hostapd
  39. }
  40. iface->conf = newconf;
  41. + for (i = 0; i < iface->num_hw_features; i++) {
  42. + struct hostapd_hw_modes *mode = &iface->hw_features[i];
  43. + if (mode->mode == iface->conf->hw_mode) {
  44. + iface->current_mode = mode;
  45. + break;
  46. + }
  47. + }
  48. +
  49. + if (iface->conf->channel)
  50. + iface->freq = hostapd_hw_get_freq(hapd, iface->conf->channel);
  51. +
  52. for (j = 0; j < iface->num_bss; j++) {
  53. hapd = iface->bss[j];
  54. hapd->iconf = newconf;
  55. - hapd->iconf->channel = oldconf->channel;
  56. - hapd->iconf->acs = oldconf->acs;
  57. - hapd->iconf->secondary_channel = oldconf->secondary_channel;
  58. - hapd->iconf->ieee80211n = oldconf->ieee80211n;
  59. - hapd->iconf->ieee80211ac = oldconf->ieee80211ac;
  60. - hapd->iconf->ht_capab = oldconf->ht_capab;
  61. - hapd->iconf->vht_capab = oldconf->vht_capab;
  62. - hostapd_set_oper_chwidth(hapd->iconf,
  63. - hostapd_get_oper_chwidth(oldconf));
  64. - hostapd_set_oper_centr_freq_seg0_idx(
  65. - hapd->iconf,
  66. - hostapd_get_oper_centr_freq_seg0_idx(oldconf));
  67. - hostapd_set_oper_centr_freq_seg1_idx(
  68. - hapd->iconf,
  69. - hostapd_get_oper_centr_freq_seg1_idx(oldconf));
  70. hapd->conf = newconf->bss[j];
  71. hostapd_reload_bss(hapd);
  72. }