mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-10-20 21:41:18 +08:00
ifconfig: Allow hostip on first non-option place after inet/inet6
NuttX previous: ifconfig eth0 10.0.0.1 [inet] ifconfig eth0 2022::2 inet6 Try to be compatible with other systems: Linux: ifconfig eth0 [inet] 10.0.0.1 ifconfig eth0 [inet6] add 2022::2 FreeBSD: ifconfig eth0 inet 10.0.0.1 ifconfig eth0 inet6 2022::2 NuttX newly supported: ifconfig eth0 [inet] 10.0.0.1 ifconfig eth0 inet6 [add] 2022::2 Ref: https://man7.org/linux/man-pages/man8/ifconfig.8.html https://www.freebsd.org/cgi/man.cgi?ifconfig Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user