From nobody Fri Jul 10 15:40:34 2026 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4gxbdG6QN6z6lJjR for ; Fri, 10 Jul 2026 15:40:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gxbdG5jwRz46x7 for ; Fri, 10 Jul 2026 15:40:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783698034; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KitIeNsRzsZ04oMUSqjleSTc4QuQTSKqFQvqtvvuLNQ=; b=IE7JxQtDKJX0XlPmyOH4jIbvoa1PiDAR2XqUC/ZGeUDFDUJ8Iq/tWxnFgCKrTTuB9fKx9r OpiLxtle5ad3557rzTohjzqa7J8x212/mo9G/BwlZJUf6z69PcWjrozEKyTGXz3rIV81CR SWwvCpigM0MCIGJr1BP/F3cvoZ040XTlshZ4UA3ERyc0Te/yBSo7bTzOJ5MoVrNIyEYFoD jgA7PViN9+oghlHdu585Acm8/UgoJpqI+3XFW8L5RA/89plML5cpCfA6644EEBxMreGPir J5vzirgRDjNgf2b6Yl9YD+aOgDyCcFnlVJ6A5jvQDAssZEwcTLMkxaM8BS+Cag== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783698034; a=rsa-sha256; cv=none; b=EP7wruQQ14PF3nDsULpq5xr5wbxSiahKmJmtEf4IO1mU0Sq8VtEebU+EKeudlPdBOo6JB6 H2nPot40t00gZLBXPTbWn1N/RIkkDGBdHeQ7IXlTjHoLVEVmyebsFGQt3e/TnurmD/nRhs mk8+2j2/+lab93UkG2c0lnsgJjF18inFHWPeyNbAd5+GBVJ+ITOEPvVojN8BoWIaSFKXl3 +rH/+iqZxdF1KVZ+AN+4UICHg3m7lDoMAzJjHM23FMwKez2+AP3IFlC8Gnkh6pYYVz5xkS ByBN9NHe6cYF1zJTJ6CrmvrtsquR9lOXuxXa52q9d7/xT1ykrtMRmkzRtAbRWA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783698034; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KitIeNsRzsZ04oMUSqjleSTc4QuQTSKqFQvqtvvuLNQ=; b=fPYjKKtKWYogmZBgJK2PO7JeuvaYTVvrWuBYkR+Z69lUIBbFiqUQR36APIsKuY1kl5j9Z9 JcRuvJqSh6I8JylJfVWS2UedWDwa1XuI2o55rCLNVGSMrdLybm+6LAkUSDncJBOlYHcqdO AzeHJbarViNEJ3+gTN6PGrNnOGpPJEAUIQLY+qwHRfPqz+VGBhj/4Bbes2T9SGf0yk4vCF CPeKU/pToTnGSVrc6t1QaYaL1M6DL4QAANnksH2U8bx+AGmw1qJS9xhtNWLWWhlPRQ6aVx 2hT2RkrNGHtKAxUWoGQAwr+yeDMyqpkwauydrLCPvAVgBiwmL+7M4R9v4mMeHA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gxbdG4V3Xz11YQ for ; Fri, 10 Jul 2026 15:40:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 336fa by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 10 Jul 2026 15:40:34 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Chuck Tuffli Subject: git: 61c64a84d42f - stable/15 - linux: Add TCP_INFO support List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: chuck X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 61c64a84d42f0e43dbfb4a10f5a7213e1761142a Auto-Submitted: auto-generated Date: Fri, 10 Jul 2026 15:40:34 +0000 Message-Id: <6a511272.336fa.347344c6@gitrepo.freebsd.org> The branch stable/15 has been updated by chuck: URL: https://cgit.FreeBSD.org/src/commit/?id=61c64a84d42f0e43dbfb4a10f5a7213e1761142a commit 61c64a84d42f0e43dbfb4a10f5a7213e1761142a Author: Chuck Tuffli AuthorDate: 2026-06-10 00:22:49 +0000 Commit: Chuck Tuffli CommitDate: 2026-07-10 15:29:29 +0000 linux: Add TCP_INFO support Implement the getsockopt for TCP_INFO by mapping FreeBSD's version to what Linux expects. (cherry picked from commit 925ca9b8355d10a0dc85175dc865095c9b3370c4) --- sys/compat/linux/linux_socket.c | 47 +++++++++++++++++++-- sys/compat/linux/linux_socket.h | 92 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+), 3 deletions(-) diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c index 615ef12ec201..56c44039420e 100644 --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -589,9 +589,7 @@ linux_to_bsd_tcp_sockopt(int opt) case LINUX_TCP_KEEPCNT: return (TCP_KEEPCNT); case LINUX_TCP_INFO: - LINUX_RATELIMIT_MSG_OPT1( - "unsupported TCP socket option TCP_INFO (%d)", opt); - return (-2); + return (TCP_INFO); case LINUX_TCP_MD5SIG: return (TCP_MD5SIG); } @@ -2259,6 +2257,42 @@ linux_getsockopt_so_linger(struct thread *td, return (linux_sockopt_copyout(td, &ling, len, args)); } +static int +linux_getsockopt_tcp_info(struct thread *td, + struct linux_getsockopt_args *args) +{ + struct tcp_info tinfo; + struct l_tcp_info l_tinfo; + socklen_t len; + int error; + + len = sizeof(tinfo); + error = kern_getsockopt(td, args->s, IPPROTO_TCP, TCP_INFO, &tinfo, + UIO_SYSSPACE, &len); + if (error != 0) + return (error); + memset(&l_tinfo, 0, sizeof(l_tinfo)); + l_tinfo.tcpi_state = tinfo.tcpi_state; + l_tinfo.tcpi_options = tinfo.tcpi_options; + l_tinfo.tcpi_snd_wscale = tinfo.tcpi_snd_wscale; + l_tinfo.tcpi_rcv_wscale = tinfo.tcpi_rcv_wscale; + l_tinfo.tcpi_rto = tinfo.tcpi_rto; + l_tinfo.tcpi_snd_mss = tinfo.tcpi_snd_mss; + l_tinfo.tcpi_rcv_mss = tinfo.tcpi_rcv_mss; + l_tinfo.tcpi_last_data_recv = tinfo.tcpi_last_data_recv; + l_tinfo.tcpi_rtt = tinfo.tcpi_rtt; + l_tinfo.tcpi_rttvar = tinfo.tcpi_rttvar; + l_tinfo.tcpi_snd_ssthresh = tinfo.tcpi_snd_ssthresh; + l_tinfo.tcpi_snd_cwnd = tinfo.tcpi_snd_cwnd; + l_tinfo.tcpi_rcv_space = tinfo.tcpi_rcv_space; + l_tinfo.tcpi_snd_wnd = tinfo.tcpi_snd_wnd; + l_tinfo.tcpi_rcv_ooopack = tinfo.tcpi_rcv_ooopack; + /* Eqivalent */ + l_tinfo.tcpi_total_retrans = tinfo.tcpi_snd_rexmitpack; + + return (linux_sockopt_copyout(td, &l_tinfo, len, args)); +} + int linux_getsockopt(struct thread *td, struct linux_getsockopt_args *args) { @@ -2355,6 +2389,13 @@ linux_getsockopt(struct thread *td, struct linux_getsockopt_args *args) name = linux_to_bsd_ip6_sockopt(args->optname); break; case IPPROTO_TCP: + switch (args->optname) { + case LINUX_TCP_INFO: + return (linux_getsockopt_tcp_info(td, args)); + /* NOTREACHED */ + default: + break; + } name = linux_to_bsd_tcp_sockopt(args->optname); break; default: diff --git a/sys/compat/linux/linux_socket.h b/sys/compat/linux/linux_socket.h index 68176c3cc401..f69ed90bd584 100644 --- a/sys/compat/linux/linux_socket.h +++ b/sys/compat/linux/linux_socket.h @@ -356,6 +356,98 @@ struct l_ifreq { } ifr_ifru; }; +/* + * Linux TCP_INFO structure as of v6.19.8 + * + * Comments indicate last field for the given kernel version + */ +struct l_tcp_info { + uint8_t tcpi_state; + uint8_t tcpi_ca_state; + uint8_t tcpi_retransmits; + uint8_t tcpi_probes; + uint8_t tcpi_backoff; + uint8_t tcpi_options; + uint8_t tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4; + uint8_t tcpi_delivery_rate_app_limited:1, tcpi_fastopen_client_fail:2; + + uint32_t tcpi_rto; + uint32_t tcpi_ato; + uint32_t tcpi_snd_mss; + uint32_t tcpi_rcv_mss; + + uint32_t tcpi_unacked; + uint32_t tcpi_sacked; + uint32_t tcpi_lost; + uint32_t tcpi_retrans; + uint32_t tcpi_fackets; + + uint32_t tcpi_last_data_sent; + uint32_t tcpi_last_ack_sent; + uint32_t tcpi_last_data_recv; + uint32_t tcpi_last_ack_recv; + + uint32_t tcpi_pmtu; + uint32_t tcpi_rcv_ssthresh; + uint32_t tcpi_rtt; + uint32_t tcpi_rttvar; + uint32_t tcpi_snd_ssthresh; + uint32_t tcpi_snd_cwnd; + uint32_t tcpi_advmss; + uint32_t tcpi_reordering; + + uint32_t tcpi_rcv_rtt; + uint32_t tcpi_rcv_space; + + uint32_t tcpi_total_retrans; /* v3.6 */ + + uint64_t tcpi_pacing_rate; + uint64_t tcpi_max_pacing_rate; /* v3.14 */ + uint64_t tcpi_bytes_acked; + uint64_t tcpi_bytes_received; + uint32_t tcpi_segs_out; + uint32_t tcpi_segs_in; /* v4.1 */ + + uint32_t tcpi_notsent_bytes; + uint32_t tcpi_min_rtt; + uint32_t tcpi_data_segs_in; + uint32_t tcpi_data_segs_out; /* v4.5 */ + + uint64_t tcpi_delivery_rate; /* v4.8 */ + + uint64_t tcpi_busy_time; + uint64_t tcpi_rwnd_limited; + uint64_t tcpi_sndbuf_limited; /* v4.9 */ + + uint32_t tcpi_delivered; + uint32_t tcpi_delivered_ce; /* v4.16 */ + + uint64_t tcpi_bytes_sent; + uint64_t tcpi_bytes_retrans; + uint32_t tcpi_dsack_dups; + uint32_t tcpi_reord_seen; /* v4.18 */ + + uint32_t tcpi_rcv_ooopack; + + uint32_t tcpi_snd_wnd; /* v5.3 */ + uint32_t tcpi_rcv_wnd; + + uint32_t tcpi_rehash; /* v6.1 */ + + uint16_t tcpi_total_rto; + uint16_t tcpi_total_rto_recoveries; + uint32_t tcpi_total_rto_time; /* v6.6 */ + uint32_t tcpi_received_ce; + uint32_t tcpi_delivered_e1_bytes; + uint32_t tcpi_delivered_e0_bytes; + uint32_t tcpi_delivered_ce_bytes; + uint32_t tcpi_received_e1_bytes; + uint32_t tcpi_received_e0_bytes; + uint32_t tcpi_received_ce_bytes; + uint16_t tcpi_accecn_fail_mode; + uint16_t tcpi_accecn_opt_seen; /* v6.17 */ +}; + /* * Define here members which are not exists in the FreeBSD struct ifreq. */