diff options
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/bgpd/bgpd.h | 5 | ||||
-rw-r--r-- | usr.sbin/bgpd/session.c | 11 | ||||
-rw-r--r-- | usr.sbin/bgpd/session.h | 4 |
3 files changed, 12 insertions, 8 deletions
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h index 926d8eb4ae4..dd22a322af8 100644 --- a/usr.sbin/bgpd/bgpd.h +++ b/usr.sbin/bgpd/bgpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.h,v 1.395 2019/11/27 01:21:54 claudio Exp $ */ +/* $OpenBSD: bgpd.h,v 1.396 2020/01/09 11:51:18 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -1291,6 +1291,9 @@ int trie_roa_check(struct trie_head *, struct bgpd_addr *, u_int8_t, void trie_dump(struct trie_head *); int trie_equal(struct trie_head *, struct trie_head *); +/* timer.c */ +time_t getmonotime(void); + /* util.c */ const char *log_addr(const struct bgpd_addr *); const char *log_in6addr(const struct in6_addr *); diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c index 2add58e2d16..2af4f8ebd9a 100644 --- a/usr.sbin/bgpd/session.c +++ b/usr.sbin/bgpd/session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: session.c,v 1.395 2019/10/02 08:57:00 claudio Exp $ */ +/* $OpenBSD: session.c,v 1.396 2020/01/09 11:51:18 claudio Exp $ */ /* * Copyright (c) 2003, 2004, 2005 Henning Brauer <henning@openbsd.org> @@ -252,7 +252,7 @@ session_main(int debug, int verbose) /* cloned peer that idled out? */ if (p->template && (p->state == STATE_IDLE || p->state == STATE_ACTIVE) && - time(NULL) - p->stats.last_updown >= + getmonotime() - p->stats.last_updown >= INTERVAL_HOLD_CLONED) p->reconf_action = RECONF_DELETE; @@ -1701,6 +1701,7 @@ session_dispatch_msg(struct pollfd *pfd, struct peer *p) bgp_fsm(p, EVNT_CON_FATAL); return (1); } + p->stats.last_write = getmonotime(); if (p->throttled && p->wbuf.queued < SESS_MSG_LOW_MARK) { if (imsg_rde(IMSG_XON, p->conf.id, NULL, 0) == -1) log_peer_warn(&p->conf, "imsg_compose XON"); @@ -1726,7 +1727,7 @@ session_dispatch_msg(struct pollfd *pfd, struct peer *p) } p->rbuf->wpos += n; - p->stats.last_read = time(NULL); + p->stats.last_read = getmonotime(); return (1); } return (0); @@ -3048,7 +3049,7 @@ void session_down(struct peer *peer) { bzero(&peer->capa.neg, sizeof(peer->capa.neg)); - peer->stats.last_updown = time(NULL); + peer->stats.last_updown = getmonotime(); /* * session_down is called in the exit code path so check * if the RDE is still around, if not there is no need to @@ -3075,7 +3076,7 @@ session_up(struct peer *p) sup.remote_bgpid = p->remote_bgpid; sup.short_as = p->short_as; memcpy(&sup.capa, &p->capa.neg, sizeof(sup.capa)); - p->stats.last_updown = time(NULL); + p->stats.last_updown = getmonotime(); if (imsg_rde(IMSG_SESSION_UP, p->conf.id, &sup, sizeof(sup)) == -1) fatalx("imsg_compose error"); } diff --git a/usr.sbin/bgpd/session.h b/usr.sbin/bgpd/session.h index 2f92021fe56..e6c193dd6f2 100644 --- a/usr.sbin/bgpd/session.h +++ b/usr.sbin/bgpd/session.h @@ -1,4 +1,4 @@ -/* $OpenBSD: session.h,v 1.141 2019/10/01 11:05:30 claudio Exp $ */ +/* $OpenBSD: session.h,v 1.142 2020/01/09 11:51:18 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -167,6 +167,7 @@ struct peer_stats { unsigned long long prefix_sent_eor; time_t last_updown; time_t last_read; + time_t last_write; u_int32_t prefix_cnt; u_int8_t last_sent_errcode; u_int8_t last_sent_suberr; @@ -310,7 +311,6 @@ int imsg_ctl_rde(int, pid_t, void *, u_int16_t); void session_stop(struct peer *, u_int8_t); /* timer.c */ -time_t getmonotime(void); struct peer_timer *timer_get(struct peer *, enum Timer); struct peer_timer *timer_nextisdue(struct peer *, time_t); time_t timer_nextduein(struct peer *, time_t); |