Index | Thread | Search

From:
Claudio Jeker <cjeker@diehard.n-r-g.com>
Subject:
bgpd: clear rtr last errors on end of data event
To:
tech@openbsd.org
Date:
Thu, 11 Jan 2024 15:24:39 +0100

Download raw body.

Thread
Currently the last_recv_error and last_sent_error (plus msgs) are too
sticky. They remain way after the error happened since they were never
cleared. This diff clears this values when a RTR_EVNT_END_OF_DATA event
is generated. This means the cache was successfully loaded and so the
old reported errors no longer matter.

I think this is a good compromise between showing very old errors and
losing this information too soon.
-- 
:wq Claudio

Index: rtr_proto.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rtr_proto.c,v
diff -u -p -r1.30 rtr_proto.c
--- rtr_proto.c	11 Jan 2024 13:08:39 -0000	1.30
+++ rtr_proto.c	11 Jan 2024 14:15:33 -0000
@@ -1174,6 +1174,11 @@ rtr_fsm(struct rtr_session *rs, enum rtr
 		rtr_sem_release(rs->active_lock);
 		rtr_recalc();
 		rs->active_lock = 0;
+		/* clear the last errors */
+		rs->last_sent_error = NO_ERROR;
+		rs->last_recv_error = NO_ERROR;
+		rs->last_sent_msg[0] = '\0';
+		rs->last_recv_msg[0] = '\0';
 		break;
 	case RTR_EVNT_CACHE_RESET:
 		rtr_reset_cache(rs);