Skip to content

Commit 04a421d

Browse files
committed
net: shell: Fix statistics for network interface
We did not check that user has supplied network interface index in "net stats iface <idx>" command. Signed-off-by: Jukka Rissanen <[email protected]>
1 parent aa07f8a commit 04a421d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

subsys/net/ip/net_shell.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4204,6 +4204,11 @@ static int cmd_net_stats_iface(const struct shell *shell, size_t argc,
42044204

42054205
#if defined(CONFIG_NET_STATISTICS)
42064206
#if defined(CONFIG_NET_STATISTICS_PER_INTERFACE)
4207+
if (argv[1] == NULL) {
4208+
PR_WARNING("Network interface index missing!\n");
4209+
return -ENOEXEC;
4210+
}
4211+
42074212
idx = strtol(argv[1], &endptr, 10);
42084213
if (*endptr != '\0') {
42094214
PR_WARNING("Invalid index %s\n", argv[1]);

0 commit comments

Comments
 (0)