Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Show HN: I integrated my from-scratch TCP/IP stack into the xv6-riscv OS (github.com/pandax381)
49 points by pandax381 4 hours ago | hide | past | favorite | 4 comments
Hi HN,

To truly understand how operating systems and network protocols work, I decided to combine two classic learning tools: the xv6 teaching OS and a from-scratch TCP/IP stack.

I'm excited to share the result: my own from-scratch TCP/IP networking stack running directly inside the xv6-riscv (https://github.com/pandax381/xv6-riscv-net) kernel.

The project uses a modern virtio-net driver, allowing it to run seamlessly in QEMU and communicate with the host machine.

Key features:

- From-Scratch Stack: The core is powered by microps (https://github.com/pandax381/microps), a TCP/IP stack I originally wrote to run in user-space as a personal project to learn the low-level details of networking.

- Kernel Integration: This project ports microps from user-space into the xv6-riscv kernel.

- Socket API: Implements standard system calls (socket, bind, accept, etc.) to enable network application development.

- User-level Tools: Comes with a simple ifconfig command, plus tcpecho and udpecho servers to demonstrate its capabilities.

This has been a fantastic learning experience. My goal was to demystify the magic behind network-aware operating systems by building the components myself.

I'd love to hear your feedback and answer any questions!





Awesome work! Thank you for showing it to the world!

I've considered writing a network stack myself. It's much more complex than most people can imagine. We have great tooling for TCP and that makes people believe it's simple technology. It's not.


This is amazing work. Most people don’t realize how much effort and depth there is behind writing a TCP/IP stack and plugging it into xv6 with virtio-net and sockets. Huge respect for making it public. Projects like this are gold for those of us who love low-level systems.

Are you using any RISC-V extensions? If so, which? I couldn't find this information on the xv6 project page. It would be cool if you could run this project in bare metal.

Well done! Thank you for sharing



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: