]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Channel Usage, peer-to-peer TWT and TWT requester support
authorShivani Baranwal <quic_shivbara@quicinc.com>
Thu, 29 Aug 2024 06:08:46 +0000 (11:38 +0530)
committerJouni Malinen <j@w1.fi>
Fri, 1 Nov 2024 20:59:58 +0000 (22:59 +0200)
Add config support for channel usage procedure and peer-to-peer TWT on
AP and TWT Requester support on STA. The actual functionality of these
operations is expected to be implemented within the drivers.

Signed-off-by: Shivani Baranwal <quic_shivbara@quicinc.com>
hostapd/config_file.c
hostapd/hostapd.conf
src/ap/ap_config.h
src/ap/ieee802_11_shared.c
wpa_supplicant/config.c
wpa_supplicant/config.h
wpa_supplicant/config_file.c
wpa_supplicant/wpa_supplicant.c
wpa_supplicant/wpa_supplicant.conf

index 96f1b174972ea80261fd7dc59a0d75ee70808788..e59e98d7c0b3d0b5329a36ba519762027a5c20d9 100644 (file)
@@ -5128,6 +5128,10 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                if (val < 0 || val > 1)
                        return 1;
                bss->ssid_protection = val;
+       } else if (os_strcmp(buf, "channel_usage") == 0) {
+               conf->channel_usage = atoi(pos);
+       } else if (os_strcmp(buf, "peer_to_peer_twt") == 0) {
+               conf->peer_to_peer_twt = atoi(pos);
 #ifdef CONFIG_IEEE80211BE
        } else if (os_strcmp(buf, "ieee80211be") == 0) {
                conf->ieee80211be = atoi(pos);
index 93524cf5d7db537e1ddaf30ad99dd54268b58cf1..b8d7d341223446580703c876764b479596288a6c 100644 (file)
@@ -1030,6 +1030,18 @@ wmm_ac_vo_acm=0
 # Valid range: 0..20 TUs; default is 0 (disabled)
 #unsol_bcast_probe_resp_interval=0
 
+#channel_usage: Whether Channel Usage procedures is supported by AP.
+# 0 = Channel Usage support is disabled (default)
+# 1 = Channel Usage support is enabled
+#channel_usage=0
+
+#peer_to_peer_twt: Indicates an HE AP supports negotiating a peer-to-peer
+# TWT schedule that is requested by a non-AP STA to establish a
+# channel-usage-aidable BSS or an off-channel TDLS direct link.
+# 0 = Does not support Peer-to-peer TWT (default)
+# 1 = Supports Peer-to-peer TWT
+#peer_to_peer_twt=0
+
 ##### IEEE 802.11be related configuration #####################################
 
 #ieee80211be: Whether IEEE 802.11be (EHT) is enabled
index d42076785d367524124d3a657a8b8275069f438f..b0ae71e1edd2b46dd201ba396e24dda4693c2b3d 100644 (file)
@@ -1249,6 +1249,9 @@ struct hostapd_config {
 
        /* Whether to enable TWT responder in HT and VHT modes */
        bool ht_vht_twt_responder;
+
+       bool channel_usage;
+       bool peer_to_peer_twt;
 };
 
 
index 3dd3a6a7719e8ca25e2ac264e3a074821b11601c..9566615ebe28621ee937b780e13df64ced9ba7a9 100644 (file)
@@ -476,6 +476,14 @@ static void hostapd_ext_capab_byte(struct hostapd_data *hapd, u8 *pos, int idx,
                        *pos |= 0x01; /* Bit 88 - SAE PK Exclusively */
 #endif /* CONFIG_SAE_PK */
                break;
+       case 12: /* Bits 96-103 */
+               if (hapd->iconf->peer_to_peer_twt)
+                       *pos |= 0x10; /* Bit 100 - Peer to Peer TWT */
+               break;
+       case 13: /* Bits 104-111 */
+               if (hapd->iconf->channel_usage)
+                       *pos |= 0x01; /* Bit 104 - Channel Usage support */
+               break;
        }
 }
 
index 6284b0ec8d395fd2e80e184d29dc1f95e47a48d2..e2e013fb5529960d8486222f0214b4ec4e3fb5b2 100644 (file)
@@ -5575,6 +5575,7 @@ static const struct global_parse_data global_fields[] = {
        { INT(gas_address3), 0 },
        { INT_RANGE(ftm_responder, 0, 1), 0 },
        { INT_RANGE(ftm_initiator, 0, 1), 0 },
+       { INT_RANGE(twt_requester, 0, 1), 0 },
        { INT(gas_rand_addr_lifetime), 0 },
        { INT_RANGE(gas_rand_mac_addr, 0, 2), 0 },
 #ifdef CONFIG_DPP
index b860dd154ad1a7c96365e8afe1dd757bdd9d52e1..2128c0a24f4313a29695306faa4df48cf6dab9dc 100644 (file)
@@ -1868,6 +1868,13 @@ struct wpa_config {
         * This is the head for the list of all the paired devices.
         */
        struct wpa_dev_ik *identity;
+
+       /**
+        * twt_requester - Whether TWT Requester Support is enabled
+        *
+        * This is for setting the bit 77 of the Extended Capabilities element.
+        */
+       bool twt_requester;
 };
 
 
index 9bbe44db66b890352bf558418da95ebc8b628cae..e9f93f0421801a4fe584f3aeef1d3bd87df3fbde 100644 (file)
@@ -1645,6 +1645,9 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config)
        if (config->ftm_initiator)
                fprintf(f, "ftm_initiator=%d\n", config->ftm_initiator);
 
+       if (config->twt_requester)
+               fprintf(f, "twt_requester=%d\n", config->twt_requester);
+
        if (config->osu_dir)
                fprintf(f, "osu_dir=%s\n", config->osu_dir);
 
index c5cf9c70db1b5df6091bd35f55d6ffd9eae8d6a3..55feaedb2db7a9cfe384ab694986b92b0e6f277b 100644 (file)
@@ -2330,6 +2330,8 @@ static void wpas_ext_capab_byte(struct wpa_supplicant *wpa_s, u8 *pos, int idx,
                if (!wpa_s->disable_fils)
                        *pos |= 0x01;
 #endif /* CONFIG_FILS */
+               if (wpa_s->conf->twt_requester)
+                       *pos |= 0x20; /* Bit 77 - TWT Requester Support */
                break;
        case 10: /* Bits 80-87 */
 #ifndef CONFIG_NO_ROBUST_AV
index b721f65041ee6324ee3b50ee13f8434e9d3663e4..9c9fe959f784cba449e186a623b2b7c54a933006 100644 (file)
@@ -608,6 +608,11 @@ fast_reauth=1
 # 1 = Publish
 #ftm_initiator=0
 
+#twt_requester: Whether TWT requester is enabled
+# 0 = disabled (default)
+# 1 = enabled if supported by the driver
+#twt_requester=0
+
 # credential block
 #
 # Each credential used for automatic network selection is configured as a set