summaryrefslogtreecommitdiff
path: root/proto
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2017-06-20 15:55:39 +0200
committerOndrej Zajicek (work) <santiago@crfreenet.org>2017-12-07 13:53:42 +0100
commitee528fbd5dc482ceece52832d4a8ea5a08251bfa (patch)
tree243ea4b34196fd7a36cb42d591aa55ba86c04484 /proto
parent92cc1e745758893a57a2432a0e11e4cd3ad289b7 (diff)
Timers: Add typecast to unit-converting macros
Diffstat (limited to 'proto')
-rw-r--r--proto/radv/radv.c6
-rw-r--r--proto/rip/config.Y6
-rw-r--r--proto/rpki/rpki.c8
3 files changed, 10 insertions, 10 deletions
diff --git a/proto/radv/radv.c b/proto/radv/radv.c
index 978d2091..415cd1d9 100644
--- a/proto/radv/radv.c
+++ b/proto/radv/radv.c
@@ -55,8 +55,8 @@ radv_timer(timer *tm)
/* Update timer */
ifa->last = current_time();
- btime t = (btime) ifa->cf->min_ra_int S;
- btime r = (btime) (ifa->cf->max_ra_int - ifa->cf->min_ra_int) S;
+ btime t = ifa->cf->min_ra_int S;
+ btime r = (ifa->cf->max_ra_int - ifa->cf->min_ra_int) S;
t += random() % (r + 1);
if (ifa->initial)
@@ -93,7 +93,7 @@ radv_iface_notify(struct radv_iface *ifa, int event)
}
/* Update timer */
- btime t = ifa->last + (btime) ifa->cf->min_delay S - current_time();
+ btime t = ifa->last + ifa->cf->min_delay S - current_time();
tm2_start(ifa->timer, t);
}
diff --git a/proto/rip/config.Y b/proto/rip/config.Y
index ba9ac20b..e3bc4ae3 100644
--- a/proto/rip/config.Y
+++ b/proto/rip/config.Y
@@ -147,9 +147,9 @@ rip_iface_item:
| SPLIT HORIZON bool { RIP_IFACE->split_horizon = $3; }
| POISON REVERSE bool { RIP_IFACE->poison_reverse = $3; }
| CHECK ZERO bool { RIP_IFACE->check_zero = $3; }
- | UPDATE TIME expr { RIP_IFACE->update_time = (btime) $3 S_; if ($3<=0) cf_error("Update time must be positive"); }
- | TIMEOUT TIME expr { RIP_IFACE->timeout_time = (btime) $3 S_; if ($3<=0) cf_error("Timeout time must be positive"); }
- | GARBAGE TIME expr { RIP_IFACE->garbage_time = (btime) $3 S_; if ($3<=0) cf_error("Garbage time must be positive"); }
+ | UPDATE TIME expr { RIP_IFACE->update_time = $3 S_; if ($3<=0) cf_error("Update time must be positive"); }
+ | TIMEOUT TIME expr { RIP_IFACE->timeout_time = $3 S_; if ($3<=0) cf_error("Timeout time must be positive"); }
+ | GARBAGE TIME expr { RIP_IFACE->garbage_time = $3 S_; if ($3<=0) cf_error("Garbage time must be positive"); }
| ECMP WEIGHT expr { RIP_IFACE->ecmp_weight = $3 - 1; if (($3<1) || ($3>256)) cf_error("ECMP weight must be in range 1-256"); }
| RX BUFFER expr { RIP_IFACE->rx_buffer = $3; if (($3<256) || ($3>65535)) cf_error("RX length must be in range 256-65535"); }
| TX LENGTH expr { RIP_IFACE->tx_length = $3; if (($3<256) || ($3>65535)) cf_error("TX length must be in range 256-65535"); }
diff --git a/proto/rpki/rpki.c b/proto/rpki/rpki.c
index cddbf017..f17024fe 100644
--- a/proto/rpki/rpki.c
+++ b/proto/rpki/rpki.c
@@ -318,7 +318,7 @@ rpki_cache_change_state(struct rpki_cache *cache, const enum rpki_cache_state ne
static void
rpki_schedule_next_refresh(struct rpki_cache *cache)
{
- btime t = (btime) cache->refresh_interval S;
+ btime t = cache->refresh_interval S;
CACHE_DBG(cache, "after %t s", t);
tm2_start(cache->refresh_timer, t);
@@ -327,7 +327,7 @@ rpki_schedule_next_refresh(struct rpki_cache *cache)
static void
rpki_schedule_next_retry(struct rpki_cache *cache)
{
- btime t = (btime) cache->retry_interval S;
+ btime t = cache->retry_interval S;
CACHE_DBG(cache, "after %t s", t);
tm2_start(cache->retry_timer, t);
@@ -337,7 +337,7 @@ static void
rpki_schedule_next_expire_check(struct rpki_cache *cache)
{
/* A minimum time to wait is 1 second */
- btime t = cache->last_update + (btime) cache->expire_interval S - current_time();
+ btime t = cache->last_update + cache->expire_interval S - current_time();
t = MAX(t, 1 S);
CACHE_DBG(cache, "after %t s", t);
@@ -483,7 +483,7 @@ rpki_expire_hook(timer *tm)
CACHE_DBG(cache, "%s", rpki_cache_state_to_str(cache->state));
- btime t = cache->last_update + (btime) cache->expire_interval S - current_time();
+ btime t = cache->last_update + cache->expire_interval S - current_time();
if (t <= 0)
{
CACHE_TRACE(D_EVENTS, cache, "All ROAs expired");