]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
TWT: Allow specifying Control field value in TWT Request
authorBen Greear <greearb@candelatech.com>
Wed, 10 Mar 2021 17:28:12 +0000 (09:28 -0800)
committerJouni Malinen <j@w1.fi>
Fri, 12 Mar 2021 08:53:02 +0000 (10:53 +0200)
See IEEE P802.11ax/D8.0, Figure 9-687 (Control field format) for
details.

Signed-off-by: Ben Greear <greearb@candelatech.com>
wpa_supplicant/ctrl_iface.c
wpa_supplicant/twt.c
wpa_supplicant/wpa_cli.c
wpa_supplicant/wpa_supplicant_i.h

index a32cd5c6a1dbd192f95ad10745c09ae6cbd297c4..c05175822c39899230aacee0254e8a587945188c 100644 (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);
 }
 
 
index d77cea2271624119e211503682ddf948fecefc6f..8ec2c85acb8de5aff9790f888620147c845bab0f 100644 (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 */
index ae10f08a4af6cb6916ff3988dbaacad98a07e15a..95608971faca6d32b95c3304c82ad0c2849b0037 100644 (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,
index 8705b55b9b113319a7ec0a0f2ff93ccfc9df50cb..68d78c11fdf4fbc1109d14337eaafa315b301ceb 100644 (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);