Skip to content

client: auto-join authorized multicast groups on connect with no args#3864

Merged
juan-malbeclabs merged 5 commits into
mainfrom
jo/multicast-connect-autojoin-accesspass
Jun 10, 2026
Merged

client: auto-join authorized multicast groups on connect with no args#3864
juan-malbeclabs merged 5 commits into
mainfrom
jo/multicast-connect-autojoin-accesspass

Conversation

@juan-malbeclabs

Copy link
Copy Markdown
Contributor

Summary of Changes

  • doublezero connect multicast invoked with no groups now auto-joins every multicast group authorized in the caller's AccessPass: it publishes to mgroup_pub_allowlist and subscribes to mgroup_sub_allowlist. The AccessPass is resolved via the existing GetAccessPassCommand, which already tries the shared dynamic-seat pass (UNSPECIFIED/0.0.0.0 PDA) first and falls back to the exact client-IP pass.
  • Allowlist entries that no longer resolve to a known group (deleted groups) are dropped; an AccessPass with no authorized groups is a no-op success (no user/tunnel created), and the generic "User Provisioned" footer is suppressed in that case.
  • Explicit --publish/--subscribe and the legacy positional syntax are unchanged.

Diff Breakdown

Category Files Lines (+/-) Net
Core logic 1 +103 / -29 +74
Tests 1 +165 / -0 +165
Docs 1 +1 / -0 +1
Total 2 +269 / -29 +240

Mostly tests; the core change is a single new branch in execute_multicast plus relaxing parse_dz_mode.

Key files (click to expand)
  • client/doublezero/src/command/connect.rsparse_dz_mode accepts multicast with no groups (empty vectors instead of erroring); execute_multicast derives pub/sub group pubkeys from the AccessPass allowlists when none are passed, filters stale pubkeys, and returns whether anything was provisioned so the success footer is conditional.
  • CHANGELOG.md — Client entry for the new auto-join behavior.

Testing Verification

  • Added unit tests in command::connect::tests: auto-join publishes + subscribes from both allowlists; empty allowlist is a no-op with no onchain calls; stale allowlist pubkeys are filtered out; parse_dz_mode yields empty groups for no-args multicast.
  • Full command::connect::tests module passes (42 tests); clippy clean with -Dclippy::all -Dwarnings.

@elitegreg elitegreg enabled auto-merge (squash) June 10, 2026 01:27
@elitegreg elitegreg disabled auto-merge June 10, 2026 01:27
When 'doublezero connect multicast' is invoked without groups, look up the
caller's AccessPass (UNSPECIFIED-first, then exact IP) and auto-join every
authorized group: publish to mgroup_pub_allowlist and subscribe to
mgroup_sub_allowlist. Stale allowlist pubkeys (deleted groups) are dropped,
and an empty allowlist is a no-op success.
Cover the no-args auto-join path: publish + subscribe from both allowlists,
empty-allowlist no-op, stale-pubkey filtering, and parse_dz_mode accepting
multicast with no groups.
Authorize a client for publishing on one group and subscribing on another,
run 'doublezero connect multicast' with no arguments, and assert the onchain
Multicast user auto-joins exactly those publish/subscribe groups.
@juan-malbeclabs juan-malbeclabs force-pushed the jo/multicast-connect-autojoin-accesspass branch from 09f3bfc to 01d503f Compare June 10, 2026 01:30
groupPubKeyByCode did a single GetProgramData read right after `multicast group create`, racing ahead of ledger propagation and intermittently failing with "group not found". Wrap the lookup in require.Eventually, matching the polling pattern used elsewhere in this test.
@juan-malbeclabs juan-malbeclabs enabled auto-merge (squash) June 10, 2026 14:32
@juan-malbeclabs juan-malbeclabs merged commit 44398a3 into main Jun 10, 2026
33 checks passed
@juan-malbeclabs juan-malbeclabs deleted the jo/multicast-connect-autojoin-accesspass branch June 10, 2026 14:50
ben-dz added a commit that referenced this pull request Jun 10, 2026
…3870)

## Summary of Changes
- Reverts #3861 (`105d9035`): `doublezero connect ibrl` no longer
auto-flips to `IBRLWithAllocatedIP` when the daemon's default-route
source is an RFC1918 address.
- The heuristic misfires on hosts behind 1:1 NAT — e.g. the chi-dn
devnet QA hosts — where plain IBRL works. After today's daily deploy
picked up the change, those hosts silently connected as a different user
type with an allocated `dz_ip`, and devnet QA
`TestQA_MultiTunnel/unicast_connectivity` failed deterministically
(route waits expect public-IP routes).
- Beyond QA, the same silent user-type change would hit any NAT'd
production client on the next release, so the detection needs to
distinguish 1:1 NAT from address-translating NAT before re-landing.
- Removes the `behind_nat` field from the daemon's `/v2/status` response
and the CLI's NAT-aware connect path; explicit `-a` / `--client-ip`
behavior is unchanged.
- Targeted for a standalone v0.27.1 release (v0.27.0 is already tagged
with the feature included).

## Diff Breakdown
| Category     | Files | Lines (+/-)  | Net   |
|--------------|-------|--------------|-------|
| Core logic   |     2 | +19 / -163   |  -144 |
| Scaffolding  |     9 | +3  / -52    |   -49 |
| Tests        |     2 | +1  / -117   |  -116 |
| Docs         |     1 | +3  / -0     |    +3 |
| **Total**    |    14 | +26 / -332   |  -306 |

Pure revert: net -306 lines, mostly removing the NAT-detection logic and
its tests.

<details>
<summary>Key files (click to expand)</summary>

- `client/doublezero/src/command/connect.rs` — remove the behind-NAT
auto-allocate decision and its tests
- `client/doublezerod/internal/runtime/clientip.go` — `DiscoverClientIP`
no longer reports `behindNAT`; restores the pre-#3861 signature

</details>

## Testing Verification
- `cargo test -p doublezero`: 145 tests pass (includes the connect
command suite the revert touches).
- `go test ./client/doublezerod/internal/runtime/...
./client/doublezerod/internal/manager/...`: pass.
- `make rust-lint` clean in the dev container.
- The revert auto-merged around #3864 (auto-join multicast groups),
which landed in `connect.rs` afterward; only `CHANGELOG.md` needed
manual resolution (v0.27.0 section kept as shipped history, revert noted
under Unreleased).
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.

2 participants