diff --git a/nshlib/README.md b/nshlib/README.md index efbc885cd..7968414dd 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 [|dhcp]] [dr|gw|gateway ] [netmask ] [dns ] [hw ]` +- `ifconfig [nic_name [address_family] [|dhcp]] [dr|gw|gateway ] [netmask ] [dns ] [hw ]` Show the current configuration of the network, for example: diff --git a/nshlib/nsh_netcmds.c b/nshlib/nsh_netcmds.c index 8e804a710..2c2cbd858 100644 --- a/nshlib/nsh_netcmds.c +++ b/nshlib/nsh_netcmds.c @@ -698,8 +698,18 @@ int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv) } } #endif - else if (i == 2) + else if (!strcmp(tmp, "add")) { + /* Compatible with linux IPv6 command, do nothing. */ + + continue; + } + else if (hostip == NULL && i <= 4) + { + /* Let first non-option be host ip, to support inet/inet6 + * options before address. + */ + hostip = tmp; } else