summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nest/proto.c2
-rw-r--r--proto/bfd/bfd.c11
-rw-r--r--proto/bgp/bgp.c20
-rw-r--r--proto/ospf/neighbor.c19
-rw-r--r--proto/rpki/rpki.c10
5 files changed, 24 insertions, 38 deletions
diff --git a/nest/proto.c b/nest/proto.c
index 3043b648..8d5edda3 100644
--- a/nest/proto.c
+++ b/nest/proto.c
@@ -1136,7 +1136,7 @@ graceful_restart_show_status(void)
cli_msg(-24, "Graceful restart recovery in progress");
cli_msg(-24, " Waiting for %d channels to recover", graceful_restart_locks);
- cli_msg(-24, " Wait timer is %d/%d", tm_remains(gr_wait_timer), config->gr_wait);
+ cli_msg(-24, " Wait timer is %t/%u", tm2_remains(gr_wait_timer), config->gr_wait);
}
/**
diff --git a/proto/bfd/bfd.c b/proto/bfd/bfd.c
index 2374cfe8..8915140d 100644
--- a/proto/bfd/bfd.c
+++ b/proto/bfd/bfd.c
@@ -1078,7 +1078,7 @@ bfd_show_sessions(struct proto *P)
byte tbuf[TM_DATETIME_BUFFER_SIZE];
struct bfd_proto *p = (struct bfd_proto *) P;
uint state, diag UNUSED;
- u32 tx_int, timeout;
+ btime tx_int, timeout;
const char *ifname;
if (p->p.proto_state != PS_UP)
@@ -1099,15 +1099,14 @@ bfd_show_sessions(struct proto *P)
state = s->loc_state;
diag = s->loc_diag;
ifname = (s->ifa && s->ifa->iface) ? s->ifa->iface->name : "---";
- tx_int = s->last_tx ? (MAX(s->des_min_tx_int, s->rem_min_rx_int) TO_MS) : 0;
- timeout = (MAX(s->req_min_rx_int, s->rem_min_tx_int) TO_MS) * s->rem_detect_mult;
+ tx_int = s->last_tx ? MAX(s->des_min_tx_int, s->rem_min_rx_int) : 0;
+ timeout = (btime) MAX(s->req_min_rx_int, s->rem_min_tx_int) * s->rem_detect_mult;
state = (state < 4) ? state : 0;
tm_format_time(tbuf, &config->tf_proto, s->last_state_change);
- cli_msg(-1020, "%-25I %-10s %-10s %-10s %3u.%03u %3u.%03u",
- s->addr, ifname, bfd_state_names[state], tbuf,
- tx_int / 1000, tx_int % 1000, timeout / 1000, timeout % 1000);
+ cli_msg(-1020, "%-25I %-10s %-10s %-10s %7t %7t",
+ s->addr, ifname, bfd_state_names[state], tbuf, tx_int, timeout);
}
HASH_WALK_END;
diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c
index dba7c875..9823be6b 100644
--- a/proto/bgp/bgp.c
+++ b/proto/bgp/bgp.c
@@ -2009,17 +2009,17 @@ bgp_show_proto_info(struct proto *P)
if ((p->start_state < BSS_CONNECT) &&
(tm_active(p->startup_timer)))
- cli_msg(-1006, " Error wait: %d/%d",
- (int) tm_remains(p->startup_timer), p->startup_delay);
+ cli_msg(-1006, " Error wait: %t/%u",
+ tm2_remains(p->startup_timer), p->startup_delay);
if ((oc->state == BS_ACTIVE) &&
(tm_active(oc->connect_timer)))
- cli_msg(-1006, " Connect delay: %d/%d",
- (int) tm_remains(oc->connect_timer), p->cf->connect_delay_time);
+ cli_msg(-1006, " Connect delay: %t/%u",
+ tm2_remains(oc->connect_timer), p->cf->connect_delay_time);
if (p->gr_active_num && tm_active(p->gr_timer))
- cli_msg(-1006, " Restart timer: %d/-",
- (int) tm_remains(p->gr_timer));
+ cli_msg(-1006, " Restart timer: %t/-",
+ tm2_remains(p->gr_timer));
}
else if (P->proto_state == PS_UP)
{
@@ -2040,10 +2040,10 @@ bgp_show_proto_info(struct proto *P)
p->ext_messages ? " ext-messages" : "");
*/
cli_msg(-1006, " Source address: %I", p->source_addr);
- cli_msg(-1006, " Hold timer: %d/%d",
- tm_remains(p->conn->hold_timer), p->conn->hold_time);
- cli_msg(-1006, " Keepalive timer: %d/%d",
- tm_remains(p->conn->keepalive_timer), p->conn->keepalive_time);
+ cli_msg(-1006, " Hold timer: %t/%u",
+ tm2_remains(p->conn->hold_timer), p->conn->hold_time);
+ cli_msg(-1006, " Keepalive timer: %t/%u",
+ tm2_remains(p->conn->keepalive_timer), p->conn->keepalive_time);
}
if ((p->last_error_class != BE_NONE) &&
diff --git a/proto/ospf/neighbor.c b/proto/ospf/neighbor.c
index 64165e46..74ea63d0 100644
--- a/proto/ospf/neighbor.c
+++ b/proto/ospf/neighbor.c
@@ -651,20 +651,6 @@ ospf_sh_neigh_info(struct ospf_neighbor *n)
{
struct ospf_iface *ifa = n->ifa;
char *pos = "PtP ";
- char etime[6];
- int exp, sec, min;
-
- exp = tm_remains(n->inactim);
- sec = exp % 60;
- min = exp / 60;
- if (min > 59)
- {
- bsprintf(etime, "-Inf-");
- }
- else
- {
- bsprintf(etime, "%02u:%02u", min, sec);
- }
if ((ifa->type == OSPF_IT_BCAST) || (ifa->type == OSPF_IT_NBMA))
{
@@ -676,6 +662,7 @@ ospf_sh_neigh_info(struct ospf_neighbor *n)
pos = "Other";
}
- cli_msg(-1013, "%-1R\t%3u\t%s/%s\t%-5s\t%-10s %-1I", n->rid, n->priority,
- ospf_ns_names[n->state], pos, etime, ifa->ifname, n->ip);
+ cli_msg(-1013, "%-1R\t%3u\t%s/%s\t%7t\t%-10s %-1I",
+ n->rid, n->priority, ospf_ns_names[n->state], pos,
+ tm2_remains(n->inactim), ifa->ifname, n->ip);
}
diff --git a/proto/rpki/rpki.c b/proto/rpki/rpki.c
index a331e45e..7930363f 100644
--- a/proto/rpki/rpki.c
+++ b/proto/rpki/rpki.c
@@ -790,9 +790,9 @@ static void
rpki_show_proto_info_timer(const char *name, uint num, timer *t)
{
if (tm_active(t))
- cli_msg(-1006, " %-17s %us (remains %ds)", name, num, (int) tm_remains(t));
+ cli_msg(-1006, " %-16s: %t/%u", name, tm2_remains(t), num);
else
- cli_msg(-1006, " %-17s ---", name);
+ cli_msg(-1006, " %-16s: ---", name);
}
static void
@@ -836,9 +836,9 @@ rpki_show_proto_info(struct proto *P)
cli_msg(-1006, " Last update: ---");
}
- rpki_show_proto_info_timer("Refresh interval:", cache->refresh_interval, cache->refresh_timer);
- rpki_show_proto_info_timer("Retry interval:", cache->retry_interval, cache->retry_timer);
- rpki_show_proto_info_timer("Expire interval:", cache->expire_interval, cache->expire_timer);
+ rpki_show_proto_info_timer("Refresh timer", cache->refresh_interval, cache->refresh_timer);
+ rpki_show_proto_info_timer("Retry timer", cache->retry_interval, cache->retry_timer);
+ rpki_show_proto_info_timer("Expire timer", cache->expire_interval, cache->expire_timer);
if (p->roa4_channel)
channel_show_info(p->roa4_channel);