From: Ilan Peer Date: Thu, 21 Dec 2023 06:49:33 +0000 (+0200) Subject: AP: Support overriding EHT operation puncturing mask X-Git-Tag: hostap_2_11~587 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=409ebaaa1c07f589f3d5ba9c7cbcb56f0309a2a4;p=thirdparty%2Fhostap.git AP: Support overriding EHT operation puncturing mask Add support for overriding EHT Operation element puncturing mask for testing purposes. Signed-off-by: Ilan Peer Signed-off-by: Andrei Otcheretianski --- diff --git a/hostapd/config_file.c b/hostapd/config_file.c index 187e98813..af324bb25 100644 --- a/hostapd/config_file.c +++ b/hostapd/config_file.c @@ -4849,6 +4849,11 @@ static int hostapd_config_fill(struct hostapd_config *conf, line); return 1; } +#ifdef CONFIG_TESTING_OPTIONS + } else if (os_strcmp(buf, "eht_oper_puncturing_override") == 0) { + if (get_u16(pos, line, &bss->eht_oper_puncturing_override)) + return 1; +#endif /* CONFIG_TESTING_OPTIONS */ #endif /* CONFIG_IEEE80211BE */ } else { wpa_printf(MSG_ERROR, diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h index 0bc799d3e..5bf41b438 100644 --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h @@ -704,6 +704,10 @@ struct hostapd_bss_config { unsigned int oci_freq_override_ft_assoc; unsigned int oci_freq_override_fils_assoc; unsigned int oci_freq_override_wnm_sleep; + +#ifdef CONFIG_IEEE80211BE + u16 eht_oper_puncturing_override; +#endif /* CONFIG_IEEE80211BE */ #endif /* CONFIG_TESTING_OPTIONS */ #define MESH_ENABLED BIT(0) diff --git a/src/ap/ieee802_11_eht.c b/src/ap/ieee802_11_eht.c index ab4029197..d03416b3d 100644 --- a/src/ap/ieee802_11_eht.c +++ b/src/ap/ieee802_11_eht.c @@ -206,22 +206,31 @@ 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 = conf->punct_bitmap; if (!hapd->iface->current_mode) return eid; +#ifdef CONFIG_TESTING_OPTIONS + if (!punct_bitmap && hapd->conf->eht_oper_puncturing_override) { + wpa_printf(MSG_DEBUG, "EHT: Puncturing mask override=0x%x", + hapd->conf->eht_oper_puncturing_override); + punct_bitmap = hapd->conf->eht_oper_puncturing_override; + } +#endif /* CONFIG_TESTING_OPTIONS */ + if (is_6ghz_op_class(conf->op_class)) chwidth = op_class_to_ch_width(conf->op_class); else chwidth = conf->eht_oper_chwidth; eht_oper_info_present = chwidth == CONF_OPER_CHWIDTH_320MHZ || - hapd->iconf->punct_bitmap; + punct_bitmap; if (eht_oper_info_present) elen += 3; - if (hapd->iconf->punct_bitmap) + if (punct_bitmap) elen += EHT_OPER_DISABLED_SUBCHAN_BITMAP_SIZE; *pos++ = WLAN_EID_EXTENSION; @@ -277,10 +286,10 @@ u8 * hostapd_eid_eht_operation(struct hostapd_data *hapd, u8 *eid) oper->oper_info.ccfs0 = seg0 ? seg0 : hapd->iconf->channel; oper->oper_info.ccfs1 = seg1; - if (hapd->iconf->punct_bitmap) { + if (punct_bitmap) { oper->oper_params |= EHT_OPER_DISABLED_SUBCHAN_BITMAP_PRESENT; oper->oper_info.disabled_chan_bitmap = - host_to_le16(hapd->iconf->punct_bitmap); + host_to_le16(punct_bitmap); } return pos + elen;