inet_diag.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. #ifndef _UAPI_INET_DIAG_H_
  3. #define _UAPI_INET_DIAG_H_
  4. #include <linux/types.h>
  5. /* Just some random number */
  6. #define TCPDIAG_GETSOCK 18
  7. #define DCCPDIAG_GETSOCK 19
  8. #define INET_DIAG_GETSOCK_MAX 24
  9. /* Socket identity */
  10. struct inet_diag_sockid {
  11. __be16 idiag_sport;
  12. __be16 idiag_dport;
  13. __be32 idiag_src[4];
  14. __be32 idiag_dst[4];
  15. __u32 idiag_if;
  16. __u32 idiag_cookie[2];
  17. #define INET_DIAG_NOCOOKIE (~0U)
  18. };
  19. /* Request structure */
  20. struct inet_diag_req {
  21. __u8 idiag_family; /* Family of addresses. */
  22. __u8 idiag_src_len;
  23. __u8 idiag_dst_len;
  24. __u8 idiag_ext; /* Query extended information */
  25. struct inet_diag_sockid id;
  26. __u32 idiag_states; /* States to dump */
  27. __u32 idiag_dbs; /* Tables to dump (NI) */
  28. };
  29. struct inet_diag_req_v2 {
  30. __u8 sdiag_family;
  31. __u8 sdiag_protocol;
  32. __u8 idiag_ext;
  33. __u8 pad;
  34. __u32 idiag_states;
  35. struct inet_diag_sockid id;
  36. };
  37. /*
  38. * SOCK_RAW sockets require the underlied protocol to be
  39. * additionally specified so we can use @pad member for
  40. * this, but we can't rename it because userspace programs
  41. * still may depend on this name. Instead lets use another
  42. * structure definition as an alias for struct
  43. * @inet_diag_req_v2.
  44. */
  45. struct inet_diag_req_raw {
  46. __u8 sdiag_family;
  47. __u8 sdiag_protocol;
  48. __u8 idiag_ext;
  49. __u8 sdiag_raw_protocol;
  50. __u32 idiag_states;
  51. struct inet_diag_sockid id;
  52. };
  53. enum {
  54. INET_DIAG_REQ_NONE,
  55. INET_DIAG_REQ_BYTECODE,
  56. };
  57. #define INET_DIAG_REQ_MAX INET_DIAG_REQ_BYTECODE
  58. /* Bytecode is sequence of 4 byte commands followed by variable arguments.
  59. * All the commands identified by "code" are conditional jumps forward:
  60. * to offset cc+"yes" or to offset cc+"no". "yes" is supposed to be
  61. * length of the command and its arguments.
  62. */
  63. struct inet_diag_bc_op {
  64. unsigned char code;
  65. unsigned char yes;
  66. unsigned short no;
  67. };
  68. enum {
  69. INET_DIAG_BC_NOP,
  70. INET_DIAG_BC_JMP,
  71. INET_DIAG_BC_S_GE,
  72. INET_DIAG_BC_S_LE,
  73. INET_DIAG_BC_D_GE,
  74. INET_DIAG_BC_D_LE,
  75. INET_DIAG_BC_AUTO,
  76. INET_DIAG_BC_S_COND,
  77. INET_DIAG_BC_D_COND,
  78. INET_DIAG_BC_DEV_COND, /* u32 ifindex */
  79. INET_DIAG_BC_MARK_COND,
  80. };
  81. struct inet_diag_hostcond {
  82. __u8 family;
  83. __u8 prefix_len;
  84. int port;
  85. __be32 addr[0];
  86. };
  87. struct inet_diag_markcond {
  88. __u32 mark;
  89. __u32 mask;
  90. };
  91. /* Base info structure. It contains socket identity (addrs/ports/cookie)
  92. * and, alas, the information shown by netstat. */
  93. struct inet_diag_msg {
  94. __u8 idiag_family;
  95. __u8 idiag_state;
  96. __u8 idiag_timer;
  97. __u8 idiag_retrans;
  98. struct inet_diag_sockid id;
  99. __u32 idiag_expires;
  100. __u32 idiag_rqueue;
  101. __u32 idiag_wqueue;
  102. __u32 idiag_uid;
  103. __u32 idiag_inode;
  104. };
  105. /* Extensions */
  106. enum {
  107. INET_DIAG_NONE,
  108. INET_DIAG_MEMINFO,
  109. INET_DIAG_INFO,
  110. INET_DIAG_VEGASINFO,
  111. INET_DIAG_CONG,
  112. INET_DIAG_TOS,
  113. INET_DIAG_TCLASS,
  114. INET_DIAG_SKMEMINFO,
  115. INET_DIAG_SHUTDOWN,
  116. INET_DIAG_DCTCPINFO,
  117. INET_DIAG_PROTOCOL, /* response attribute only */
  118. INET_DIAG_SKV6ONLY,
  119. INET_DIAG_LOCALS,
  120. INET_DIAG_PEERS,
  121. INET_DIAG_PAD,
  122. INET_DIAG_MARK,
  123. INET_DIAG_BBRINFO,
  124. INET_DIAG_CLASS_ID,
  125. INET_DIAG_MD5SIG,
  126. __INET_DIAG_MAX,
  127. };
  128. #define INET_DIAG_MAX (__INET_DIAG_MAX - 1)
  129. /* INET_DIAG_MEM */
  130. struct inet_diag_meminfo {
  131. __u32 idiag_rmem;
  132. __u32 idiag_wmem;
  133. __u32 idiag_fmem;
  134. __u32 idiag_tmem;
  135. };
  136. /* INET_DIAG_VEGASINFO */
  137. struct tcpvegas_info {
  138. __u32 tcpv_enabled;
  139. __u32 tcpv_rttcnt;
  140. __u32 tcpv_rtt;
  141. __u32 tcpv_minrtt;
  142. };
  143. /* INET_DIAG_DCTCPINFO */
  144. struct 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. };
  151. /* INET_DIAG_BBRINFO */
  152. struct tcp_bbr_info {
  153. /* u64 bw: max-filtered BW (app throughput) estimate in Byte per sec: */
  154. __u32 bbr_bw_lo; /* lower 32 bits of bw */
  155. __u32 bbr_bw_hi; /* upper 32 bits of bw */
  156. __u32 bbr_min_rtt; /* min-filtered RTT in uSec */
  157. __u32 bbr_pacing_gain; /* pacing gain shifted left 8 bits */
  158. __u32 bbr_cwnd_gain; /* cwnd gain shifted left 8 bits */
  159. };
  160. union tcp_cc_info {
  161. struct tcpvegas_info vegas;
  162. struct tcp_dctcp_info dctcp;
  163. struct tcp_bbr_info bbr;
  164. };
  165. #endif /* _UAPI_INET_DIAG_H_ */