public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
From: Michael Tremer <michael.tremer@ipfire.org>
To: development@lists.ipfire.org
Cc: Michael Tremer <michael.tremer@ipfire.org>
Subject: [PATCH 8/9] hostapd: Fix 40 MHz flags when manually chosing the channel
Date: Wed, 29 Apr 2026 19:49:33 +0000	[thread overview]
Message-ID: <20260429194934.863108-8-michael.tremer@ipfire.org> (raw)
In-Reply-To: <20260429194934.863108-1-michael.tremer@ipfire.org>

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
---
 src/initscripts/packages/hostapd | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/src/initscripts/packages/hostapd b/src/initscripts/packages/hostapd
index eb00e11d3..3d6ea4f69 100644
--- a/src/initscripts/packages/hostapd
+++ b/src/initscripts/packages/hostapd
@@ -189,6 +189,9 @@ write_config() {
 	local he_caps=()
 	local eht_caps=()
 
+	# Clear [HT40+][HT40-]
+	ht_flags="$(( ht_flags & ~0x0002 ))"
+
 	# HT Capabilities
 	for flag in ${!HT_CAPS[@]}; do
 		if (( ${ht_flags} & ${flag} )); then
@@ -381,8 +384,32 @@ write_config() {
 	local enable_n=0
 
 	case "${CONFIG["MODE"]}" in
-		HT*|VHT*|HE*|EHT*)
+		HT20|VHT20|HE20|EHT20)
+			enable_n=1
+			;;
+
+		*40|*80|*160|*320)
 			enable_n=1
+
+			case "${CONFIG["BAND"]}" in
+				6g|5g)
+					case "$(( ((${CONFIG["CHANNEL"]} / 4) + channel_offset) % 2 ))" in
+						0)
+							ht_caps+=( "[HT40-]" )
+							;;
+						1)
+							ht_caps+=( "[HT40+]" )
+							;;
+					esac
+					;;
+				2g)
+					if [ "${CONFIG["CHANNEL"]}" -lt 7 ]; then
+						ht_caps+=( "[HT40+]" )
+					else
+						ht_caps+=( "[HT40-]" )
+					fi
+					;;
+			esac
 			;;
 	esac
 
-- 
2.47.3



  parent reply	other threads:[~2026-04-29 19:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-29 19:49 [PATCH 1/9] hostapd: Force setting reg domain before hostapd starts Michael Tremer
2026-04-29 19:49 ` [PATCH 2/9] wlanap.cgi: Add option to select 6 GHz band Michael Tremer
2026-04-29 19:49 ` [PATCH 3/9] hostapd: Correctly parse capabilities for the " Michael Tremer
2026-04-29 19:49 ` [PATCH 4/9] hostapd: Add support " Michael Tremer
2026-04-29 19:49 ` [PATCH 5/9] hostapd: Configure as indoor AP and increase transmit power Michael Tremer
2026-04-29 19:49 ` [PATCH 6/9] hostapd: Disable 802.11n in 6 GHz band, too Michael Tremer
2026-04-29 19:49 ` [PATCH 7/9] hostapd: Tell the AP that the antennas won't change Michael Tremer
2026-04-29 19:49 ` Michael Tremer [this message]
2026-04-29 19:49 ` [PATCH 9/9] hostapd: Bump version Michael Tremer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260429194934.863108-8-michael.tremer@ipfire.org \
    --to=michael.tremer@ipfire.org \
    --cc=development@lists.ipfire.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox