Commit | Line | Data |
---|---|---|
6f52b16c | 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ |
607ca46e DH |
2 | #ifndef _UAPI_INET_DIAG_H_ |
3 | #define _UAPI_INET_DIAG_H_ | |
4 | ||
5 | #include <linux/types.h> | |
6 | ||
7 | /* Just some random number */ | |
8 | #define TCPDIAG_GETSOCK 18 | |
9 | #define DCCPDIAG_GETSOCK 19 | |
10 | ||
11 | #define INET_DIAG_GETSOCK_MAX 24 | |
12 | ||
13 | /* Socket identity */ | |
14 | struct inet_diag_sockid { | |
15 | __be16 idiag_sport; | |
16 | __be16 idiag_dport; | |
17 | __be32 idiag_src[4]; | |
18 | __be32 idiag_dst[4]; | |
19 | __u32 idiag_if; | |
20 | __u32 idiag_cookie[2]; | |
21 | #define INET_DIAG_NOCOOKIE (~0U) | |
22 | }; | |
23 | ||
24 | /* Request structure */ | |
25 | ||
26 | struct inet_diag_req { | |
27 | __u8 idiag_family; /* Family of addresses. */ | |
28 | __u8 idiag_src_len; | |
29 | __u8 idiag_dst_len; | |
30 | __u8 idiag_ext; /* Query extended information */ | |
31 | ||
32 | struct inet_diag_sockid id; | |
33 | ||
34 | __u32 idiag_states; /* States to dump */ | |
35 | __u32 idiag_dbs; /* Tables to dump (NI) */ | |
36 | }; | |
37 | ||
38 | struct inet_diag_req_v2 { | |
39 | __u8 sdiag_family; | |
40 | __u8 sdiag_protocol; | |
41 | __u8 idiag_ext; | |
42 | __u8 pad; | |
43 | __u32 idiag_states; | |
44 | struct inet_diag_sockid id; | |
45 | }; | |
46 | ||
432490f9 CG |
47 | /* |
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 | |
53 | * @inet_diag_req_v2. | |
54 | */ | |
55 | struct inet_diag_req_raw { | |
56 | __u8 sdiag_family; | |
57 | __u8 sdiag_protocol; | |
58 | __u8 idiag_ext; | |
59 | __u8 sdiag_raw_protocol; | |
60 | __u32 idiag_states; | |
61 | struct inet_diag_sockid id; | |
62 | }; | |
63 | ||
607ca46e DH |
64 | enum { |
65 | INET_DIAG_REQ_NONE, | |
66 | INET_DIAG_REQ_BYTECODE, | |
085c20ca | 67 | INET_DIAG_REQ_SK_BPF_STORAGES, |
3f935c75 | 68 | INET_DIAG_REQ_PROTOCOL, |
0df6d328 | 69 | __INET_DIAG_REQ_MAX, |
607ca46e DH |
70 | }; |
71 | ||
0df6d328 | 72 | #define INET_DIAG_REQ_MAX (__INET_DIAG_REQ_MAX - 1) |
607ca46e DH |
73 | |
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. | |
78 | */ | |
79 | ||
80 | struct inet_diag_bc_op { | |
81 | unsigned char code; | |
82 | unsigned char yes; | |
83 | unsigned short no; | |
84 | }; | |
85 | ||
86 | enum { | |
87 | INET_DIAG_BC_NOP, | |
88 | INET_DIAG_BC_JMP, | |
89 | INET_DIAG_BC_S_GE, | |
90 | INET_DIAG_BC_S_LE, | |
91 | INET_DIAG_BC_D_GE, | |
92 | INET_DIAG_BC_D_LE, | |
93 | INET_DIAG_BC_AUTO, | |
94 | INET_DIAG_BC_S_COND, | |
95 | INET_DIAG_BC_D_COND, | |
637c841d | 96 | INET_DIAG_BC_DEV_COND, /* u32 ifindex */ |
a52e95ab | 97 | INET_DIAG_BC_MARK_COND, |
bbb6189d KE |
98 | INET_DIAG_BC_S_EQ, |
99 | INET_DIAG_BC_D_EQ, | |
b1f3e43d | 100 | INET_DIAG_BC_CGROUP_COND, /* u64 cgroup v2 ID */ |
607ca46e DH |
101 | }; |
102 | ||
103 | struct inet_diag_hostcond { | |
104 | __u8 family; | |
105 | __u8 prefix_len; | |
106 | int port; | |
94dfc73e | 107 | __be32 addr[]; |
607ca46e DH |
108 | }; |
109 | ||
a52e95ab LC |
110 | struct inet_diag_markcond { |
111 | __u32 mark; | |
112 | __u32 mask; | |
113 | }; | |
114 | ||
607ca46e DH |
115 | /* Base info structure. It contains socket identity (addrs/ports/cookie) |
116 | * and, alas, the information shown by netstat. */ | |
117 | struct inet_diag_msg { | |
118 | __u8 idiag_family; | |
119 | __u8 idiag_state; | |
120 | __u8 idiag_timer; | |
121 | __u8 idiag_retrans; | |
122 | ||
123 | struct inet_diag_sockid id; | |
124 | ||
125 | __u32 idiag_expires; | |
126 | __u32 idiag_rqueue; | |
127 | __u32 idiag_wqueue; | |
128 | __u32 idiag_uid; | |
129 | __u32 idiag_inode; | |
130 | }; | |
131 | ||
132 | /* Extensions */ | |
133 | ||
134 | enum { | |
135 | INET_DIAG_NONE, | |
136 | INET_DIAG_MEMINFO, | |
137 | INET_DIAG_INFO, | |
138 | INET_DIAG_VEGASINFO, | |
139 | INET_DIAG_CONG, | |
140 | INET_DIAG_TOS, | |
141 | INET_DIAG_TCLASS, | |
142 | INET_DIAG_SKMEMINFO, | |
e4e541a8 | 143 | INET_DIAG_SHUTDOWN, |
1ec17dbd KK |
144 | |
145 | /* | |
70d0bb45 | 146 | * Next extensions cannot be requested in struct inet_diag_req_v2: |
1ec17dbd KK |
147 | * its field idiag_ext has only 8 bits. |
148 | */ | |
149 | ||
150 | INET_DIAG_DCTCPINFO, /* request as INET_DIAG_VEGASINFO */ | |
151 | INET_DIAG_PROTOCOL, /* response attribute only */ | |
20462155 | 152 | INET_DIAG_SKV6ONLY, |
8f840e47 XL |
153 | INET_DIAG_LOCALS, |
154 | INET_DIAG_PEERS, | |
6ed46d12 | 155 | INET_DIAG_PAD, |
1ec17dbd KK |
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 */ | |
c03fa9bc | 159 | INET_DIAG_MD5SIG, |
61723b39 | 160 | INET_DIAG_ULP_INFO, |
085c20ca | 161 | INET_DIAG_SK_BPF_STORAGES, |
6e3a401f | 162 | INET_DIAG_CGROUP_ID, |
c1077616 | 163 | INET_DIAG_SOCKOPT, |
6ed46d12 | 164 | __INET_DIAG_MAX, |
607ca46e DH |
165 | }; |
166 | ||
6ed46d12 | 167 | #define INET_DIAG_MAX (__INET_DIAG_MAX - 1) |
607ca46e | 168 | |
61723b39 DC |
169 | enum { |
170 | INET_ULP_INFO_UNSPEC, | |
171 | INET_ULP_INFO_NAME, | |
26811cc9 | 172 | INET_ULP_INFO_TLS, |
5147dfb5 | 173 | INET_ULP_INFO_MPTCP, |
61723b39 DC |
174 | __INET_ULP_INFO_MAX, |
175 | }; | |
176 | #define INET_ULP_INFO_MAX (__INET_ULP_INFO_MAX - 1) | |
177 | ||
607ca46e DH |
178 | /* INET_DIAG_MEM */ |
179 | ||
180 | struct inet_diag_meminfo { | |
181 | __u32 idiag_rmem; | |
182 | __u32 idiag_wmem; | |
183 | __u32 idiag_fmem; | |
184 | __u32 idiag_tmem; | |
185 | }; | |
186 | ||
c1077616 WW |
187 | /* INET_DIAG_SOCKOPT */ |
188 | ||
189 | struct inet_diag_sockopt { | |
190 | __u8 recverr:1, | |
191 | is_icsk:1, | |
192 | freebind:1, | |
193 | hdrincl:1, | |
194 | mc_loop:1, | |
195 | transparent:1, | |
196 | mc_all:1, | |
197 | nodefrag:1; | |
198 | __u8 bind_address_no_port:1, | |
199 | recverr_rfc4884:1, | |
200 | defer_connect:1, | |
201 | unused:5; | |
202 | }; | |
203 | ||
607ca46e DH |
204 | /* INET_DIAG_VEGASINFO */ |
205 | ||
206 | struct tcpvegas_info { | |
207 | __u32 tcpv_enabled; | |
208 | __u32 tcpv_rttcnt; | |
209 | __u32 tcpv_rtt; | |
210 | __u32 tcpv_minrtt; | |
211 | }; | |
212 | ||
e3118e83 DB |
213 | /* INET_DIAG_DCTCPINFO */ |
214 | ||
215 | struct tcp_dctcp_info { | |
216 | __u16 dctcp_enabled; | |
217 | __u16 dctcp_ce_state; | |
218 | __u32 dctcp_alpha; | |
219 | __u32 dctcp_ab_ecn; | |
220 | __u32 dctcp_ab_tot; | |
221 | }; | |
607ca46e | 222 | |
0f8782ea NC |
223 | /* INET_DIAG_BBRINFO */ |
224 | ||
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 */ | |
232 | }; | |
233 | ||
64f40ff5 ED |
234 | union tcp_cc_info { |
235 | struct tcpvegas_info vegas; | |
236 | struct tcp_dctcp_info dctcp; | |
0f8782ea | 237 | struct tcp_bbr_info bbr; |
64f40ff5 | 238 | }; |
607ca46e | 239 | #endif /* _UAPI_INET_DIAG_H_ */ |