1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 #ifndef _UAPI_INET_DIAG_H_
3 #define _UAPI_INET_DIAG_H_
5 #include <linux/types.h>
7 /* Just some random number */
8 #define TCPDIAG_GETSOCK 18
9 #define DCCPDIAG_GETSOCK 19
11 #define INET_DIAG_GETSOCK_MAX 24
14 struct inet_diag_sockid {
20 __u32 idiag_cookie[2];
21 #define INET_DIAG_NOCOOKIE (~0U)
24 /* Request structure */
26 struct inet_diag_req {
27 __u8 idiag_family; /* Family of addresses. */
30 __u8 idiag_ext; /* Query extended information */
32 struct inet_diag_sockid id;
34 __u32 idiag_states; /* States to dump */
35 __u32 idiag_dbs; /* Tables to dump (NI) */
38 struct inet_diag_req_v2 {
44 struct inet_diag_sockid id;
48 * SOCK_RAW sockets require the underlied protocol to be
49 * additionally specified so we can use @pad member for
50 * this, but we can't rename it because userspace programs
51 * still may depend on this name. Instead lets use another
52 * structure definition as an alias for struct
55 struct inet_diag_req_raw {
59 __u8 sdiag_raw_protocol;
61 struct inet_diag_sockid id;
66 INET_DIAG_REQ_BYTECODE,
67 INET_DIAG_REQ_SK_BPF_STORAGES,
68 INET_DIAG_REQ_PROTOCOL,
72 #define INET_DIAG_REQ_MAX (__INET_DIAG_REQ_MAX - 1)
74 /* Bytecode is sequence of 4 byte commands followed by variable arguments.
75 * All the commands identified by "code" are conditional jumps forward:
76 * to offset cc+"yes" or to offset cc+"no". "yes" is supposed to be
77 * length of the command and its arguments.
80 struct inet_diag_bc_op {
96 INET_DIAG_BC_DEV_COND, /* u32 ifindex */
97 INET_DIAG_BC_MARK_COND,
100 INET_DIAG_BC_CGROUP_COND, /* u64 cgroup v2 ID */
103 struct inet_diag_hostcond {
110 struct inet_diag_markcond {
115 /* Base info structure. It contains socket identity (addrs/ports/cookie)
116 * and, alas, the information shown by netstat. */
117 struct inet_diag_msg {
123 struct inet_diag_sockid id;
146 * Next extenstions cannot be requested in struct inet_diag_req_v2:
147 * its field idiag_ext has only 8 bits.
150 INET_DIAG_DCTCPINFO, /* request as INET_DIAG_VEGASINFO */
151 INET_DIAG_PROTOCOL, /* response attribute only */
156 INET_DIAG_MARK, /* only with CAP_NET_ADMIN */
157 INET_DIAG_BBRINFO, /* request as INET_DIAG_VEGASINFO */
158 INET_DIAG_CLASS_ID, /* request as INET_DIAG_TCLASS */
161 INET_DIAG_SK_BPF_STORAGES,
167 #define INET_DIAG_MAX (__INET_DIAG_MAX - 1)
170 INET_ULP_INFO_UNSPEC,
176 #define INET_ULP_INFO_MAX (__INET_ULP_INFO_MAX - 1)
180 struct inet_diag_meminfo {
187 /* INET_DIAG_SOCKOPT */
189 struct inet_diag_sockopt {
198 __u8 bind_address_no_port:1,
204 /* INET_DIAG_VEGASINFO */
206 struct tcpvegas_info {
213 /* INET_DIAG_DCTCPINFO */
215 struct tcp_dctcp_info {
217 __u16 dctcp_ce_state;
223 /* INET_DIAG_BBRINFO */
225 struct tcp_bbr_info {
226 /* u64 bw: max-filtered BW (app throughput) estimate in Byte per sec: */
227 __u32 bbr_bw_lo; /* lower 32 bits of bw */
228 __u32 bbr_bw_hi; /* upper 32 bits of bw */
229 __u32 bbr_min_rtt; /* min-filtered RTT in uSec */
230 __u32 bbr_pacing_gain; /* pacing gain shifted left 8 bits */
231 __u32 bbr_cwnd_gain; /* cwnd gain shifted left 8 bits */
235 struct tcpvegas_info vegas;
236 struct tcp_dctcp_info dctcp;
237 struct tcp_bbr_info bbr;
239 #endif /* _UAPI_INET_DIAG_H_ */