summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-01-03 22:44:30 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-01-03 22:44:30 +0000
commit534b52210bcd8885257c2c303175d6751713f08e (patch)
treed7a301e40eedb75f9876f6d643331695d52bb2a0 /usr.sbin
parent27b4b627291e409fae17809f5eeac5f3f3390121 (diff)
keep track of last session up/down and last successfull read
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bgpd/session.c5
-rw-r--r--usr.sbin/bgpd/session.h5
2 files changed, 8 insertions, 2 deletions
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c
index 37167c3b4ea..4d94db2a27a 100644
--- a/usr.sbin/bgpd/session.c
+++ b/usr.sbin/bgpd/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.57 2004/01/03 22:18:58 henning Exp $ */
+/* $OpenBSD: session.c,v 1.58 2004/01/03 22:44:28 henning Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -1010,6 +1010,7 @@ session_dispatch_msg(struct pollfd *pfd, struct peer *peer)
rpos = 0;
av = peer->rbuf->wpos + n;
+ peer->stats.last_read = time(NULL);
for (;;) {
if (rpos + MSGSIZE_HEADER > av)
@@ -1397,6 +1398,7 @@ getpeerbyip(in_addr_t ip)
void
session_down(struct peer *peer)
{
+ peer->stats.last_updown = time(NULL);
if (imsg_compose(&ibuf_rde, IMSG_SESSION_DOWN, peer->conf.id,
NULL, 0) == -1)
fatalx("imsg_compose error");
@@ -1405,6 +1407,7 @@ session_down(struct peer *peer)
void
session_up(struct peer *peer)
{
+ peer->stats.last_updown = time(NULL);
if (imsg_compose(&ibuf_rde, IMSG_SESSION_UP, peer->conf.id,
&peer->remote_bgpid, sizeof(peer->remote_bgpid)) == -1)
fatalx("imsg_compose error");
diff --git a/usr.sbin/bgpd/session.h b/usr.sbin/bgpd/session.h
index d74f94c82ef..8ad48abdd65 100644
--- a/usr.sbin/bgpd/session.h
+++ b/usr.sbin/bgpd/session.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.h,v 1.6 2004/01/03 22:18:58 henning Exp $ */
+/* $OpenBSD: session.h,v 1.7 2004/01/03 22:44:29 henning Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -17,6 +17,7 @@
*/
#include <sys/types.h>
+#include <time.h>
#define MAX_BACKLOG 5
#define INTERVAL_CONNECTRETRY 120
@@ -118,6 +119,8 @@ TAILQ_HEAD(ctl_conns, ctl_conn) ctl_conns;
struct peer_stats {
u_int64_t msg_rcvd;
u_int64_t msg_send;
+ time_t last_updown;
+ time_t last_read;
};
struct peer {