summaryrefslogtreecommitdiff
path: root/sys/netinet6/in6.c
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2017-03-16 10:42:02 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2017-03-16 10:42:02 +0000
commitb82375da07a1291952729cb545f2afc6d179e2ab (patch)
tree4f008da94d7f52dbc438d58978649d97518c1bc6 /sys/netinet6/in6.c
parentb4fa3d1490b67b060f904449ed443d1c4c7f062b (diff)
Userland expects pltime to be a time stamp not number of seconds.
pltime conversion was missing from rev 1.193 which did the vltime conversion only. OK mpi
Diffstat (limited to 'sys/netinet6/in6.c')
-rw-r--r--sys/netinet6/in6.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
index 8e97cf848d3..5aaef3b515b 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6.c,v 1.200 2017/03/06 08:59:07 mpi Exp $ */
+/* $OpenBSD: in6.c,v 1.201 2017/03/16 10:42:01 florian Exp $ */
/* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */
/*
@@ -376,7 +376,7 @@ in6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, int privileged)
retlt->ia6t_expire = maxexpire;
}
if (ia6->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME) {
- time_t maxexpire;
+ time_t expire, maxexpire;
struct in6_addrlifetime *retlt =
&ifr->ifr_ifru.ifru_lifetime;
@@ -388,8 +388,13 @@ in6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, int privileged)
(time_t)~(1ULL << ((sizeof(maxexpire) * 8) - 1));
if (ia6->ia6_lifetime.ia6t_pltime <
maxexpire - ia6->ia6_updatetime) {
- retlt->ia6t_preferred = ia6->ia6_updatetime +
+ expire = ia6->ia6_updatetime +
ia6->ia6_lifetime.ia6t_pltime;
+ if (expire != 0) {
+ expire -= time_uptime;
+ expire += time_second;
+ }
+ retlt->ia6t_preferred = expire;
} else
retlt->ia6t_preferred = maxexpire;
}