7 ms·
To do user space IP you need raw sockets (to build the TCP headers). Raw sockets require root access or special privileges for your process as the kernel typica
by vlovich123 6y ago
To do user space IP you need raw sockets (to build the TCP headers). Raw sockets require root access or special privileges for your process as the kernel typically is the only one allowed to build such headers as TCP requires good network behavior. You don’t want trivial compromises of user-space apps to suddenly give malicious code to send arbitrary TCP packets that may be exploiting some property of TCP stacks to DDOS more effectively or to misbehave on the behavioral side of TCP things like ignore flow control.
That’s a huge part of why the kernel implements it. The other part is that network stacks typically can be more tightly coupled with network drivers for performance (again trusted context so less/no validation needed for the buffers being shared and whatnot). Now there are obviously cases where user space can do a better job of buffer management for better latency/throughout so the perf aspect isn’t that conclusive.