mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-10-12 00:10:14 +00:00
netutils/netlib: Add support for add/del a single IPv6 address
Note: The `SIOCSIFADDR` and `SIOCDIFADDR` uses different params for `AF_INET` and `AF_INET6` (`struct ifreq` vs `struct in6_ifreq`) as defined by https://man7.org/linux/man-pages/man7/netdevice.7.html Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
This commit is contained in:
parent
8cc06ac5cf
commit
2f9d98cab2
6 changed files with 217 additions and 1 deletions
|
|
@ -239,7 +239,21 @@ int netlib_get_ipv4netmask(FAR const char *ifname, FAR struct in_addr *addr);
|
|||
int netlib_ipv4adaptor(in_addr_t destipaddr, FAR in_addr_t *srcipaddr);
|
||||
#endif
|
||||
|
||||
/* We support multiple IPv6 addresses on a single interface.
|
||||
* Recommend to use netlib_add/del_ipv6addr to manage them, by which you
|
||||
* don't need to care about the slot it stored.
|
||||
*
|
||||
* Previous interfaces can still work, the ifname can be <eth>:<num>,
|
||||
* e.g. eth0:0 stands for managing the secondary address on eth0
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
# ifdef CONFIG_NETDEV_MULTIPLE_IPv6
|
||||
int netlib_add_ipv6addr(FAR const char *ifname,
|
||||
FAR const struct in6_addr *addr, uint8_t preflen);
|
||||
int netlib_del_ipv6addr(FAR const char *ifname,
|
||||
FAR const struct in6_addr *addr, uint8_t preflen);
|
||||
# endif
|
||||
int netlib_get_ipv6addr(FAR const char *ifname, FAR struct in6_addr *addr);
|
||||
int netlib_set_ipv6addr(FAR const char *ifname,
|
||||
FAR const struct in6_addr *addr);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue