developer | 1ec629b | 2022-05-09 13:05:53 +0800 | [diff] [blame^] | 1 | From 56613ad9b568a3ac7467105beaa162c68ffbbf70 Mon Sep 17 00:00:00 2001 |
| 2 | From: "howard.hsu" <howard-yh.hsu@mediatek.com> |
| 3 | Date: Wed, 19 Jan 2022 20:20:03 +0800 |
| 4 | Subject: [PATCH 4/9] Support configuring BSS Termination TSF by using |
| 5 | hostapd_cli command |
| 6 | |
| 7 | --- |
| 8 | hostapd/ctrl_iface.c | 9 +++++++++ |
| 9 | src/ap/ap_config.c | 1 + |
| 10 | src/ap/ap_config.h | 1 + |
| 11 | 3 files changed, 11 insertions(+) |
| 12 | |
| 13 | diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c |
| 14 | index f50fafb..1b5a091 100644 |
| 15 | --- a/hostapd/ctrl_iface.c |
| 16 | +++ b/hostapd/ctrl_iface.c |
| 17 | @@ -954,6 +954,10 @@ static int hostapd_ctrl_iface_bss_tm_req(struct hostapd_data *hapd, |
| 18 | wpa_printf(MSG_DEBUG, "Invalid bss_term data"); |
| 19 | return -1; |
| 20 | } |
| 21 | + if (hapd->conf->bss_termination_tsf) { |
| 22 | + WPA_PUT_LE64(&bss_term_dur[2], hapd->conf->bss_termination_tsf); |
| 23 | + } |
| 24 | + |
| 25 | end++; |
| 26 | WPA_PUT_LE16(&bss_term_dur[10], atoi(end)); |
| 27 | } |
| 28 | @@ -1589,6 +1593,11 @@ static int hostapd_ctrl_iface_set(struct hostapd_data *hapd, char *cmd) |
| 29 | #endif /* CONFIG_DPP */ |
| 30 | } else if (os_strcasecmp(cmd, "setband") == 0) { |
| 31 | ret = hostapd_ctrl_iface_set_band(hapd, value); |
| 32 | + } else if (os_strcasecmp(cmd, "bss_termination_tsf") == 0) { |
| 33 | + int termination_sec = atoi(value); |
| 34 | + hapd->conf->bss_termination_tsf = termination_sec; |
| 35 | + wpa_printf(MSG_DEBUG, "BSS Termination TSF: value = %d", |
| 36 | + termination_sec); |
| 37 | } else { |
| 38 | ret = hostapd_set_iface(hapd->iconf, hapd->conf, cmd, value); |
| 39 | if (ret) |
| 40 | diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c |
| 41 | index 1f04686..078a3fc 100644 |
| 42 | --- a/src/ap/ap_config.c |
| 43 | +++ b/src/ap/ap_config.c |
| 44 | @@ -170,6 +170,7 @@ void hostapd_config_defaults_bss(struct hostapd_bss_config *bss) |
| 45 | /* comeback after 10 TUs */ |
| 46 | bss->pasn_comeback_after = 10; |
| 47 | #endif /* CONFIG_PASN */ |
| 48 | + bss->bss_termination_tsf = 0; |
| 49 | } |
| 50 | |
| 51 | |
| 52 | diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h |
| 53 | index f3aff36..7301bbb 100644 |
| 54 | --- a/src/ap/ap_config.h |
| 55 | +++ b/src/ap/ap_config.h |
| 56 | @@ -549,6 +549,7 @@ struct hostapd_bss_config { |
| 57 | int wnm_sleep_mode; |
| 58 | int wnm_sleep_mode_no_keys; |
| 59 | int bss_transition; |
| 60 | + unsigned int bss_termination_tsf; |
| 61 | |
| 62 | /* IEEE 802.11u - Interworking */ |
| 63 | int interworking; |
| 64 | -- |
| 65 | 2.18.0 |
| 66 | |