Repository navigation
gotc: tc qdisc and class show (increment 9) - #325
Merged
Merged
Conversation
…9S, V001) gotc is a read-only clone of iproute2 7.2.0's tc, modelled on gobridge. This first task runs tc.c's main: the option loop in its matches() order (-c is -cf, Q24; -b is -batch; a lone - is -stats; no "--"), do_cmd's object dispatch, do_qdisc's and do_class's verbs (qdisc tests link before list), usage, -batch with its ll_init_map before the file opens, -force and -netns. tc_core_init's /proc/net/psched scan and cls_names_init's class names databases (Q33: the -cf names are dropped when neither default file exists) read through a sysFS root, so tests are hermetic. qdisc and class show return not-implemented until 9R; filter, chain, actions, monitor, exec and every write are refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two spaces, tcqdisc (142 rows) and tcclass (82), over nine fixtures
covering noqueue, mq, pfifo_fast, prio, the fifos, fq_codel, fq, htb,
tbf, sfq, netem, ingress and clsact, every positive plain and -j, with
batches and refusals. Every qdisc has an explicit handle and netem a
fixed seed, so two batches on one boot agree on stdout, stderr, rc and
replies, apart from two named exceptions: the heap garbage of Q34's
abort, and fq's time_next_delayed_flow timestamp in TCA_XSTATS.
The capture found Q34: graph_cls_show frees the -g nodes but keeps the
static list heads, so a second -g line in a batch reads freed memory
and aborts with a double free (rc 134).
Corpus: pkg/xtcpnl/testdata/7_3_1/ws/tc{qdisc,class}, kernel 7.3.1,
tc 7.2.0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, V003) Decode each in-slice qdisc kind's TCA_OPTIONS and xstats the way its tc/q_*.c printer reads them, TCA_STATS2 and the compat TCA_STATS the way print_tcstats*_attr does (MIN-copy into a zeroed struct), and build tc's qdisc and class dump requests byte for byte. FamilyHdrLen models tcmsg for the qdisc and class messages; RTM_GETTFILTER is now the unmodeled example. Every in-slice qdisc and class in the workbench corpus decodes; other kinds are ErrTcKindUnknown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tc_qdisc_list/print_qdisc and tc_class_list/print_class with -g, the statistics printers, the json_print port with print_size/print_rate, and one printer per kind: prio/pfifo_fast, the fifos, ingress, clsact, fq_codel, fq, htb, tbf, sfq and netem. A kind tc links but gotc does not print is refused by name. All 224 tcqdisc/tcclass capture rows replay byte for byte (Q34's stderr and the two write rows excepted), and 216 tdc readbacks render exactly; the 245 holding other kinds are refused and pinned. Ten mutants killed; coverage 82.4%. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every bug-class lead from the plan read at v7.2.0 and confirmed or dropped, with file:line, the pinning row, status at HEAD (GitHub mirror) and how gotc handles it. New: Q36, -g reads freed graph nodes on every nested tree, confirmed byte for byte by the corpus; Q35, the compat nest parser trusts its inner rta_len. Q14 is fixed upstream by 9dd1bec6b863. Recorded only; not submitted to netdev. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
All 224 capture commands run live as tc and as gotc over the 24 fixtures: 221 identical; the 3 that differ are the two refused writes and Q34's heap-garbage stderr line. The VM was left as found. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Increment 9: gotc, a Go clone of
tc qdisc showandtc class show(iproute2 7.2.0).What's in it
matches()order, dispatch, batch, psched and names seamstcqdisc/tcclasscapture spaces, 224 rowsBuildTcDumpRequestbyte-exact vs tc; tcmsg FamilyHdrLen modeled-s -d -r -p -g -j -iec -nmdocs/netlink/upstream/iproute2-tc-qdisc-class.md(not submitted to netdev)Results
verify.outexactly; 245 with out-of-slice kinds are refused (errNotImplementednaming the kind), counts pinned.internal/gotccoverage 82.4%; all 10 planned mutants killed.go test ./...andtest-go-racepass.Notable iproute2 findings
tc -greads freed graph nodes when drawing nested class trees; the extra|bars come from that memory.-gline in one batch double-frees (rc 134) and loses earlier output.rta_len; a crafted message over-reads.Out of scope (refused): filter, chain, actions, monitor, exec, and all writes. Filters are increment 10.
🤖 Generated with Claude Code