4 ms·
Years ago, I attempted to build a user-space network stack in C [0] that processes raw packets through the TUN interface and got it working to a certain point.
by cihangir 2y ago
Years ago, I attempted to build a user-space network stack in C [0] that processes raw packets through the TUN interface and got it working to a certain point. It currently includes a simple shell that allows configuring IP addresses, routes, and such. A hybrid structure reminiscent of both mbuf and sk_buf is used to hold the network packets. However, after completing the UDP implementation I didn't find the time or motivation to implement TCP. If you want to check it out, here's the link:
[0] https://github.com/cakturk/unet https://github.com/cakturk/unet
- VWWHFSfQ 2y agoMany years ago, I wrote a pcap/tcpdump parser in pure bash, because it's all I knew how to write "programs" with. It was, of course, the slowest and most brittle thing of all time, but it did actually work. And was kinda fun. Wish I still had that code somewhere.
- jpfr 2y agoMany embedded devices run the lwip implementation of TCP/IP. The "POSIX port" of lwip does the same. It takes the raw Ethernet bytes from a TUN/TAP device. https://github.com/lwip-tcpip/lwip/blob/master/contrib/ports/unix/port/netif/tapif.c https://github.com/lwip-tcpip/lwip/blob/master/contrib/ports...