inet_diag.h 3.9 KB

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