sndiod: Allow control slots to have NULL opt pointer
This case is not encoutered yet, but to control non-audio properties
the control slots must work with no opt structure.
Adjust last commit, the loop termination was not quite correct.
Set pte to NULL before the inner pt_get loop so that the outer
loop terminates correctly on (!found && pte != NULL).
Since pte is NULL now plen needs to be set earlier as well.
OK tb@
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.