nshlib/ifconfig: Add support for add/del a single IPv6 address

Note: We're using similar error codes as Linux:
```
linux> sudo ifconfig eth0 inet6 add fc00::2/64
linux> sudo ifconfig eth0 inet6 del fc00::2/112
SIOCDIFADDR: Cannot assign requested address
linux> sudo ifconfig eth0 inet6 del fc00::3/64
SIOCDIFADDR: Cannot assign requested address
linux> sudo ifconfig eth0 inet6 add fc00::2/64
SIOCSIFADDR: File exists

nuttx> ifconfig eth0 inet6 add fc00::2/64
nuttx> ifconfig eth0 inet6 del fc00::2/112
Failed to manage IPv6 address: Cannot assign requested address
nuttx> ifconfig eth0 inet6 del fc00::3/112
Failed to manage IPv6 address: Cannot assign requested address
nuttx> ifconfig eth0 inet6 add fc00::2/64
Failed to manage IPv6 address: File exists
```

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
This commit is contained in:
Zhe Weng
2023-10-25 15:18:00 +08:00
committed by Xiang Xiao
parent 2f9d98cab2
commit 56ef320d6f
2 changed files with 43 additions and 7 deletions

View File

@@ -278,7 +278,7 @@ static const struct cmdmap_s g_cmdmap[] =
#ifdef CONFIG_NET
# ifndef CONFIG_NSH_DISABLE_IFCONFIG
CMD_MAP("ifconfig", cmd_ifconfig, 1, 12,
"[interface [address_family] [mtu <len>] | [<ip-address>|dhcp]]"
"[interface [mtu <len>]|[address_family] [[add|del] <ip-address>|dhcp]]"
"[dr|gw|gateway <dr-address>] [netmask <net-mask>|prefixlen <len>] "
"[dns <dns-address>] [hw <hw-mac>]"),
# endif