Bug 82101

Summary: Strange code in /net/ipv4/tcp_output.c: tcp_send_syn_data()
Product: Networking Reporter: Maks Naumov (maksqwe1)
Component: IPV4Assignee: Stephen Hemminger (stephen)
Status: RESOLVED CODE_FIX    
Severity: normal CC: ycheng
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.16.0 Subsystem:
Regression: No Bisected commit-id:

Description Maks Naumov 2014-08-10 14:37:47 UTC
tcp_output.c 3015

/* Queue a data-only packet after the regular SYN for retransmission */
data = pskb_copy(syn_data, sk->sk_allocation);
if (data == NULL)
  goto fallback;
TCP_SKB_CB(data)->seq++;
TCP_SKB_CB(data)->tcp_flags &= ~TCPHDR_SYN;            // <===
TCP_SKB_CB(data)->tcp_flags = (TCPHDR_ACK|TCPHDR_PSH); // <===
tcp_connect_queue_skb(sk, data);
fo->copied = data->len;

This code intriduced in "net-tcp: Fast Open client - sending SYN-data"
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=783237e8daf13481ee234997cbbbb823872ac388
Comment 1 Maks Naumov 2014-08-18 10:27:47 UTC
Maybe it should be:

TCP_SKB_CB(data)->seq++;
TCP_SKB_CB(data)->tcp_flags &= ~TCPHDR_SYN;
TCP_SKB_CB(data)->tcp_flags |= (TCPHDR_ACK|TCPHDR_PSH);

?
Comment 2 Yuchung Cheng 2014-08-21 18:46:50 UTC
Indeed that's what I intended. I can send a patch to address this. thanks for catching that.