Code query: tcp_request_sock deallocation

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <netdev@...>
Date: Thursday, August 7, 2008 - 7:07 pm

I'm hoping someone can explain part of the lifetime of a request_sock for me.

In tcp_minisocks.c:tcp_check_req (near the bottom) we have the code
path for upgrading a request_sock to a full sock in the case that we
get a valid ack:

child = inet_csk(sk)->icsk_af_ops->syn_recv_sock(sk, skb,
								 req, NULL);
if (child == NULL)
	goto listen_overflow;

// MD5 stuff omitted

inet_csk_reqsk_queue_unlink(sk, req, prev);
inet_csk_reqsk_queue_removed(sk, req);

inet_csk_reqsk_queue_add(sk, req, child);

Those last three lines appear to remove the request_sock from the
queue (fine), can then re-enqueue it at the end of the queue with ->sk
pointing to the new ESTABLISHED socket. At this point I loose track,
because I don't see where the request_sock is free'ed, except maybe
from inet_csk_reqsk_queue_prune.

Other code paths in that function (like goto embryonic_reset) end up
removing it from the queue and freeing it immediately (with
inet_csk_reqsk_queue_drop).

I wondered if it was enqueued in order to be reused, but new
request_socks seem to be alloced rather than taken from that queue.


Thanks

AGL

-- 
Adam Langley agl@imperialviolet.org http://www.imperialviolet.org
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Code query: tcp_request_sock deallocation, Adam Langley, (Thu Aug 7, 7:07 pm)
Re: Code query: tcp_request_sock deallocation, Adam Langley, (Thu Aug 7, 9:19 pm)