Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 #ifndef _UAPI_INET_DIAG_H_
0003 #define _UAPI_INET_DIAG_H_
0004 
0005 #include <linux/types.h>
0006 
0007 /* Just some random number */
0008 #define TCPDIAG_GETSOCK 18
0009 #define DCCPDIAG_GETSOCK 19
0010 
0011 #define INET_DIAG_GETSOCK_MAX 24
0012 
0013 /* Socket identity */
0014 struct inet_diag_sockid {
0015     __be16  idiag_sport;
0016     __be16  idiag_dport;
0017     __be32  idiag_src[4];
0018     __be32  idiag_dst[4];
0019     __u32   idiag_if;
0020     __u32   idiag_cookie[2];
0021 #define INET_DIAG_NOCOOKIE (~0U)
0022 };
0023 
0024 /* Request structure */
0025 
0026 struct inet_diag_req {
0027     __u8    idiag_family;       /* Family of addresses. */
0028     __u8    idiag_src_len;
0029     __u8    idiag_dst_len;
0030     __u8    idiag_ext;      /* Query extended information */
0031 
0032     struct inet_diag_sockid id;
0033 
0034     __u32   idiag_states;       /* States to dump */
0035     __u32   idiag_dbs;      /* Tables to dump (NI) */
0036 };
0037 
0038 struct inet_diag_req_v2 {
0039     __u8    sdiag_family;
0040     __u8    sdiag_protocol;
0041     __u8    idiag_ext;
0042     __u8    pad;
0043     __u32   idiag_states;
0044     struct inet_diag_sockid id;
0045 };
0046 
0047 /*
0048  * SOCK_RAW sockets require the underlied protocol to be
0049  * additionally specified so we can use @pad member for
0050  * this, but we can't rename it because userspace programs
0051  * still may depend on this name. Instead lets use another
0052  * structure definition as an alias for struct
0053  * @inet_diag_req_v2.
0054  */
0055 struct inet_diag_req_raw {
0056     __u8    sdiag_family;
0057     __u8    sdiag_protocol;
0058     __u8    idiag_ext;
0059     __u8    sdiag_raw_protocol;
0060     __u32   idiag_states;
0061     struct inet_diag_sockid id;
0062 };
0063 
0064 enum {
0065     INET_DIAG_REQ_NONE,
0066     INET_DIAG_REQ_BYTECODE,
0067     INET_DIAG_REQ_SK_BPF_STORAGES,
0068     INET_DIAG_REQ_PROTOCOL,
0069     __INET_DIAG_REQ_MAX,
0070 };
0071 
0072 #define INET_DIAG_REQ_MAX (__INET_DIAG_REQ_MAX - 1)
0073 
0074 /* Bytecode is sequence of 4 byte commands followed by variable arguments.
0075  * All the commands identified by "code" are conditional jumps forward:
0076  * to offset cc+"yes" or to offset cc+"no". "yes" is supposed to be
0077  * length of the command and its arguments.
0078  */
0079  
0080 struct inet_diag_bc_op {
0081     unsigned char   code;
0082     unsigned char   yes;
0083     unsigned short  no;
0084 };
0085 
0086 enum {
0087     INET_DIAG_BC_NOP,
0088     INET_DIAG_BC_JMP,
0089     INET_DIAG_BC_S_GE,
0090     INET_DIAG_BC_S_LE,
0091     INET_DIAG_BC_D_GE,
0092     INET_DIAG_BC_D_LE,
0093     INET_DIAG_BC_AUTO,
0094     INET_DIAG_BC_S_COND,
0095     INET_DIAG_BC_D_COND,
0096     INET_DIAG_BC_DEV_COND,   /* u32 ifindex */
0097     INET_DIAG_BC_MARK_COND,
0098     INET_DIAG_BC_S_EQ,
0099     INET_DIAG_BC_D_EQ,
0100     INET_DIAG_BC_CGROUP_COND,   /* u64 cgroup v2 ID */
0101 };
0102 
0103 struct inet_diag_hostcond {
0104     __u8    family;
0105     __u8    prefix_len;
0106     int port;
0107     __be32  addr[];
0108 };
0109 
0110 struct inet_diag_markcond {
0111     __u32 mark;
0112     __u32 mask;
0113 };
0114 
0115 /* Base info structure. It contains socket identity (addrs/ports/cookie)
0116  * and, alas, the information shown by netstat. */
0117 struct inet_diag_msg {
0118     __u8    idiag_family;
0119     __u8    idiag_state;
0120     __u8    idiag_timer;
0121     __u8    idiag_retrans;
0122 
0123     struct inet_diag_sockid id;
0124 
0125     __u32   idiag_expires;
0126     __u32   idiag_rqueue;
0127     __u32   idiag_wqueue;
0128     __u32   idiag_uid;
0129     __u32   idiag_inode;
0130 };
0131 
0132 /* Extensions */
0133 
0134 enum {
0135     INET_DIAG_NONE,
0136     INET_DIAG_MEMINFO,
0137     INET_DIAG_INFO,
0138     INET_DIAG_VEGASINFO,
0139     INET_DIAG_CONG,
0140     INET_DIAG_TOS,
0141     INET_DIAG_TCLASS,
0142     INET_DIAG_SKMEMINFO,
0143     INET_DIAG_SHUTDOWN,
0144 
0145     /*
0146      * Next extenstions cannot be requested in struct inet_diag_req_v2:
0147      * its field idiag_ext has only 8 bits.
0148      */
0149 
0150     INET_DIAG_DCTCPINFO,    /* request as INET_DIAG_VEGASINFO */
0151     INET_DIAG_PROTOCOL, /* response attribute only */
0152     INET_DIAG_SKV6ONLY,
0153     INET_DIAG_LOCALS,
0154     INET_DIAG_PEERS,
0155     INET_DIAG_PAD,
0156     INET_DIAG_MARK,     /* only with CAP_NET_ADMIN */
0157     INET_DIAG_BBRINFO,  /* request as INET_DIAG_VEGASINFO */
0158     INET_DIAG_CLASS_ID, /* request as INET_DIAG_TCLASS */
0159     INET_DIAG_MD5SIG,
0160     INET_DIAG_ULP_INFO,
0161     INET_DIAG_SK_BPF_STORAGES,
0162     INET_DIAG_CGROUP_ID,
0163     INET_DIAG_SOCKOPT,
0164     __INET_DIAG_MAX,
0165 };
0166 
0167 #define INET_DIAG_MAX (__INET_DIAG_MAX - 1)
0168 
0169 enum {
0170     INET_ULP_INFO_UNSPEC,
0171     INET_ULP_INFO_NAME,
0172     INET_ULP_INFO_TLS,
0173     INET_ULP_INFO_MPTCP,
0174     __INET_ULP_INFO_MAX,
0175 };
0176 #define INET_ULP_INFO_MAX (__INET_ULP_INFO_MAX - 1)
0177 
0178 /* INET_DIAG_MEM */
0179 
0180 struct inet_diag_meminfo {
0181     __u32   idiag_rmem;
0182     __u32   idiag_wmem;
0183     __u32   idiag_fmem;
0184     __u32   idiag_tmem;
0185 };
0186 
0187 /* INET_DIAG_SOCKOPT */
0188 
0189 struct inet_diag_sockopt {
0190     __u8    recverr:1,
0191         is_icsk:1,
0192         freebind:1,
0193         hdrincl:1,
0194         mc_loop:1,
0195         transparent:1,
0196         mc_all:1,
0197         nodefrag:1;
0198     __u8    bind_address_no_port:1,
0199         recverr_rfc4884:1,
0200         defer_connect:1,
0201         unused:5;
0202 };
0203 
0204 /* INET_DIAG_VEGASINFO */
0205 
0206 struct tcpvegas_info {
0207     __u32   tcpv_enabled;
0208     __u32   tcpv_rttcnt;
0209     __u32   tcpv_rtt;
0210     __u32   tcpv_minrtt;
0211 };
0212 
0213 /* INET_DIAG_DCTCPINFO */
0214 
0215 struct tcp_dctcp_info {
0216     __u16   dctcp_enabled;
0217     __u16   dctcp_ce_state;
0218     __u32   dctcp_alpha;
0219     __u32   dctcp_ab_ecn;
0220     __u32   dctcp_ab_tot;
0221 };
0222 
0223 /* INET_DIAG_BBRINFO */
0224 
0225 struct tcp_bbr_info {
0226     /* u64 bw: max-filtered BW (app throughput) estimate in Byte per sec: */
0227     __u32   bbr_bw_lo;      /* lower 32 bits of bw */
0228     __u32   bbr_bw_hi;      /* upper 32 bits of bw */
0229     __u32   bbr_min_rtt;        /* min-filtered RTT in uSec */
0230     __u32   bbr_pacing_gain;    /* pacing gain shifted left 8 bits */
0231     __u32   bbr_cwnd_gain;      /* cwnd gain shifted left 8 bits */
0232 };
0233 
0234 union tcp_cc_info {
0235     struct tcpvegas_info    vegas;
0236     struct tcp_dctcp_info   dctcp;
0237     struct tcp_bbr_info bbr;
0238 };
0239 #endif /* _UAPI_INET_DIAG_H_ */