diff options
| -rw-r--r-- | net/ipv4/tcp_input.c | 52 |
1 files changed, 25 insertions, 27 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 3a40584cb473..706a99ec73f6 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
| @@ -5989,6 +5989,27 @@ reset_and_undo: | |||
| 5989 | return 1; | 5989 | return 1; |
| 5990 | } | 5990 | } |
| 5991 | 5991 | ||
| 5992 | static void tcp_rcv_synrecv_state_fastopen(struct sock *sk) | ||
| 5993 | { | ||
| 5994 | tcp_try_undo_loss(sk, false); | ||
| 5995 | inet_csk(sk)->icsk_retransmits = 0; | ||
| 5996 | |||
| 5997 | /* Once we leave TCP_SYN_RECV or TCP_FIN_WAIT_1, | ||
| 5998 | * we no longer need req so release it. | ||
| 5999 | */ | ||
| 6000 | reqsk_fastopen_remove(sk, tcp_sk(sk)->fastopen_rsk, false); | ||
| 6001 | |||
| 6002 | /* Re-arm the timer because data may have been sent out. | ||
| 6003 | * This is similar to the regular data transmission case | ||
| 6004 | * when new data has just been ack'ed. | ||
| 6005 | * | ||
| 6006 | * (TFO) - we could try to be more aggressive and | ||
| 6007 | * retransmitting any data sooner based on when they | ||
| 6008 | * are sent out. | ||
| 6009 | */ | ||
| 6010 | tcp_rearm_rto(sk); | ||
| 6011 | } | ||
| 6012 | |||
| 5992 | /* | 6013 | /* |
| 5993 | * This function implements the receiving procedure of RFC 793 for | 6014 | * This function implements the receiving procedure of RFC 793 for |
| 5994 | * all states except ESTABLISHED and TIME_WAIT. | 6015 | * all states except ESTABLISHED and TIME_WAIT. |
| @@ -6085,22 +6106,8 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb) | |||
| 6085 | if (!tp->srtt_us) | 6106 | if (!tp->srtt_us) |
| 6086 | tcp_synack_rtt_meas(sk, req); | 6107 | tcp_synack_rtt_meas(sk, req); |
| 6087 | 6108 | ||
| 6088 | /* Once we leave TCP_SYN_RECV, we no longer need req | ||
| 6089 | * so release it. | ||
| 6090 | */ | ||
| 6091 | if (req) { | 6109 | if (req) { |
| 6092 | tcp_try_undo_loss(sk, false); | 6110 | tcp_rcv_synrecv_state_fastopen(sk); |
| 6093 | inet_csk(sk)->icsk_retransmits = 0; | ||
| 6094 | reqsk_fastopen_remove(sk, req, false); | ||
| 6095 | /* Re-arm the timer because data may have been sent out. | ||
| 6096 | * This is similar to the regular data transmission case | ||
| 6097 | * when new data has just been ack'ed. | ||
| 6098 | * | ||
| 6099 | * (TFO) - we could try to be more aggressive and | ||
| 6100 | * retransmitting any data sooner based on when they | ||
| 6101 | * are sent out. | ||
| 6102 | */ | ||
| 6103 | tcp_rearm_rto(sk); | ||
| 6104 | } else { | 6111 | } else { |
| 6105 | tcp_try_undo_spurious_syn(sk); | 6112 | tcp_try_undo_spurious_syn(sk); |
| 6106 | tp->retrans_stamp = 0; | 6113 | tp->retrans_stamp = 0; |
| @@ -6138,18 +6145,9 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb) | |||
| 6138 | case TCP_FIN_WAIT1: { | 6145 | case TCP_FIN_WAIT1: { |
| 6139 | int tmo; | 6146 | int tmo; |
| 6140 | 6147 | ||
| 6141 | /* If we enter the TCP_FIN_WAIT1 state and we are a | 6148 | if (req) |
| 6142 | * Fast Open socket and this is the first acceptable | 6149 | tcp_rcv_synrecv_state_fastopen(sk); |
| 6143 | * ACK we have received, this would have acknowledged | 6150 | |
| 6144 | * our SYNACK so stop the SYNACK timer. | ||
| 6145 | */ | ||
| 6146 | if (req) { | ||
| 6147 | tcp_try_undo_loss(sk, false); | ||
| 6148 | inet_csk(sk)->icsk_retransmits = 0; | ||
| 6149 | /* We no longer need the request sock. */ | ||
| 6150 | reqsk_fastopen_remove(sk, req, false); | ||
| 6151 | tcp_rearm_rto(sk); | ||
| 6152 | } | ||
| 6153 | if (tp->snd_una != tp->write_seq) | 6151 | if (tp->snd_una != tp->write_seq) |
| 6154 | break; | 6152 | break; |
| 6155 | 6153 | ||
