[PATCH] AP: Don't pass eht_oper_puncturing_override to the driver
Andrei Otcheretianski
andrei.otcheretianski at intel.com
Wed Nov 25 07:16:20 PST 2026
From: Shaul Triebitz <shaul.triebitz at intel.com>
eht_oper_puncturing_override is a testing option for advertising a
puncturing bitmap in the operation elements without actually puncturing.
It is used for testing the station side, and some tests intentionally
advertise a bitmap that is invalid for the operating bandwidth, so it
must never be used for the actual channel configuration.
Since commit 9f43c1e26bc6 ("Provide punct_bitmap to
hostapd_set_freq_params()") it is also passed to the driver as
freq->punct_bitmap, which nl80211 rejects with -EINVAL unless the driver
advertises NL80211_EXT_FEATURE_PUNCT, so AP setup fails.
Add an include_override argument to hostapd_get_punct_bitmap() and set
it only where the advertised elements and channel information are built.
Driver and channel configuration now uses the configured punct_bitmap
only.
The eht_5ghz_80mhz_puncturing_override_{1,2,3} tests relied on the
override reaching hostapd_set_freq_params(); convert them to the real
punct_bitmap and rename accordingly.
Fixes: 9f43c1e26bc6 ("Provide punct_bitmap to hostapd_set_freq_params()")
Signed-off-by: Shaul Triebitz <shaul.triebitz at intel.com>
---
src/ap/ap_drv_ops.c | 4 ++--
src/ap/beacon.c | 2 +-
src/ap/dfs.c | 3 ++-
src/ap/hostapd.c | 9 +++++----
src/ap/hostapd.h | 11 ++++++++++-
src/ap/ieee802_11_eht.c | 2 +-
src/ap/ieee802_11_he.c | 2 +-
src/ap/ieee802_11_ht.c | 2 +-
src/ap/ieee802_11_vht.c | 2 +-
tests/hwsim/test_eht.py | 28 ++++++++++++++--------------
10 files changed, 38 insertions(+), 27 deletions(-)
diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
index 099a0c9a42..43203f87ac 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -701,7 +701,7 @@ int hostapd_set_freq(struct hostapd_data *hapd, enum hostapd_hw_mode mode,
.vht.caps = cmode ? cmode->vht_capab : 0,
.he.cap = cmode ? &cmode->he_capab[IEEE80211_MODE_AP] : NULL,
.eht.cap = cmode ? &cmode->eht_capab[IEEE80211_MODE_AP] : NULL,
- .eht.punct_bitmap = hostapd_get_punct_bitmap(hapd),
+ .eht.punct_bitmap = hostapd_get_punct_bitmap(hapd, false),
};
if (hostapd_set_freq_params(&data, &info))
@@ -1155,7 +1155,7 @@ int hostapd_start_dfs_cac(struct hostapd_iface *iface,
.vht.caps = cmode ? cmode->vht_capab : 0,
.he.cap = cmode ? &cmode->he_capab[IEEE80211_MODE_AP] : NULL,
.eht.cap = cmode ? &cmode->eht_capab[IEEE80211_MODE_AP] : NULL,
- .eht.punct_bitmap = hostapd_get_punct_bitmap(hapd),
+ .eht.punct_bitmap = hostapd_get_punct_bitmap(hapd, false),
};
if (!hapd->driver || !hapd->driver->start_dfs_cac || !cmode)
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index c2421a853d..38aeea22de 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -2912,7 +2912,7 @@ static int __ieee802_11_set_beacon(struct hostapd_data *hapd)
.vht.caps = cmode ? cmode->vht_capab : 0,
.he.cap = cmode ? &cmode->he_capab[IEEE80211_MODE_AP] : NULL,
.eht.cap = cmode ? &cmode->eht_capab[IEEE80211_MODE_AP] : NULL,
- .eht.punct_bitmap = hostapd_get_punct_bitmap(hapd),
+ .eht.punct_bitmap = hostapd_get_punct_bitmap(hapd, false),
#ifdef CONFIG_IEEE80211BN
.uhr.enabled = iconf->ieee80211bn,
.uhr.dbe_bandwidth = iconf->dbe_bandwidth,
diff --git a/src/ap/dfs.c b/src/ap/dfs.c
index 8b85a25558..c62e96e469 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -1031,7 +1031,8 @@ static int hostapd_dfs_request_channel_switch(struct hostapd_iface *iface,
.vht.caps = cmode->vht_capab,
.he.cap = &cmode->he_capab[ieee80211_mode],
.eht.cap = &cmode->eht_capab[ieee80211_mode],
- .eht.punct_bitmap = hostapd_get_punct_bitmap(iface->bss[0]),
+ .eht.punct_bitmap =
+ hostapd_get_punct_bitmap(iface->bss[0], false),
};
err = hostapd_set_freq_params(&csa_settings.freq_params, &info);
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index 5e14f0f787..762dc91fd0 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -4605,7 +4605,8 @@ int hostapd_change_config_freq(struct hostapd_data *hapd,
NULL,
.eht.cap = mode ? &mode->eht_capab[IEEE80211_MODE_AP] :
NULL,
- .eht.punct_bitmap = hostapd_get_punct_bitmap(hapd),
+ .eht.punct_bitmap =
+ hostapd_get_punct_bitmap(hapd, false),
};
if (hostapd_set_freq_params(old_params, &info))
@@ -5445,14 +5446,14 @@ u8 hostapd_get_active_links(struct hostapd_data *hapd)
#endif /* CONFIG_IEEE80211BE */
-u16 hostapd_get_punct_bitmap(struct hostapd_data *hapd)
+u16 hostapd_get_punct_bitmap(struct hostapd_data *hapd, bool include_override)
{
u16 punct_bitmap = 0;
#ifdef CONFIG_IEEE80211BE
punct_bitmap = hapd->iconf->punct_bitmap;
#ifdef CONFIG_TESTING_OPTIONS
- if (!punct_bitmap)
+ if (include_override && !punct_bitmap)
punct_bitmap = hapd->conf->eht_oper_puncturing_override;
#endif /* CONFIG_TESTING_OPTIONS */
#endif /* CONFIG_IEEE80211BE */
@@ -5550,7 +5551,7 @@ void hostapd_get_oper_chan_info_of_bss(struct hostapd_data *hapd,
* capable interface for punctured channel and 320 MHz bandwidth cases.
*/
if (hapd->iconf->ieee80211be && !hostapd_is_eht_enabled(hapd)) {
- u16 punct_bitmap = hostapd_get_punct_bitmap(hapd);
+ u16 punct_bitmap = hostapd_get_punct_bitmap(hapd, true);
if (punct_bitmap)
punct_update_legacy_bw(punct_bitmap,
diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h
index 6ce29653b2..3055f7de8f 100644
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -971,7 +971,16 @@ static inline bool hostapd_mld_is_first_bss(struct hostapd_data *hapd)
#endif /* CONFIG_IEEE80211BE */
-u16 hostapd_get_punct_bitmap(struct hostapd_data *hapd);
+/**
+ * hostapd_get_punct_bitmap - Get the puncturing bitmap of a BSS
+ * @hapd: BSS context
+ * @include_override: Whether the eht_oper_puncturing_override testing option
+ * may be used when no puncturing bitmap is configured. This is allowed
+ * only when building the advertised elements and channel information;
+ * driver/channel configuration must pass %false.
+ * Returns: The puncturing bitmap to use
+ */
+u16 hostapd_get_punct_bitmap(struct hostapd_data *hapd, bool include_override);
void hostapd_get_oper_chan_info_of_bss(struct hostapd_data *hapd,
enum oper_chan_width *width,
diff --git a/src/ap/ieee802_11_eht.c b/src/ap/ieee802_11_eht.c
index 06e8b8c11d..c3bac8fcef 100644
--- a/src/ap/ieee802_11_eht.c
+++ b/src/ap/ieee802_11_eht.c
@@ -118,7 +118,7 @@ u8 * hostapd_eid_eht_operation(struct hostapd_data *hapd, u8 *eid)
enum oper_chan_width chwidth;
size_t elen = 1 + 4;
bool eht_oper_info_present;
- u16 punct_bitmap = hostapd_get_punct_bitmap(hapd);
+ u16 punct_bitmap = hostapd_get_punct_bitmap(hapd, true);
if (!hapd->iface->current_mode)
return eid;
diff --git a/src/ap/ieee802_11_he.c b/src/ap/ieee802_11_he.c
index 1bc5c7ecf7..876dd6da11 100644
--- a/src/ap/ieee802_11_he.c
+++ b/src/ap/ieee802_11_he.c
@@ -169,7 +169,7 @@ u8 * hostapd_eid_he_operation(struct hostapd_data *hapd, u8 *eid)
u8 seg1 = hostapd_get_oper_centr_freq_seg1_idx(hapd->iconf);
u8 control;
#ifdef CONFIG_IEEE80211BE
- u16 punct_bitmap = hostapd_get_punct_bitmap(hapd);
+ u16 punct_bitmap = hostapd_get_punct_bitmap(hapd, true);
if (punct_bitmap) {
oper_chwidth = hostapd_get_oper_chwidth(hapd->iconf);
diff --git a/src/ap/ieee802_11_ht.c b/src/ap/ieee802_11_ht.c
index 04bb60f45d..8b6f53c913 100644
--- a/src/ap/ieee802_11_ht.c
+++ b/src/ap/ieee802_11_ht.c
@@ -85,7 +85,7 @@ static void set_ht_param(struct hostapd_data *hapd,
int secondary_channel = hapd->iconf->secondary_channel;
#ifdef CONFIG_IEEE80211BE
enum oper_chan_width chwidth = hostapd_get_oper_chwidth(hapd->iconf);
- u16 bw = 0, punct_bitmap = hostapd_get_punct_bitmap(hapd);
+ u16 bw = 0, punct_bitmap = hostapd_get_punct_bitmap(hapd, true);
u8 offset, chan_bit_pos;
switch (chwidth) {
diff --git a/src/ap/ieee802_11_vht.c b/src/ap/ieee802_11_vht.c
index 65143626a7..616397a11e 100644
--- a/src/ap/ieee802_11_vht.c
+++ b/src/ap/ieee802_11_vht.c
@@ -88,7 +88,7 @@ u8 * hostapd_eid_vht_operation(struct hostapd_data *hapd, u8 *eid)
u8 seg0 = hapd->iconf->vht_oper_centr_freq_seg0_idx;
u8 seg1 = hapd->iconf->vht_oper_centr_freq_seg1_idx;
#ifdef CONFIG_IEEE80211BE
- u16 punct_bitmap = hostapd_get_punct_bitmap(hapd);
+ u16 punct_bitmap = hostapd_get_punct_bitmap(hapd, true);
#endif /* CONFIG_IEEE80211BE */
if (is_6ghz_op_class(hapd->iconf->op_class))
diff --git a/tests/hwsim/test_eht.py b/tests/hwsim/test_eht.py
index 5ce2edc9c5..9a4975f821 100644
--- a/tests/hwsim/test_eht.py
+++ b/tests/hwsim/test_eht.py
@@ -1672,7 +1672,7 @@ def eht_5ghz_params(channel, chanwidth, ccfs1, ccfs2=0,
return params
def _test_eht_5ghz(dev, apdev, channel, chanwidth, ccfs1, ccfs2=0,
- eht_oper_puncturing_override=None,
+ punct_bitmap=None,
he_ccfs1=None, he_oper_chanwidth=None):
if he_ccfs1 is None:
he_ccfs1 = ccfs1
@@ -1685,8 +1685,8 @@ def _test_eht_5ghz(dev, apdev, channel, chanwidth, ccfs1, ccfs2=0,
params['ssid'] = 'eht'
- if eht_oper_puncturing_override:
- params['eht_oper_puncturing_override'] = eht_oper_puncturing_override
+ if punct_bitmap:
+ params['punct_bitmap'] = punct_bitmap
freq = 5000 + channel * 5
bw = "20"
@@ -1701,8 +1701,8 @@ def _test_eht_5ghz(dev, apdev, channel, chanwidth, ccfs1, ccfs2=0,
eht_verify_wifi_version(dev[0])
hwsim_utils.test_connectivity(dev[0], hapd)
- if eht_oper_puncturing_override:
- hapd.set("eht_oper_puncturing_override", "0x0")
+ if punct_bitmap:
+ hapd.set("punct_bitmap", "0")
hapd.request("UPDATE_BEACON")
time.sleep(1)
finally:
@@ -1731,28 +1731,28 @@ def test_eht_5ghz_80mhz_2(dev, apdev):
"""EHT with 80 MHz channel width on 5 GHz - primary=149"""
_test_eht_5ghz(dev, apdev, 149, 1, 155, 0)
-def test_eht_5ghz_80mhz_puncturing_override_1(dev, apdev):
- """EHT with 80 MHz channel width on 5 GHz - primary=36 - puncturing override (2nd)"""
+def test_eht_5ghz_80mhz_puncturing_1(dev, apdev):
+ """EHT with 80 MHz channel width on 5 GHz - primary=36 - puncturing (2nd)"""
# The 2nd 20 MHz is punctured
_test_eht_5ghz(dev, apdev, 36, 1, 42, 0,
- eht_oper_puncturing_override="0x0002",
+ punct_bitmap="0x0002",
he_ccfs1=36, he_oper_chanwidth=0)
-def test_eht_5ghz_80mhz_puncturing_override_2(dev, apdev):
- """EHT with 80 MHz channel width on 5 GHz - primary=149 - puncturing override (3rd)"""
+def test_eht_5ghz_80mhz_puncturing_2(dev, apdev):
+ """EHT with 80 MHz channel width on 5 GHz - primary=149 - puncturing (3rd)"""
# The 3rd 20 MHz is punctured
_test_eht_5ghz(dev, apdev, 149, 1, 155, 0,
- eht_oper_puncturing_override="0x0004",
+ punct_bitmap="0x0004",
he_ccfs1=151, he_oper_chanwidth=0)
-def test_eht_5ghz_80mhz_puncturing_override_3(dev, apdev):
- """EHT with 80 MHz channel width on 5 GHz - primary=149 - puncturing override (4th)"""
+def test_eht_5ghz_80mhz_puncturing_3(dev, apdev):
+ """EHT with 80 MHz channel width on 5 GHz - primary=149 - puncturing (4th)"""
# The 4th 20 MHz is punctured
_test_eht_5ghz(dev, apdev, 149, 1, 155, 0,
- eht_oper_puncturing_override="0x0008",
+ punct_bitmap="0x0008",
he_ccfs1=151, he_oper_chanwidth=0)
def test_eht_5ghz_80p80mhz(dev, apdev):
--
2.56.1
More information about the Hostap
mailing list