Skip to content

gotc: tc qdisc and class writes, dry-run (increment 17); tnlsys tracer split - #356

Merged
randomizedcoder merged 8 commits into
mainfrom
gotc/qwrite
Nov 28, 2026
Merged

randomizedcoder merged 8 commits into
mainfrom
gotc/qwrite

Conversation

@randomizedcoder

Copy link
Copy Markdown
Owner

Summary

  • 17C (V037): new tcqwrite capture space, 125 rows (verbs × increment-9 kinds, common options, W leads, negatives).
  • 17P (V038): BuildTcQdiscWrite/BuildTcClassWrite, struct Append encoders, tc units parsers ported from tc_util/tc_core/tc_stab.
  • 17W (V039): tc qdisc/tc class writes for pfifo, bfifo, pfifo_head_drop, prio, pfifo_fast, fq_codel, fq, htb, tbf, sfq, netem, ingress, clsact. Dry-run only, behind the gotc_write tag: replay sources compare requests byte for byte, GOTC_WRITE_OUT captures them, and anything else gets ErrWriteNotApplied. Kinds from increments 15/16 are refused by name.
  • 17B (DOC010): upstream/iproute2-tc-write.md, W1–W25 (W7 dropped) and K44–K45. Recorded only, not sent to netdev.
  • 17L (V040): live diff on the workbench: 125/125 requests match tc byte for byte (ifindex masked), with 13 named exceptions where tc prints the kernel's answer.
  • tnlsys fix: Trace moved to internal/tnlsys/trace, so the daemons no longer link os/exec. This fixes the no-write-encoders check, which was failing on main.

Results

  • Corpus: 125/125 tcqwrite rows replay exactly.
  • tdc: 173 writes match; 237 are refused by kind, with counts pinned.
  • Coverage of internal/gotc: 85.3%. All 8 planned mutants are killed.

Test plan

  • go test ./...
  • nix build .#checks.x86_64-linux.test-go-race
  • golangci-lint, default and comprehensive
  • netlink-audit, kernel-citation-audit, no-write-encoders
  • live workbench diff (17L)

🤖 Generated with Claude Code

randomizedcoder and others added 8 commits November 27, 2026 13:58
…tc 17C)

125 rows: every add body of the increment-9 root kinds with change,
replace, link and delete on each, ingress and clsact, the common frame
(parent, estimator, stab, prefixes) and htb classes, each write with a
tc -d qdisc/class show readback; 25 refusals pinned by errno and rc.

The first batch corrected the expectations: sfq and htb have no kernel
qdisc change op (EINVAL), htb offload needs hw-tc-offload (ENOTSUP),
W2 and W9 are confirmed, and the unknown-kind rows end at rc 1 rather
than at W5's or W8's message. Two batches on one boot agree on every
row (V037).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…units (gotc 17P)

pkg/xtcpnl: an Append per slice-kind tc struct (round-trips through its
decoder), and under gotc_write BuildTcWriteRequest, which lays out a
qdisc or class write in tc_qdisc_modify's and tc_class_modify's order
and matches tc's captured requests byte for byte. The write gate admits
RTM_NEW/DELQDISC and RTM_NEW/DELTCLASS.

internal/gotc: tc's rate, size, time, rtable, size-table and estimator
code, every expected value from iproute2's own C; cDoubleToU64 now
converts as gcc does. New leads W10-W14.

nix: gotc_write is opt-in only, scanned, linted, kept out of the
daemons, and has a focused test (V038).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…gotc 17W)

tc_qdisc_modify and tc_class_modify behind gotc_write, with parse_estimator,
parse_size_table, get_percent_rate and the parse_qopt/parse_copt of pfifo,
bfifo, pfifo_head_drop, prio, fq_codel, fq, htb, tbf, sfq, netem, ingress
and clsact. A replay matches each request byte for byte; the kernel socket
carries only GETs and writes go to GOTC_WRITE_OUT. All 125 tcqwrite rows
replay exactly; 173 tdc writes match and 237 are refused by kind (V039).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…4-K45 (gotc 17B)

Not submitted to netdev. All present at HEAD 35033e4713fe (DOC010).

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gotc_write's GOTC_WRITE_OUT requests equal tc's byte for byte on every
tcqwrite row (ifindex aside); output matches wherever tc stops before the
kernel (V040).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…os/exec

internal/tnlsys's Trace took an *exec.Cmd, so every importer of tnlsys
linked os/exec. goip imports tnlsys and xtcp2 links goip, so the
no-write-encoders check's no_exec proof failed on main. Trace now lives in
internal/tnlsys/trace, which only cmd/tnlsnap imports. The helpers it
shares with Live (KnownReq, MaxArg, IfNameSize, SpillFill, SpillOf) are
exported, and TestTrace moved with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cStrtod returned erange=false for a hex float that overflowed to +Inf, so
get_time and get_rate64 let 0x1p1024 through where tc rejects it: fq_codel
target, netem delay and rate, and fq timer_slack sent a request instead of
tc's Illegal "..." and rc 1. hexFloat now reports the overflow and cStrtod
returns it, as the decimal path does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@randomizedcoder
randomizedcoder merged commit 463286b into main Nov 28, 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