summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/rtadvd/config.c10
-rw-r--r--usr.sbin/rtadvd/dump.c16
-rw-r--r--usr.sbin/rtadvd/rtadvd.c24
-rw-r--r--usr.sbin/rtadvd/rtadvd.h6
4 files changed, 29 insertions, 27 deletions
diff --git a/usr.sbin/rtadvd/config.c b/usr.sbin/rtadvd/config.c
index 3c72a6db83b..07abb62ce72 100644
--- a/usr.sbin/rtadvd/config.c
+++ b/usr.sbin/rtadvd/config.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: config.c,v 1.31 2013/03/17 00:38:29 brad Exp $ */
+/* $OpenBSD: config.c,v 1.32 2013/04/30 12:29:04 florian Exp $ */
/* $KAME: config.c,v 1.62 2002/05/29 10:13:10 itojun Exp $ */
/*
@@ -803,13 +803,13 @@ make_packet(struct rainfo *rainfo)
if (pfx->vltimeexpire == 0)
vltime = pfx->validlifetime;
else
- vltime = (pfx->vltimeexpire > now.tv_sec) ?
- pfx->vltimeexpire - now.tv_sec : 0;
+ vltime = (u_int32_t)(pfx->vltimeexpire > now.tv_sec ?
+ pfx->vltimeexpire - now.tv_sec : 0);
if (pfx->pltimeexpire == 0)
pltime = pfx->preflifetime;
else
- pltime = (pfx->pltimeexpire > now.tv_sec) ?
- pfx->pltimeexpire - now.tv_sec : 0;
+ pltime = (u_int32_t)(pfx->pltimeexpire > now.tv_sec ?
+ pfx->pltimeexpire - now.tv_sec : 0);
if (vltime < pltime) {
/*
* this can happen if vltime is decrement but pltime
diff --git a/usr.sbin/rtadvd/dump.c b/usr.sbin/rtadvd/dump.c
index 36018c3f3c7..df4882f4d15 100644
--- a/usr.sbin/rtadvd/dump.c
+++ b/usr.sbin/rtadvd/dump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dump.c,v 1.12 2013/04/02 03:21:20 deraadt Exp $ */
+/* $OpenBSD: dump.c,v 1.13 2013/04/30 12:29:04 florian Exp $ */
/* $KAME: dump.c,v 1.27 2002/05/29 14:23:55 itojun Exp $ */
/*
@@ -182,13 +182,15 @@ rtadvd_dump()
origin = "";
}
if (pfx->vltimeexpire != 0)
- asprintf(&vltimexpire, "(decr,expire %ld)", (long)
- pfx->vltimeexpire > now.tv_sec ?
- pfx->vltimeexpire - now.tv_sec : 0);
+ /* truncate to onwire value */
+ asprintf(&vltimexpire, "(decr,expire %u)",
+ (u_int32_t)(pfx->vltimeexpire > now.tv_sec ?
+ pfx->vltimeexpire - now.tv_sec : 0));
if (pfx->pltimeexpire != 0)
- asprintf(&pltimexpire, "(decr,expire %ld)", (long)
- pfx->pltimeexpire > now.tv_sec ?
- pfx->pltimeexpire - now.tv_sec : 0);
+ /* truncate to onwire value */
+ asprintf(&pltimexpire, "(decr,expire %u)",
+ (u_int32_t)(pfx->pltimeexpire > now.tv_sec ?
+ pfx->pltimeexpire - now.tv_sec : 0));
vltime = lifetime(pfx->validlifetime);
pltime = lifetime(pfx->preflifetime);
diff --git a/usr.sbin/rtadvd/rtadvd.c b/usr.sbin/rtadvd/rtadvd.c
index a5dd636c348..45d96a23ca6 100644
--- a/usr.sbin/rtadvd/rtadvd.c
+++ b/usr.sbin/rtadvd/rtadvd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtadvd.c,v 1.42 2013/04/19 05:06:35 deraadt Exp $ */
+/* $OpenBSD: rtadvd.c,v 1.43 2013/04/30 12:29:04 florian Exp $ */
/* $KAME: rtadvd.c,v 1.66 2002/05/29 14:18:36 itojun Exp $ */
/*
@@ -928,7 +928,7 @@ static int
prefix_check(struct nd_opt_prefix_info *pinfo,
struct rainfo *rai, struct sockaddr_in6 *from)
{
- u_int32_t preferred_time, valid_time;
+ time_t preferred_time, valid_time;
struct prefix *pp;
int inconsistent = 0;
u_char ntopbuf[INET6_ADDRSTRLEN], prefixbuf[INET6_ADDRSTRLEN];
@@ -980,24 +980,24 @@ prefix_check(struct nd_opt_prefix_info *pinfo,
abs(preferred_time - pp->pltimeexpire) > rai->clockskew) {
log_info("prefeerred lifetime for %s/%d"
" (decr. in real time) inconsistent on %s:"
- " %d from %s, %ld from us",
+ " %lld from %s, %lld from us",
inet_ntop(AF_INET6, &pinfo->nd_opt_pi_prefix,
prefixbuf, INET6_ADDRSTRLEN),
pinfo->nd_opt_pi_prefix_len,
- rai->ifname, preferred_time,
+ rai->ifname, (long long)preferred_time,
inet_ntop(AF_INET6, &from->sin6_addr,
ntopbuf, INET6_ADDRSTRLEN),
- pp->pltimeexpire);
+ (long long)pp->pltimeexpire);
inconsistent++;
}
} else if (preferred_time != pp->preflifetime)
log_info("prefeerred lifetime for %s/%d"
" inconsistent on %s:"
- " %d from %s, %d from us",
+ " %lld from %s, %d from us",
inet_ntop(AF_INET6, &pinfo->nd_opt_pi_prefix,
prefixbuf, INET6_ADDRSTRLEN),
pinfo->nd_opt_pi_prefix_len,
- rai->ifname, preferred_time,
+ rai->ifname, (long long)preferred_time,
inet_ntop(AF_INET6, &from->sin6_addr,
ntopbuf, INET6_ADDRSTRLEN),
pp->preflifetime);
@@ -1011,24 +1011,24 @@ prefix_check(struct nd_opt_prefix_info *pinfo,
abs(valid_time - pp->vltimeexpire) > rai->clockskew) {
log_info("valid lifetime for %s/%d"
" (decr. in real time) inconsistent on %s:"
- " %d from %s, %ld from us",
+ " %lld from %s, %lld from us",
inet_ntop(AF_INET6, &pinfo->nd_opt_pi_prefix,
prefixbuf, INET6_ADDRSTRLEN),
pinfo->nd_opt_pi_prefix_len,
- rai->ifname, preferred_time,
+ rai->ifname, (long long)preferred_time,
inet_ntop(AF_INET6, &from->sin6_addr,
ntopbuf, INET6_ADDRSTRLEN),
- pp->vltimeexpire);
+ (long long)pp->vltimeexpire);
inconsistent++;
}
} else if (valid_time != pp->validlifetime) {
log_info("valid lifetime for %s/%d"
" inconsistent on %s:"
- " %d from %s, %d from us",
+ " %lld from %s, %d from us",
inet_ntop(AF_INET6, &pinfo->nd_opt_pi_prefix,
prefixbuf, INET6_ADDRSTRLEN),
pinfo->nd_opt_pi_prefix_len,
- rai->ifname, valid_time,
+ rai->ifname, (long long)valid_time,
inet_ntop(AF_INET6, &from->sin6_addr,
ntopbuf, INET6_ADDRSTRLEN),
pp->validlifetime);
diff --git a/usr.sbin/rtadvd/rtadvd.h b/usr.sbin/rtadvd/rtadvd.h
index 34ffbaeeb80..653c899d9e6 100644
--- a/usr.sbin/rtadvd/rtadvd.h
+++ b/usr.sbin/rtadvd/rtadvd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtadvd.h,v 1.13 2012/07/11 10:40:47 phessler Exp $ */
+/* $OpenBSD: rtadvd.h,v 1.14 2013/04/30 12:29:04 florian Exp $ */
/* $KAME: rtadvd.h,v 1.20 2002/05/29 10:13:10 itojun Exp $ */
/*
@@ -72,9 +72,9 @@ struct prefix {
TAILQ_ENTRY(prefix) entry;
u_int32_t validlifetime; /* AdvValidLifetime */
- long vltimeexpire; /* expiration of vltime; decrement case only */
+ time_t vltimeexpire; /* expiration of vltime; decrement case only */
u_int32_t preflifetime; /* AdvPreferredLifetime */
- long pltimeexpire; /* expiration of pltime; decrement case only */
+ time_t pltimeexpire; /* expiration of pltime; decrement case only */
u_int onlinkflg; /* bool: AdvOnLinkFlag */
u_int autoconfflg; /* bool: AdvAutonomousFlag */
int prefixlen;