title: Does listen's backlog number include SYN-received connections count in case of TCP in Linux?
body: <p>I read some posts and checked Linux kernel code like <code>inet_listen()</code>-><a href="https://elixir.bootlin.com/linux/v4.3.6/source/net/ipv4/inet_connection_sock.c#L795" rel="nofollow noreferrer"><code>inet_csk_listen_start()</code></a> and it seems that <strong><code>backlog</code> argument of <code>listen()</code> syscall only affects on accepted queue</strong>, but not on SYN-received queue:</p>
  
  <pre><code>sk-&gt;sk_max_ack_backlog = backlog;
  </code></pre>
  
  <p>I.e. symbolically <em><code>accept-queue + syn-received-queue != backlog</code></em>.
  I can't figure out what is happening. <a href="https://blog.cloudflare.com/syn-packet-handling-in-the-wild/" rel="nofollow noreferrer">This article</a> states:</p>
  
  <blockquote>
    <p>The maximum allowed length of both the Accept and SYN Queues is taken
    from the backlog parameter passed to the listen(2) syscall by the
    application.</p>
  </blockquote>
  
  <p>But there is nothing similar in <a href="http://man7.org/linux/man-pages/man2/listen.2.html" rel="nofollow noreferrer">MAN page</a>.</p>
  
  <p>Also in case of Linux: Is <code>backlog</code> a hint as mentioned <a href="https://stackoverflow.com/questions/5111040/listen-ignores-the-backlog-argument">here</a> or it really limits queues?</p>