summaryrefslogtreecommitdiff
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
parent02288d0e0b8f430b30d006846ccd3391b91a2135 (diff)
keep seperate message counters for open/update/keepalive/notification
-rw-r--r--usr.sbin/bgpctl/bgpctl.c12
-rw-r--r--usr.sbin/bgpd/session.c14
-rw-r--r--usr.sbin/bgpd/session.h12
3 files changed, 26 insertions, 12 deletions
diff --git a/usr.sbin/bgpctl/bgpctl.c b/usr.sbin/bgpctl/bgpctl.c
index 5a0490b56d2..6af7444ddf4 100644
--- a/usr.sbin/bgpctl/bgpctl.c
+++ b/usr.sbin/bgpctl/bgpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpctl.c,v 1.12 2004/01/04 19:44:27 henning Exp $ */
+/* $OpenBSD: bgpctl.c,v 1.13 2004/01/04 20:07:30 henning Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -189,10 +189,14 @@ show_summary_msg(struct imsg *imsg)
switch (imsg->hdr.type) {
case IMSG_CTL_SHOW_NEIGHBOR:
p = imsg->data;
- printf("%-15s %5u %10llu %10llu %8s %s\n",
+ printf("%-15s %5u %10llu %10llu %-8s %s\n",
inet_ntoa(p->conf.remote_addr.sin_addr),
- p->conf.remote_as, p->stats.msg_rcvd,
- p->stats.msg_send, fmt_timeframe(p->stats.last_updown),
+ p->conf.remote_as,
+ p->stats.msg_rcvd_open + p->stats.msg_rcvd_notification +
+ p->stats.msg_rcvd_update + p->stats.msg_rcvd_keepalive,
+ p->stats.msg_sent_open + p->stats.msg_sent_notification +
+ p->stats.msg_sent_update + p->stats.msg_sent_keepalive,
+ fmt_timeframe(p->stats.last_updown),
statenames[p->state]);
break;
case IMSG_CTL_END:
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;
};