]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
AP: Allow hex format for puncturing bitmap
authorAndrei Otcheretianski <andrei.otcheretianski@intel.com>
Thu, 21 Dec 2023 06:49:32 +0000 (08:49 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 22 Dec 2023 12:19:28 +0000 (14:19 +0200)
It is much more convinient to specify the bitmap as a hex value.
Allow it.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
hostapd/config_file.c

index 1127d74f0c5eeb0d6416326455f9881735931b73..187e988135e06e438919f70f2756e5c6e791056e 100644 (file)
@@ -2344,6 +2344,24 @@ static int get_hex_config(u8 *buf, size_t max_len, int line,
 }
 
 
+#ifdef CONFIG_IEEE80211BE
+static int get_u16(const char *pos, int line, u16 *ret_val)
+{
+       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;
+       }
+
+       *ret_val = val;
+       return 0;
+}
+#endif /* CONFIG_IEEE80211BE */
+
+
 static int hostapd_config_fill(struct hostapd_config *conf,
                               struct hostapd_bss_config *bss,
                               const char *buf, char *pos, int line)
@@ -4809,7 +4827,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
        } 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);
+               if (get_u16(pos, line, &conf->punct_bitmap))
+                       return 1;
        } else if (os_strcmp(buf, "punct_acs_threshold") == 0) {
                int val = atoi(pos);