Skip to content

gotc: tc actions list/get and 12 action kinds (increment 12) - #334

Merged
randomizedcoder merged 6 commits into
mainfrom
gotc/actions
Nov 25, 2026
Merged

randomizedcoder merged 6 commits into
mainfrom
gotc/actions

Conversation

@randomizedcoder

Copy link
Copy Markdown
Owner

Summary

Increment 12: gotc gains the read side of tc actions, plus 12 action kinds.

  • Commands: tc actions list/show/ls and get.
  • Action kinds: police, mirred, skbedit, vlan, csum, nat, simple, connmark, ctinfo, sample, skbmod and mpls.
    • They print both from tc actions and inside filters.
    • Police in filters no longer gets refused.
  • Still refused:
    • the writes: add, change, replace, delete and flush;
    • the kinds deferred to increment 13: pedit, tunnel_key, ife, ct, gate and bpf;
    • monitor.
commit task what
aeaebb2 12C (V014) the tcaction nlcapgen capture space and its corpus
7741000 12P (V015) xtcpnl: decoders for the 12 kinds, plus BuildTcActionDump and BuildTcActionGet
fbfe9e8 12R (V016) gotc: action_cmd.go and the m_*.go kind printers
b99d125 12B (DOC004) docs/netlink/upstream/iproute2-tc-action.md (findings AC1–AC37, kernel notes K1–K7)
c05639a 12L (V017) live comparison against tc 7.2.0

iproute2 findings (recorded only, not submitted to netdev)

  • Confirmed: AC1–AC37. AC13 was dropped because it is the same bug as F24.
  • Found during the work:
    • AC35: double spaces in vlan, mpls, police and skbedit output.
    • AC36: "total acts" is a per-message count, and action order numbering restarts at 0 in each message.
    • AC37: police names its kind only in JSON.
  • Kernel notes K6 and K7: TCA_ROOT_COUNT is per message, and an empty dump sends only the end-of-dump message
    (NLMSG_DONE).

Test plan

  • go test ./...
  • nix build .#checks.x86_64-linux.test-go-race
  • golangci-lint (the comprehensive config), netlink-audit and kernel-citation-audit are clean.
  • Coverage of internal/gotc is 85.4%, and all 10 planted bugs (mutants) are caught.
  • Live comparison on the workbench: gotc and tc 7.2.0 give identical output on 133 of 134 commands. The one
    difference is actions delete, which gotc refuses by design.

🤖 Generated with Claude Code

randomizedcoder and others added 6 commits November 24, 2026 22:31
tcaction: 132 rows over six fixtures and a bare netns, `tc actions
list/get` of 13 action kinds and `filter show` of filters holding them,
each positive plain and -j. Two batches on one boot agree on every
stdout, stderr and rc; the pcaps differ only inside tcf_t.

The captures confirm AC8, AC10, AC15, AC16, AC18, AC22, AC24-AC26 and
AC29, correct AC9 (an empty get prints total acts 0, rc 0) and add
AC31-AC34.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Decoders for the options of police, mirred, skbedit, vlan, csum, nat,
simple, connmark, ctinfo, sample, skbmod and mpls, each MIN-copying its
parms struct and keeping the attribute's length as tc sees it. Adds
BuildTcActionDump and BuildTcActionGet, byte-equal to tc 7.2.0's
requests, and FamilyHdrLen for the action message types.

Every action of these kinds in the tcaction and tdc captures decodes
(756). New kernel note K5: dump and get replies carry RTM_GETACTION.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tc actions ls/list/show and get, following m_action.c's do_action,
tc_action_gd and print_action with their argument quirks (AC6-AC10,
AC34). police, mirred, skbedit, vlan, csum, nat, simple, connmark,
ctinfo, sample, skbmod and mpls print at bind 0 and in filters at
bind 1; police in u32/basic/cgroup/fw/route4/flow no longer refused.
Writes and the increment-13 kinds are refused by name.

Also: SkbeditFInheritDsfield is 0x20, csum update flag constants,
BuildTcActionGet takes []TcActRef, and wsreplay no longer merges a
same-seq request into a get's echo transaction.

All 132 tcaction rows replay; 887 tdc readbacks render; 85.4% cover;
10/10 mutants killed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/netlink/upstream/iproute2-tc-action.md, not submitted to netdev:
AC1-AC12 and AC14-AC34 confirmed against v7.2.0, the tcaction corpus
and the kernel at v7.4-rc4; AC13 dropped as a duplicate of F24. New:
AC35 (double spaces by kind), AC36 (total acts is per message), AC37
(police's kind is JSON-only, so -br text has none), K6 and K7.

Three corner rows pin AC17, AC19 and AC27; gotc.md gains an
increment 12 section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gotc beside tc 7.2.0 on the workbench over the 132 tcaction rows and
two -netns reads: 133 of 134 identical on stdout, stderr and rc, the
-s rows included; the difference is the refused write (ng-006).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BuildTcActionGet built into a 56-byte buffer, enough for one action, so a
get naming three gacts (or two connmarks) failed in gotc while tc sent it.
The buffer is now sized from the actions named (TcActGetLen). Past tc's
MAX_MSG, gotc refuses: tc ignores addattr_l's failures there and sends what
fit (AC38, confirmed live).

tcaction gains gets of 3, 32 and 33 actions, appended so earlier ids stay.
The 33-action get found K8: the kernel answers only the first 32
(TCA_ACT_MAX_PRIO), with no error.

Cleanups: linkedActKinds is derived from actionUtils plus deferredActKinds;
printOneAction's comment covers both callers.

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