Greetings,
I'm doing a project where I need to do an implementation of TCP over IP in the user space.
My problem resides in the fact that, since I'm building real TCP blocks, the kernel is replying to the packets itself.
I'm looking for a way to tell the kernel to just don't reply to any TCP packets, although I cannot disable the TCP implementation on the kernel, 'cause if I do that I'll loose things like even the loopback (which I obviously need to my purposes).
Any ideas?
Thanks in advance,
Mind Booster Noori
userspace loopback or rawip
you have to implement loopback in userspace too. you have to use rawip sockets otherwise. dhcp clients do that to implement udp in userspace.
RE: userspace loopback or rawip
I'm already using rawip sockets.
The issue is that ATM when I send a SYN packet to, say, port 12345, the kernel answers with a RST. If, to avoid that, I bind that port, then the kernel will reply with an ACK packet (which I want to avoid, I want that my server proggie sends that ACK, not the kernel).
raw eth
you have to use raw eth packets then
iptables
The simplest solution probably is to just create an iptables rule causing the kernel to DROP the incomming packets. BTW I'd like to see what you come up with. I have a few things I'd like to test if I had access to a user mode TCP implementation.
RE: iptables
iptables won't do. The packets are written in usermode, but are still send in the IP layer, so they will arrive at the other side and, if there's an iptables rule causing the kernel to drop the incoming packets, my packets will drop too.
I'm studying best ways to deal with the problem using rawip sockets, if it turns out not viable, I'll try raw eth (which, as a more or less sane person, I'm trying to avoid).
The implementation I'm writting is being made in python and will be release GPL'd as far as there's a working version.
I'll post something about that herem when the time comes.
Pointer to IP stack in user space
http://www.vzavenue.net/~neelnatu/alpine4linux/alpine4linux.txt