blob: 07e486cb2f4cc61b093065d84c60a996088b700d [file] [log] [blame]
Stephen Hemminger910773d2012-12-11 11:16:36 -08001#ifndef _INET_DIAG_H_
2#define _INET_DIAG_H_
shemminger351efcd2005-09-01 19:21:50 +00003
Stephen Hemminger67881152009-03-24 15:13:31 -07004#include <linux/types.h>
5
shemminger351efcd2005-09-01 19:21:50 +00006/* 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 {
Stephen Hemmingeread2ba72006-12-05 09:54:48 -080014 __be16 idiag_sport;
15 __be16 idiag_dport;
16 __be32 idiag_src[4];
17 __be32 idiag_dst[4];
shemminger351efcd2005-09-01 19:21:50 +000018 __u32 idiag_if;
19 __u32 idiag_cookie[2];
20#define INET_DIAG_NOCOOKIE (~0U)
21};
22
23/* Request structure */
24
Stephen Hemminger7878c0b2012-01-19 14:09:42 -080025struct inet_diag_req {
shemminger351efcd2005-09-01 19:21:50 +000026 __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
Stephen Hemminger7878c0b2012-01-19 14:09:42 -080037struct inet_diag_req_v2 {
Stephen Hemmingera08d2592012-01-10 10:50:02 -080038 __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
shemminger351efcd2005-09-01 19:21:50 +000046enum {
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,
75};
76
77struct inet_diag_hostcond {
78 __u8 family;
79 __u8 prefix_len;
80 int port;
Stephen Hemmingeread2ba72006-12-05 09:54:48 -080081 __be32 addr[0];
shemminger351efcd2005-09-01 19:21:50 +000082};
83
84/* Base info structure. It contains socket identity (addrs/ports/cookie)
85 * and, alas, the information shown by netstat. */
86struct inet_diag_msg {
87 __u8 idiag_family;
88 __u8 idiag_state;
89 __u8 idiag_timer;
90 __u8 idiag_retrans;
91
92 struct inet_diag_sockid id;
93
94 __u32 idiag_expires;
95 __u32 idiag_rqueue;
96 __u32 idiag_wqueue;
97 __u32 idiag_uid;
98 __u32 idiag_inode;
99};
100
101/* Extensions */
102
103enum {
104 INET_DIAG_NONE,
105 INET_DIAG_MEMINFO,
106 INET_DIAG_INFO,
107 INET_DIAG_VEGASINFO,
108 INET_DIAG_CONG,
Stephen Hemminger9044a452011-11-23 14:34:49 -0800109 INET_DIAG_TOS,
110 INET_DIAG_TCLASS,
Stephen Hemmingera08d2592012-01-10 10:50:02 -0800111 INET_DIAG_SKMEMINFO,
Stephen Hemminger910773d2012-12-11 11:16:36 -0800112 INET_DIAG_SHUTDOWN,
Stephen Hemmingerdddfc7f2014-10-29 22:32:02 -0700113 INET_DIAG_DCTCPINFO,
Stephen Hemmingerff631c32015-06-25 22:34:26 -0400114 INET_DIAG_PROTOCOL, /* response attribute only */
115 INET_DIAG_SKV6ONLY,
Stephen Hemminger8b5be9e2016-04-19 08:06:11 -0700116 INET_DIAG_LOCALS,
117 INET_DIAG_PEERS,
Stephen Hemminger31ce6e02016-05-13 14:56:31 -0700118 INET_DIAG_PAD,
119 __INET_DIAG_MAX,
shemminger351efcd2005-09-01 19:21:50 +0000120};
121
Stephen Hemminger31ce6e02016-05-13 14:56:31 -0700122#define INET_DIAG_MAX (__INET_DIAG_MAX - 1)
shemminger351efcd2005-09-01 19:21:50 +0000123
124/* INET_DIAG_MEM */
125
126struct inet_diag_meminfo {
127 __u32 idiag_rmem;
128 __u32 idiag_wmem;
129 __u32 idiag_fmem;
130 __u32 idiag_tmem;
131};
132
133/* INET_DIAG_VEGASINFO */
134
135struct tcpvegas_info {
136 __u32 tcpv_enabled;
137 __u32 tcpv_rttcnt;
138 __u32 tcpv_rtt;
139 __u32 tcpv_minrtt;
140};
141
Stephen Hemmingerdddfc7f2014-10-29 22:32:02 -0700142/* INET_DIAG_DCTCPINFO */
143
144struct tcp_dctcp_info {
145 __u16 dctcp_enabled;
146 __u16 dctcp_ce_state;
147 __u32 dctcp_alpha;
148 __u32 dctcp_ab_ecn;
149 __u32 dctcp_ab_tot;
150};
shemminger351efcd2005-09-01 19:21:50 +0000151
Stephen Hemminger27076352015-05-04 09:04:59 -0700152union tcp_cc_info {
153 struct tcpvegas_info vegas;
154 struct tcp_dctcp_info dctcp;
155};
Stephen Hemminger910773d2012-12-11 11:16:36 -0800156#endif /* _INET_DIAG_H_ */