Skip to content

Commit 92c8ef9

Browse files
Krishna Trlubos
Krishna T
authored andcommitted
[nrf fromtree] net: wifi: Fix TWT interval
As we are using a generic validation function for limits, due to data type mismatch the check for TWT interval overflow and fails. Fix the data type and accordingly the maximum value in the help. Signed-off-by: Krishna T <[email protected]> (cherry picked from commit 2b48c92)
1 parent 89e976f commit 92c8ef9

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

include/zephyr/net/wifi_mgmt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ struct wifi_twt_params {
230230

231231
/* Flow ID is only 3 bits */
232232
#define WIFI_MAX_TWT_FLOWS 8
233-
#define WIFI_MAX_TWT_INTERVAL_US (ULONG_MAX - 1)
233+
#define WIFI_MAX_TWT_INTERVAL_US (LONG_MAX - 1)
234234
/* 256 (u8) * 1TU */
235235
#define WIFI_MAX_TWT_WAKE_INTERVAL_US 262144
236236
struct wifi_twt_flow_info {

subsys/net/l2/wifi/wifi_shell.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static struct net_mgmt_event_callback wifi_shell_mgmt_cb;
5959
} \
6060
} while (false)
6161

62-
static bool parse_number(const struct shell *sh, long *param, char *str, int min, int max)
62+
static bool parse_number(const struct shell *sh, long *param, char *str, long min, long max)
6363
{
6464
char *endptr;
6565
char *str_tmp = str;
@@ -70,7 +70,7 @@ static bool parse_number(const struct shell *sh, long *param, char *str, int min
7070
return false;
7171
}
7272
if ((num) < (min) || (num) > (max)) {
73-
print(sh, SHELL_WARNING, "Value out of range: %s, (%d-%d)", str_tmp, min, max);
73+
print(sh, SHELL_WARNING, "Value out of range: %s, (%ld-%ld)", str_tmp, min, max);
7474
return false;
7575
}
7676
*param = num;
@@ -873,13 +873,13 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_cmd_ap,
873873

874874
SHELL_STATIC_SUBCMD_SET_CREATE(wifi_twt_ops,
875875
SHELL_CMD(quick_setup, NULL, " Start a TWT flow with defaults:\n"
876-
"<twt_wake_interval: 1-262144us> <twt_interval: 1us-2^64us>\n",
876+
"<twt_wake_interval: 1-262144us> <twt_interval: 1us-2^31us>\n",
877877
cmd_wifi_twt_setup_quick),
878878
SHELL_CMD(setup, NULL, " Start a TWT flow:\n"
879879
"<negotiation_type, 0: Individual, 1: Broadcast, 2: Wake TBTT>\n"
880880
"<setup_cmd: 0: Request, 1: Suggest, 2: Demand>\n"
881881
"<dialog_token: 1-255> <flow_id: 0-7> <responder: 0/1> <trigger: 0/1> <implicit:0/1> "
882-
"<announce: 0/1> <twt_wake_interval: 1-262144us> <twt_interval: 1us-2^64us>\n",
882+
"<announce: 0/1> <twt_wake_interval: 1-262144us> <twt_interval: 1us-2^31us>\n",
883883
cmd_wifi_twt_setup),
884884
SHELL_CMD(teardown, NULL, " Teardown a TWT flow:\n"
885885
"<negotiation_type, 0: Individual, 1: Broadcast, 2: Wake TBTT>\n"

0 commit comments

Comments
 (0)