TWT: Allow specifying Control field value in TWT Request

See IEEE P802.11ax/D8.0, Figure 9-687 (Control field format) for
details.

Signed-off-by: Ben Greear <greearb@candelatech.com>
This commit is contained in:
Ben Greear 2021-03-10 09:28:12 -08:00 committed by Jouni Malinen
parent a3c94d61cd
commit a746393dcf
4 changed files with 12 additions and 6 deletions

View file

@ -9809,6 +9809,8 @@ static int wpas_ctrl_iface_send_twt_setup(struct wpa_supplicant *wpa_s,
int flow_id = 0;
bool protection = false;
u8 twt_channel = 0;
u8 control = BIT(4); /* Control field (IEEE P802.11ax/D8.0 Figure
* 9-687): B4 = TWT Information Frame Disabled */
const char *tok_s;
tok_s = os_strstr(cmd, " dialog=");
@ -9863,9 +9865,14 @@ static int wpas_ctrl_iface_send_twt_setup(struct wpa_supplicant *wpa_s,
if (tok_s)
twt_channel = atoi(tok_s + os_strlen(" twt_channel="));
tok_s = os_strstr(cmd, " control=");
if (tok_s)
control = atoi(tok_s + os_strlen(" control="));
return wpas_twt_send_setup(wpa_s, dtok, exponent, mantissa, min_twt,
setup_cmd, twt, requestor, trigger, implicit,
flow_type, flow_id, protection, twt_channel);
flow_type, flow_id, protection, twt_channel,
control);
}

View file

@ -30,7 +30,7 @@ int wpas_twt_send_setup(struct wpa_supplicant *wpa_s, u8 dtok, int exponent,
int mantissa, u8 min_twt, int setup_cmd, u64 twt,
bool requestor, bool trigger, bool implicit,
bool flow_type, u8 flow_id, bool protection,
u8 twt_channel)
u8 twt_channel, u8 control)
{
struct wpabuf *buf;
u16 req_type = 0;
@ -62,8 +62,7 @@ int wpas_twt_send_setup(struct wpa_supplicant *wpa_s, u8 dtok, int exponent,
wpabuf_put_u8(buf, WLAN_EID_TWT);
wpabuf_put_u8(buf, 15); /* len */
wpabuf_put_u8(buf, BIT(4)); /* Control field:
* B4 = TWT Information Frame Disabled */
wpabuf_put_u8(buf, control);
if (requestor)
req_type |= BIT(0); /* This STA is a TWT Requesting STA */

View file

@ -3821,7 +3821,7 @@ static const struct wpa_cli_cmd wpa_cli_commands[] = {
},
{ "twt_setup",
wpa_cli_cmd_twt_setup, NULL, cli_cmd_flag_none,
"[dialog=<token>] [exponent=<exponent>] [mantissa=<mantissa>] [min_twt=<Min TWT>] [setup_cmd=<setup-cmd>] [twt=<u64>] [requestor=0|1] [trigger=0|1] [implicit=0|1] [flow_type=0|1] [flow_id=<3-bit-id>] [protection=0|1] [twt_channel=<twt chanel id>] = Send TWT Setup frame"
"[dialog=<token>] [exponent=<exponent>] [mantissa=<mantissa>] [min_twt=<Min TWT>] [setup_cmd=<setup-cmd>] [twt=<u64>] [requestor=0|1] [trigger=0|1] [implicit=0|1] [flow_type=0|1] [flow_id=<3-bit-id>] [protection=0|1] [twt_channel=<twt chanel id>] [control=<control-u8>] = Send TWT Setup frame"
},
{ "twt_teardown",
wpa_cli_cmd_twt_teardown, NULL, cli_cmd_flag_none,

View file

@ -1519,7 +1519,7 @@ int wpas_twt_send_setup(struct wpa_supplicant *wpa_s, u8 dtok, int exponent,
int mantissa, u8 min_twt, int setup_cmd, u64 twt,
bool requestor, bool trigger, bool implicit,
bool flow_type, u8 flow_id, bool protection,
u8 twt_channel);
u8 twt_channel, u8 control);
int wpas_twt_send_teardown(struct wpa_supplicant *wpa_s, u8 flags);
void wpas_rrm_reset(struct wpa_supplicant *wpa_s);