diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2020-01-09 11:55:26 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2020-01-09 11:55:26 +0000 |
commit | 0b25131f248b04d0ff3ff7ae4c3f2b3a67486d0f (patch) | |
tree | 2cd5dd52c3d9569ff27f48234a39293af11a9b93 /usr.sbin/bgpd/rde.c | |
parent | 6cdd3aac731e58d47a474b7343f2a2ed12bf6037 (diff) |
Convert the lastchange of a prefix from time(NULL) to getmonotime() which
uses CLOCK_MONOTONIC. Convert the control messages to return the relative
age of the prefix instead of the absolute age. Adjust the mrt dump code
to stil dump the route age in seconds since epoch as defined in the RFC.
With this all times in bgpd are now based on CLOCK_MONOTONIC.
OK denis@
Diffstat (limited to 'usr.sbin/bgpd/rde.c')
-rw-r--r-- | usr.sbin/bgpd/rde.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c index 83e0d1ed320..08eb50f7986 100644 --- a/usr.sbin/bgpd/rde.c +++ b/usr.sbin/bgpd/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.496 2020/01/08 18:01:22 deraadt Exp $ */ +/* $OpenBSD: rde.c,v 1.497 2020/01/09 11:55:25 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -2204,7 +2204,7 @@ rde_dump_rib_as(struct prefix *p, struct rde_aspath *asp, pid_t pid, int flags) nexthop = prefix_nexthop(p); bzero(&rib, sizeof(rib)); - rib.lastchange = p->lastchange; + rib.age = getmonotime() - p->lastchange; rib.local_pref = asp->lpref; rib.med = asp->med; rib.weight = asp->weight; @@ -3883,7 +3883,7 @@ peer_stale(struct rde_peer *peer, u_int8_t aid) if (peer->staletime[aid]) peer_flush(peer, aid, peer->staletime[aid]); - peer->staletime[aid] = now = time(NULL); + peer->staletime[aid] = now = getmonotime(); peer->state = PEER_DOWN; /* mark Adj-RIB-Out stale for this peer */ @@ -3892,7 +3892,7 @@ peer_stale(struct rde_peer *peer, u_int8_t aid) fatal("%s: prefix_dump_new", __func__); /* make sure new prefixes start on a higher timestamp */ - while (now >= time(NULL)) + while (now >= getmonotime()) sleep(1); } |