Skip to content

gotc: action writes for the twelve increment-12 kinds (increment 22) - #375

Merged
randomizedcoder merged 9 commits into
mainfrom
gotc/actwrite
Dec 1, 2026
Merged

randomizedcoder merged 9 commits into
mainfrom
gotc/actwrite

Conversation

@randomizedcoder

@randomizedcoder randomizedcoder commented Nov 30, 2026 •

Copy link
Copy Markdown
Owner

Increment 22: dry-run action writes for tc 7.2.0. This covers tc actions add|change|replace|delete|flush and actions inside filters. The parts ported are m_action.c's write paths and the parsers for increment 12's twelve kinds: police (including filter-side police), mirred, skbedit, vlan, csum, nat, simple, connmark, ctinfo, sample, skbmod and mpls.

  • 22C: a new tcactwrite capture space with 363 rows: 269 writes and 94 refusals. Two batches on one boot agree on every row and on all 295 requests (V060).
  • 22P: Append encoders for the seven parms structs (TcGen, TcPolice, TcMirred, TcActInt, TcNat, TcConnmark, TcSkbmod) and BuildTcActionWriteRequest. The write gate now admits RTM_NEWACTION and RTM_DELACTION (V061).
  • 22W: gotc writes for the twelve kinds and the action verbs, through a new actParsers registry (V062).
    • tcactwrite replays 363/363. pedit, tunnel_key, ife, ct, gate and bpf stay refused by name until increment 23.
    • tcfwrite ec-111–ec-113 and tcematch ec-138–ec-140 (filter police and mirred) now match.
    • tdc: 332 tc actions writes match, and 184 are refused by kind. Filter writes that match go from 245 to 276.
    • W189: when simple's sdata is shorter than 32 bytes, tc copies the bytes after it in its argv memory into the request. gotc copies the same bytes and sends zeros where tc would read the environment or the heap. The replay masks only those zeroed bytes.
    • 10/10 mutants killed; internal/gotc coverage is 85.6%. Three fuzz targets ran 60s each with no findings.
    • Fixed on the way: tbf's burst and mtu errors now cut the word at the / the way tc does (W184).
  • 22B: iproute2 leads W156–W215 and kernel notes K63–K76 are in the new docs/netlink/upstream/iproute2-tc-action-write.md. Not sent to netdev (DOC015).
    • W179: deleting 33 actions deletes 32. The kernel silently keeps the 33rd, and tc reports success (K8, now on the delete side too).
    • W188 is dropped as a duplicate of AC33.
    • AC34 is corrected: the kernel refuses a get or delete with no INDEX.
    • Extensions are recorded in the older leads' own docs.
    • HEAD check: only W172 has moved. 5faf18f672c1 partly fixes it; gotc keeps v7.2.0's behaviour.
  • 22L: a live diff on the workbench, 342/366 identical (V063). Of the other 24, 6 are the refusals by name, and in 18 the only difference is mirred's target ifindex. The capture harness's monitor device shifts that index by one. tc's output matches the corpus on every row.
  • 22R: review fixes (V064).
    • A bare 0x MAC group is now refused, as glibc's %x refuses it. This covers skbmod set dmac 0x:2:3:4:5:6 and vlan's MACs (W196).
    • tc's NULs in argv now persist across batch lines: vlan's MAC colons, skbedit's mark slash, the tbf and htb size/cell slash on a failure, flow's key commas and fw's handle slash. A later simple sdata copies them as tc does (W189).
    • A new 10-row batch test pins this, checked against host tc 7.2.0 under strace. 9 of the 10 rows fail with the fix disabled.

Gates: go test ./..., test-go-race, lint-baseline (tiers 0-2) and no-write-encoders pass.

🤖 Generated with Claude Code

randomizedcoder and others added 9 commits November 30, 2026 10:20
363 rows (269 writes, 94 refusals) for tc actions add, change, replace,
delete and flush across police, mirred, skbedit, vlan, csum, nat,
simple, connmark, ctinfo, sample, skbmod and mpls, standalone and in
filters, with the frame words, the 32-action bound, the batches and a
row for each sweep lead. The increment-23 kinds get out- rows.

Two batches on one boot agree. The write-up starts in
docs/netlink/upstream/iproute2-tc-action-write.md: W156-W215 plus the
new W187 and W188, and K63-K76 (not submitted to netdev).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Append for the parms structs of increment 12's kinds (tc_gen, tc_police,
tc_mirred, tc_vlan/mpls/csum, tc_nat, tc_connmark with its zeroed tail
padding, tc_skbmod), each re-laying tc's captured PARMS byte for byte.
IsAdmittedWriteType admits RTM_NEWACTION and RTM_DELACTION, and the
gotc_write BuildTcActionWriteRequest, PutTcActDeleteTab and
PutTcActFlushAttrs reproduce tc's add, change, replace, delete and
flush requests, W177-W180 included.

The goip_write gate test's admitted set also gains the filter and chain
pairs it had missed since 20W.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tc actions add|change|replace|delete|flush (do_action's write verbs) and
the parse side of police, mirred, skbedit, vlan, csum, nat, simple,
connmark, ctinfo, sample, skbmod and mpls, standalone and in filters,
through an actParsers registry; filter-side police goes live for basic,
cgroup, fw, route, u32 and flow. Increment 23's six kinds stay refused
by name.

W189: simple's 32-byte copy is rebuilt from argv's memory (argmem.go):
the command line's words, or getline's line buffer in a batch; past
them gotc sends zeros and the replay masks them (w189Canon).

All 363 tcactwrite rows replay byte for byte. tdc: 332 action writes
match and 184 are refused by kind; filter writes match 276 (was 245).
W166 is copied as x86 casts it, not refused as planned. W184's argv cut
is shared with tbf (sizeCellShown). Three fuzz targets ran 60s clean;
all 10 mutants were killed; coverage 85.6%/86.4%.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
goconst: word constants for the control words, index, modify and
minburst where 22W repeated them. gocyclo: policeLoop splits into
policeWordClass (act_parse_police's arms in order, which the prefixes
need) and the value arms. funlen: route's to and from share routeRealm.
S1019 in 22P's encoder test, a misspelling and a prealloc in aw_test.go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
iproute2-tc-action-write.md is finished: a gotc column on the 60
summary rows, the HEAD check (no in-scope tc file changed since v7.2.0;
lib/ll_addr.c's 5faf18f672c1 partly fixes W172; no act_*.c change
after v7.4-rc4), and entries for W200 and W202.

W179 is corrected from ec-231's readback: the kernel deletes 32 of 33
and keeps the 33rd silently (K8 on the delete side). W188 is dropped
as a duplicate of AC33.

Extensions where the leads live: AC6, AC7, AC33, AC34 (corrected by
W178/K70), AC70 and K8 in iproute2-tc-action.md; W65, W68, W74, W75,
W85, W113, W114, W117 and W121 in iproute2-tc-filter-write.md.

V062's gates now record lint-baseline (tiers 0-2) and
no-write-encoders.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tc 7.2.0 and the gotc_write build ran side by side on the workbench
for the 363 tcactwrite rows and tcfwrite ec-111..113. 342/366 are
identical (55 where only tc hears the kernel, 10 once W189's bytes are
masked). The named exceptions are increment 23's six refusals by name
and 18 mirred requests whose only differing field is d1's ifindex (the
capture harness's nlmon0 shifts it by one). tc matches the corpus on
every row, so the kernel answers behind K63-K76 recurred. No new lead.

The VM was left as found: modules removed, no namespace, no core
file, powered off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A MAC group that is a bare 0x is no conversion in glibc's %x: skbmod's
  sscanfMac and vlan's llAddrA2N (now on scanfHex, not the strtoul model)
  refuse it as tc 7.2.0 does.
- The NULs tc's parsers write into argv and never put back (ll_addr_a2n's
  colons, skbedit's mark slash, get_size64_and_cell's slash on a failure,
  flow's key commas, fw's handle slash) now persist in the batch line
  buffer, so a later line's sdata copies them as tc does (W189).

TestGotcBatchArgvNuls is checked against host tc 7.2.0 under strace.
W189 and W196 extended in iproute2-tc-action-write.md.

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