Re: Help on TCP Output/Input

Andi Kleen (ak-uu@muc.de)
07 Oct 1999 21:20:19 +0200


kchak@iitk.ac.in (Koushik Chakraborty) writes:

>
> I have been trying to understand various things on this regard for last
> few weeks by going through the Linux kernel source code (version 2.2.9).
> Could you please clarify a few doubts in this regards ..
>
> A> At which point in the TCP implementaion, do you have ordered,
> non-duplicated data stream (as if ready to be consumed by the
> application).

When the data is queued in the receive_queue of the socket. The kernel
consumes it from tcp_recvmsg().

>
> B> Is it possible to retrive this data stream and form into sk_buff and
> subsequently call tcp_write for the outgoing sockets ? I mean will it
> actually take care of ACK's and sliding-window management ?

If you steal packets before tcp_recvmsg you have to do some of its work, mainly
the ack management done in cleanup_rbuf(). You could skb_clone() the packet
though and queue to some other socket (similar to how raw sockets are
implemented in ip_input.c)

> C> Can anybody suggest any other or possibly best way to achieve this ?

Tapping the data via packet or raw sockets (you'll need to implement your
own reassembly then)

Using shared memory in user space to distribute the data to all consumers.
That is probably the best way.

-Andi

-- 
This is like TV. I don't like TV.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/