If you compile a minimal linux kernel without a tcp/ip stack -> 400KB. If you add a tcp/ip stack -> 800KB. For a project where I should just send the temperature, I just made a small C program in userspace that sent the value over a crafted UDP message, saved a lot of space (and complexity) :-).
Curiosly, why is the IP stack so large? 400kbytes of binary is a lot of code. Is it highly optimised for large server use case?
Let’s code a TCP/IP stack, 1: Ethernet and ARP (2016)
21–30 of 30 posts
Re: Let’s code a TCP/IP stack, 1: Ethernet and ARP (2016)
#22Re: Let’s code a TCP/IP stack, 1: Ethernet and ARP (2016)
#23This immediately turns off anyone reading it who doesn't know what those things mean. The thought process will be, "Oh, this article is for those for whom these fields are self-explanatory. Since it's not for me, I'll stop reading"
Re: Let’s code a TCP/IP stack, 1: Ethernet and ARP (2016)
#24One minute into it, the article says, "The dmac and smac are pretty self-explanatory fields" This immediately turns off anyone reading it who doesn't know what those things mean. The thought process will be, "Oh, this article is for those for whom these fields are self-explanatory. Since it's not for me, I'll stop reading"
> They contain the MAC addresses of the communicating parties (destination and source, respectively).
Re: Let’s code a TCP/IP stack, 1: Ethernet and ARP (2016)
#25One minute into it, the article says, "The dmac and smac are pretty self-explanatory fields" This immediately turns off anyone reading it who doesn't know what those things mean. The thought process will be, "Oh, this article is for those for whom these fields are self-explanatory. Since it's not for me, I'll stop reading"
Re: Let’s code a TCP/IP stack, 1: Ethernet and ARP (2016)
#26If you compile a minimal linux kernel without a tcp/ip stack -> 400KB. If you add a tcp/ip stack -> 800KB. For a project where I should just send the temperature, I just made a small C program in userspace that sent the value over a crafted UDP message, saved a lot of space (and complexity) :-).
Wow that’s crazy! As someone who knows nothing about anything: that doesn’t mean the tcp/ip stuff is half the source code of the whole kernel, does it?
Re: Let’s code a TCP/IP stack, 1: Ethernet and ARP (2016)
#27If you disable ARP, you can have a group of servers on the same network configured with the same IP! and if a server acting as a routing frontend can forward packets to a backend server's network interface by mac address (need a kernel extension for this trickery), that backend server will recognize itself as the destination, swap the source/dest IP and respond directly back to the client (without going back through…
Re: Let’s code a TCP/IP stack, 1: Ethernet and ARP (2016)
#28There's also rarp, which is one way to ask 'the network' for your IP address. I have no idea if rarp still works irl.
Re: Let’s code a TCP/IP stack, 1: Ethernet and ARP (2016)
#29Years 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…
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...
Re: Let’s code a TCP/IP stack, 1: Ethernet and ARP (2016)
#30If you disable ARP, you can have a group of servers on the same network configured with the same IP! and if a server acting as a routing frontend can forward packets to a backend server's network interface by mac address (need a kernel extension for this trickery), that backend server will recognize itself as the destination, swap the source/dest IP and respond directly back to the client (without going back through…