Commit de213e5eedecdfb1b1eea7e6be28bc64cac5c078
Committed by
David S. Miller
1 parent
eedf042a63
Exists in
master
and in
39 other branches
tcp: tcp_synack_options() fix
Commit 33ad798c924b4a (tcp: options clean up) introduced a problem if MD5+SACK+timestamps were used in initial SYN message. Some stacks (old linux for example) try to negotiate MD5+SACK+TSTAMP sessions, but since 40 bytes of tcp options space are not enough to store all the bits needed, we chose to disable timestamps in this case. We send a SYN-ACK _without_ timestamp option, but socket has timestamps enabled and all further outgoing messages contain a TS block, all with the initial timestamp of the remote peer. Fix is to really disable timestamps option for the whole session. Reported-by: Bijay Singh <Bijay.Singh@guavus.com> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 1 changed file with 4 additions and 5 deletions Side-by-side Diff
net/ipv4/tcp_output.c
... | ... | @@ -668,7 +668,6 @@ |
668 | 668 | u8 cookie_plus = (xvp != NULL && !xvp->cookie_out_never) ? |
669 | 669 | xvp->cookie_plus : |
670 | 670 | 0; |
671 | - bool doing_ts = ireq->tstamp_ok; | |
672 | 671 | |
673 | 672 | #ifdef CONFIG_TCP_MD5SIG |
674 | 673 | *md5 = tcp_rsk(req)->af_specific->md5_lookup(sk, req); |
... | ... | @@ -681,7 +680,7 @@ |
681 | 680 | * rather than TS in order to fit in better with old, |
682 | 681 | * buggy kernels, but that was deemed to be unnecessary. |
683 | 682 | */ |
684 | - doing_ts &= !ireq->sack_ok; | |
683 | + ireq->tstamp_ok &= !ireq->sack_ok; | |
685 | 684 | } |
686 | 685 | #else |
687 | 686 | *md5 = NULL; |
... | ... | @@ -696,7 +695,7 @@ |
696 | 695 | opts->options |= OPTION_WSCALE; |
697 | 696 | remaining -= TCPOLEN_WSCALE_ALIGNED; |
698 | 697 | } |
699 | - if (likely(doing_ts)) { | |
698 | + if (likely(ireq->tstamp_ok)) { | |
700 | 699 | opts->options |= OPTION_TS; |
701 | 700 | opts->tsval = TCP_SKB_CB(skb)->when; |
702 | 701 | opts->tsecr = req->ts_recent; |
... | ... | @@ -704,7 +703,7 @@ |
704 | 703 | } |
705 | 704 | if (likely(ireq->sack_ok)) { |
706 | 705 | opts->options |= OPTION_SACK_ADVERTISE; |
707 | - if (unlikely(!doing_ts)) | |
706 | + if (unlikely(!ireq->tstamp_ok)) | |
708 | 707 | remaining -= TCPOLEN_SACKPERM_ALIGNED; |
709 | 708 | } |
710 | 709 | |
... | ... | @@ -712,7 +711,7 @@ |
712 | 711 | * If the <SYN> options fit, the same options should fit now! |
713 | 712 | */ |
714 | 713 | if (*md5 == NULL && |
715 | - doing_ts && | |
714 | + ireq->tstamp_ok && | |
716 | 715 | cookie_plus > TCPOLEN_COOKIE_BASE) { |
717 | 716 | int need = cookie_plus; /* has TCPOLEN_COOKIE_BASE */ |
718 | 717 |