This is an automated email from the ASF dual-hosted git repository. lserris pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push: new 7aacd8d4fb MPTCP warnings and clean up (#10802) 7aacd8d4fb is described below commit 7aacd8d4fbc1ca7272e73e823ca4995d4cf06866 Author: Serris Lew <serrisn...@gmail.com> AuthorDate: Mon Nov 27 08:48:57 2023 -0800 MPTCP warnings and clean up (#10802) * MPTCP warnings and clean up * Add doc kernel details --------- Co-authored-by: Serris Lew <lser...@apple.com> --- doc/admin-guide/files/records.yaml.en.rst | 4 ++++ include/tscore/ink_platform.h | 9 --------- src/iocore/net/Connection.cc | 19 ++++++++++++------- src/iocore/net/P_UnixNetVConnection.h | 11 ----------- src/records/RecHttp.cc | 9 ++------- 5 files changed, 18 insertions(+), 34 deletions(-) diff --git a/doc/admin-guide/files/records.yaml.en.rst b/doc/admin-guide/files/records.yaml.en.rst index 174ea0f8b9..fc0415eaa4 100644 --- a/doc/admin-guide/files/records.yaml.en.rst +++ b/doc/admin-guide/files/records.yaml.en.rst @@ -4925,6 +4925,7 @@ Sockets This directive enables operating system specific optimizations for a listening socket. ``defer_accept`` holds a call to ``accept(2)`` back until data has arrived. In Linux' special case this is up to a maximum of 45 seconds. On FreeBSD, ``accf_data`` module needs to be loaded. + Note: If MPTCP is enabled, TCP_DEFER_ACCEPT is only supported on Linux kernels 5.19+. .. ts:cv:: CONFIG proxy.config.net.listen_backlog INT -1 :reloadable: @@ -4965,6 +4966,8 @@ Sockets PACKET_TOS (32) TCP_NOTSENT_LOWAT (64) + Note: If MPTCP is enabled, TCP_NODELAY is only supported on Linux kernels 5.17+. TCP_FASTOPEN + and TCP_NOTSENT_LOWAT socket options are currently not supported. .. note:: This is a bitmask and you need to decide what bits to set. Therefore, @@ -5019,6 +5022,7 @@ Sockets .. ts:cv:: CONFIG proxy.config.net.sock_mss_in INT 0 Same as the command line option ``--accept_mss`` that sets the MSS for all incoming requests. + Note: If MPTCP is enabled, TCP_MAXSEG socket option is not supported. .. ts:cv:: CONFIG proxy.config.net.sock_packet_mark_in INT 0x0 diff --git a/include/tscore/ink_platform.h b/include/tscore/ink_platform.h index 2bf3cb0ad0..beec36d991 100644 --- a/include/tscore/ink_platform.h +++ b/include/tscore/ink_platform.h @@ -181,15 +181,6 @@ using in_addr_t = unsigned int; // windows-260,etc) #endif -// This is a little bit of a hack for now, until MPTCP has landed upstream in Linux land. -#ifndef MPTCP_ENABLED -#if defined(__linux__) -#define MPTCP_ENABLED 42 -#else -#define MPTCP_ENABLED 0 -#endif -#endif - // If kernel headers do not support IPPROTO_MPTCP definition #ifndef IPPROTO_MPTCP #define IPPROTO_MPTCP 262 diff --git a/src/iocore/net/Connection.cc b/src/iocore/net/Connection.cc index 195b6eafc0..79b400b712 100644 --- a/src/iocore/net/Connection.cc +++ b/src/iocore/net/Connection.cc @@ -229,7 +229,7 @@ Server::setup_fd_for_listen(bool non_blocking, const NetProcessor::AcceptOptions #endif } - if ((opt.sockopt_flags & NetVCOptions::SOCK_OPT_NO_DELAY) && !opt.f_mptcp && setsockopt_on(fd, IPPROTO_TCP, TCP_NODELAY) < 0) { + if ((opt.sockopt_flags & NetVCOptions::SOCK_OPT_NO_DELAY) && setsockopt_on(fd, IPPROTO_TCP, TCP_NODELAY) < 0) { goto Lerror; } @@ -239,9 +239,12 @@ Server::setup_fd_for_listen(bool non_blocking, const NetProcessor::AcceptOptions } #ifdef TCP_FASTOPEN - if ((opt.sockopt_flags & NetVCOptions::SOCK_OPT_TCP_FAST_OPEN) && !opt.f_mptcp && - safe_setsockopt(fd, IPPROTO_TCP, TCP_FASTOPEN, (char *)&opt.tfo_queue_length, sizeof(int))) { - goto Lerror; + if (opt.sockopt_flags & NetVCOptions::SOCK_OPT_TCP_FAST_OPEN) { + if (opt.f_mptcp) { + Warning("[Server::listen] TCP_FASTOPEN socket option not valid on MPTCP socket level"); + } else if (safe_setsockopt(fd, IPPROTO_TCP, TCP_FASTOPEN, (char *)&opt.tfo_queue_length, sizeof(int))) { + goto Lerror; + } } #endif @@ -261,8 +264,10 @@ Server::setup_fd_for_listen(bool non_blocking, const NetProcessor::AcceptOptions } #if defined(TCP_MAXSEG) - if (NetProcessor::accept_mss > 0 && !opt.f_mptcp) { - if (safe_setsockopt(fd, IPPROTO_TCP, TCP_MAXSEG, reinterpret_cast<char *>(&NetProcessor::accept_mss), sizeof(int)) < 0) { + if (NetProcessor::accept_mss > 0) { + if (opt.f_mptcp) { + Warning("[Server::listen] TCP_MAXSEG socket option not valid on MPTCP socket level"); + } else if (safe_setsockopt(fd, IPPROTO_TCP, TCP_MAXSEG, reinterpret_cast<char *>(&NetProcessor::accept_mss), sizeof(int)) < 0) { goto Lerror; } } @@ -271,7 +276,7 @@ Server::setup_fd_for_listen(bool non_blocking, const NetProcessor::AcceptOptions #ifdef TCP_DEFER_ACCEPT // set tcp defer accept timeout if it is configured, this will not trigger an accept until there is // data on the socket ready to be read - if (opt.defer_accept > 0 && !opt.f_mptcp && setsockopt(fd, IPPROTO_TCP, TCP_DEFER_ACCEPT, &opt.defer_accept, sizeof(int)) < 0) { + if (opt.defer_accept > 0 && setsockopt(fd, IPPROTO_TCP, TCP_DEFER_ACCEPT, &opt.defer_accept, sizeof(int)) < 0) { // FIXME: should we go to the error // goto error; Error("[Server::listen] Defer accept is configured but set failed: %d", errno); diff --git a/src/iocore/net/P_UnixNetVConnection.h b/src/iocore/net/P_UnixNetVConnection.h index 395be61a55..919ba216ff 100644 --- a/src/iocore/net/P_UnixNetVConnection.h +++ b/src/iocore/net/P_UnixNetVConnection.h @@ -306,17 +306,6 @@ UnixNetVConnection::set_local_addr() inline void UnixNetVConnection::set_mptcp_state() { - int mptcp_enabled = -1; - int mptcp_enabled_size = sizeof(mptcp_enabled); - - if (0 == safe_getsockopt(con.fd, IPPROTO_TCP, MPTCP_ENABLED, (char *)&mptcp_enabled, &mptcp_enabled_size)) { - Dbg(_dbg_ctl_socket_mptcp, "MPTCP socket state: %d", mptcp_enabled); - mptcp_state = (mptcp_enabled > 0); - return; - } else { - Dbg(_dbg_ctl_socket_mptcp, "MPTCP failed getsockopt(MPTCP_ENABLED): %s", strerror(errno)); - } - #if defined(HAVE_STRUCT_MPTCP_INFO_SUBFLOWS) && defined(MPTCP_INFO) && MPTCP_INFO == 1 struct mptcp_info minfo; int minfo_len = sizeof(minfo); diff --git a/src/records/RecHttp.cc b/src/records/RecHttp.cc index f24748176d..05c993581a 100644 --- a/src/records/RecHttp.cc +++ b/src/records/RecHttp.cc @@ -102,18 +102,13 @@ SessionProtocolSet DEFAULT_QUIC_SESSION_PROTOCOL_SET; static bool mptcp_supported() { - ats_scoped_fd fd(::open("/proc/sys/net/mptcp/mptcp_enabled", O_RDONLY)); - // Newer kernel mptcp config - ats_scoped_fd fd_new(::open("/proc/sys/net/mptcp/enabled", O_RDONLY)); + ats_scoped_fd fd(::open("/proc/sys/net/mptcp/enabled", O_RDONLY)); int value = 0; - TextBuffer buffer(16); if (fd > 0) { + TextBuffer buffer(16); buffer.slurp(fd.get()); value = atoi(buffer.bufPtr()); - } else if (fd_new > 0) { - buffer.slurp(fd_new.get()); - value = atoi(buffer.bufPtr()); } return value != 0;