blob: ad9c926e50502f9aa2dc006889678c449666fd2c [file] [log] [blame]
developerac7492d2022-06-09 20:22:14 +08001From 6a949f8644546d689b7271228d19b1b1ad80632f Mon Sep 17 00:00:00 2001
2From: Howard Hsu <howard-yh.hsu@mediatek.com>
3Date: Thu, 9 Jun 2022 19:56:18 +0800
4Subject: [PATCH 1/6] Support configuring BSS Termination TSF by using
developere2cc0fa2022-03-29 17:31:03 +08005 hostapd_cli command
6
7---
developerac7492d2022-06-09 20:22:14 +08008 hostapd/ctrl_iface.c | 5 +++++
9 src/ap/ap_config.c | 1 +
10 src/ap/ap_config.h | 1 +
11 src/ap/ctrl_iface_ap.c | 4 ++++
12 4 files changed, 11 insertions(+)
developere2cc0fa2022-03-29 17:31:03 +080013
14diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
developerac7492d2022-06-09 20:22:14 +080015index 4718368..e0a7e4f 100644
developere2cc0fa2022-03-29 17:31:03 +080016--- a/hostapd/ctrl_iface.c
17+++ b/hostapd/ctrl_iface.c
developerac7492d2022-06-09 20:22:14 +080018@@ -1326,6 +1326,11 @@ static int hostapd_ctrl_iface_set(struct hostapd_data *hapd, char *cmd)
developere2cc0fa2022-03-29 17:31:03 +080019 #endif /* CONFIG_DPP */
20 } else if (os_strcasecmp(cmd, "setband") == 0) {
21 ret = hostapd_ctrl_iface_set_band(hapd, value);
22+ } else if (os_strcasecmp(cmd, "bss_termination_tsf") == 0) {
23+ int termination_sec = atoi(value);
24+ hapd->conf->bss_termination_tsf = termination_sec;
25+ wpa_printf(MSG_DEBUG, "BSS Termination TSF: value = %d",
26+ termination_sec);
27 } else {
28 ret = hostapd_set_iface(hapd->iconf, hapd->conf, cmd, value);
29 if (ret)
30diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
developerac7492d2022-06-09 20:22:14 +080031index 23b67e1..f248281 100644
developere2cc0fa2022-03-29 17:31:03 +080032--- a/src/ap/ap_config.c
33+++ b/src/ap/ap_config.c
34@@ -170,6 +170,7 @@ void hostapd_config_defaults_bss(struct hostapd_bss_config *bss)
35 /* comeback after 10 TUs */
36 bss->pasn_comeback_after = 10;
37 #endif /* CONFIG_PASN */
38+ bss->bss_termination_tsf = 0;
39 }
40
41
42diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
developerac7492d2022-06-09 20:22:14 +080043index f795ee9..5dab8be 100644
developere2cc0fa2022-03-29 17:31:03 +080044--- a/src/ap/ap_config.h
45+++ b/src/ap/ap_config.h
developerac7492d2022-06-09 20:22:14 +080046@@ -557,6 +557,7 @@ struct hostapd_bss_config {
developere2cc0fa2022-03-29 17:31:03 +080047 int wnm_sleep_mode;
48 int wnm_sleep_mode_no_keys;
49 int bss_transition;
50+ unsigned int bss_termination_tsf;
51
52 /* IEEE 802.11u - Interworking */
53 int interworking;
developerac7492d2022-06-09 20:22:14 +080054diff --git a/src/ap/ctrl_iface_ap.c b/src/ap/ctrl_iface_ap.c
55index c496e4f..aad5180 100644
56--- a/src/ap/ctrl_iface_ap.c
57+++ b/src/ap/ctrl_iface_ap.c
58@@ -1202,6 +1202,10 @@ int hostapd_ctrl_iface_bss_tm_req(struct hostapd_data *hapd,
59 wpa_printf(MSG_DEBUG, "Invalid bss_term data");
60 return -1;
61 }
62+ if (hapd->conf->bss_termination_tsf) {
63+ WPA_PUT_LE64(&bss_term_dur[2], hapd->conf->bss_termination_tsf);
64+ }
65+
66 end++;
67 WPA_PUT_LE16(&bss_term_dur[10], atoi(end));
68 }
developere2cc0fa2022-03-29 17:31:03 +080069--
702.18.0
71