Skip to content

Commit 2b48c92

Browse files
Krishna Tfabiobaltieri
authored andcommitted
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]>
1 parent bb1ede6 commit 2b48c92

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
@@ -232,7 +232,7 @@ struct wifi_twt_params {
232232

233233
/* Flow ID is only 3 bits */
234234
#define WIFI_MAX_TWT_FLOWS 8
235-
#define WIFI_MAX_TWT_INTERVAL_US (ULONG_MAX - 1)
235+
#define WIFI_MAX_TWT_INTERVAL_US (LONG_MAX - 1)
236236
/* 256 (u8) * 1TU */
237237
#define WIFI_MAX_TWT_WAKE_INTERVAL_US 262144
238238
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;
@@ -866,13 +866,13 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_cmd_ap,
866866

867867
SHELL_STATIC_SUBCMD_SET_CREATE(wifi_twt_ops,
868868
SHELL_CMD(quick_setup, NULL, " Start a TWT flow with defaults:\n"
869-
"<twt_wake_interval: 1-262144us> <twt_interval: 1us-2^64us>\n",
869+
"<twt_wake_interval: 1-262144us> <twt_interval: 1us-2^31us>\n",
870870
cmd_wifi_twt_setup_quick),
871871
SHELL_CMD(setup, NULL, " Start a TWT flow:\n"
872872
"<negotiation_type, 0: Individual, 1: Broadcast, 2: Wake TBTT>\n"
873873
"<setup_cmd: 0: Request, 1: Suggest, 2: Demand>\n"
874874
"<dialog_token: 1-255> <flow_id: 0-7> <responder: 0/1> <trigger: 0/1> <implicit:0/1> "
875-
"<announce: 0/1> <twt_wake_interval: 1-262144us> <twt_interval: 1us-2^64us>\n",
875+
"<announce: 0/1> <twt_wake_interval: 1-262144us> <twt_interval: 1us-2^31us>\n",
876876
cmd_wifi_twt_setup),
877877
SHELL_CMD(teardown, NULL, " Teardown a TWT flow:\n"
878878
"<negotiation_type, 0: Individual, 1: Broadcast, 2: Wake TBTT>\n"

0 commit comments

Comments
 (0)