Skip to content

Feature/uid autoconfiguration#3

Draft
jonathan-reichardt wants to merge 4 commits into
feature/macos-dev-compatfrom
feature/uid-autoconfiguration
Draft

Feature/uid autoconfiguration#3
jonathan-reichardt wants to merge 4 commits into
feature/macos-dev-compatfrom
feature/uid-autoconfiguration

Conversation

@jonathan-reichardt

Copy link
Copy Markdown

No description provided.

Phase 1 of UID autoconfiguration lands in OpenAudioNetwork behind the
new OAN_UID_AUTOCONF flag (default OFF). Mirror the option here so
the parent build can propagate it; bump the submodule pointer to pick
up the new structs, algorithm, and tests.

See Docs/proposals/uid-autoconfiguration.md and -impl.md.
Engine, coreui, and io_sim now derive their OAN UID via the autoconfig
algorithm (MAC-hash + collision probe) on first boot and persist it for
subsequent boots. The flag OAN_UID_AUTOCONF defaults ON for Linux and
host-backend dev builds; firmwares stay OFF and wire it themselves in
phase 3.

- engine: NetMan owns the autoconfig step; main.cpp constructs an
  EnvOverrideUidStore over a FileUidStore at /var/lib/oals/engine-<iface>.uid
  (Linux) or ~/.local/state/oals/engine-<iface>.uid (host), and defers
  AudioRouter construction until NetMan has committed a UID. Removes the
  hardcoded uid=100.
- coreui: ShowManager wraps surface.json with a QJsonFieldUidStore (QSaveFile
  atomic write of network.persisted_uid). NetworkConfig splits hint_uid
  (static-range pin from network.uid) from persisted_uid and the committed
  uid. Static-range hints bypass the probe phase.
- io_sim: inline JsonFieldUidStore over the config JSON (atomic temp+rename),
  removes the long-standing hardcoded uid=1, fixes ClockSlave to use the
  committed UID, moves launch_mapping_process after autoconfig.
- All three accept --renumber to clear the persisted UID and re-derive.
@jonathan-reichardt jonathan-reichardt self-assigned this Jun 4, 2026
UID autoconfiguration is now unconditional in engine, coreui, and io_sim.
Removes the option() in top-level CMakeLists.txt, the #ifdef blocks across
all three binaries, and the legacy uid=100/uid=200/uid=1 fallback paths.

- engine/NetMan: init_netman is now a single overload that always takes an
  IUidStore* (nullable for tests). Deleted the m_pconf.uid = 100 branch.
- engine/main: unconditional FileUidStore + EnvOverrideUidStore wiring.
- coreui/ShowManager: unconditional QJsonFieldUidStore over surface.json.
  network.uid is honoured only as a static-range pin; dynamic values are
  silently ignored by the configurator.
- io_sim: unconditional JsonFieldUidStore over the config JSON.
- surface.json: strip the now-meaningless uid=200 default.
- example.json: update the comment to clarify static-pin behaviour.

Bumps OAN submodule to 1b824ac (the matching OAN-side phase 4 commit).

Firmwares are unaffected; they pin pre-phase-1 OAN and will autoconfigure
once their submodules get bumped in phase 3.
A peer's discovery socket is created by NetworkMapper before UID
autoconfig runs, so the hello on that conn carries uid=0. The
committed UID first appears on the wire inside MAPPING packets sent
on the same conn. Without adoption, every engine's disco conn stays
registered as uid=0 in the switch for the rest of the session, which
breaks unicast disco routing (last-zero-wins in the route table) and
makes the TUI aggregate every engine into one fake "uid=0 (unknown)"
peer.

When a MAPPING packet arrives on a non-promiscuous disco conn whose
self_uid is still 0, parse the payload's self_uid and adopt it: drop
the stale (disco, 0) route entry if it still points to us, install
the new (disco, learned_uid) entry, and let the subsequent src_uid
overwrite + peer-stats attribution use the real identity.

Verified end-to-end: two engines on one sim_switch now each surface
under their autoconfigured UIDs in oaninspect's disco stream instead
of both showing src_uid=0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant