wlan-ap-Telecominfraproject/feeds/qca/hostapd/patches/b00-014-hostapd-add-ht40-allow-map.patch
John Crispin 008ca9618d
Some checks failed
Build OpenWrt/uCentral images / build (cig_wf186h) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf186w) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf188n) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf189) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf196) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cybertan_eww631-a1) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cybertan_eww631-b1) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap101) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap102) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap104) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap105) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap111) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap112) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101-6e) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101e) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101e-6e) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x_2) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x_3) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x_w) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4xe) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4xi) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4xi_w) (push) Has been cancelled
Build OpenWrt/uCentral images / build (indio_um-305ax) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sercomm_ap72tip) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sonicfi_rap630c-311g) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sonicfi_rap630w-211g) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sonicfi_rap630w-311g) (push) Has been cancelled
Build OpenWrt/uCentral images / build (udaya_a6-id2) (push) Has been cancelled
Build OpenWrt/uCentral images / build (udaya_a6-od2) (push) Has been cancelled
Build OpenWrt/uCentral images / build (wallys_dr5018) (push) Has been cancelled
Build OpenWrt/uCentral images / build (wallys_dr6018) (push) Has been cancelled
Build OpenWrt/uCentral images / build (wallys_dr6018-v4) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_ax820) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_ax840) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_fap640) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_fap650) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_fap655) (push) Has been cancelled
Build OpenWrt/uCentral images / trigger-testing (push) Has been cancelled
Build OpenWrt/uCentral images / create-x64_vm-ami (push) Has been cancelled
ipq95xx: import ath12.4-cs kernel and drivers
Signed-off-by: John Crispin <john@phrozen.org>
2024-10-20 09:25:13 +02:00

135 lines
4.0 KiB
Diff

diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
index 55711ab..b744c92 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -3221,6 +3221,93 @@ fail:
}
+static int hostapd_2ghz_ht40_allow_map(struct hostapd_hw_modes *mode,
+ char *buf, size_t buflen)
+{
+ int j, ret, len = 0;
+
+ for (j = 0; j < mode->num_channels; j++) {
+ struct hostapd_channel_data *chan = &mode->channels[j];
+ if (!(chan->flag & HOSTAPD_CHAN_DISABLED)) {
+ ret = os_snprintf(buf + len, buflen - len,
+ "Channel: %d : %d HT40%c%c\n",
+ chan->chan, chan->freq,
+ (chan->flag & HOSTAPD_CHAN_HT40MINUS) ?
+ '-' : ' ',
+ (chan->flag & HOSTAPD_CHAN_HT40PLUS) ?
+ '+' : ' ');
+ if (os_snprintf_error(buflen - len, ret))
+ return len;
+ len += ret;
+ }
+ }
+ return len;
+}
+
+static int hostapd_5ghz_ht40_allow_map(struct hostapd_hw_modes *mode,
+ char *buf, size_t buflen)
+{
+ int j, k, ok, ret, len = 0, allowed[] = { 36, 44, 52, 60, 100, 108, 116, 124, 132, 140,
+ 149, 157, 184, 192 };
+
+ for (j = 0; j < mode->num_channels; j++) {
+ struct hostapd_channel_data *chan = &mode->channels[j];
+
+ if ((chan->flag & HOSTAPD_CHAN_HT40MINUS) ||
+ (chan->flag & HOSTAPD_CHAN_HT40PLUS)) {
+ ok = 0;
+ for (k = 0; k < ARRAY_SIZE(allowed); k++) {
+ if (chan->chan < allowed[k])
+ break;
+ if (chan->chan == allowed[k]) {
+ ok = 1;
+ break;
+ }
+ }
+
+ if (!ok && chan->chan != (allowed[k - 1] + 4))
+ ok = -1;
+
+ if (ok == 1 && (mode->channels[j + 1].flag &
+ HOSTAPD_CHAN_DISABLED))
+ ok = -1;
+
+ if (ok != -1) {
+ ret = os_snprintf(buf + len, buflen - len,
+ "Channel: %d : %d HT40%s\n",
+ chan->chan, chan->freq,
+ ok == 1 ? "+" : "-");
+
+ if (os_snprintf_error(buflen - len, ret))
+ return len;
+
+ len += ret;
+ }
+ }
+ }
+ return len;
+}
+
+static int hostapd_ctrl_iface_ht40_allow_map(struct hostapd_iface *iface,
+ char *buf, size_t buflen)
+{
+ struct hostapd_data *hapd = iface->bss[0];
+ struct hostapd_hw_modes *mode;
+ int len = 0;
+ u16 num_modes, flags;
+ u8 dfs_domain;
+
+ mode = hostapd_get_hw_feature_data(hapd, &num_modes, &flags,
+ &dfs_domain);
+
+ if (mode->mode != HOSTAPD_MODE_IEEE80211A)
+ len = hostapd_2ghz_ht40_allow_map(mode, buf, buflen);
+ else
+ len = hostapd_5ghz_ht40_allow_map(mode, buf, buflen);
+
+ return len;
+}
+
static int hostapd_ctrl_iface_remove_neighbor(struct hostapd_data *hapd,
char *buf)
{
@@ -3891,6 +3978,10 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
if (radius_server_dac_request(hapd->radius_srv, buf + 12) < 0)
reply_len = -1;
#endif /* RADIUS_SERVER */
+ } else if (os_strcmp(buf, "HT40_ALLOW_MAP") == 0) {
+ reply_len = hostapd_ctrl_iface_ht40_allow_map(hapd->iface,
+ reply,
+ reply_size);
} else if (os_strncmp(buf, "GET_CAPABILITY ", 15) == 0) {
reply_len = hostapd_ctrl_iface_get_capability(
hapd, buf + 15, reply, reply_size);
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
index 61f8cba..ef33968 100644
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -1381,6 +1381,11 @@ static int hostapd_cli_cmd_driver_flags(struct wpa_ctrl *ctrl, int argc,
return wpa_ctrl_command(ctrl, "DRIVER_FLAGS");
}
+static int hostapd_cli_cmd_ht40_allow_map(struct wpa_ctrl *ctrl,
+ int argc, char *argv[])
+{
+ return wpa_ctrl_command(ctrl, "HT40_ALLOW_MAP");
+}
#ifdef CONFIG_DPP
@@ -1765,6 +1770,8 @@ static const struct hostapd_cli_cmd hostapd_cli_commands[] = {
"=Add/Delete/Show/Clear deny MAC ACL" },
{ "poll_sta", hostapd_cli_cmd_poll_sta, hostapd_complete_stations,
"<addr> = poll a STA to check connectivity with a QoS null frame" },
+ { "ht40_allow_map", hostapd_cli_cmd_ht40_allow_map, NULL,
+ "= show ht40 allow map status" },
{ "req_beacon", hostapd_cli_cmd_req_beacon, NULL,
"<addr> [req_mode=] <measurement request hexdump> = send a Beacon report request to a station" },
{ "reload_wpa_psk", hostapd_cli_cmd_reload_wpa_psk, NULL,