TCP connection simulation

Bindinganavile, Vinuthananda (vinu@rnd.cts-corp.com)
Wed, 29 Dec 1999 10:36:07 +0530


Hi,
I have a really peculiar situation, so please excuse me if it is a silly or
unfeasible requirement. But I really need it for one of my modules and any
help in this regard will be appreciated.

The problem statement goes as follows:
I am working in the TCP/IP layer of the Linux kernel. Whenever any client
contacts this server all the client packets i.e. the sk_buff are queued in
my own queue(a linked list). Hence for each TCP connection I have in my
queue packets from SYN to the end of connection(FIN or ACK). Once the
connection is completed, I am trying to simulate the same connection again
with the queued pakcets and this will be within the machine (i.e. packets
dont go out to the n/w). Of course this involves changing the sequence
numbers of the queued packets so that the server will accept them, since
the server's ISN during simulation will be different.

I am working in the ip_output.c file where I send my SYN packet to the
upper layers. This packet is recd and a SYN-ACK is also sent by the TCP.
Now in the same file, when the server's response comes down, I trap this,
check if it is my response and then send the ACK packet from my queue after
modifications. But the problem which is now arising is that when I send my
ACK packet to complete the 3-way handshake, the sk->state will be still be
in LISTEN and TCP will reject any ACK packets in this state. So could
anyone please tell me how do I wait in a loop for the state to become
SYN_RECV before sending the next packet. Or are there any other approaches
for this problem?

I am really sorry for the long question but any help will be great. BTW I
am using kernel 2.2.5

TIA.
bye
Vinu

-
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/