I'm recently learning the TCP/IP implementation in linux kernel(version 4.4), and got really confused about the accept queue. I know there is a queue in struct inet_connection_sock which is called a accept queue:

struct inet_connection_sock {
    /* @icsk_accept_queue:     FIFO of established children */
    struct request_sock_queue icsk_accept_queue;

and there is a qlen member in it, I think it is used to indicate the length of the queue.

When a LISTEN socket receives a SYN packet, in function tcp_conn_request, inet_csk_reqsk_queue_hash_add is called to put the newly created NEW_SYN_RECV sock into ehash table (not icsk_accept_queue). But in inet_csk_reqsk_queue_hash_add, inet_csk_reqsk_queue_added is called to increment icsk_accept_queue.len. My question is why increment qlen since nothing is inserted to icsk_accept_queue?

What's more, tcp_conn_request also called inet_csk_reqsk_queue_add to add a fast open sock(if enabled) to icsk_accept_queue, but this function ended up incrementing sk.sk_ack_backlog (by calling sk_acceptq_added) instead of icsk_accept_queue.qlen... What am I missing?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.