summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2024-01-11 14:11:04 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2024-01-11 14:11:04 +0000
commit170cf17e3aba02a36e9cc28c8abaa61db2afab26 (patch)
tree36ec6cd012cfa0e311043be4427a5a8ed738f887 /usr.sbin/bgpd
parent888e874b2d70f168858faa5a36ff8b744264e4c4 (diff)
Clear the last_sent_errcode, last_rcvd_errcode and last_reason when
the session comes up instead of at the start of a connect. With this the last errors reported should stick around longer. Reported by linx.net, OK job@
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r--usr.sbin/bgpd/session.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c
index 8e77c4f028b..c36fae41b2b 100644
--- a/usr.sbin/bgpd/session.c
+++ b/usr.sbin/bgpd/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.457 2024/01/10 11:08:04 claudio Exp $ */
+/* $OpenBSD: session.c,v 1.458 2024/01/11 14:11:03 claudio Exp $ */
/*
* Copyright (c) 2003, 2004, 2005 Henning Brauer <henning@openbsd.org>
@@ -608,11 +608,6 @@ bgp_fsm(struct peer *peer, enum session_events event)
/* init write buffer */
msgbuf_init(&peer->wbuf);
- 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->timers, Timer_ConnectRetry);
else if (peer->passive || peer->conf.passive ||
@@ -3553,6 +3548,13 @@ session_up(struct peer *p)
{
struct session_up sup;
+ /* clear last errors, now that the session is up */
+ p->stats.last_sent_errcode = 0;
+ p->stats.last_sent_suberr = 0;
+ p->stats.last_rcvd_errcode = 0;
+ p->stats.last_rcvd_suberr = 0;
+ memset(p->stats.last_reason, 0, sizeof(p->stats.last_reason));
+
if (imsg_rde(IMSG_SESSION_ADD, p->conf.id,
&p->conf, sizeof(p->conf)) == -1)
fatalx("imsg_compose error");