hostapd-0.7.3-ht40-secondary.patch 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. From dea50507861b79f522c70500fe978072f143af8f Mon Sep 17 00:00:00 2001
  2. From: Jouni Malinen <jouni.malinen@atheros.com>
  3. Date: Fri, 12 Nov 2010 18:31:56 +0200
  4. Subject: [PATCH] AP: Verify that HT40 secondary channel is supported
  5. Refuse to enable HT40 mode AP unless both the primary and secondary
  6. channels are enabled for AP use.
  7. (cherry picked from commit 8ea3dd21d2e8b760612af0c7b6a3bb5b89ba7304)
  8. ---
  9. src/ap/hw_features.c | 26 ++++++++++++++++++++++++++
  10. 1 files changed, 26 insertions(+), 0 deletions(-)
  11. diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c
  12. index 0159c72..7fc5b83 100644
  13. --- a/src/ap/hw_features.c
  14. +++ b/src/ap/hw_features.c
  15. @@ -642,6 +642,32 @@ int hostapd_select_hw_mode(struct hostapd_iface *iface)
  16. break;
  17. }
  18. }
  19. + if (ok && iface->conf->secondary_channel) {
  20. + int sec_ok = 0;
  21. + int sec_chan = iface->conf->channel +
  22. + iface->conf->secondary_channel * 4;
  23. + for (j = 0; j < iface->current_mode->num_channels; j++) {
  24. + struct hostapd_channel_data *chan =
  25. + &iface->current_mode->channels[j];
  26. + if (!(chan->flag & HOSTAPD_CHAN_DISABLED) &&
  27. + (chan->chan == sec_chan)) {
  28. + sec_ok = 1;
  29. + break;
  30. + }
  31. + }
  32. + if (!sec_ok) {
  33. + hostapd_logger(iface->bss[0], NULL,
  34. + HOSTAPD_MODULE_IEEE80211,
  35. + HOSTAPD_LEVEL_WARNING,
  36. + "Configured HT40 secondary channel "
  37. + "(%d) not found from the channel list "
  38. + "of current mode (%d) %s",
  39. + sec_chan, iface->current_mode->mode,
  40. + hostapd_hw_mode_txt(
  41. + iface->current_mode->mode));
  42. + ok = 0;
  43. + }
  44. + }
  45. if (iface->conf->channel == 0) {
  46. /* TODO: could request a scan of neighboring BSSes and select
  47. * the channel automatically */
  48. --
  49. 1.7.4-rc1