| David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 1 | #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 */ | 
 | 13 | struct 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 |  | 
 | 25 | struct 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 |  | 
 | 37 | struct 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 |  | 
| Cyrill Gorcunov | 432490f | 2016-10-21 13:03:44 +0300 | [diff] [blame] | 46 | /* | 
 | 47 |  * SOCK_RAW sockets require the underlied protocol to be | 
 | 48 |  * additionally specified so we can use @pad member for | 
 | 49 |  * this, but we can't rename it because userspace programs | 
 | 50 |  * still may depend on this name. Instead lets use another | 
 | 51 |  * structure definition as an alias for struct | 
 | 52 |  * @inet_diag_req_v2. | 
 | 53 |  */ | 
 | 54 | struct inet_diag_req_raw { | 
 | 55 | 	__u8	sdiag_family; | 
 | 56 | 	__u8	sdiag_protocol; | 
 | 57 | 	__u8	idiag_ext; | 
 | 58 | 	__u8	sdiag_raw_protocol; | 
 | 59 | 	__u32	idiag_states; | 
 | 60 | 	struct inet_diag_sockid id; | 
 | 61 | }; | 
 | 62 |  | 
| David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 63 | enum { | 
 | 64 | 	INET_DIAG_REQ_NONE, | 
 | 65 | 	INET_DIAG_REQ_BYTECODE, | 
 | 66 | }; | 
 | 67 |  | 
 | 68 | #define INET_DIAG_REQ_MAX INET_DIAG_REQ_BYTECODE | 
 | 69 |  | 
 | 70 | /* Bytecode is sequence of 4 byte commands followed by variable arguments. | 
 | 71 |  * All the commands identified by "code" are conditional jumps forward: | 
 | 72 |  * to offset cc+"yes" or to offset cc+"no". "yes" is supposed to be | 
 | 73 |  * length of the command and its arguments. | 
 | 74 |  */ | 
 | 75 |   | 
 | 76 | struct inet_diag_bc_op { | 
 | 77 | 	unsigned char	code; | 
 | 78 | 	unsigned char	yes; | 
 | 79 | 	unsigned short	no; | 
 | 80 | }; | 
 | 81 |  | 
 | 82 | enum { | 
 | 83 | 	INET_DIAG_BC_NOP, | 
 | 84 | 	INET_DIAG_BC_JMP, | 
 | 85 | 	INET_DIAG_BC_S_GE, | 
 | 86 | 	INET_DIAG_BC_S_LE, | 
 | 87 | 	INET_DIAG_BC_D_GE, | 
 | 88 | 	INET_DIAG_BC_D_LE, | 
 | 89 | 	INET_DIAG_BC_AUTO, | 
 | 90 | 	INET_DIAG_BC_S_COND, | 
 | 91 | 	INET_DIAG_BC_D_COND, | 
| David Ahern | 637c841 | 2016-06-23 18:42:51 -0700 | [diff] [blame] | 92 | 	INET_DIAG_BC_DEV_COND,   /* u32 ifindex */ | 
| Lorenzo Colitti | a52e95a | 2016-08-24 15:46:26 +0900 | [diff] [blame] | 93 | 	INET_DIAG_BC_MARK_COND, | 
| David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 94 | }; | 
 | 95 |  | 
 | 96 | struct inet_diag_hostcond { | 
 | 97 | 	__u8	family; | 
 | 98 | 	__u8	prefix_len; | 
 | 99 | 	int	port; | 
 | 100 | 	__be32	addr[0]; | 
 | 101 | }; | 
 | 102 |  | 
| Lorenzo Colitti | a52e95a | 2016-08-24 15:46:26 +0900 | [diff] [blame] | 103 | struct inet_diag_markcond { | 
 | 104 | 	__u32 mark; | 
 | 105 | 	__u32 mask; | 
 | 106 | }; | 
 | 107 |  | 
| David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 108 | /* Base info structure. It contains socket identity (addrs/ports/cookie) | 
 | 109 |  * and, alas, the information shown by netstat. */ | 
 | 110 | struct inet_diag_msg { | 
 | 111 | 	__u8	idiag_family; | 
 | 112 | 	__u8	idiag_state; | 
 | 113 | 	__u8	idiag_timer; | 
 | 114 | 	__u8	idiag_retrans; | 
 | 115 |  | 
 | 116 | 	struct inet_diag_sockid id; | 
 | 117 |  | 
 | 118 | 	__u32	idiag_expires; | 
 | 119 | 	__u32	idiag_rqueue; | 
 | 120 | 	__u32	idiag_wqueue; | 
 | 121 | 	__u32	idiag_uid; | 
 | 122 | 	__u32	idiag_inode; | 
 | 123 | }; | 
 | 124 |  | 
 | 125 | /* Extensions */ | 
 | 126 |  | 
 | 127 | enum { | 
 | 128 | 	INET_DIAG_NONE, | 
 | 129 | 	INET_DIAG_MEMINFO, | 
 | 130 | 	INET_DIAG_INFO, | 
 | 131 | 	INET_DIAG_VEGASINFO, | 
 | 132 | 	INET_DIAG_CONG, | 
 | 133 | 	INET_DIAG_TOS, | 
 | 134 | 	INET_DIAG_TCLASS, | 
 | 135 | 	INET_DIAG_SKMEMINFO, | 
| Pavel Emelyanov | e4e541a | 2012-10-23 22:29:56 +0400 | [diff] [blame] | 136 | 	INET_DIAG_SHUTDOWN, | 
| Daniel Borkmann | e3118e8 | 2014-09-26 22:37:36 +0200 | [diff] [blame] | 137 | 	INET_DIAG_DCTCPINFO, | 
| Craig Gallek | 35ac838 | 2015-06-15 11:26:20 -0400 | [diff] [blame] | 138 | 	INET_DIAG_PROTOCOL,  /* response attribute only */ | 
| Phil Sutter | 2046215 | 2015-06-24 11:02:51 +0200 | [diff] [blame] | 139 | 	INET_DIAG_SKV6ONLY, | 
| Xin Long | 8f840e4 | 2016-04-14 15:35:33 +0800 | [diff] [blame] | 140 | 	INET_DIAG_LOCALS, | 
 | 141 | 	INET_DIAG_PEERS, | 
| Nicolas Dichtel | 6ed46d1 | 2016-04-26 10:06:14 +0200 | [diff] [blame] | 142 | 	INET_DIAG_PAD, | 
| Lorenzo Colitti | d545cac | 2016-09-08 00:42:25 +0900 | [diff] [blame] | 143 | 	INET_DIAG_MARK, | 
| Neal Cardwell | 0f8782e | 2016-09-19 23:39:23 -0400 | [diff] [blame] | 144 | 	INET_DIAG_BBRINFO, | 
| Nicolas Dichtel | 6ed46d1 | 2016-04-26 10:06:14 +0200 | [diff] [blame] | 145 | 	__INET_DIAG_MAX, | 
| David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 146 | }; | 
 | 147 |  | 
| Nicolas Dichtel | 6ed46d1 | 2016-04-26 10:06:14 +0200 | [diff] [blame] | 148 | #define INET_DIAG_MAX (__INET_DIAG_MAX - 1) | 
| David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 149 |  | 
 | 150 | /* INET_DIAG_MEM */ | 
 | 151 |  | 
 | 152 | struct inet_diag_meminfo { | 
 | 153 | 	__u32	idiag_rmem; | 
 | 154 | 	__u32	idiag_wmem; | 
 | 155 | 	__u32	idiag_fmem; | 
 | 156 | 	__u32	idiag_tmem; | 
 | 157 | }; | 
 | 158 |  | 
 | 159 | /* INET_DIAG_VEGASINFO */ | 
 | 160 |  | 
 | 161 | struct tcpvegas_info { | 
 | 162 | 	__u32	tcpv_enabled; | 
 | 163 | 	__u32	tcpv_rttcnt; | 
 | 164 | 	__u32	tcpv_rtt; | 
 | 165 | 	__u32	tcpv_minrtt; | 
 | 166 | }; | 
 | 167 |  | 
| Daniel Borkmann | e3118e8 | 2014-09-26 22:37:36 +0200 | [diff] [blame] | 168 | /* INET_DIAG_DCTCPINFO */ | 
 | 169 |  | 
 | 170 | struct tcp_dctcp_info { | 
 | 171 | 	__u16	dctcp_enabled; | 
 | 172 | 	__u16	dctcp_ce_state; | 
 | 173 | 	__u32	dctcp_alpha; | 
 | 174 | 	__u32	dctcp_ab_ecn; | 
 | 175 | 	__u32	dctcp_ab_tot; | 
 | 176 | }; | 
| David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 177 |  | 
| Neal Cardwell | 0f8782e | 2016-09-19 23:39:23 -0400 | [diff] [blame] | 178 | /* INET_DIAG_BBRINFO */ | 
 | 179 |  | 
 | 180 | struct tcp_bbr_info { | 
 | 181 | 	/* u64 bw: max-filtered BW (app throughput) estimate in Byte per sec: */ | 
 | 182 | 	__u32	bbr_bw_lo;		/* lower 32 bits of bw */ | 
 | 183 | 	__u32	bbr_bw_hi;		/* upper 32 bits of bw */ | 
 | 184 | 	__u32	bbr_min_rtt;		/* min-filtered RTT in uSec */ | 
 | 185 | 	__u32	bbr_pacing_gain;	/* pacing gain shifted left 8 bits */ | 
 | 186 | 	__u32	bbr_cwnd_gain;		/* cwnd gain shifted left 8 bits */ | 
 | 187 | }; | 
 | 188 |  | 
| Eric Dumazet | 64f40ff | 2015-04-28 16:23:48 -0700 | [diff] [blame] | 189 | union tcp_cc_info { | 
 | 190 | 	struct tcpvegas_info	vegas; | 
 | 191 | 	struct tcp_dctcp_info	dctcp; | 
| Neal Cardwell | 0f8782e | 2016-09-19 23:39:23 -0400 | [diff] [blame] | 192 | 	struct tcp_bbr_info	bbr; | 
| Eric Dumazet | 64f40ff | 2015-04-28 16:23:48 -0700 | [diff] [blame] | 193 | }; | 
| David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 194 | #endif /* _UAPI_INET_DIAG_H_ */ |