| From de13e08cb3e1210bfed2de824c6a19e8dbed057e Mon Sep 17 00:00:00 2001 |
| From: Howard Hsu <howard-yh.hsu@mediatek.com> |
| Date: Thu, 9 Jun 2022 19:56:18 +0800 |
| Subject: [PATCH 99903/99917] Support configuring BSS Termination TSF by using |
| hostapd_cli command |
| |
| --- |
| hostapd/ctrl_iface.c | 5 +++++ |
| src/ap/ap_config.c | 1 + |
| src/ap/ap_config.h | 1 + |
| src/ap/ctrl_iface_ap.c | 4 ++++ |
| 4 files changed, 11 insertions(+) |
| |
| diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c |
| index a258492..c2a2822 100644 |
| --- a/hostapd/ctrl_iface.c |
| +++ b/hostapd/ctrl_iface.c |
| @@ -1338,6 +1338,11 @@ static int hostapd_ctrl_iface_set(struct hostapd_data *hapd, char *cmd) |
| #endif /* CONFIG_DPP */ |
| } else if (os_strcasecmp(cmd, "setband") == 0) { |
| ret = hostapd_ctrl_iface_set_band(hapd, value); |
| + } else if (os_strcasecmp(cmd, "bss_termination_tsf") == 0) { |
| + int termination_sec = atoi(value); |
| + hapd->conf->bss_termination_tsf = termination_sec; |
| + wpa_printf(MSG_DEBUG, "BSS Termination TSF: value = %d", |
| + termination_sec); |
| } else { |
| ret = hostapd_set_iface(hapd->iconf, hapd->conf, cmd, value); |
| if (ret) |
| diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c |
| index d7a0c7c..4a20eb4 100644 |
| --- a/src/ap/ap_config.c |
| +++ b/src/ap/ap_config.c |
| @@ -170,6 +170,7 @@ void hostapd_config_defaults_bss(struct hostapd_bss_config *bss) |
| /* comeback after 10 TUs */ |
| bss->pasn_comeback_after = 10; |
| #endif /* CONFIG_PASN */ |
| + bss->bss_termination_tsf = 0; |
| } |
| |
| |
| diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h |
| index ed3bec7..3f68e76 100644 |
| --- a/src/ap/ap_config.h |
| +++ b/src/ap/ap_config.h |
| @@ -557,6 +557,7 @@ struct hostapd_bss_config { |
| int wnm_sleep_mode; |
| int wnm_sleep_mode_no_keys; |
| int bss_transition; |
| + unsigned int bss_termination_tsf; |
| |
| /* IEEE 802.11u - Interworking */ |
| int interworking; |
| diff --git a/src/ap/ctrl_iface_ap.c b/src/ap/ctrl_iface_ap.c |
| index 96209ce..46a8609 100644 |
| --- a/src/ap/ctrl_iface_ap.c |
| +++ b/src/ap/ctrl_iface_ap.c |
| @@ -1203,6 +1203,10 @@ int hostapd_ctrl_iface_bss_tm_req(struct hostapd_data *hapd, |
| wpa_printf(MSG_DEBUG, "Invalid bss_term data"); |
| return -1; |
| } |
| + if (hapd->conf->bss_termination_tsf) { |
| + WPA_PUT_LE64(&bss_term_dur[2], hapd->conf->bss_termination_tsf); |
| + } |
| + |
| end++; |
| WPA_PUT_LE16(&bss_term_dur[10], atoi(end)); |
| } |
| -- |
| 2.36.1 |
| |