Bug #1434

TCP_INIT_CWND setsockopt doesn't work on passive connections.

Added by Theo Schlossnagle over 2 years ago. Updated over 2 years ago.

Status:Resolved Start date:2011-08-31
Priority:Normal Due date:2011-09-02
Assignee:Dan McDonald % Done:

100%

Category:kernel Spent time: -
Target version:- Estimated time:6.00 hours
Difficulty:Medium Tags:needs-triage

Description

The current implementation of the IPPROTO_TCP/TCP_INIT_CWND only affects a socket before accept() and connect(). This is quite limiting and unnecessary. There is a Google patch for Linux that implements this stuff correctly there and we should adopt their approach. They allow (via ioctl, I recommend keeping this a setsockopt) a modification of the initial window until data is first sent on the socket.

Specifically, this allows for following:

p = socket
bind(p) // http web server
listen(p)
setsockopt(p, IPPROTO_TCP, TCP_INIT_CWND, &10...)
c = accept(p)
// up to here currently works, the rest is limited by the current implementation
request = read(c)
if(someanalysis(request))
setsockopt(c, IPPROTO_TCP, TCP_INIT_CWND, &2...)
write(c, response)

This use-case demonstrates adjusting the initial congestion window before data send on the socket to enable different treatment of clients based on network information and request information (like user-agent indicating mobile browser).

History

Updated by Dan McDonald over 2 years ago

  • Assignee set to Dan McDonald

After having a conversation with the poster, here's the problem statement:

Consider a server having a policy of dynamically setting the initial congestion window based on knowledge of a specific peer (e.g. based on IP address). This knowledge only comes after the three-way handshake (i.e. when accept() returns a new socket). Today, the setsockopt(..TCP_INIT_CWND...) works, but doesn't affect any change after the accept() operation.

This bug aims to address that problem.

Updated by Dan McDonald over 2 years ago

The proposed fix slightly alters the semantics of TCP_INIT_CWND:

IF (and only if) the socket in question is both in ESTABLISHED state,
and has not yet sent any data (checked by comparing "iss" to "snxt"),
the TCP connection's actual congestion window size will also be
altered.

Updated by Dan McDonald over 2 years ago

  • Due date set to 2011-09-02
  • Status changed from New to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF