[PATCH 3/5] AP: Allow hex format for puncturing bitmap

Andrei Otcheretianski andrei.otcheretianski at intel.com
Wed Dec 20 22:49:32 PST 2023


It is much more convinient to specify the bitmap as a hex value.
Allow it.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
 hostapd/config_file.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 1a49292b11..3d356e617a 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -4768,8 +4768,20 @@ static int hostapd_config_fill(struct hostapd_config *conf,
 		conf->eht_phy_capab.mu_beamformer = atoi(pos);
 	} else if (os_strcmp(buf, "eht_default_pe_duration") == 0) {
 		conf->eht_default_pe_duration = atoi(pos);
-	} else if (os_strcmp(buf, "punct_bitmap") == 0) {
-		conf->punct_bitmap = atoi(pos);
+#define PARSE_FORCE_U16(_config, _val)				\
+	} else if (os_strcmp(buf, #_val) == 0) {		\
+		char *end;					\
+		long int val = strtol(pos, &end, 0);		\
+								\
+		if (*end || val < 0 || val > 0xffff) {		\
+			wpa_printf(MSG_ERROR,			\
+				   "Line %d: Invalid value '%s'", \
+				   line, pos);			\
+			return 1;				\
+		}						\
+								\
+		_config->_val = val;
+	PARSE_FORCE_U16(conf, punct_bitmap)
 	} else if (os_strcmp(buf, "punct_acs_threshold") == 0) {
 		int val = atoi(pos);
 
-- 
2.43.0




More information about the Hostap mailing list