Skip to content

fix(mount): check broadcast ports before changing anything on disk - #61

Merged
mattmattox merged 2 commits into
mainfrom
claude/broadcast-precheck
Nov 12, 2026
Merged

mattmattox merged 2 commits into
mainfrom
claude/broadcast-precheck

Conversation

@mattmattox

Copy link
Copy Markdown
Contributor

Stacked on #59; retarget to main once #59 merges. These are the shepherd's three follow-ups from the #59 review.

  • Fail before touching the disk. A taken broadcast port used to fail the mount only after it had formatted (with -format), claimed a registry slot and set up its journal. broadcast.CheckPorts now opens and releases the same sockets Start uses, through one shared listen helper, before the mount opens the device. The fatal after Register stays as the backstop for a process that grabs the port in between.
  • Docs. Each mount on a host needs its own -unicast-port and -api-addr. Clusters sharing a LAN need their own -mcast-group or a -broadcast-secret.

Tests:

  • TestMountFailsOnTakenBroadcastPortBeforeFormat holds the unicast port and runs mount -format. The mount must exit with the broadcast error and leave the image's first 4 KB zero. Without the pre-check it fails: "mount wrote the superblock before failing on the broadcast port".
  • CheckPorts unit tests: it releases its sockets, fails on a taken port, and rejects equal ports.

On .68, the broadcast unit tests pass 3× with -race, and the broadcast, API and mount integration tests (16) all pass.

🤖 Generated with Claude Code

A taken broadcast port only failed the mount after it had formatted
(with -format), claimed a registry slot and set up its journal.
broadcast.CheckPorts now opens and releases the same sockets Start
uses, through the same listen helper, before the mount opens the
device. The fatal after Register stays as the backstop for a process
that binds the port in between.

The docs now say that each mount on a host needs its own -unicast-port
and -api-addr, and that clusters sharing a LAN need their own
-mcast-group or a -broadcast-secret.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mattmattox
mattmattox force-pushed the claude/broadcast-precheck branch from 96d0c76 to fb0c5fc Compare November 12, 2026 07:10
@mattmattox
mattmattox changed the base branch from claude/fix-broadcast-ports to main November 12, 2026 07:11
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mattmattox
mattmattox merged commit 39b344d into main Nov 12, 2026
10 checks passed
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