blob: abbd1dc5d683487e96be1489f216373ea8be3c77 [file] [log] [blame]
Ben Cheng30692c62013-10-15 18:26:18 -07001#ifndef _UAPI_INET_DIAG_H_
2#define _UAPI_INET_DIAG_H_
3
4#include <linux/types.h>
5
6/* Just some random number */
7#define TCPDIAG_GETSOCK 18
8#define DCCPDIAG_GETSOCK 19
9
10#define INET_DIAG_GETSOCK_MAX 24
11
12/* Socket identity */
13struct inet_diag_sockid {
14 __be16 idiag_sport;
15 __be16 idiag_dport;
16 __be32 idiag_src[4];
17 __be32 idiag_dst[4];
18 __u32 idiag_if;
19 __u32 idiag_cookie[2];
20#define INET_DIAG_NOCOOKIE (~0U)
21};
22
23/* Request structure */
24
25struct inet_diag_req {
26 __u8 idiag_family; /* Family of addresses. */
27 __u8 idiag_src_len;
28 __u8 idiag_dst_len;
29 __u8 idiag_ext; /* Query extended information */
30
31 struct inet_diag_sockid id;
32
33 __u32 idiag_states; /* States to dump */
34 __u32 idiag_dbs; /* Tables to dump (NI) */
35};
36
37struct inet_diag_req_v2 {
38 __u8 sdiag_family;
39 __u8 sdiag_protocol;
40 __u8 idiag_ext;
41 __u8 pad;
42 __u32 idiag_states;
43 struct inet_diag_sockid id;
44};
45
46enum {
47 INET_DIAG_REQ_NONE,
48 INET_DIAG_REQ_BYTECODE,
49};
50
51#define INET_DIAG_REQ_MAX INET_DIAG_REQ_BYTECODE
52
53/* Bytecode is sequence of 4 byte commands followed by variable arguments.
54 * All the commands identified by "code" are conditional jumps forward:
55 * to offset cc+"yes" or to offset cc+"no". "yes" is supposed to be
56 * length of the command and its arguments.
57 */
58
59struct inet_diag_bc_op {
60 unsigned char code;
61 unsigned char yes;
62 unsigned short no;
63};
64
65enum {
66 INET_DIAG_BC_NOP,
67 INET_DIAG_BC_JMP,
68 INET_DIAG_BC_S_GE,
69 INET_DIAG_BC_S_LE,
70 INET_DIAG_BC_D_GE,
71 INET_DIAG_BC_D_LE,
72 INET_DIAG_BC_AUTO,
73 INET_DIAG_BC_S_COND,
74 INET_DIAG_BC_D_COND,
Christopher Ferris6e3550f2016-12-12 14:51:18 -080075 INET_DIAG_BC_DEV_COND, /* u32 ifindex */
Ben Cheng30692c62013-10-15 18:26:18 -070076};
77
78struct inet_diag_hostcond {
79 __u8 family;
80 __u8 prefix_len;
81 int port;
82 __be32 addr[0];
83};
84
85/* Base info structure. It contains socket identity (addrs/ports/cookie)
86 * and, alas, the information shown by netstat. */
87struct inet_diag_msg {
88 __u8 idiag_family;
89 __u8 idiag_state;
90 __u8 idiag_timer;
91 __u8 idiag_retrans;
92
93 struct inet_diag_sockid id;
94
95 __u32 idiag_expires;
96 __u32 idiag_rqueue;
97 __u32 idiag_wqueue;
98 __u32 idiag_uid;
99 __u32 idiag_inode;
100};
101
102/* Extensions */
103
104enum {
105 INET_DIAG_NONE,
106 INET_DIAG_MEMINFO,
107 INET_DIAG_INFO,
108 INET_DIAG_VEGASINFO,
109 INET_DIAG_CONG,
110 INET_DIAG_TOS,
111 INET_DIAG_TCLASS,
112 INET_DIAG_SKMEMINFO,
113 INET_DIAG_SHUTDOWN,
Christopher Ferris7c0b6392015-01-23 15:34:26 -0800114 INET_DIAG_DCTCPINFO,
Christopher Ferris12e1f282016-02-04 12:35:07 -0800115 INET_DIAG_PROTOCOL, /* response attribute only */
116 INET_DIAG_SKV6ONLY,
Christopher Ferrisccfaccd2016-08-24 12:11:31 -0700117 INET_DIAG_LOCALS,
118 INET_DIAG_PEERS,
119 INET_DIAG_PAD,
120 __INET_DIAG_MAX,
Ben Cheng30692c62013-10-15 18:26:18 -0700121};
122
Christopher Ferrisccfaccd2016-08-24 12:11:31 -0700123#define INET_DIAG_MAX (__INET_DIAG_MAX - 1)
Ben Cheng30692c62013-10-15 18:26:18 -0700124
125/* INET_DIAG_MEM */
126
127struct inet_diag_meminfo {
128 __u32 idiag_rmem;
129 __u32 idiag_wmem;
130 __u32 idiag_fmem;
131 __u32 idiag_tmem;
132};
133
134/* INET_DIAG_VEGASINFO */
135
136struct tcpvegas_info {
137 __u32 tcpv_enabled;
138 __u32 tcpv_rttcnt;
139 __u32 tcpv_rtt;
140 __u32 tcpv_minrtt;
141};
142
Christopher Ferris7c0b6392015-01-23 15:34:26 -0800143/* INET_DIAG_DCTCPINFO */
144
145struct tcp_dctcp_info {
146 __u16 dctcp_enabled;
147 __u16 dctcp_ce_state;
148 __u32 dctcp_alpha;
149 __u32 dctcp_ab_ecn;
150 __u32 dctcp_ab_tot;
151};
Ben Cheng30692c62013-10-15 18:26:18 -0700152
Christopher Ferris12e1f282016-02-04 12:35:07 -0800153union tcp_cc_info {
154 struct tcpvegas_info vegas;
155 struct tcp_dctcp_info dctcp;
156};
Ben Cheng30692c62013-10-15 18:26:18 -0700157#endif /* _UAPI_INET_DIAG_H_ */