diff options
author | claudio <claudio@openbsd.org> | 2020-01-21 11:12:06 +0000 |
---|---|---|
committer | claudio <claudio@openbsd.org> | 2020-01-21 11:12:06 +0000 |
commit | 165e0d63cbc6620df033ab1d67057ae9113c894d (patch) | |
tree | 706bfa8856ebd8714ee2c125692f8e7d0c1b0359 /usr.sbin/bgpd | |
parent | Whack last remaining LIBRESSL_VERSION_NUMBER check in the C code. (diff) | |
download | wireguard-openbsd-165e0d63cbc6620df033ab1d67057ae9113c894d.tar.xz wireguard-openbsd-165e0d63cbc6620df033ab1d67057ae9113c894d.zip |
Add last_rcvd_errcode and last_rcvd_suberr to the peer_stats so that
not only sent errors can be reported but also received ones.
OK denis@ deraadt@
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r-- | usr.sbin/bgpd/session.c | 6 | ||||
-rw-r--r-- | usr.sbin/bgpd/session.h | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c index 2af4f8ebd9a..c1498fbc2f0 100644 --- a/usr.sbin/bgpd/session.c +++ b/usr.sbin/bgpd/session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: session.c,v 1.396 2020/01/09 11:51:18 claudio Exp $ */ +/* $OpenBSD: session.c,v 1.397 2020/01/21 11:12:06 claudio Exp $ */ /* * Copyright (c) 2003, 2004, 2005 Henning Brauer <henning@openbsd.org> @@ -610,6 +610,8 @@ bgp_fsm(struct peer *peer, enum session_events event) peer->stats.last_sent_errcode = 0; peer->stats.last_sent_suberr = 0; + peer->stats.last_rcvd_errcode = 0; + peer->stats.last_rcvd_suberr = 0; if (!peer->depend_ok) timer_stop(peer, Timer_ConnectRetry); @@ -2189,6 +2191,8 @@ parse_notification(struct peer *peer) log_notification(peer, errcode, subcode, p, datalen, "received"); peer->errcnt++; + peer->stats.last_rcvd_errcode = errcode; + peer->stats.last_rcvd_suberr = subcode; if (errcode == ERR_OPEN && subcode == ERR_OPEN_CAPA) { if (datalen == 0) { /* zebra likes to send those.. humbug */ diff --git a/usr.sbin/bgpd/session.h b/usr.sbin/bgpd/session.h index e6c193dd6f2..298286f5cbe 100644 --- a/usr.sbin/bgpd/session.h +++ b/usr.sbin/bgpd/session.h @@ -1,4 +1,4 @@ -/* $OpenBSD: session.h,v 1.142 2020/01/09 11:51:18 claudio Exp $ */ +/* $OpenBSD: session.h,v 1.143 2020/01/21 11:12:06 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -171,6 +171,8 @@ struct peer_stats { u_int32_t prefix_cnt; u_int8_t last_sent_errcode; u_int8_t last_sent_suberr; + u_int8_t last_rcvd_errcode; + u_int8_t last_rcvd_suberr; char last_shutcomm[SHUT_COMM_LEN]; }; |