summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2017-10-03 23:40:50 +0100
committerRoy Marples <roy@marples.name>2017-10-03 23:40:50 +0100
commit5e2811aa5a2f7883960be1606b7016132550c21b (patch)
tree0ec123c13e9faea607e77926e4b07629f429ad9a
parent9f23d8c75a9cf46e0c5ce46f0c4a5828e5312404 (diff)
downloaddhcpcd-5e2811aa5a2f7883960be1606b7016132550c21b.tar.xz
Compare tv_sec to uint32_t correctly.
-rw-r--r--src/dhcp6.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/dhcp6.c b/src/dhcp6.c
index 4ebc331f..7505ce0c 100644
--- a/src/dhcp6.c
+++ b/src/dhcp6.c
@@ -2941,24 +2941,26 @@ dhcp6_bind(struct interface *ifp, const char *op)
clock_gettime(CLOCK_MONOTONIC, &now);
if (state->state == DH6S_TIMEDOUT || state->state == DH6S_ITIMEDOUT) {
struct timespec diff;
+ uint32_t diffsec;
/* Reduce timers */
timespecsub(&now, &state->acquired, &diff);
+ diffsec = (uint32_t)diff.tv_sec;
if (state->renew && state->renew != ND6_INFINITE_LIFETIME) {
- if (state->renew > diff.tv_sec)
- state->renew -= (uint32_t)diff.tv_sec;
+ if (state->renew > diffsec)
+ state->renew -= diffsec;
else
state->renew = 0;
}
if (state->rebind && state->rebind != ND6_INFINITE_LIFETIME) {
- if (state->rebind > diff.tv_sec)
- state->rebind -= (uint32_t)diff.tv_sec;
+ if (state->rebind > diffsec)
+ state->rebind -= diffsec;
else
state->rebind = 0;
}
if (state->expire && state->expire != ND6_INFINITE_LIFETIME) {
- if (state->expire > diff.tv_sec)
- state->expire -= (uint32_t)diff.tv_sec;
+ if (state->expire > diffsec)
+ state->expire -= diffsec;
else {
if (!(ifp->options->options &
DHCPCD_LASTLEASE_EXTEND))