summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstefan <stefan@openbsd.org>2016-02-28 07:15:34 +0000
committerstefan <stefan@openbsd.org>2016-02-28 07:15:34 +0000
commitf487585d711456156cf95432fac5a11ff78440c8 (patch)
treead3a3e3d20505487b8bcf26ec0f5e1259ba3d756
parentAdd back undocumented -h switch defaulting to usage(). (diff)
downloadwireguard-openbsd-f487585d711456156cf95432fac5a11ff78440c8.tar.xz
wireguard-openbsd-f487585d711456156cf95432fac5a11ff78440c8.zip
Remove SIOCSIFALIFETIME_IN6 ioctl, as NetBSD did.
As described in NetBSD kern/35897 PR, the parameters this ioctl needs overlay each other in a union. The ioctl cannot have worked properly. Discovered while discussing overflow checks with mmcc@ and mpi@ The checks were part of the removed code. ok deraadt@
-rw-r--r--sys/netinet6/in6.c38
-rw-r--r--sys/netinet6/in6_var.h3
2 files changed, 2 insertions, 39 deletions
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
index e1256cfa18a..0b203a49bf5 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6.c,v 1.183 2016/01/21 11:23:48 mpi Exp $ */
+/* $OpenBSD: in6.c,v 1.184 2016/02/28 07:15:34 stefan Exp $ */
/* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */
/*
@@ -253,7 +253,6 @@ in6_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp)
case SIOCSPFXFLUSH_IN6:
case SIOCSRTRFLUSH_IN6:
case SIOCGIFALIFETIME_IN6:
- case SIOCSIFALIFETIME_IN6:
case SIOCGIFSTAT_IN6:
case SIOCGIFSTAT_ICMP6:
sa6 = &ifr->ifr_addr;
@@ -337,26 +336,6 @@ in6_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp)
if (ia6 == NULL)
return (EADDRNOTAVAIL);
break;
- case SIOCSIFALIFETIME_IN6:
- {
- struct in6_addrlifetime *lt;
-
- if (!privileged)
- return (EPERM);
- if (ia6 == NULL)
- return (EADDRNOTAVAIL);
- /* sanity for overflow - beware unsigned */
- lt = &ifr->ifr_ifru.ifru_lifetime;
- if (lt->ia6t_vltime != ND6_INFINITE_LIFETIME
- && lt->ia6t_vltime + time_second < time_second) {
- return EINVAL;
- }
- if (lt->ia6t_pltime != ND6_INFINITE_LIFETIME
- && lt->ia6t_pltime + time_second < time_second) {
- return EINVAL;
- }
- break;
- }
}
switch (cmd) {
@@ -427,21 +406,6 @@ in6_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp)
}
break;
- case SIOCSIFALIFETIME_IN6:
- ia6->ia6_lifetime = ifr->ifr_ifru.ifru_lifetime;
- /* for sanity */
- if (ia6->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME) {
- ia6->ia6_lifetime.ia6t_expire =
- time_second + ia6->ia6_lifetime.ia6t_vltime;
- } else
- ia6->ia6_lifetime.ia6t_expire = 0;
- if (ia6->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME) {
- ia6->ia6_lifetime.ia6t_preferred =
- time_second + ia6->ia6_lifetime.ia6t_pltime;
- } else
- ia6->ia6_lifetime.ia6t_preferred = 0;
- break;
-
case SIOCAIFADDR_IN6:
{
int plen, error = 0, newifaddr = 0;
diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h
index fc91a9b1224..860189ec18e 100644
--- a/sys/netinet6/in6_var.h
+++ b/sys/netinet6/in6_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6_var.h,v 1.59 2016/01/21 11:23:48 mpi Exp $ */
+/* $OpenBSD: in6_var.h,v 1.60 2016/02/28 07:15:34 stefan Exp $ */
/* $KAME: in6_var.h,v 1.55 2001/02/16 12:49:45 itojun Exp $ */
/*
@@ -405,7 +405,6 @@ struct in6_rrenumreq {
#define SIOCSRTRFLUSH_IN6 _IOWR('i', 80, struct in6_ifreq)
#define SIOCGIFALIFETIME_IN6 _IOWR('i', 81, struct in6_ifreq)
-#define SIOCSIFALIFETIME_IN6 _IOWR('i', 82, struct in6_ifreq)
#define SIOCGIFSTAT_IN6 _IOWR('i', 83, struct in6_ifreq)
#define SIOCGIFSTAT_ICMP6 _IOWR('i', 84, struct in6_ifreq)