dotfiles/patches/0001-intel_lar-and-noscan.patch
Magic_RB fed32ecfca Possibly functional blowhole configuration
Signed-off-by: Magic_RB <magic_rb@redalder.org>
2023-06-16 16:08:09 +02:00

160 lines
5.1 KiB
Diff

From 3590d38c853ce2fd7c2397f6421171234fb9d0a6 Mon Sep 17 00:00:00 2001
From: Magic_RB <magic_rb@redalder.org>
Date: Sat, 27 May 2023 18:11:58 +0200
Subject: [PATCH] intel_lar and noscan
Signed-off-by: Magic_RB <magic_rb@redalder.org>
---
hostapd/config_file.c | 4 ++++
src/ap/ap_config.h | 1 +
src/ap/hw_features.c | 45 +++++++++++++++++++++++++++++++++++++++---
src/ap/ieee802_11_ht.c | 6 ++++++
4 files changed, 53 insertions(+), 3 deletions(-)
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 8e179d151..6fa0849a0 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -2874,6 +2874,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
line, bss->wpa_deny_ptk0_rekey);
return 1;
}
+ } else if (os_strcmp(buf, "noscan") == 0) {
+ conf->noscan = atoi(pos);
} else if (os_strcmp(buf, "wpa_group_update_count") == 0) {
char *endp;
unsigned long val = strtoul(pos, &endp, 0);
@@ -3446,6 +3448,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
if (bss->ocv && !bss->ieee80211w)
bss->ieee80211w = 1;
#endif /* CONFIG_OCV */
+ } else if (os_strcmp(buf, "noscan") == 0) {
+ conf->noscan = atoi(pos);
} else if (os_strcmp(buf, "ieee80211n") == 0) {
conf->ieee80211n = atoi(pos);
} else if (os_strcmp(buf, "ht_capab") == 0) {
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index 8598602b1..a25cf2cbe 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -1061,6 +1061,7 @@ struct hostapd_config {
int ht_op_mode_fixed;
u16 ht_capab;
+ int noscan;
int ieee80211n;
int secondary_channel;
int no_pri_sec_switch;
diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c
index 842d9f5ba..30ff7b496 100644
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -24,6 +24,17 @@
#include "beacon.h"
#include "hw_features.h"
+static void ieee80211n_do_nothing(struct hostapd_iface *iface)
+{
+ wpa_printf(MSG_DEBUG,
+ "Scan finished!");
+}
+
+static void ieee80211n_scan_channels_2g4(struct hostapd_iface *iface,
+ struct wpa_driver_scan_params *params);
+static void ieee80211n_scan_channels_5g(struct hostapd_iface *iface,
+ struct wpa_driver_scan_params *params);
+
void hostapd_free_hw_features(struct hostapd_hw_modes *hw_features,
size_t num_hw_features)
@@ -82,6 +93,33 @@ int hostapd_get_hw_features(struct hostapd_iface *iface)
if (hostapd_drv_none(hapd))
return -1;
+
+
+
+ // scan
+ struct wpa_driver_scan_params params;
+ int ret1;
+
+ os_memset(&params, 0, sizeof(params));
+ ieee80211n_scan_channels_5g(iface, &params);
+
+ ret1 = hostapd_driver_scan(iface->bss[0], &params);
+
+ if (ret1 == -EBUSY) {
+ wpa_printf(MSG_ERROR,
+ "Failed to request a scan of neighboring BSSes ret=%d (%s)!",
+ ret1, strerror(-ret1));
+ }
+
+ if (ret1 == 0) {
+ iface->scan_cb = ieee80211n_do_nothing;
+ wpa_printf(MSG_DEBUG,
+ "Sleeping...");
+ for (int i=0; i<110; i++) {
+ usleep(100000);
+ }
+ }
+
modes = hostapd_get_hw_feature_data(hapd, &num_modes, &flags,
&dfs_domain);
if (modes == NULL) {
@@ -308,7 +346,6 @@ static int ieee80211n_check_40mhz_2g4(struct hostapd_iface *iface,
sec_chan);
}
-
static void ieee80211n_check_scan(struct hostapd_iface *iface)
{
struct wpa_scan_results *scan_res;
@@ -517,8 +554,10 @@ static int ieee80211n_check_40mhz(struct hostapd_iface *iface)
int ret;
/* Check that HT40 is used and PRI / SEC switch is allowed */
- if (!iface->conf->secondary_channel || iface->conf->no_pri_sec_switch)
+ if (!iface->conf->secondary_channel || iface->conf->no_pri_sec_switch || iface->conf->noscan) {
+ wpa_printf(MSG_DEBUG, "Not scanning due to noscan?");
return 0;
+ }
hostapd_set_state(iface, HAPD_IFACE_HT_SCAN);
wpa_printf(MSG_DEBUG, "Scan for neighboring BSSes prior to enabling "
@@ -967,7 +1006,7 @@ static int hostapd_is_usable_chans(struct hostapd_iface *iface)
if (!hostapd_is_usable_punct_bitmap(iface))
return 0;
- if (!iface->conf->secondary_channel)
+ if (!iface->conf->secondary_channel || iface->conf->noscan)
return 1;
if (hostapd_is_usable_chan(iface, iface->freq +
diff --git a/src/ap/ieee802_11_ht.c b/src/ap/ieee802_11_ht.c
index 59ecbdce7..99d6e82bc 100644
--- a/src/ap/ieee802_11_ht.c
+++ b/src/ap/ieee802_11_ht.c
@@ -230,6 +230,9 @@ void hostapd_2040_coex_action(struct hostapd_data *hapd,
return;
}
+ if (iface->conf->noscan)
+ return;
+
if (len < IEEE80211_HDRLEN + 2 + sizeof(*bc_ie)) {
wpa_printf(MSG_DEBUG,
"Ignore too short 20/40 BSS Coexistence Management frame");
@@ -390,6 +393,9 @@ void ht40_intolerant_add(struct hostapd_iface *iface, struct sta_info *sta)
if (iface->current_mode->mode != HOSTAPD_MODE_IEEE80211G)
return;
+ if (iface->conf->noscan)
+ return;
+
wpa_printf(MSG_INFO, "HT: Forty MHz Intolerant is set by STA " MACSTR
" in Association Request", MAC2STR(sta->addr));
--
2.39.1