Date: Thu, 10 Sep 2020 11:43:23 +0000 (UTC) From: Michael Tuexen <tuexen@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r365561 - stable/12/sys/netinet Message-ID: <202009101143.08ABhN3r013735@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: tuexen Date: Thu Sep 10 11:43:23 2020 New Revision: 365561 URL: https://svnweb.freebsd.org/changeset/base/365561 Log: MFC r361750: Restrict enabling TCP-FASTOPEN to end-points in CLOSED or LISTEN state Enabling TCP-FASTOPEN on an end-point which is in a state other than CLOSED or LISTEN, is a bug in the application. So it should not work. Also the TCP code does not (and needs not to) handle this. While there, also simplify the setting of the TF_FASTOPEN flag. Modified: stable/12/sys/netinet/tcp_usrreq.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/tcp_usrreq.c ============================================================================== --- stable/12/sys/netinet/tcp_usrreq.c Thu Sep 10 10:49:59 2020 (r365560) +++ stable/12/sys/netinet/tcp_usrreq.c Thu Sep 10 11:43:23 2020 (r365561) @@ -2082,6 +2082,11 @@ unlock_and_done: return (error); INP_WLOCK_RECHECK(inp); + if ((tp->t_state != TCPS_CLOSED) && + (tp->t_state != TCPS_LISTEN)) { + error = EINVAL; + goto unlock_and_done; + } if (tfo_optval.enable) { if (tp->t_state == TCPS_LISTEN) { if (!V_tcp_fastopen_server_enable) { @@ -2089,7 +2094,6 @@ unlock_and_done: goto unlock_and_done; } - tp->t_flags |= TF_FASTOPEN; if (tp->t_tfo_pending == NULL) tp->t_tfo_pending = tcp_fastopen_alloc_counter(); @@ -2108,8 +2112,8 @@ unlock_and_done: tp->t_tfo_client_cookie_len = TCP_FASTOPEN_PSK_LEN; } - tp->t_flags |= TF_FASTOPEN; } + tp->t_flags |= TF_FASTOPEN; } else tp->t_flags &= ~TF_FASTOPEN; goto unlock_and_done;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202009101143.08ABhN3r013735>