[glibc] netinet/tcp.h: Sync with Linux 6.15 and fix struct tcp_info tail (BZ 34347)

Adhemerval Zanella via Glibc-cvs <[email protected]> Mon, 6 Jul 2026 13:54:57 +0000 (GMT)
Newsgroups gmane.comp.lib.glibc.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=b416f91801b72982e4fa09b01fca19969c2ba90b

commit b416f91801b72982e4fa09b01fca19969c2ba90b
Author: Adhemerval Zanella <[email protected]>
Date:   Fri Jul 3 10:33:48 2026 -0300

    netinet/tcp.h: Sync with Linux 6.15 and fix struct tcp_info tail (BZ 34347)
    
    Add the TCP_RTO_MAX_MS and TCP_RTO_MIN_US socket options (commit
    54a378f43425085d0684679d99735696b69165bc, Linux 6.15) and TCP_DELACK_MAX_US
    (commit 9552f90835ef3552d0af327e48dc360717777d62, Linux 6.15).
    
    Commit 7e46c2aae47d3284d4eb0845ddcc3951e987d681 synced the accurate ECN
    additions but encoded the trailing bitfield word of struct tcp_info
    incorrectly as two uint16_t fields (tcpi_accecn_fail_mode and
    tcpi_accecn_opt_seen), omitting tcpi_ecn_mode and tcpi_options2.  Restore
    the kernel layout:
    
      uint32_t tcpi_ecn_mode:2,
               tcpi_accecn_opt_seen:2,
               tcpi_accecn_fail_mode:4,
               tcpi_options2:24;
    
    The overall structure size is unchanged.  Also add the TCPI_ECN_MODE_*
    and TCP_ACCECN_* value constants for these fields, introduced together
    with them by Linux commit 4fa4ac5e5848 (Linux 7.0).
    
    Reviewed-by: Florian Weimer <[email protected]>

Diff:
---
 sysdeps/gnu/netinet/tcp.h | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/sysdeps/gnu/netinet/tcp.h b/sysdeps/gnu/netinet/tcp.h
index 17dd6b49c0..98ea9ab742 100644
--- a/sysdeps/gnu/netinet/tcp.h
+++ b/sysdeps/gnu/netinet/tcp.h
@@ -80,6 +80,9 @@
 				       as a cmsg on read.  */
 #define TCP_CM_INQ		 TCP_INQ
 #define TCP_TX_DELAY		 37 /* Delay outgoing packets by XX usec.  */
+#define TCP_RTO_MAX_MS		 44 /* Max time to retransmit (msec).  */
+#define TCP_RTO_MIN_US		 45 /* Min time to retransmit (usec).  */
+#define TCP_DELACK_MAX_US	 46 /* Max delayed ack time (usec).  */
 
 #define TCP_REPAIR_ON		 1
 #define TCP_REPAIR_OFF		 0
@@ -226,6 +229,24 @@ enum tcp_ca_state
   TCP_CA_Loss = 4
 };
 
+/* Values for tcpi_ecn_mode after negotiation.  */
+#define TCPI_ECN_MODE_DISABLED	0x0
+#define TCPI_ECN_MODE_RFC3168	0x1
+#define TCPI_ECN_MODE_ACCECN	0x2
+#define TCPI_ECN_MODE_PENDING	0x3
+
+/* Values for tcpi_accecn_opt_seen.  */
+#define TCP_ACCECN_OPT_NOT_SEEN		0x0
+#define TCP_ACCECN_OPT_EMPTY_SEEN	0x1
+#define TCP_ACCECN_OPT_COUNTER_SEEN	0x2
+#define TCP_ACCECN_OPT_FAIL_SEEN	0x3
+
+/* Values for tcpi_accecn_fail_mode.  */
+#define TCP_ACCECN_ACE_FAIL_SEND	0x1
+#define TCP_ACCECN_ACE_FAIL_RECV	0x2
+#define TCP_ACCECN_OPT_FAIL_SEND	0x4
+#define TCP_ACCECN_OPT_FAIL_RECV	0x8
+
 struct tcp_info
 {
   uint8_t	tcpi_state;
@@ -319,8 +340,10 @@ struct tcp_info
   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;
+  uint32_t	tcpi_ecn_mode:2,
+		tcpi_accecn_opt_seen:2,
+		tcpi_accecn_fail_mode:4,
+		tcpi_options2:24;
 };
 
 /* Netlink attributes types for SCM_TIMESTAMPING_OPT_STATS */