AFAIK you have raw sockets and BSD sockets (that's more or less one, but...) and no interface in between. It means that you need to use raw sockets, in your case. The thing is that you want certain parts of the stack,
but not all.
From the things you mentioned, you can emulate them using BSD sockets (FIN after close and so on) and using iptables in a creative way (with passing packets to user space). It looks that's not all you need to do. When you come to IP level, it becomes much more complicated.
Different algorithms come into play. "Send FIN" is not that simple, FIN can look in many different ways depending on the implementation methods, options used and so on.
I don't know what's the purpose, but it looks to me you'll finish using raw sockets and filling the packets yourself.
|