Guest User

Untitled

a guest
Aug 11th, 2025
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 5.34 KB | None | 0 0
  1. diff --git a/hostapd/config_file.c b/hostapd/config_file.c
  2. index 3fb059770..664d14ebe 100644
  3. --- a/hostapd/config_file.c
  4. +++ b/hostapd/config_file.c
  5. @@ -3091,6 +3091,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
  6.                                    line, bss->wpa_deny_ptk0_rekey);
  7.                         return 1;
  8.                 }
  9. +    } else if (os_strcmp(buf, "noscan") == 0) {
  10. +        conf->noscan = atoi(pos);
  11.         } else if (os_strcmp(buf, "wpa_group_update_count") == 0) {
  12.                 char *endp;
  13.                 unsigned long val = strtoul(pos, &endp, 0);
  14. @@ -3678,6 +3680,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
  15.                 if (bss->ocv && !bss->ieee80211w)
  16.                         bss->ieee80211w = 1;
  17.  #endif /* CONFIG_OCV */
  18. +    } else if (os_strcmp(buf, "noscan") == 0) {
  19. +        conf->noscan = atoi(pos);
  20.         } else if (os_strcmp(buf, "ieee80211n") == 0) {
  21.                 conf->ieee80211n = atoi(pos);
  22.         } else if (os_strcmp(buf, "ht_capab") == 0) {
  23. diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
  24. index ced2181ab..9160eb5bf 100644
  25. --- a/src/ap/ap_config.h
  26. +++ b/src/ap/ap_config.h
  27. @@ -1108,6 +1108,7 @@ struct hostapd_config {
  28.  
  29.         int ht_op_mode_fixed;
  30.         u16 ht_capab;
  31. +    int noscan;
  32.         int ieee80211n;
  33.         int secondary_channel;
  34.         int no_pri_sec_switch;
  35. diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c
  36. index c4556603d..10d4400a6 100644
  37. --- a/src/ap/hw_features.c
  38. +++ b/src/ap/hw_features.c
  39. @@ -24,6 +24,17 @@
  40.  #include "beacon.h"
  41.  #include "hw_features.h"
  42.  
  43. +static void ieee80211n_do_nothing(struct hostapd_iface *iface)
  44. +{
  45. +                       wpa_printf(MSG_DEBUG,
  46. +                                  "Scan finished!");
  47. +}
  48. +
  49. +static void ieee80211n_scan_channels_2g4(struct hostapd_iface *iface,
  50. +                                        struct wpa_driver_scan_params *params);
  51. +static void ieee80211n_scan_channels_5g(struct hostapd_iface *iface,
  52. +                                       struct wpa_driver_scan_params *params);
  53. +
  54.  
  55.  void hostapd_free_hw_features(struct hostapd_hw_modes *hw_features,
  56.                               size_t num_hw_features)
  57. @@ -85,6 +96,33 @@ int hostapd_get_hw_features(struct hostapd_iface *iface)
  58.  
  59.         if (hostapd_drv_none(hapd))
  60.                 return -1;
  61. +
  62. +
  63. +
  64. +        // scan
  65. +       struct wpa_driver_scan_params params;
  66. +       int ret1;
  67. +
  68. +       os_memset(&params, 0, sizeof(params));
  69. +       ieee80211n_scan_channels_5g(iface, &params);
  70. +
  71. +       ret1 = hostapd_driver_scan(iface->bss[0], &params);
  72. +
  73. +        if (ret1 == -EBUSY) {
  74. +                wpa_printf(MSG_ERROR,
  75. +                           "Failed to request a scan of neighboring BSSes ret=%d (%s)!",
  76. +                           ret1, strerror(-ret1));
  77. +        }
  78. +
  79. +        if (ret1 == 0) {
  80. +                iface->scan_cb = ieee80211n_do_nothing;
  81. +                wpa_printf(MSG_DEBUG,
  82. +                           "Sleeping...");
  83. +                for (int i=0; i<110; i++) {
  84. +                  usleep(100000);
  85. +                }
  86. +        }
  87. +
  88.         modes = hostapd_get_hw_feature_data(hapd, &num_modes, &flags,
  89.                                             &dfs_domain);
  90.         if (modes == NULL) {
  91. @@ -335,7 +373,6 @@ static int ieee80211n_check_40mhz_2g4(struct hostapd_iface *iface,
  92.                                sec_chan);
  93.  }
  94.  
  95. -
  96.  static void ieee80211n_check_scan(struct hostapd_iface *iface)
  97.  {
  98.         struct wpa_scan_results *scan_res;
  99. @@ -551,8 +588,10 @@ static int ieee80211n_check_40mhz(struct hostapd_iface *iface)
  100.         int ret;
  101.  
  102.         /* Check that HT40 is used and PRI / SEC switch is allowed */
  103. -       if (!iface->conf->secondary_channel || iface->conf->no_pri_sec_switch)
  104. +       if (!iface->conf->secondary_channel || iface->conf->no_pri_sec_switch || iface->conf->noscan) {
  105. +                wpa_printf(MSG_DEBUG, "Not scanning due to noscan?");
  106.                 return 0;
  107. +        }
  108.  
  109.         hostapd_set_state(iface, HAPD_IFACE_HT_SCAN);
  110.         wpa_printf(MSG_DEBUG, "Scan for neighboring BSSes prior to enabling "
  111. @@ -1037,7 +1076,7 @@ static int hostapd_is_usable_chans(struct hostapd_iface *iface)
  112.         if (!hostapd_is_usable_punct_bitmap(iface))
  113.                 return 0;
  114.  
  115. -       if (!iface->conf->secondary_channel)
  116. +       if (!iface->conf->secondary_channel || iface->conf->noscan)
  117.                 return 1;
  118.  
  119.         err = hostapd_is_usable_chan(iface, iface->freq +
  120. diff --git a/src/ap/ieee802_11_ht.c b/src/ap/ieee802_11_ht.c
  121. index f90f1254e..2b4d2ef66 100644
  122. --- a/src/ap/ieee802_11_ht.c
  123. +++ b/src/ap/ieee802_11_ht.c
  124. @@ -230,6 +230,9 @@ void hostapd_2040_coex_action(struct hostapd_data *hapd,
  125.                 return;
  126.         }
  127.  
  128. +    if (iface->conf->noscan)
  129. +        return;
  130. +
  131.         if (len < IEEE80211_HDRLEN + 2 + sizeof(*bc_ie)) {
  132.                 wpa_printf(MSG_DEBUG,
  133.                            "Ignore too short 20/40 BSS Coexistence Management frame");
  134. @@ -390,6 +393,9 @@ void ht40_intolerant_add(struct hostapd_iface *iface, struct sta_info *sta)
  135.         if (iface->current_mode->mode != HOSTAPD_MODE_IEEE80211G)
  136.                 return;
  137.  
  138. +    if (iface->conf->noscan)
  139. +        return;
  140. +
  141.         wpa_printf(MSG_INFO, "HT: Forty MHz Intolerant is set by STA " MACSTR
  142.                    " in Association Request", MAC2STR(sta->addr));
  143.  
Advertisement
Add Comment
Please, Sign In to add comment