2005-08-12 23:51:49 +08:00
|
|
|
#ifndef _INET_DIAG_H_
|
|
|
|
#define _INET_DIAG_H_ 1
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2009-01-31 00:12:47 +08:00
|
|
|
#include <linux/types.h>
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* Just some random number */
|
|
|
|
#define TCPDIAG_GETSOCK 18
|
2005-08-10 16:54:28 +08:00
|
|
|
#define DCCPDIAG_GETSOCK 19
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-12 20:27:49 +08:00
|
|
|
#define INET_DIAG_GETSOCK_MAX 24
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* Socket identity */
|
2005-08-12 23:51:49 +08:00
|
|
|
struct inet_diag_sockid {
|
2006-09-28 09:44:30 +08:00
|
|
|
__be16 idiag_sport;
|
|
|
|
__be16 idiag_dport;
|
|
|
|
__be32 idiag_src[4];
|
|
|
|
__be32 idiag_dst[4];
|
2005-08-12 23:51:49 +08:00
|
|
|
__u32 idiag_if;
|
|
|
|
__u32 idiag_cookie[2];
|
|
|
|
#define INET_DIAG_NOCOOKIE (~0U)
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Request structure */
|
|
|
|
|
2012-01-11 06:37:26 +08:00
|
|
|
struct inet_diag_req {
|
2005-08-12 23:51:49 +08:00
|
|
|
__u8 idiag_family; /* Family of addresses. */
|
|
|
|
__u8 idiag_src_len;
|
|
|
|
__u8 idiag_dst_len;
|
|
|
|
__u8 idiag_ext; /* Query extended information */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-12 23:51:49 +08:00
|
|
|
struct inet_diag_sockid id;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-12 23:51:49 +08:00
|
|
|
__u32 idiag_states; /* States to dump */
|
|
|
|
__u32 idiag_dbs; /* Tables to dump (NI) */
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
2012-01-11 06:36:35 +08:00
|
|
|
struct inet_diag_req_v2 {
|
2011-12-06 15:58:21 +08:00
|
|
|
__u8 sdiag_family;
|
|
|
|
__u8 sdiag_protocol;
|
|
|
|
__u8 idiag_ext;
|
|
|
|
__u8 pad;
|
|
|
|
__u32 idiag_states;
|
|
|
|
struct inet_diag_sockid id;
|
|
|
|
};
|
|
|
|
|
2005-08-12 23:51:49 +08:00
|
|
|
enum {
|
|
|
|
INET_DIAG_REQ_NONE,
|
|
|
|
INET_DIAG_REQ_BYTECODE,
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
2005-08-12 23:51:49 +08:00
|
|
|
#define INET_DIAG_REQ_MAX INET_DIAG_REQ_BYTECODE
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Bytecode is sequence of 4 byte commands followed by variable arguments.
|
|
|
|
* All the commands identified by "code" are conditional jumps forward:
|
|
|
|
* to offset cc+"yes" or to offset cc+"no". "yes" is supposed to be
|
|
|
|
* length of the command and its arguments.
|
|
|
|
*/
|
|
|
|
|
2005-08-12 23:51:49 +08:00
|
|
|
struct inet_diag_bc_op {
|
2005-04-17 06:20:36 +08:00
|
|
|
unsigned char code;
|
|
|
|
unsigned char yes;
|
|
|
|
unsigned short no;
|
|
|
|
};
|
|
|
|
|
2005-08-12 23:51:49 +08:00
|
|
|
enum {
|
|
|
|
INET_DIAG_BC_NOP,
|
|
|
|
INET_DIAG_BC_JMP,
|
|
|
|
INET_DIAG_BC_S_GE,
|
|
|
|
INET_DIAG_BC_S_LE,
|
|
|
|
INET_DIAG_BC_D_GE,
|
|
|
|
INET_DIAG_BC_D_LE,
|
|
|
|
INET_DIAG_BC_AUTO,
|
|
|
|
INET_DIAG_BC_S_COND,
|
|
|
|
INET_DIAG_BC_D_COND,
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
2005-08-12 23:51:49 +08:00
|
|
|
struct inet_diag_hostcond {
|
2005-04-17 06:20:36 +08:00
|
|
|
__u8 family;
|
|
|
|
__u8 prefix_len;
|
|
|
|
int port;
|
2006-09-28 09:44:30 +08:00
|
|
|
__be32 addr[0];
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Base info structure. It contains socket identity (addrs/ports/cookie)
|
|
|
|
* and, alas, the information shown by netstat. */
|
2005-08-12 23:51:49 +08:00
|
|
|
struct inet_diag_msg {
|
|
|
|
__u8 idiag_family;
|
|
|
|
__u8 idiag_state;
|
|
|
|
__u8 idiag_timer;
|
|
|
|
__u8 idiag_retrans;
|
|
|
|
|
|
|
|
struct inet_diag_sockid id;
|
|
|
|
|
|
|
|
__u32 idiag_expires;
|
|
|
|
__u32 idiag_rqueue;
|
|
|
|
__u32 idiag_wqueue;
|
|
|
|
__u32 idiag_uid;
|
|
|
|
__u32 idiag_inode;
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Extensions */
|
|
|
|
|
2005-08-12 23:51:49 +08:00
|
|
|
enum {
|
|
|
|
INET_DIAG_NONE,
|
|
|
|
INET_DIAG_MEMINFO,
|
|
|
|
INET_DIAG_INFO,
|
|
|
|
INET_DIAG_VEGASINFO,
|
|
|
|
INET_DIAG_CONG,
|
2011-10-12 17:00:35 +08:00
|
|
|
INET_DIAG_TOS,
|
2011-11-07 22:23:11 +08:00
|
|
|
INET_DIAG_TCLASS,
|
2011-12-30 08:53:32 +08:00
|
|
|
INET_DIAG_SKMEMINFO,
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
2011-12-30 08:53:32 +08:00
|
|
|
#define INET_DIAG_MAX INET_DIAG_SKMEMINFO
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
|
2005-08-12 23:51:49 +08:00
|
|
|
/* INET_DIAG_MEM */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-12 23:51:49 +08:00
|
|
|
struct inet_diag_meminfo {
|
|
|
|
__u32 idiag_rmem;
|
|
|
|
__u32 idiag_wmem;
|
|
|
|
__u32 idiag_fmem;
|
|
|
|
__u32 idiag_tmem;
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
2005-08-12 23:51:49 +08:00
|
|
|
/* INET_DIAG_VEGASINFO */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
struct tcpvegas_info {
|
|
|
|
__u32 tcpv_enabled;
|
|
|
|
__u32 tcpv_rttcnt;
|
|
|
|
__u32 tcpv_rtt;
|
|
|
|
__u32 tcpv_minrtt;
|
|
|
|
};
|
|
|
|
|
2005-08-12 20:27:49 +08:00
|
|
|
#ifdef __KERNEL__
|
|
|
|
struct sock;
|
|
|
|
struct inet_hashinfo;
|
2011-12-09 14:22:44 +08:00
|
|
|
struct nlattr;
|
2011-12-09 14:23:00 +08:00
|
|
|
struct nlmsghdr;
|
|
|
|
struct sk_buff;
|
2011-12-09 14:23:18 +08:00
|
|
|
struct netlink_callback;
|
2005-08-12 20:27:49 +08:00
|
|
|
|
|
|
|
struct inet_diag_handler {
|
2011-12-09 14:23:18 +08:00
|
|
|
void (*dump)(struct sk_buff *skb,
|
|
|
|
struct netlink_callback *cb,
|
2012-01-11 06:36:35 +08:00
|
|
|
struct inet_diag_req_v2 *r,
|
2011-12-09 14:23:18 +08:00
|
|
|
struct nlattr *bc);
|
|
|
|
|
|
|
|
int (*dump_one)(struct sk_buff *in_skb,
|
|
|
|
const struct nlmsghdr *nlh,
|
2012-01-11 06:36:35 +08:00
|
|
|
struct inet_diag_req_v2 *req);
|
2011-12-09 14:23:18 +08:00
|
|
|
|
2005-08-12 20:27:49 +08:00
|
|
|
void (*idiag_get_info)(struct sock *sk,
|
2005-08-12 23:51:49 +08:00
|
|
|
struct inet_diag_msg *r,
|
2005-08-12 20:27:49 +08:00
|
|
|
void *info);
|
|
|
|
__u16 idiag_type;
|
|
|
|
};
|
|
|
|
|
2011-12-09 14:23:00 +08:00
|
|
|
struct inet_connection_sock;
|
|
|
|
int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
|
2012-01-11 06:36:35 +08:00
|
|
|
struct sk_buff *skb, struct inet_diag_req_v2 *req,
|
2011-12-09 14:23:00 +08:00
|
|
|
u32 pid, u32 seq, u16 nlmsg_flags,
|
|
|
|
const struct nlmsghdr *unlh);
|
2011-12-09 14:23:18 +08:00
|
|
|
void inet_diag_dump_icsk(struct inet_hashinfo *h, struct sk_buff *skb,
|
2012-01-11 06:36:35 +08:00
|
|
|
struct netlink_callback *cb, struct inet_diag_req_v2 *r,
|
2011-12-09 14:23:18 +08:00
|
|
|
struct nlattr *bc);
|
|
|
|
int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo,
|
|
|
|
struct sk_buff *in_skb, const struct nlmsghdr *nlh,
|
2012-01-11 06:36:35 +08:00
|
|
|
struct inet_diag_req_v2 *req);
|
2011-12-09 14:23:18 +08:00
|
|
|
|
2011-12-09 14:22:44 +08:00
|
|
|
int inet_diag_bc_sk(const struct nlattr *_bc, struct sock *sk);
|
2011-12-09 14:21:53 +08:00
|
|
|
|
2005-08-12 20:27:49 +08:00
|
|
|
extern int inet_diag_register(const struct inet_diag_handler *handler);
|
|
|
|
extern void inet_diag_unregister(const struct inet_diag_handler *handler);
|
|
|
|
#endif /* __KERNEL__ */
|
|
|
|
|
2005-08-12 23:51:49 +08:00
|
|
|
#endif /* _INET_DIAG_H_ */
|