Skip to content

gobridge: increment 26 - bridge link set and mst set, dry-run writes - #397

Merged
randomizedcoder merged 8 commits into
mainfrom
gobridge/link-write
Dec 5, 2026
Merged

randomizedcoder merged 8 commits into
mainfrom
gobridge/link-write

Conversation

@randomizedcoder

Copy link
Copy Markdown
Owner

Increment 26: gobridge's first writes, bridge link set and bridge mst set. They are built only with the new opt-in gobridge_write tag, and even then a write is never applied: a replay source answers it from the recorded capture, and a live source writes the request to GOBRIDGE_WRITE_OUT (unset, it fails with ErrWriteNotApplied). The default gobridge still refuses both by name, and neither daemon carries any bridge write code.

Commits

  • 26X (V115) groundwork, copied from gotc's write model:
    • the gobridge_write tag, wired into nix, flavor-tags, govulncheck, the golangci tag lists and a focused-gobridge-write check;
    • dry-run delivery (send_write.go), with write_off.go refusing in the untagged build;
    • LiveSource.Talk now refuses any non-GET request in every build;
    • no-write-encoders covers internal/gobridge: *_write.go files carry the tag, and a cmd/gobridge control checks that.
  • 26C (V116) the brlinkwrite capture space, 141 rows: 92 accepted (each with a readback), 46 refused, 3 -force batches. Captured twice on one boot; the two batches agree.
  • 26P (V117) pkg/xtcpnl: the bridge port write encoders (BuildBrLinkWriteRequest). They are behind the tag rather than untagged as planned, so no daemon links them. TestWsBrLinkWrite rebuilds all 118 captured SETLINKs byte for byte and checks 91 against the kernel's readback.
  • 26W (V118) gobridge: link_write.go and mst_write.go, copying brlink_modify and mst_set, C number narrowing included. Four new pkg/cint helpers handle the narrowing so gosec is fixed in code.
  • 26B (DOC039) upstream/iproute2-bridge-write.md completed, with a HEAD check of both trees, plus two standalone kernel notes.
  • 26L (V119) live diff on the workbench.
  • Two fix-ups: lint-baseline (word constants, a linkWrite split, preallocation), and DOC036 renumbered to DOC039 after rebasing on main (the events plan holds DOC035–DOC037; see docs(upstream): the bridge monitor note's index row, and the DOC035 collision (PR #388's gap) #394), with the upstream index rows for the three new notes.

Results

  • Corpus: with the tag, all 485 gobridge rows replay byte for byte, the 141 new brlinkwrite rows included, requests too; so do the 92 new readbacks. Untagged, every write row is refused by name.
  • Live diff: gobridge's requests were identical to bridge 7.2.0's on 141 of 141 rows, in two runs that agree exactly; live bridge matched the capture on 141 of 141.
  • Tests:
    • table tests: TestGobridgeLinkWrite 40 rows, TestGobridgeMstWrite 20, TestGobridgeWriteOut 12, TestGobridgeIsGetRequest 16;
    • FuzzGobridgeLinkSet ran 60 s (1.03M executions) and found nothing;
    • 8/8 mutants killed;
    • internal/gobridge coverage 84.3% with the tag.
  • Upstream (docs/netlink/upstream/, nothing sent to netdev):
    • B77–B90 all confirmed by rows, and all still present at iproute2 HEAD (d7e038f99479). Examples: mcast_router abc turns router mode off, msti "" is sent as MSTI 0, and msti 70000 as 4464.
    • K18–K22 confirmed, K23 and K24 corrected, K25–K28 new.
    • Standalone kernel notes: K25, a refused port write is partly applied (hairpin on cost 70000 gets ERANGE, yet hairpin ends up on); K27, a software bridge acks learning_sync and ignores it.

Gates

At fe9e932 (the head; code identical to c696584a4):

  • test-goip-docs, no-write-encoders, kernel-citation-audit, netlink-audit: pass

At c696584a4 / 216dc015a (before the rebase on main, which brought docs only):

  • go test ./...: 114 packages pass
  • test-go-race: pass
  • lint-baseline (tiers 0-2): pass
  • focused-gobridge-write: pass

🤖 Generated with Claude Code

randomizedcoder and others added 8 commits December 5, 2026 08:52
…ve GET guard (V115)

- gobridge_write tag wired as gotc_write is: versions.nix (optInOnlyTags,
  gobridgeWriteTags), flavor-tags, govulncheck, the golangci tag lists and
  a focused-gobridge-write test. pkg/xtcpnl's BuildWriteRequest builds
  under it. The default gobridge stays untagged.
- no-write-encoders: internal/gobridge joins writePkgs; a completeness loop
  ties the tag to *_write.go names; a positive control on
  cmd/gobridge with the tag (a per-daemon one waits for 26P); the
  default debug gobridge must link no write builder.
- send_write.go (tagged): gotc's deliverWrite/writeOut, second copy.
  Replay answers with the recorded ack (NAK -> retCode(-1)); live goes to
  GOBRIDGE_WRITE_OUT or ErrWriteNotApplied. write_off.go keeps link set and
  mst set refused by name.
- LiveSource.Talk refuses anything but an RTM_GET* in every build.
- upstream/iproute2-bridge-write.md: B77-B90 and K18-K24, predicted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s (V116)

- matrix_brlinkwrite.go: bridge link set and mst set over five fixtures
  (brl, brlstp, brldown, brmst, brmstoff). 92 accepted writes, each with
  a readback (bridge -d link show / bridge mst show dev d1), 46
  refusals and 3 -force batches.
- Captured on the workbench (kernel 7.3.1, bridge 7.2.0), batch A and
  B identical in rc/stderr/stdout/readbacks; bodies differ only in the
  forward-delay timer and ll_init_map's ifi_flags (V097's classes).
- upstream/iproute2-bridge-write.md: B77-B90 and K18-K22 confirmed,
  K23/K24 corrected, K25 (br_setport applies flags before the range
  checks, so a refused write is partly applied) and K26 new.
- TestBrLinkWriteSpace pins every lead and K note to a row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…(V117)

- xtcpnl_bridge_write.go (gobridge_write): BrPortProtinfo (24 IFLA_BRPORT_*
  in brlink_modify's order), BrAfSpecFlags, BrMstEntry, BrLinkWrite and
  BuildBrLinkWriteRequest. Tagged rather than untagged as planned, so no
  daemon carries a bridge write layout (decision log).
- no-write-encoders: the per-daemon ,gobridge_write control is back,
  naming xtcpnl_bridge_write.go.
- TestWsBrLinkWrite rebuilds all 118 captured SETLINKs byte for byte,
  checks bridge refusals send none, and checks 91 accepted writes against
  the kernel's readback dump. TestBrLinkWriteEncode pins layout, widths,
  the empty PROTINFO and the NLA_F_NESTED conventions.
- Found: K27 (learning_sync is acked and ignored by a software bridge)
  and K28 (state blocking does not stick without STP).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- link_write.go (gobridge_write): brlink_modify, C's narrowings via new
  pkg/cint conversions (IntToSChar, IntToShort, LongToSChar, LongToU16),
  parse_on_off's -EINVAL (rc 234), hwmode assigning flags, PROTINFO always
  sent, dev checked last, the three device texts; C strtol/get_s32/get_u32.
- mst_write.go (gobridge_write): mst_set, the *s MSTI check, __u16 MSTI.
- link.go/mst.go dispatch to linkWrite/mstWrite; write_off.go refuses.
- TestGobridgeCorpus replays all 141 brlinkwrite rows byte for byte when
  tagged (485 rows total); untagged, TestGobridgeWriteCorpusRefused holds
  each to the refusal. 92 readbacks replay in both builds.
- Unit tables: link set 40, batch 4, mst set 20, C numbers 13.
- FuzzGobridgeLinkSet: 60 s, 1.03M execs, nothing found. 8/8 mutants
  killed. Coverage 84.3% tagged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- upstream/iproute2-bridge-write.md: HEAD check (iproute2 d7e038f99479,
  torvalds 28a23309c8e4): every B lead present, every K note's code
  unchanged; At HEAD and gobridge columns filled.
- K25 and K27 written up on their own: kernel-bridge-setport-partial-apply.md
  and kernel-bridge-learning-sync-ignored.md. Not submitted anywhere.
- B64 gains an "Extended in increment 26" line: do_mst never zeroes
  timestamp.
- gobridge.md: Increment 26 section. Checklist passes; four mutated
  copies of the doc fail it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lint-baseline at 2decedb1e gained tier1 gocyclo (linkWrite 32 > 30) and
tier2 goconst/prealloc findings, all from 26W:
- the shared words (locked, master, self, state, learning,
  mcast_max_groups, mcast_router, neigh_forward_grat, neigh_suppress)
  are constants beside wordDev, used across the package's printers and
  parsers;
- linkWrite's per-word switch moves to linkWord over a linkArgs struct;
- the fuzz target preallocates its replies.
Tests pass in both builds; the 8 mutants are still killed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gobridge (gobridge_write, dry run to GOBRIDGE_WRITE_OUT) beside bridge
7.2.0 (applied, nlmon captured) on the workbench, kernel 7.3.1:
requests identical 141/141, bridge's own refusals 22/22, readbacks
92/92, in two batches agreeing on all 1,148 files; bridge matches its
corpus 141/141. Nothing new found. Increment 26 complete.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rebased on main 4a9a934, which renumbered 25B from DOC035 to DOC038
(the events plan holds DOC035-DOC037; DOC IDs are repo-unique). 26B had
taken DOC036, the events plan's too: it becomes DOC039, the next free,
in gobridge.md, gobridge-status.md and the note, and events-export-status's
next-free line moves to DOC040. The summary table's 25 row still said
DOC035; it now says DOC038.

The upstream index gains the three notes increment 26 added, the gap
main's 81bea3a closed for increment 25: iproute2-bridge-write.md
(B77-B90, K18-K28), kernel-bridge-setport-partial-apply.md (K25) and
kernel-bridge-learning-sync-ignored.md (K27).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@randomizedcoder
randomizedcoder merged commit b0f99fb into main Dec 5, 2026
1 check 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