[PATCH 15/15] netinet/tcp.h: Sync struct tcp_info tail with Linux 7.0

Adhemerval Zanella adhemerval.zanella@linaro.org
Thu Jul 2 18:38:46 GMT 2026


Commit 7e46c2aae47d3284d4eb0845ddcc3951e987d681 synced the accurate ECN
additions but encoded the trailing bitfield word incorrectly as two
uint16_t fields (tcpi_accecn_fail_mode and tcpi_accecn_opt_seen),
omitting tcpi_ecn_mode and tcpi_options2 entirely.  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).
---
 sysdeps/gnu/netinet/tcp.h | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/sysdeps/gnu/netinet/tcp.h b/sysdeps/gnu/netinet/tcp.h
index 17dd6b49c07..0e7251b7b93 100644
--- a/sysdeps/gnu/netinet/tcp.h
+++ b/sysdeps/gnu/netinet/tcp.h
@@ -226,6 +226,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 +337,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 */
-- 
2.43.0



More information about the Libc-alpha mailing list