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