aboutgitcodebugslistschat
path: root/tcp.c
diff options
context:
space:
mode:
Diffstat (limited to 'tcp.c')
-rw-r--r--tcp.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/tcp.c b/tcp.c
index 1de6d99..4748461 100644
--- a/tcp.c
+++ b/tcp.c
@@ -798,10 +798,13 @@ static int tcp_send_to_tap(struct ctx *c, int s, int flags, char *in, int len)
th->source = tc[s].sock_port;
th->dest = tc[s].tap_port;
- if (!err)
- th->window = htons(info.tcpi_snd_wnd >> info.tcpi_snd_wscale);
- else
- th->window = WINDOW_DEFAULT;
+ if (!err) {
+ /* First value sent by receiver is not scaled */
+ th->window = htons(info.tcpi_snd_wnd >>
+ ((flags & SYN) ? 0 : info.tcpi_snd_wscale));
+ } else {
+ th->window = htons(WINDOW_DEFAULT);
+ }
th->urg_ptr = 0;
th->check = 0;