diff --git a/tools/README.md b/tools/README.md index 1bb68fd00..f59eaa78b 100644 --- a/tools/README.md +++ b/tools/README.md @@ -36,9 +36,12 @@ ifconfig -p [-f type:format] %sinterface address_family ifconfig -p -l [-d] [-u] [address_family] ifconfig -p %s[-d] [-m] [-u] [-v] ``` +We has supportted inet6, you can config ipv6 address like this: + + ifconfig -p interface inet6 autoconf + Unsupported interfaces or parameters: ``` -inet6 MAC(Mandatory Access Control) media SFP/SFP+ @@ -77,6 +80,7 @@ Examples: Display the route for a destination network: ./sbin/route -p 0 show 172.16.10.0 + ./sbin/route -p 0 -6 show ::/0 Delete a static route from the routing table: diff --git a/tools/compat/ioctl.c b/tools/compat/ioctl.c index f29afbd21..73cb81983 100644 --- a/tools/compat/ioctl.c +++ b/tools/compat/ioctl.c @@ -53,7 +53,7 @@ ioctl_va(int fd, unsigned long com, void *data, int argc, ...) unsigned size; void *cpy_mem; size_t offset, clen; - int af = 0; + int af = AF_INET; if (argc != 0 && argc != 3 && argc != 1) { errno = EINVAL; @@ -107,6 +107,7 @@ ioctl_va(int fd, unsigned long com, void *data, int argc, ...) msg->msg_type = FF_IOCTL; else { errno = EINVAL; + ff_ipc_msg_free(msg); return -1; } diff --git a/tools/ifconfig/af_nd6.c b/tools/ifconfig/af_nd6.c index c4e4d1423..36f28888e 100644 --- a/tools/ifconfig/af_nd6.c +++ b/tools/ifconfig/af_nd6.c @@ -76,7 +76,11 @@ setnd6flags(const char *dummyaddr __unused, memset(&nd, 0, sizeof(nd)); strlcpy(nd.ifname, ifr.ifr_name, sizeof(nd.ifname)); - error = ioctl(s, SIOCGIFINFO_IN6, &nd); +#ifndef FSTACK + error = ioctl(s, SIOCGIFINFO_IN6, (caddr_t)&nd); +#else + error = ioctl_va(s, SIOCGIFINFO_IN6, (caddr_t)&nd, 1, AF_INET6); +#endif if (error) { warn("ioctl(SIOCGIFINFO_IN6)"); return; @@ -85,7 +89,12 @@ setnd6flags(const char *dummyaddr __unused, nd.ndi.flags &= ~(-d); else nd.ndi.flags |= d; + +#ifndef FSTACK error = ioctl(s, SIOCSIFINFO_IN6, (caddr_t)&nd); +#else + error = ioctl_va(s, SIOCSIFINFO_IN6, (caddr_t)&nd, 1, AF_INET6); +#endif if (error) warn("ioctl(SIOCSIFINFO_IN6)"); } @@ -114,7 +123,11 @@ setnd6defif(const char *dummyaddr __unused, } ndifreq.ifindex = ifindex; +#ifndef FSTACK error = ioctl(s, SIOCSDEFIFACE_IN6, (caddr_t)&ndifreq); +#else + error = ioctl_va(s, SIOCSDEFIFACE_IN6, (caddr_t)&ndifreq, 1, AF_INET6); +#endif if (error) warn("ioctl(SIOCSDEFIFACE_IN6)"); } @@ -130,7 +143,11 @@ isnd6defif(int s) strlcpy(ndifreq.ifname, ifr.ifr_name, sizeof(ndifreq.ifname)); ifindex = if_nametoindex(ndifreq.ifname); +#ifndef FSTACK error = ioctl(s, SIOCGDEFIFACE_IN6, (caddr_t)&ndifreq); +#else + error = ioctl_va(s, SIOCGDEFIFACE_IN6, (caddr_t)&ndifreq, 1, AF_INET6); +#endif if (error) { warn("ioctl(SIOCGDEFIFACE_IN6)"); return (error); @@ -153,7 +170,12 @@ nd6_status(int s) warn("socket(AF_INET6, SOCK_DGRAM)"); return; } + +#ifndef FSTACK error = ioctl(s6, SIOCGIFINFO_IN6, &nd); +#else + error = ioctl_va(s, SIOCGIFINFO_IN6, (caddr_t)&nd, 1, AF_INET6); +#endif if (error) { if (errno != EPFNOSUPPORT) warn("ioctl(SIOCGIFINFO_IN6)");