[PATCH] nl80211: do not send zero HE OBSS PD offsets

github at singe.za.net github at singe.za.net
Thu Oct 1 02:04:08 PDT 2026


From: Dominic White <github at singe.za.net>

The kernel treats omitted HE OBSS-PD offset attributes as zero. Omit
zero-valued offsets in the nl80211 AP setup request so zero remains usable
with kernels that reject explicit zero attributes.

Add a hwsim regression test covering zero for all three offsets.

Johannes Berg confirmed this is the intended kernal ABI upstream.
https://lore.kernel.org/linux-wireless/a5f74bb1113b5841a4a5359ba615cc114f41a1cd.camel@sipsolutions.net/

Signed-off-by: Dominic White <github at singe.za.net>
---
 src/drivers/driver_nl80211.c | 11 +++++++----
 tests/hwsim/test_he.py       | 17 +++++++++++++++++
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 114cd4330..25e477f70 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -6044,16 +6044,19 @@ static int wpa_driver_nl80211_set_ap(void *priv,
 			       params->he_spr_ctrl) ||
 		    ((params->he_spr_ctrl &
 		      SPATIAL_REUSE_NON_SRG_OFFSET_PRESENT) &&
+		     params->he_spr_non_srg_obss_pd_max_offset &&
 		     nla_put_u8(msg, NL80211_HE_OBSS_PD_ATTR_NON_SRG_MAX_OFFSET,
 				params->he_spr_non_srg_obss_pd_max_offset)))
 			goto fail;
 
 		if ((params->he_spr_ctrl &
 		     SPATIAL_REUSE_SRG_INFORMATION_PRESENT) &&
-		    (nla_put_u8(msg, NL80211_HE_OBSS_PD_ATTR_MIN_OFFSET,
-				params->he_spr_srg_obss_pd_min_offset) ||
-		     nla_put_u8(msg, NL80211_HE_OBSS_PD_ATTR_MAX_OFFSET,
-				params->he_spr_srg_obss_pd_max_offset) ||
+		    ((params->he_spr_srg_obss_pd_min_offset &&
+		      nla_put_u8(msg, NL80211_HE_OBSS_PD_ATTR_MIN_OFFSET,
+				params->he_spr_srg_obss_pd_min_offset)) ||
+		     (params->he_spr_srg_obss_pd_max_offset &&
+		      nla_put_u8(msg, NL80211_HE_OBSS_PD_ATTR_MAX_OFFSET,
+				params->he_spr_srg_obss_pd_max_offset)) ||
 		     nla_put(msg, NL80211_HE_OBSS_PD_ATTR_BSS_COLOR_BITMAP,
 			     sizeof(params->he_spr_bss_color_bitmap),
 			     params->he_spr_bss_color_bitmap) ||
diff --git a/tests/hwsim/test_he.py b/tests/hwsim/test_he.py
index 9f3c367ae..1b1ed664d 100644
--- a/tests/hwsim/test_he.py
+++ b/tests/hwsim/test_he.py
@@ -116,6 +116,23 @@ def test_he_spr_params(dev, apdev):
         raise Exception("STATUS did not indicate ieee80211ax=1")
     dev[0].connect("he", key_mgmt="NONE", scan_freq="2412")
 
+def test_he_spr_zero_offsets(dev, apdev):
+    """HE AP spatial reuse parameters with zero offsets"""
+    params = {"ssid": "he-zero-offsets",
+              "ieee80211ax": "1",
+              "he_spr_sr_control": "12",
+              "he_spr_non_srg_obss_pd_max_offset": "0",
+              "he_spr_srg_obss_pd_min_offset": "0",
+              "he_spr_srg_obss_pd_max_offset": "0",
+              "he_spr_srg_bss_colors": "1 2 10 63",
+              "he_spr_srg_partial_bssid": "0 1 3 63",
+              "he_oper_chwidth": "0",
+              "he_oper_centr_freq_seg0_idx": "1",
+              "he_oper_centr_freq_seg1_idx": "0"}
+    hapd = hostapd.add_ap(apdev[0], params)
+    if hapd.get_status_field("ieee80211ax") != "1":
+        raise Exception("STATUS did not indicate ieee80211ax=1")
+
 def he_supported():
     cmd = subprocess.Popen(["iw", "reg", "get"], stdout=subprocess.PIPE)
     out, err = cmd.communicate()
-- 
2.54.0 (Apple Git-157)




More information about the Hostap mailing list