Index | Thread | Search

From:
Theo Buehler <tb@theobuehler.org>
Subject:
Re: bgpd: Adjust BGP FSM handling in change_state
To:
tech@openbsd.org
Date:
Tue, 15 Apr 2025 06:25:33 +0200

Download raw body.

Thread
On Mon, Apr 14, 2025 at 04:59:17PM +0200, Claudio Jeker wrote:
> change_state() switches the peer FSM form one state to another.
> One thing I dislike is that it does a lot of work before changing the
> state and so it is possible to shoot yourself with e.g. session_up() that
> is called with a peer->state that is not ESTABLISHED.
> 
> I prefer to first update the peer state (and prev_state) and then do all
> the fumbling using peer->state and peer->prev_state. This makes the code
> less of a mind bender.
> 
> As a side-effect the mrt_state_dump call becomes a lot simpler and
> log_statechange() would also but there is this 'don't clutter the logs'
> magic that needs 3 states. But even that is less horrible like this.

I agree, this is a lot nicer this way.

ok tb