lkml.org 
[lkml]   [1999]   [Dec]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: TCP connection simulation
From
Date
vinu@rnd.cts-corp.com (Bindinganavile, Vinuthananda (CTS)) writes:
>
> 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?

In Linux 2.2 SYN_RECV sockets are represented as open_requests (smaller
structures). Only after the ack in the three way handshake comes in a new
socket is created, directly in ESTABLISHED state.
open_requests are associated with a listen socket. You're probably
looking at the listen socket. tcp_ipv4.c does the open_request check.
your ack is probably wrong in some way and thus never matches an
open_request, and it ends up being rejected by the LISTEN socket.

BTW, why aren't you doing that from user space via a packet socket?

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

\
 
 \ /
  Last update: 2005-03-22 13:55    [W:1.181 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site