]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
netinet/tcp.h: Sync with Linux 6.15 and fix struct tcp_info tail (BZ 34347)
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 3 Jul 2026 13:33:48 +0000 (10:33 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 6 Jul 2026 13:50:50 +0000 (10:50 -0300)
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 <fweimer@redhat.com>
sysdeps/gnu/netinet/tcp.h

index 17dd6b49c07dcad83d9b6a783f3f4ce6e5f8dc97..98ea9ab74276354b3f4b635f07ed8a766708dc71 100644 (file)
@@ -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 */