Skip to content

Add host addressing mode for broker sockets - #1931

Merged
Weidong Cui (wdcui) merged 6 commits into
uliteboxfrom
wdcui/ulitebox/broker-socket-addressing
Nov 27, 2026
Merged

Weidong Cui (wdcui) merged 6 commits into
uliteboxfrom
wdcui/ulitebox/broker-socket-addressing

Conversation

@wdcui

@wdcui Weidong Cui (wdcui) commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

This PR lets a broker socket provider declare whether it uses isolated guest addresses or host addresses. With host addressing, which supports only TCP streams, the provider binds host sockets and reports the addresses the host assigns, including when it binds an unbound stream at connect. Core reserves no ports and passes the egress rule verdict into connect, so a destination the rules deny is reachable only at the provider's own listeners. Existing providers keep isolated addressing by default.

@wdcui
Weidong Cui (wdcui) force-pushed the wdcui/ulitebox/broker-socket-addressing branch from 0354be4 to ecb76ed Compare November 23, 2026 15:31
Distinguish core-reserved guest endpoints from provider-bound host endpoints. Pass the destination policy verdict into connect, preserve retryable denials, and keep existing providers in isolated mode.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 0b6fd4b0-2ea1-49a9-adbb-739cd59c61ef
@wdcui
Weidong Cui (wdcui) force-pushed the wdcui/ulitebox/broker-socket-addressing branch from ecb76ed to 8212c06 Compare November 26, 2026 18:57
Weidong Cui (wdcui) and others added 5 commits November 26, 2026 11:01
State that a served-only connect never reaches the host, that host
addressing is TCP-only, when core passes a source lease, and which
failed connects leave a stream free to retry. Describe isolated
addressing without assuming host sockets.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 0b6fd4b0-2ea1-49a9-adbb-739cd59c61ef
In host addressing, core no longer binds an unbound stream to 0.0.0.0:0
before connect, which would take an ephemeral port exclusively. The
provider binds at connect time and core records the address reported by
PlatformSocket::local_address, which replaces release_connect_bind. A
wildcard IP reported mid-connect is refined from later status.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 0b6fd4b0-2ea1-49a9-adbb-739cd59c61ef
Core refuses non-TCP sockets in host addressing, rejects multicast and
limited broadcast endpoints a host-addressed provider reports, and
renames the contract's types for clarity (SocketEgressVerdict,
SocketBindRequest::Isolated, GuestSourceLease::with_port_owner).

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 0b6fd4b0-2ea1-49a9-adbb-739cd59c61ef
Co-authored-by: Copilot <[email protected]>
Copilot-Session: 0b6fd4b0-2ea1-49a9-adbb-739cd59c61ef
Cover that core keeps a with_port_owner lease's owner alive until the
accepted host stream closes, and that host addressing still normalizes
the unspecified destination and rejects multicast and broadcast ones.
Drop host test assertions that only restate others.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 0b6fd4b0-2ea1-49a9-adbb-739cd59c61ef
@wdcui Weidong Cui (wdcui) changed the title Let socket providers declare their addressing mode Add host addressing mode for broker sockets Nov 27, 2026
@wdcui
Weidong Cui (wdcui) marked this pull request as ready for review November 27, 2026 01:07
@wdcui
Weidong Cui (wdcui) added this pull request to the merge queue Nov 27, 2026
@github-actions

Copy link
Copy Markdown

🤖 SemverChecks 🤖 ⚠️ Potential breaking API changes detected ⚠️

Click for details
--- failure enum_variant_added: enum variant added on exhaustive enum ---

Description:
A publicly-visible enum without #[non_exhaustive] has a new variant.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#enum-variant-new
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.51.0/src/lints/enum_variant_added.ron

Failed in:
  variant PlatformConnectError:Rejected in /home/runner/work/litebox/litebox/litebox_broker_core/src/socket.rs:486

--- failure trait_method_parameter_count_changed: pub trait method parameter count changed ---

Description:
A trait method now takes a different number of parameters.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#trait-item-signature
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.51.0/src/lints/trait_method_parameter_count_changed.ron

Failed in:
  PlatformSocket::connect now takes 3 instead of 2 parameters, in file /home/runner/work/litebox/litebox/litebox_broker_core/src/socket.rs:760

Merged via the queue into ulitebox with commit e078601 Nov 27, 2026
14 checks passed
@wdcui
Weidong Cui (wdcui) deleted the wdcui/ulitebox/broker-socket-addressing branch November 27, 2026 01:20
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