About this project

pktc is a CLI tool and tree-tiling compiler that lets you describe the packet structure you expect on the network wire and automatically derives the corresponding Linux kernel tunnel device configuration. Instead of naming a device type first and then filling in parameters (as `netplan`, `systemd-networkd`, and NetworkManager require), pktc takes the opposite approach: you describe the encapsulation stack as a tree, and the tool determines which kernel primitive produces it. The core idea is instruction selection by tree tiling. An encapsulation stack flattens to a spine — a linear list of protocol layers — which is then covered with device-shaped tiles. The technique mirrors how compiler back ends pick machine instructions, except the tiles are Linux tunnel devices and the emitted code is `iproute2` commands. Supported tiles include IPIP (`ipv4 · ipv4`), GRE (`ipv4 · gre · ipv4`), GRE tap (`ipv4 · gre · ethernet`), and VXLAN (`ipv4 · udp · vxlan · ethernet`). Nested tunnels compose naturally as multiple tiles without special-case logic. Key commands: - `pktc lower` — prints the `ip link` / `ip addr` commands to create the device - `pktc mirror` — prints the symmetric configuration for the far end - `pktc expect` — prints what the underlay traffic should look like for verification - `pktc parse` — prints the encapsulation spine from a description file A distinctive feature is the loop-closing test mode: `make netns` builds two network namespaces on a veth pair, configures both ends from the same description, pushes traffic through, and captures the underlay. A golden test proves the intended commands were emitted; a kernel test proves the device was created; the capture proves the device carries what the tree claimed. Install via `go install github.com/vinodhalaharvi/pktc/cmd/pktc@latest` or build from source with `make check`, `make demo`, and `make netns`. The project is early-stage with four tiles and one backend. Geneve, VLAN, XFRM, and WireGuard are intentionally omitted because their kernel modules were unavailable during development.