net/netdev: Support managing multiple IPv6 addresses by ioctl

1. Supporting `SIOCSIFADDR` and `SIOCDIFADDR` with Linux in6_ifreq struct to manage ipv6 addresses.
   Ref: https://man7.org/linux/man-pages/man7/netdevice.7.html
2. Supporting alias like 'eth0:0' for multiple IPv6 addresses, to keep previous ioctl `SIOCGLIFADDR`, `SIOCSLIFADDR`, `SIOCGLIFNETMASK` and `SIOCSLIFNETMASK` working.
   Ref: https://man7.org/linux/man-pages/man8/ifconfig.8.html

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
This commit is contained in:
Zhe Weng
2023-10-20 17:08:10 +08:00
committed by Xiang Xiao
parent 7f421a46ca
commit 3e4d847f42
6 changed files with 178 additions and 70 deletions
+7
View File
@@ -335,6 +335,13 @@ struct in6_pktinfo
int ipi6_ifindex; /* send/recv interface index */
};
struct in6_ifreq
{
struct in6_addr ifr6_addr; /* The IPv6 address of the request */
uint32_t ifr6_prefixlen; /* The IPv6 prefix length */
int ifr6_ifindex; /* The interface index of the request */
};
/****************************************************************************
* Public Data
****************************************************************************/
+2 -2
View File
@@ -301,7 +301,7 @@ void net_initialize(void);
* Calculate the ioctl argument buffer length.
*
* Input Parameters:
*
* domain The socket domain
* cmd The ioctl command
*
* Returned Value:
@@ -309,7 +309,7 @@ void net_initialize(void);
*
****************************************************************************/
ssize_t net_ioctl_arglen(int cmd);
ssize_t net_ioctl_arglen(uint8_t domain, int cmd);
/****************************************************************************
* Critical section management.