340-reload_freq_change.patch 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. --- a/src/ap/hostapd.c
  2. +++ b/src/ap/hostapd.c
  3. @@ -80,6 +80,25 @@ 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->ieee80211n,
  10. + hapd->iconf->ieee80211ac,
  11. + hapd->iconf->secondary_channel,
  12. + hapd->iconf->vht_oper_chwidth,
  13. + hapd->iconf->vht_oper_centr_freq_seg0_idx,
  14. + hapd->iconf->vht_oper_centr_freq_seg1_idx);
  15. +
  16. + if (hapd->iface->current_mode) {
  17. + if (hostapd_prepare_rates(hapd->iface, hapd->iface->current_mode)) {
  18. + wpa_printf(MSG_ERROR, "Failed to prepare rates table.");
  19. + hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
  20. + HOSTAPD_LEVEL_WARNING,
  21. + "Failed to prepare rates table.");
  22. + }
  23. + }
  24. +
  25. if (!ssid->wpa_psk_set && ssid->wpa_psk && !ssid->wpa_psk->next &&
  26. ssid->wpa_passphrase_set && ssid->wpa_passphrase) {
  27. /*
  28. @@ -158,6 +177,7 @@ int hostapd_reload_config(struct hostapd
  29. struct hostapd_data *hapd = iface->bss[0];
  30. struct hostapd_config *newconf, *oldconf;
  31. size_t j;
  32. + int i;
  33. if (iface->config_fname == NULL) {
  34. /* Only in-memory config in use - assume it has been updated */
  35. @@ -179,21 +199,20 @@ int hostapd_reload_config(struct hostapd
  36. oldconf = hapd->iconf;
  37. iface->conf = newconf;
  38. + for (i = 0; i < iface->num_hw_features; i++) {
  39. + struct hostapd_hw_modes *mode = &iface->hw_features[i];
  40. + if (mode->mode == iface->conf->hw_mode) {
  41. + iface->current_mode = mode;
  42. + break;
  43. + }
  44. + }
  45. +
  46. + if (iface->conf->channel)
  47. + iface->freq = hostapd_hw_get_freq(hapd, iface->conf->channel);
  48. +
  49. for (j = 0; j < iface->num_bss; j++) {
  50. hapd = iface->bss[j];
  51. hapd->iconf = newconf;
  52. - hapd->iconf->channel = oldconf->channel;
  53. - hapd->iconf->acs = oldconf->acs;
  54. - hapd->iconf->secondary_channel = oldconf->secondary_channel;
  55. - hapd->iconf->ieee80211n = oldconf->ieee80211n;
  56. - hapd->iconf->ieee80211ac = oldconf->ieee80211ac;
  57. - hapd->iconf->ht_capab = oldconf->ht_capab;
  58. - hapd->iconf->vht_capab = oldconf->vht_capab;
  59. - hapd->iconf->vht_oper_chwidth = oldconf->vht_oper_chwidth;
  60. - hapd->iconf->vht_oper_centr_freq_seg0_idx =
  61. - oldconf->vht_oper_centr_freq_seg0_idx;
  62. - hapd->iconf->vht_oper_centr_freq_seg1_idx =
  63. - oldconf->vht_oper_centr_freq_seg1_idx;
  64. hapd->conf = newconf->bss[j];
  65. hostapd_reload_bss(hapd);
  66. }