From 717bc86c88c6541bd8e14f946a98c38ab8271f25 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Fri, 25 Apr 2014 13:05:15 +0000 Subject: [PATCH] Fix some -Wconversion errors on FreeBSD. --- dhcp.c | 6 +++--- dhcp6.c | 15 ++++++++------- dhcp6.h | 8 ++++---- ipv6nd.c | 4 ++-- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/dhcp.c b/dhcp.c index 3791aae2..f2ff32c3 100644 --- a/dhcp.c +++ b/dhcp.c @@ -1871,11 +1871,11 @@ dhcp_bind(void *arg) lease->renewaltime = lease->rebindtime = lease->leasetime; else { eloop_timeout_add_sec(iface->ctx->eloop, - lease->renewaltime, dhcp_renew, iface); + (time_t)lease->renewaltime, dhcp_renew, iface); eloop_timeout_add_sec(iface->ctx->eloop, - lease->rebindtime, dhcp_rebind, iface); + (time_t)lease->rebindtime, dhcp_rebind, iface); eloop_timeout_add_sec(iface->ctx->eloop, - lease->leasetime, dhcp_expire, iface); + (time_t)lease->leasetime, dhcp_expire, iface); syslog(LOG_DEBUG, "%s: renew in %"PRIu32" seconds, rebind in %"PRIu32 " seconds", diff --git a/dhcp6.c b/dhcp6.c index ebc3c6a7..c1813310 100644 --- a/dhcp6.c +++ b/dhcp6.c @@ -2228,7 +2228,7 @@ dhcp6_handledata(void *arg) if (u32 >= 60 && u32 <= 86400) { syslog(LOG_DEBUG, "%s: SOL_MAX_RT %d -> %d", ifp->name, state->sol_max_rt, u32); - state->sol_max_rt = u32; + state->sol_max_rt = (time_t)u32; } else syslog(LOG_ERR, "%s: invalid SOL_MAX_RT %d", ifp->name, u32); @@ -2240,7 +2240,7 @@ dhcp6_handledata(void *arg) if (u32 >= 60 && u32 <= 86400) { syslog(LOG_DEBUG, "%s: INF_MAX_RT %d -> %d", ifp->name, state->inf_max_rt, u32); - state->inf_max_rt = u32; + state->inf_max_rt = (time_t)u32; } else syslog(LOG_ERR, "%s: invalid INF_MAX_RT %d", ifp->name, u32); @@ -2406,15 +2406,16 @@ recv: else state->state = DH6S_BOUND; if (state->renew && state->renew != ND6_INFINITE_LIFETIME) - eloop_timeout_add_sec(ifp->ctx->eloop, state->renew, + eloop_timeout_add_sec(ifp->ctx->eloop, + (time_t)state->renew, state->state == DH6S_INFORMED ? dhcp6_startinform : dhcp6_startrenew, ifp); if (state->rebind && state->rebind != ND6_INFINITE_LIFETIME) - eloop_timeout_add_sec(ifp->ctx->eloop, state->rebind, - dhcp6_startrebind, ifp); + eloop_timeout_add_sec(ifp->ctx->eloop, + (time_t)state->rebind, dhcp6_startrebind, ifp); if (state->expire && state->expire != ND6_INFINITE_LIFETIME) - eloop_timeout_add_sec(ifp->ctx->eloop, state->expire, - dhcp6_startexpire, ifp); + eloop_timeout_add_sec(ifp->ctx->eloop, + (time_t)state->expire, dhcp6_startexpire, ifp); if (ifp->options->ia_type == D6_OPTION_IA_PD) dhcp6_delegate_prefix(ifp); diff --git a/dhcp6.h b/dhcp6.h index 9e148b76..468c4f5f 100644 --- a/dhcp6.h +++ b/dhcp6.h @@ -174,12 +174,12 @@ struct dhcp6_state { struct timeval RT; unsigned int IMD; unsigned int RTC; - unsigned int IRT; + time_t IRT; unsigned int MRC; - unsigned int MRT; + time_t MRT; void (*MRCcallback)(void *); - unsigned int sol_max_rt; - unsigned int inf_max_rt; + time_t sol_max_rt; + time_t inf_max_rt; struct dhcp6_message *send; size_t send_len; diff --git a/ipv6nd.c b/ipv6nd.c index 615ad661..53893a15 100644 --- a/ipv6nd.c +++ b/ipv6nd.c @@ -905,7 +905,7 @@ ipv6nd_handlera(struct ipv6_ctx *ctx, struct interface *ifp, if (lifetime == ~0U) timerclear(&rao->expire); else { - expire.tv_sec = lifetime; + expire.tv_sec = (time_t)lifetime; expire.tv_usec = 0; timeradd(&rap->received, &expire, &rao->expire); } @@ -1110,7 +1110,7 @@ ipv6nd_expirera(void *arg) continue; valid = 0; if (rap->lifetime) { - lt.tv_sec = rap->lifetime; + lt.tv_sec = (time_t)rap->lifetime; lt.tv_usec = 0; timeradd(&rap->received, <, &expire); if (rap->lifetime == 0 || timercmp(&now, &expire, >)) { -- 2.47.3