From 343eb477b5b08b45f2f420ce753ab187657b31aa Mon Sep 17 00:00:00 2001 From: Sriram R Date: Fri, 24 Mar 2023 23:20:49 +0530 Subject: [PATCH] hostapd: Add Operating Class and Primary channel in FD for non PSC chan If a non PSC 6GHz channel is configured, duplicate beacons/FD/UBPR will be transmitted in other 20MHz channels of the current configured bandwidth to aid in faster scan. In such cases the duplicate FD needs to carry the Operating Class and Primary channel for clients to identify the primary non PSC. As per IEEE802.11 2020, "The Operating Class subfield specifies the operating class of the Primary Channel of the transmitting AP (see 9.4.1.36). The Primary Channel subfield is set to the channel number of the primary channel (see 11.15.2) if the FILS Discovery frame is transmitted as a non-HT duplicate PPDU; otherwise, the subfield is not present." Hence, add the Oper class and Primary channel if the current channel is non PSC. Signed-off-by: Sriram R --- src/ap/beacon.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/ap/beacon.c b/src/ap/beacon.c index e3d2c5d..24abf52 100644 --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -1505,6 +1505,15 @@ static u8 * hostapd_gen_fils_discovery(struct hostapd_data *hapd, size_t *len) FD_FRAME_CTL_CAP_PRESENT; total_len += 4 + 1 + 2; + /* Fill Primary Channel info, if primary channel is not a PSC */ + if (is_6ghz_op_class(hapd->iconf->op_class) && + !is_6ghz_psc_frequency(ieee80211_chan_to_freq(NULL, + hapd->iconf->op_class, hapd->iconf->channel)) && + op_class_to_bandwidth(hapd->iconf->op_class) > 20) { + ctl |= FD_FRAME_CTL_PRI_CHAN_PRESENT; + total_len += 2; + } + /* Check for optional subfields and calculate length */ if (wpa_auth_write_fd_rsn_info(hapd->wpa_auth, fd_rsn_info)) { ctl |= FD_FRAME_CTL_RSN_INFO_PRESENT; @@ -1571,9 +1580,11 @@ static u8 * hostapd_gen_fils_discovery(struct hostapd_data *hapd, size_t *len) WPA_PUT_LE16(pos, hostapd_fils_discovery_cap(hapd)); pos += 2; - /* Operating Class - not present */ - - /* Primary Channel - not present */ + /* Operating Class and Primary Channel - if chan is non PSC */ + if (ctl & FD_FRAME_CTL_PRI_CHAN_PRESENT) { + *pos++ = hapd->iconf->op_class; + *pos++ = hapd->iconf->channel; + } /* AP Configuration Sequence Number - not present */