400-scan_wait.patch 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. --- a/src/ap/hostapd.h
  2. +++ b/src/ap/hostapd.h
  3. @@ -247,6 +247,7 @@ struct hostapd_iface {
  4. int (*for_each_interface)(struct hapd_interfaces *interfaces,
  5. int (*cb)(struct hostapd_iface *iface,
  6. void *ctx), void *ctx);
  7. + int (*init_complete)(struct hostapd_iface *iface);
  8. };
  9. /* hostapd.c */
  10. --- a/src/ap/hostapd.c
  11. +++ b/src/ap/hostapd.c
  12. @@ -852,6 +852,9 @@ int hostapd_setup_interface_complete(str
  13. wpa_printf(MSG_DEBUG, "%s: Setup of interface done.",
  14. iface->bss[0]->conf->iface);
  15. + if (iface->init_complete)
  16. + iface->init_complete(iface);
  17. +
  18. return 0;
  19. }
  20. --- a/hostapd/main.c
  21. +++ b/hostapd/main.c
  22. @@ -31,6 +31,8 @@
  23. extern int wpa_debug_level;
  24. extern int wpa_debug_show_keys;
  25. extern int wpa_debug_timestamp;
  26. +static int daemonize = 0;
  27. +static char *pid_file = NULL;
  28. extern struct wpa_driver_ops *wpa_drivers[];
  29. @@ -145,6 +147,16 @@ static void hostapd_logger_cb(void *ctx,
  30. }
  31. #endif /* CONFIG_NO_HOSTAPD_LOGGER */
  32. +static int hostapd_init_complete(struct hostapd_iface *iface)
  33. +{
  34. + if (daemonize && os_daemonize(pid_file)) {
  35. + perror("daemon");
  36. + return -1;
  37. + }
  38. + daemonize = 0;
  39. + return 0;
  40. +}
  41. +
  42. /**
  43. * hostapd_init - Allocate and initialize per-interface data
  44. @@ -166,6 +178,7 @@ static struct hostapd_iface * hostapd_in
  45. if (hapd_iface == NULL)
  46. goto fail;
  47. + hapd_iface->init_complete = hostapd_init_complete;
  48. hapd_iface->reload_config = hostapd_reload_config;
  49. hapd_iface->config_read_cb = hostapd_config_read;
  50. hapd_iface->config_fname = os_strdup(config_file);
  51. @@ -419,7 +432,7 @@ static int hostapd_global_init(struct ha
  52. }
  53. -static void hostapd_global_deinit(const char *pid_file)
  54. +static void hostapd_global_deinit(void)
  55. {
  56. int i;
  57. @@ -449,8 +462,7 @@ static void hostapd_global_deinit(const
  58. }
  59. -static int hostapd_global_run(struct hapd_interfaces *ifaces, int daemonize,
  60. - const char *pid_file)
  61. +static int hostapd_global_run(struct hapd_interfaces *iface)
  62. {
  63. #ifdef EAP_SERVER_TNC
  64. int tnc = 0;
  65. @@ -471,11 +483,6 @@ static int hostapd_global_run(struct hap
  66. }
  67. #endif /* EAP_SERVER_TNC */
  68. - if (daemonize && os_daemonize(pid_file)) {
  69. - perror("daemon");
  70. - return -1;
  71. - }
  72. -
  73. eloop_run();
  74. return 0;
  75. @@ -532,8 +539,7 @@ int main(int argc, char *argv[])
  76. struct hapd_interfaces interfaces;
  77. int ret = 1;
  78. size_t i;
  79. - int c, debug = 0, daemonize = 0;
  80. - char *pid_file = NULL;
  81. + int c, debug = 0;
  82. const char *log_file = NULL;
  83. const char *entropy_file = NULL;
  84. @@ -611,7 +617,7 @@ int main(int argc, char *argv[])
  85. goto out;
  86. }
  87. - if (hostapd_global_run(&interfaces, daemonize, pid_file))
  88. + if (hostapd_global_run(&interfaces))
  89. goto out;
  90. ret = 0;
  91. @@ -622,7 +628,7 @@ int main(int argc, char *argv[])
  92. hostapd_interface_deinit_free(interfaces.iface[i]);
  93. os_free(interfaces.iface);
  94. - hostapd_global_deinit(pid_file);
  95. + hostapd_global_deinit();
  96. os_free(pid_file);
  97. if (log_file)
  98. --- a/hostapd/config_file.c
  99. +++ b/hostapd/config_file.c
  100. @@ -1947,6 +1947,8 @@ static int hostapd_config_fill(struct ho
  101. }
  102. #endif /* CONFIG_IEEE80211W */
  103. #ifdef CONFIG_IEEE80211N
  104. + } else if (os_strcmp(buf, "noscan") == 0) {
  105. + conf->noscan = atoi(pos);
  106. } else if (os_strcmp(buf, "ieee80211n") == 0) {
  107. conf->ieee80211n = atoi(pos);
  108. } else if (os_strcmp(buf, "ht_capab") == 0) {
  109. --- a/src/ap/ap_config.h
  110. +++ b/src/ap/ap_config.h
  111. @@ -430,6 +430,7 @@ struct hostapd_config {
  112. int ht_op_mode_fixed;
  113. u16 ht_capab;
  114. + int noscan;
  115. int ieee80211n;
  116. int secondary_channel;
  117. int require_ht;
  118. --- a/src/ap/hw_features.c
  119. +++ b/src/ap/hw_features.c
  120. @@ -491,7 +491,7 @@ static int ieee80211n_check_40mhz(struct
  121. {
  122. struct wpa_driver_scan_params params;
  123. - if (!iface->conf->secondary_channel)
  124. + if (!iface->conf->secondary_channel || iface->conf->noscan)
  125. return 0; /* HT40 not used */
  126. wpa_printf(MSG_DEBUG, "Scan for neighboring BSSes prior to enabling "