tcp: Fix window scaling for accecpted socket
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Fri, 27 Apr 2012 06:49:07 +0000 (14:49 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Fri, 27 Apr 2012 07:57:14 +0000 (15:57 +0800)
commitdf1d2774875776b9ee946a447abd7a9ab8bd7052
tree7a97b79f9e2d087cc87fbe2ff8c67bde9490a518
parenta098966f5a899988149ce42ce48446d59a94dd23
tcp: Fix window scaling for accecpted socket

- Retire tcpcb.requested_s_scale, use tcpcb.snd_scale directly.
- Set tcpcb.snd_wnd in SYN_SENT state only if the TCP flags contains SYN.
- Save other side advertised window into syncache, and setup tcpcb.snd_wnd
  according to the save value after the 3-way hand shake is done.
- Delay tiwin setup in tcp_input(), specificly after tcpcb.snd_scale is
  setup on the SO_ACCEPTCONN path.

This tends to fix the window scaling bug: when the sender accepts
connection and data only follow from sender to receiver.
sys/netinet/tcp_input.c
sys/netinet/tcp_syncache.c
sys/netinet/tcp_var.h