Use clearer semantics on how rde_generate_updates is called.
Adjust prefix_evaluate and prefix_evaluate_nexthop so that
rde_generate_updates() is only called with a few options.
Either new is valid or old is valid. If both are invalid then
there is no need to call rde_generate_updates(). If both are
valid only new matters and old_pathid_tx is set to 0.
In prefix_evaluate() most calls are with either new or old set to NULL.
If both are set then new->path_id_tx == old->path_id_tx.
In prefix_evaluate_nexthop() if old was valid then new becomes invalid
but if old was invalid new may still be invalid.
OK tb@
Respect RTR min-version in the implicit downgrade path and release
activity lock when closing the connection.
Check min_version in the implict downgrade case and error out if the
suggested version is too low. Also trigger the RTR_EVNT_NEGOTIATION_DONE
event only after parsing all of the header. If the PDU was bad don't
trigger this event.
In the rtr_fsm() when closing a connection check the state of the
active_lock and if the lock is held, reset the cache, release the lock and
recalculate the sets. The internal state is corrupt if a connection error
triggerd during an exchange so it makes no sense to carry a bad cache
around.
OK tb@
sndiod: Add a reference counter to the port structure
Using a counter is simpler than (ab-)using the midi endpoint bitmaps
to figure out if the port is in use. In turn this allows holding a
reference to the port without involving midi endpoint
connections. This change also reduces the differences between MIDI
ports and audio devices: less logic, less bugs.
sndiod: Save a pointer to the struct opt associated to the midi endpoint
As the socket code holds a reference to the struct opt, it's simpler
to just save it and release it when the socket is closed. This avoids
iterating over the full set of midi endpoint structures.
No behavior change
sndiod: Unlink the MIDI port from the socket when its closed
Not unlinking the port is bad style and might keep the port open after
the socket is closed.
sndiod: Add the server.mode control making the setting dynamic
The default mode remains "-m play,rec" but now it can be changed with
sndioctl(1). If the server is switched to play-only mode, then
existing clients will start recording silence. Similarly if it's
switched to rec-only mode, clients are muted.
ok armani, deraadt, rsadowski