diff --git a/nshlib/README.md b/nshlib/README.md index b95aeefe4..975df7ea1 100644 --- a/nshlib/README.md +++ b/nshlib/README.md @@ -670,7 +670,7 @@ system image. Dump data in hexadecimal format from a file or character device. -- `ifconfig [nic_name [address_family] [|dhcp]] [dr|gw|gateway ] [netmask ] [prefixlen ] [dns ] [hw ]` +- `ifconfig [nic_name [address_family] [|dhcp]] [dr|gw|gateway ] [netmask |prefixlen ] [dns ] [hw ]` Show the current configuration of the network, for example: diff --git a/nshlib/nsh_command.c b/nshlib/nsh_command.c index ba8bf74f0..28009f49b 100644 --- a/nshlib/nsh_command.c +++ b/nshlib/nsh_command.c @@ -244,9 +244,10 @@ static const struct cmdmap_s g_cmdmap[] = #ifdef CONFIG_NET # ifndef CONFIG_NSH_DISABLE_IFCONFIG - { "ifconfig", cmd_ifconfig, 1, 11, - "[interface [|dhcp]] [dr|gw|gateway ] " - "[netmask ] [dns ] [hw ]" }, + { "ifconfig", cmd_ifconfig, 1, 12, + "[interface [address_family] [|dhcp]] " + "[dr|gw|gateway ] [netmask |prefixlen ] " + "[dns ] [hw ]" }, # endif # ifndef CONFIG_NSH_DISABLE_IFUPDOWN { "ifdown", cmd_ifdown, 2, 2, "" }, diff --git a/nshlib/nsh_netcmds.c b/nshlib/nsh_netcmds.c index ca7655b90..5d0810e9d 100644 --- a/nshlib/nsh_netcmds.c +++ b/nshlib/nsh_netcmds.c @@ -595,6 +595,11 @@ int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv) if (argc <= 2) { + if (argc == 2) + { + return ifconfig_callback(vtbl, argv[1]); + } + ret = nsh_foreach_netdev(ifconfig_callback, vtbl, "ifconfig"); if (ret < 0) {