summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-01-04 20:07:31 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-01-04 20:07:31 +0000
commite127442db30804c78a939d0db51b8bf9435b29a8 (patch)
treee8b6d40ea4acd6fe41a6cb68a3d11c879857444f /usr.sbin/bgpd
parent02288d0e0b8f430b30d006846ccd3391b91a2135 (diff)
keep seperate message counters for open/update/keepalive/notification
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r--usr.sbin/bgpd/session.c14
-rw-r--r--usr.sbin/bgpd/session.h12
2 files changed, 18 insertions, 8 deletions
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c
index 3294be71ab0..10a54fbac8d 100644
--- a/usr.sbin/bgpd/session.c
+++ b/usr.sbin/bgpd/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.61 2004/01/04 19:39:46 henning Exp $ */
+/* $OpenBSD: session.c,v 1.62 2004/01/04 20:07:30 henning Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -843,7 +843,7 @@ session_open(struct peer *peer)
bgp_fsm(peer, EVNT_CON_FATAL);
}
- peer->stats.msg_send++;
+ peer->stats.msg_sent_open++;
}
void
@@ -885,13 +885,14 @@ session_keepalive(struct peer *peer)
}
start_timer_keepalive(peer);
- peer->stats.msg_send++;
+ peer->stats.msg_sent_keepalive++;
}
void
session_update(struct peer *peer)
{
start_timer_keepalive(peer);
+ peer->stats.msg_sent_update++;
}
void
@@ -936,7 +937,7 @@ session_notification(struct peer *peer, u_int8_t errcode, u_int8_t subcode,
buf_free(buf);
bgp_fsm(peer, EVNT_CON_FATAL);
}
- peer->stats.msg_send++;
+ peer->stats.msg_sent_notification++;
}
int
@@ -1029,15 +1030,19 @@ session_dispatch_msg(struct pollfd *pfd, struct peer *peer)
switch (msgtype) {
case OPEN:
bgp_fsm(peer, EVNT_RCVD_OPEN);
+ peer->stats.msg_rcvd_open++;
break;
case UPDATE:
bgp_fsm(peer, EVNT_RCVD_UPDATE);
+ peer->stats.msg_rcvd_update++;
break;
case NOTIFICATION:
bgp_fsm(peer, EVNT_RCVD_NOTIFICATION);
+ peer->stats.msg_rcvd_notification++;
break;
case KEEPALIVE:
bgp_fsm(peer, EVNT_RCVD_KEEPALIVE);
+ peer->stats.msg_rcvd_update++;
break;
default: /* cannot happen */
session_notification(peer, ERR_HEADER,
@@ -1047,7 +1052,6 @@ session_dispatch_msg(struct pollfd *pfd, struct peer *peer)
" %u", msgtype);
}
rpos += msglen;
- peer->stats.msg_rcvd++;
}
if (rpos < av) {
left = av - rpos;
diff --git a/usr.sbin/bgpd/session.h b/usr.sbin/bgpd/session.h
index c983e0a0b93..aea136d2830 100644
--- a/usr.sbin/bgpd/session.h
+++ b/usr.sbin/bgpd/session.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.h,v 1.9 2004/01/04 19:39:46 henning Exp $ */
+/* $OpenBSD: session.h,v 1.10 2004/01/04 20:07:30 henning Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -117,8 +117,14 @@ struct ctl_conn {
TAILQ_HEAD(ctl_conns, ctl_conn) ctl_conns;
struct peer_stats {
- u_int64_t msg_rcvd;
- u_int64_t msg_send;
+ u_int64_t msg_rcvd_open;
+ u_int64_t msg_rcvd_update;
+ u_int64_t msg_rcvd_notification;
+ u_int64_t msg_rcvd_keepalive;
+ u_int64_t msg_sent_open;
+ u_int64_t msg_sent_update;
+ u_int64_t msg_sent_notification;
+ u_int64_t msg_sent_keepalive;
time_t last_updown;
time_t last_read;
};