Repository navigation
goip: ip tunnel, ip -6 tunnel and ip tuntap show (increment 8) - #321
Merged
Merged
Conversation
…IP_TNLSYS (8S, V001) ip tunnel and ip tuntap ask the kernel outside netlink: SIOCGETTUNNEL, SIOCGETPRL and SIOCGET6RD ioctls, /sys/class/net tun props and a /proc walk. internal/tnlsys is the seam: Live asks the kernel (with a spill window, since ip6gre writes 76 bytes into whatever it is given), and Snapshot answers from a JSON sidecar keyed by each ioctl's exact input, because a fallback device answers per the parameters passed. tnlsnap records the sidecar by running ip under ptrace (threads followed), plus the tun props and the tun descriptor walk. goip's runCtx.sys comes from GOIP_TNLSYS, an empty snapshot under GOIP_REPLAY, or Live. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rows (8C, V002) Two capture spaces: tunnel (171 rows: ip tunnel and ip -6 tunnel show, plain and -j, the list, named and mode paths, filters, batch and 27 negatives) and tuntap (46 rows, including -d with python TUNSETIFF holders and a holder in another namespace). Each row carries a tnlsys readback: tnlsnap traces ip again and records its ioctls, the tun props and, when ip would walk it, /proc. Two batches on one workbench boot agree byte for byte except for the holder pids of the eight -d rows with holders, and every sidecar's traced run matches the captured ip. The batches found two recorder faults, fixed here. The spill kept ip's own stack past the kernel's write, so the tracer now fills the window with 0xA5, cuts at the last changed byte and restores the rest; gre6x's spill is exactly the 24 bytes ip6gre writes past 52. The /proc walk ran for every row and picked up other rows' holders, so it now runs only when ip would walk it, mirroring ip.c's option loop and object order. goip's hermetic import test now allows internal/tnlsys, which 8S added without updating it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ParseIPTunnelParm, ParseIP6TnlParm2, ParseTunnelPRL, ParseTunnel6RD and ParseSysfsLong (read_prop's strtol check). Table tests, fuzz targets, benchmarks, and an O-check: all 958 corpus SIOCGETTUNNEL answers decode and the 554 with a link in the row's dump agree with its info data. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…R, V004) goip now runs `ip tunnel`, `ip -6 tunnel`, `ip tunl` and `ip tuntap|tap` as iproute2 7.2.0 does: do_iptunnel's mode pre-scan, both parse_args, the named path (text even under -j) and do_tunnels_list with its bare stats and newlines, ip6tunnel's no-newline named path, and print_tuntap with read_prop's messages and show_processes. Ioctls, sysfs and /proc go through runCtx.sys. All 195 replayable ws/tunnel and ws/tuntap rows match ip's stdout and exit status byte for byte, -d pids included; batches, -p and writes are left out and counted. The wrong tunl6 row becomes ip.c's tunl alias. Shared C helpers and keyword constants move from goip_write files to untagged ones so the read build has them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, DOC001) Records 23 iproute2 findings and 2 kernel notes from increment 8, each with its v7.2.0 file:line, the corpus row or unit row that pins it, and its status at HEAD: a stack overflow on `ip tunnel show gre*` for an ip6gre device (fixed upstream after 7.3.0, the garbage line remains), a double fclose in read_prop, an uninitialized encaplimit byte, -s text inside -j, and filters that match the wrong tunnels. Not submitted to netdev. T21 is refuted; nlcapgen's comment that asserted it is fixed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On the workbench VM, goip and ip 7.2.0 ran every 8C read command over the 8C fixtures, each in its own netns with real tun holders, and agreed on stdout and exit status in all 195, holder pids included. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The nix test sandbox has no /sys/class/net, so test-go-race failed in TestRunIP. snapshotIP now reads a package-level liveSys, which the test points at an empty fake tree. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The full go test ./... failed cmd/tnlsnap TestRunIP with "trace: regs: no such process", 77 of 800 runs under load. A thread of the multithreaded Go helper can be killed by its sibling's exit_group between Wait4 and PTRACE_GETREGS; ptrace(2) says a tracee can vanish at any stop. The tracer now drops such a thread and keeps waiting. TestThreadGone pins the rule; the stress run passes 800 of 800. 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.
goip now runs
ip [-4|-6] tunnel show|list|lst,ip tunlandip tuntap|tap show, and matches iproute2 7.2.0 byte for byte. These commands need ioctl, sysfs and procfs answers that netlink doesn't carry, so the increment adds a sidecar for them.Changes
internal/tnlsys+cmd/tnlsnap(8S):tnlsnaprunsipunder ptrace and records each tunnel ioctl with its exact input, plus the sysfs props and the/proctun-fd walk.GOIP_TNLSYS. An unrecorded question is a replay error, not a guessed answer.ws/tunnelandws/tuntap, each with atnlsyssidecar.ip_tunnel_parm,ip6_tnl_parm2, PRL, 6rd and sysfs parsers inpkg/xtcpnl, with fuzz targets and benchmarks.obj_tunnel.go,obj_tunnel6.go,obj_tuntap.goandrender/tunnel.go.tunl6is renamedtunl, which is what ip has.add,change,del,prl,6rd, tuntapadd/del) are refused as not implemented.docs/netlink/upstream/iproute2-tunnel-tuntap.md, with T1–T25 for iproute2 and K1–K2 for the kernel. Recorded only, not submitted to netdev./sys, which the nix sandbox doesn't have.Verification
-prows and 8 writes.go test ./...and nixtest-go-racepass at ef74024. lint-baseline, netlink-audit and kernel-citation-audit pass.Ledger:
docs/netlink/goip-tunnel-status.md(V001–V007, DOC001).🤖 Generated with Claude Code