Diff below remove some more deprecated ioctl(2). The first group below correspond to features now deprecated by slaacd(8):
SIOCSIFINFO_FLAGS, SIOCSNDFLUSH_IN6, SIOCSPFXFLUSH_IN6, SIOCSRTRFLUSH_IN6 Removing those might break some ports. This is good! Because now they are broken at compile time and can be fixed. Currently they might or might not work. On codesearch.debian.net only dhcpcd5 seems to try to use them. The second group of ioctl(2)s is not used in base and should be used conditionally in ports, so it should be safe: SIOCGIFADDR_IN6, SIOCGIFSTAT_IN6, SIOCGIFSTAT_ICMP6 Diff below also move some define around in netinet6/in6_var.h to reduce the number of #ifdef _KERNEL chunks. ok? Index: netinet6/in6.c =================================================================== RCS file: /cvs/src/sys/netinet6/in6.c,v retrieving revision 1.215 diff -u -p -r1.215 in6.c --- netinet6/in6.c 24 Oct 2017 09:30:15 -0000 1.215 +++ netinet6/in6.c 25 Oct 2017 10:06:05 -0000 @@ -213,13 +213,6 @@ in6_ioctl(u_long cmd, caddr_t data, stru return (EOPNOTSUPP); switch (cmd) { - case SIOCSNDFLUSH_IN6: - case SIOCSPFXFLUSH_IN6: - case SIOCSRTRFLUSH_IN6: - case SIOCSIFINFO_FLAGS: - if (!privileged) - return (EPERM); - /* FALLTHROUGH */ case SIOCGIFINFO_IN6: case SIOCGNBRINFO_IN6: return (nd6_ioctl(cmd, data, ifp)); @@ -241,17 +234,11 @@ in6_ioctl(u_long cmd, caddr_t data, stru case SIOCAIFADDR_IN6: sa6 = &ifra->ifra_addr; break; - case SIOCGIFADDR_IN6: case SIOCGIFDSTADDR_IN6: case SIOCGIFNETMASK_IN6: case SIOCDIFADDR_IN6: case SIOCGIFAFLAG_IN6: - case SIOCSNDFLUSH_IN6: - case SIOCSPFXFLUSH_IN6: - case SIOCSRTRFLUSH_IN6: case SIOCGIFALIFETIME_IN6: - case SIOCGIFSTAT_IN6: - case SIOCGIFSTAT_ICMP6: sa6 = &ifr->ifr_addr; break; case SIOCSIFADDR: @@ -313,9 +300,6 @@ in6_ioctl(u_long cmd, caddr_t data, stru break; - case SIOCGIFADDR_IN6: - /* This interface is basically deprecated. use SIOCGIFCONF. */ - /* FALLTHROUGH */ case SIOCGIFAFLAG_IN6: case SIOCGIFNETMASK_IN6: case SIOCGIFDSTADDR_IN6: @@ -328,10 +312,6 @@ in6_ioctl(u_long cmd, caddr_t data, stru switch (cmd) { - case SIOCGIFADDR_IN6: - ifr->ifr_addr = ia6->ia_addr; - break; - case SIOCGIFDSTADDR_IN6: if ((ifp->if_flags & IFF_POINTOPOINT) == 0) return (EINVAL); @@ -349,10 +329,6 @@ in6_ioctl(u_long cmd, caddr_t data, stru case SIOCGIFAFLAG_IN6: ifr->ifr_ifru.ifru_flags6 = ia6->ia6_flags; break; - - case SIOCGIFSTAT_IN6: - case SIOCGIFSTAT_ICMP6: - return (EOPNOTSUPP); case SIOCGIFALIFETIME_IN6: ifr->ifr_ifru.ifru_lifetime = ia6->ia6_lifetime; Index: netinet6/in6_var.h =================================================================== RCS file: /cvs/src/sys/netinet6/in6_var.h,v retrieving revision 1.70 diff -u -p -r1.70 in6_var.h --- netinet6/in6_var.h 24 Oct 2017 09:36:13 -0000 1.70 +++ netinet6/in6_var.h 25 Oct 2017 10:06:05 -0000 @@ -278,40 +278,21 @@ struct in6_aliasreq { #define IFA_IN6(x) (&((struct sockaddr_in6 *)((x)->ifa_addr))->sin6_addr) #define IFA_DSTIN6(x) (&((struct sockaddr_in6 *)((x)->ifa_dstaddr))->sin6_addr) -#ifdef _KERNEL -#define IN6_ARE_MASKED_ADDR_EQUAL(d, a, m) ( \ - (((d)->s6_addr32[0] ^ (a)->s6_addr32[0]) & (m)->s6_addr32[0]) == 0 && \ - (((d)->s6_addr32[1] ^ (a)->s6_addr32[1]) & (m)->s6_addr32[1]) == 0 && \ - (((d)->s6_addr32[2] ^ (a)->s6_addr32[2]) & (m)->s6_addr32[2]) == 0 && \ - (((d)->s6_addr32[3] ^ (a)->s6_addr32[3]) & (m)->s6_addr32[3]) == 0 ) -#endif /* _KERNEL */ - -#define SIOCGIFADDR_IN6 _IOWR('i', 33, struct in6_ifreq) +#define SIOCDIFADDR_IN6 _IOW('i', 25, struct in6_ifreq) +#define SIOCAIFADDR_IN6 _IOW('i', 26, struct in6_aliasreq) #define SIOCGIFDSTADDR_IN6 _IOWR('i', 34, struct in6_ifreq) #define SIOCGIFNETMASK_IN6 _IOWR('i', 37, struct in6_ifreq) -#define SIOCDIFADDR_IN6 _IOW('i', 25, struct in6_ifreq) -#define SIOCAIFADDR_IN6 _IOW('i', 26, struct in6_aliasreq) - #define SIOCGIFAFLAG_IN6 _IOWR('i', 73, struct in6_ifreq) #define SIOCGIFINFO_IN6 _IOWR('i', 108, struct in6_ndireq) -#define SIOCSNDFLUSH_IN6 _IOWR('i', 77, struct in6_ifreq) #define SIOCGNBRINFO_IN6 _IOWR('i', 78, struct in6_nbrinfo) -#define SIOCSPFXFLUSH_IN6 _IOWR('i', 79, struct in6_ifreq) -#define SIOCSRTRFLUSH_IN6 _IOWR('i', 80, struct in6_ifreq) #define SIOCGIFALIFETIME_IN6 _IOWR('i', 81, struct in6_ifreq) -#define SIOCGIFSTAT_IN6 _IOWR('i', 83, struct in6_ifreq) -#define SIOCGIFSTAT_ICMP6 _IOWR('i', 84, struct in6_ifreq) - -#define SIOCSIFINFO_FLAGS _IOWR('i', 87, struct in6_ndireq) /* XXX */ -#define SIOCGETSGCNT_IN6 _IOWR('u', 106, \ - struct sioc_sg_req6) /* get s,g pkt cnt */ -#define SIOCGETMIFCNT_IN6 _IOWR('u', 107, \ - struct sioc_mif_req6) /* get pkt cnt per if */ +#define SIOCGETSGCNT_IN6 _IOWR('u', 106, struct sioc_sg_req6) +#define SIOCGETMIFCNT_IN6 _IOWR('u', 107, struct sioc_mif_req6) #define IN6_IFF_ANYCAST 0x01 /* anycast address */ #define IN6_IFF_TENTATIVE 0x02 /* tentative address */ @@ -322,6 +303,12 @@ struct in6_aliasreq { #define IN6_IFF_PRIVACY 0x80 /* RFC 4941 temporary address */ #ifdef _KERNEL +#define IN6_ARE_MASKED_ADDR_EQUAL(d, a, m) ( \ + (((d)->s6_addr32[0] ^ (a)->s6_addr32[0]) & (m)->s6_addr32[0]) == 0 && \ + (((d)->s6_addr32[1] ^ (a)->s6_addr32[1]) & (m)->s6_addr32[1]) == 0 && \ + (((d)->s6_addr32[2] ^ (a)->s6_addr32[2]) & (m)->s6_addr32[2]) == 0 && \ + (((d)->s6_addr32[3] ^ (a)->s6_addr32[3]) & (m)->s6_addr32[3]) == 0 ) + #define IN6_ARE_SCOPE_CMP(a,b) ((a)-(b)) #define IN6_ARE_SCOPE_EQUAL(a,b) ((a)==(b)) Index: netinet6/nd6.c =================================================================== RCS file: /cvs/src/sys/netinet6/nd6.c,v retrieving revision 1.219 diff -u -p -r1.219 nd6.c --- netinet6/nd6.c 11 Aug 2017 21:24:20 -0000 1.219 +++ netinet6/nd6.c 25 Oct 2017 10:06:05 -0000 @@ -996,25 +996,6 @@ nd6_ioctl(u_long cmd, caddr_t data, stru case SIOCGIFINFO_IN6: ndi->ndi = *ND_IFINFO(ifp); break; - case SIOCSIFINFO_FLAGS: - error = ENOTSUP; - break; - case SIOCSNDFLUSH_IN6: /* XXX: the ioctl name is confusing... */ - /* sync kernel routing table with the default router list */ - error = ENOTSUP; - break; - case SIOCSPFXFLUSH_IN6: - { - /* flush all the prefix advertised by routers */ - error = ENOTSUP; - break; - } - case SIOCSRTRFLUSH_IN6: - { - /* flush all the default routers */ - error = ENOTSUP; - break; - } case SIOCGNBRINFO_IN6: { struct llinfo_nd6 *ln;