Projects / Personal project
tapstack: a TCP/IP stack in C
A network stack written from scratch in C. It plugs into a Linux TAP device, so my laptop's own kernel talks to it like a second computer on a cable.
In progressOct 2026 – now

Linux kernel tapstack (my C code)
┌─────────────────┐ ┌──────────────────┐
│ ping, curl, nc │ │ HTTP │
│ Linux TCP/IP │ Ethernet │ TCP / UDP / ICMP │
│ tap0 10.0.0.1 ◄┼─ frames ─┼► IPv4 / ARP │
└─────────────────┘ │ 10.0.0.2 │
└──────────────────┘My part. Sole developer. I write the data structures and protocol code myself and use Claude Code as a tutor that points me to the RFCs.
Why I built it
At Karios I configured Linux networking from Go. I wanted to write the protocols themselves in C, byte by byte, and have Linux's real TCP stack on the other end grading my code.
How it works
- Working now: opens tap0, reads raw Ethernet frames, computes the Internet checksum (RFC 1071), and has a tested ring buffer.
- Next, in order: Ethernet and ARP with a hash-table cache, IPv4 and ping, UDP, the TCP handshake and state machine (RFC 9293), retransmission timers on a min-heap (RFC 6298), and a tiny web server so
curl http://10.0.0.2/works. - Planned dashboard with four screens: overview counters, the TCP connection table with its state machine, a packet ladder with hex decode, and the stack's internals (ARP cache, timer heap, buffer pool). The design is done; the screens aren't built yet.
Design decisions
- Single-threaded poll() loop, no threads.
- No malloc per packet once the buffer pool lands.
- Every parser checks lengths first; bad frames are dropped and counted.
- Builds with -Wall -Wextra -Werror and tests run under AddressSanitizer.
Testing
Each stage ends with a test using standard tools: ping, arping, nc, curl and tcpdump against tap0, with 10% packet loss added for the TCP stages.