On Thu, Nov 08, 2012 at 08:08:05PM +0200, Dan Shechter wrote: > For unrelated reasons, I can't directly receive the TCP stream. > > I must copy the TCP data from a running stream to another server. I > can use tap or just port-mirroring on the switch. So I can't use any > network stack or leverage any offloading. > > I also need to modify the received data, and add few application > headers before sending it as a multicast udp stream. > > Winsock is userland. What I want to do is in the kernel, even before > ip_input. I guess it should be faster. > > I am looking at netFPGA too, but prefer to do this in software. >
You might want to try this: http://info.iet.unipi.it/~luigi/netmap/ It's FreeBSD and Linux only, though. The emerging solution for high performance traffic routers like this is to have one or more threads loop in userspace over a memory mapped NIC buffer. Most of these interfaces are highly proprietary. Netmap provides the relative programmatic simplicity of a TAP-type interface with the zero-copy performance of the mapped buffering.