From 41ac09096bccd529db79fac5770c7f673c3ebf1c Mon Sep 17 00:00:00 2001 From: claudio Date: Thu, 11 Jan 2024 14:11:03 +0000 Subject: [PATCH] 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@ --- usr.sbin/bgpd/session.c | 14 ++++++++------ 1 file 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 @@ -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"); -- 2.20.1