Skip to content

Commit

Permalink
[TCPDIAG]: Just rename everything to inet_diag
Browse files Browse the repository at this point in the history
Next changeset will rename tcp_diag.[ch] to inet_diag.[ch].

I'm taking this longer route so as to easy review, making clear the changes
made all along the way.

Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Arnaldo Carvalho de Melo authored and David S. Miller committed Aug 29, 2005
1 parent 4f5736c commit 73c1f4a
Show file tree
Hide file tree
Showing 10 changed files with 275 additions and 283 deletions.
2 changes: 1 addition & 1 deletion include/linux/netlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define NETLINK_W1 1 /* 1-wire subsystem */
#define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */
#define NETLINK_FIREWALL 3 /* Firewalling hook */
#define NETLINK_TCPDIAG 4 /* TCP socket monitoring */
#define NETLINK_INET_DIAG 4 /* INET socket monitoring */
#define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */
#define NETLINK_XFRM 6 /* ipsec */
#define NETLINK_SELINUX 7 /* SELinux event notifications */
Expand Down
135 changes: 63 additions & 72 deletions include/linux/tcp_diag.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _TCP_DIAG_H_
#define _TCP_DIAG_H_ 1
#ifndef _INET_DIAG_H_
#define _INET_DIAG_H_ 1

/* Just some random number */
#define TCPDIAG_GETSOCK 18
Expand All @@ -8,68 +8,62 @@
#define INET_DIAG_GETSOCK_MAX 24

/* Socket identity */
struct tcpdiag_sockid
{
__u16 tcpdiag_sport;
__u16 tcpdiag_dport;
__u32 tcpdiag_src[4];
__u32 tcpdiag_dst[4];
__u32 tcpdiag_if;
__u32 tcpdiag_cookie[2];
#define TCPDIAG_NOCOOKIE (~0U)
struct inet_diag_sockid {
__u16 idiag_sport;
__u16 idiag_dport;
__u32 idiag_src[4];
__u32 idiag_dst[4];
__u32 idiag_if;
__u32 idiag_cookie[2];
#define INET_DIAG_NOCOOKIE (~0U)
};

/* Request structure */

struct tcpdiagreq
{
__u8 tcpdiag_family; /* Family of addresses. */
__u8 tcpdiag_src_len;
__u8 tcpdiag_dst_len;
__u8 tcpdiag_ext; /* Query extended information */
struct inet_diag_req {
__u8 idiag_family; /* Family of addresses. */
__u8 idiag_src_len;
__u8 idiag_dst_len;
__u8 idiag_ext; /* Query extended information */

struct tcpdiag_sockid id;
struct inet_diag_sockid id;

__u32 tcpdiag_states; /* States to dump */
__u32 tcpdiag_dbs; /* Tables to dump (NI) */
__u32 idiag_states; /* States to dump */
__u32 idiag_dbs; /* Tables to dump (NI) */
};

enum
{
TCPDIAG_REQ_NONE,
TCPDIAG_REQ_BYTECODE,
enum {
INET_DIAG_REQ_NONE,
INET_DIAG_REQ_BYTECODE,
};

#define TCPDIAG_REQ_MAX TCPDIAG_REQ_BYTECODE
#define INET_DIAG_REQ_MAX INET_DIAG_REQ_BYTECODE

/* 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.
*/

struct tcpdiag_bc_op
{
struct inet_diag_bc_op {
unsigned char code;
unsigned char yes;
unsigned short no;
};

enum
{
TCPDIAG_BC_NOP,
TCPDIAG_BC_JMP,
TCPDIAG_BC_S_GE,
TCPDIAG_BC_S_LE,
TCPDIAG_BC_D_GE,
TCPDIAG_BC_D_LE,
TCPDIAG_BC_AUTO,
TCPDIAG_BC_S_COND,
TCPDIAG_BC_D_COND,
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,
};

struct tcpdiag_hostcond
{
struct inet_diag_hostcond {
__u8 family;
__u8 prefix_len;
int port;
Expand All @@ -78,47 +72,44 @@ struct tcpdiag_hostcond

/* Base info structure. It contains socket identity (addrs/ports/cookie)
* and, alas, the information shown by netstat. */
struct tcpdiagmsg
{
__u8 tcpdiag_family;
__u8 tcpdiag_state;
__u8 tcpdiag_timer;
__u8 tcpdiag_retrans;

struct tcpdiag_sockid id;

__u32 tcpdiag_expires;
__u32 tcpdiag_rqueue;
__u32 tcpdiag_wqueue;
__u32 tcpdiag_uid;
__u32 tcpdiag_inode;
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;
};

/* Extensions */

enum
{
TCPDIAG_NONE,
TCPDIAG_MEMINFO,
TCPDIAG_INFO,
TCPDIAG_VEGASINFO,
TCPDIAG_CONG,
enum {
INET_DIAG_NONE,
INET_DIAG_MEMINFO,
INET_DIAG_INFO,
INET_DIAG_VEGASINFO,
INET_DIAG_CONG,
};

#define TCPDIAG_MAX TCPDIAG_CONG
#define INET_DIAG_MAX INET_DIAG_CONG


/* TCPDIAG_MEM */
/* INET_DIAG_MEM */

struct tcpdiag_meminfo
{
__u32 tcpdiag_rmem;
__u32 tcpdiag_wmem;
__u32 tcpdiag_fmem;
__u32 tcpdiag_tmem;
struct inet_diag_meminfo {
__u32 idiag_rmem;
__u32 idiag_wmem;
__u32 idiag_fmem;
__u32 idiag_tmem;
};

/* TCPDIAG_VEGASINFO */
/* INET_DIAG_VEGASINFO */

struct tcpvegas_info {
__u32 tcpv_enabled;
Expand All @@ -134,7 +125,7 @@ struct inet_hashinfo;
struct inet_diag_handler {
struct inet_hashinfo *idiag_hashinfo;
void (*idiag_get_info)(struct sock *sk,
struct tcpdiagmsg *r,
struct inet_diag_msg *r,
void *info);
__u16 idiag_info_size;
__u16 idiag_type;
Expand All @@ -144,4 +135,4 @@ extern int inet_diag_register(const struct inet_diag_handler *handler);
extern void inet_diag_unregister(const struct inet_diag_handler *handler);
#endif /* __KERNEL__ */

#endif /* _TCP_DIAG_H_ */
#endif /* _INET_DIAG_H_ */
2 changes: 1 addition & 1 deletion include/net/tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ struct tcp_congestion_ops {
u32 (*undo_cwnd)(struct sock *sk);
/* hook for packet ack accounting (optional) */
void (*pkts_acked)(struct sock *sk, u32 num_acked);
/* get info for tcp_diag (optional) */
/* get info for inet_diag (optional) */
void (*get_info)(struct sock *sk, u32 ext, struct sk_buff *skb);

char name[TCP_CA_NAME_MAX];
Expand Down
4 changes: 2 additions & 2 deletions net/dccp/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ config IP_DCCP
If in doubt, say N.

config IP_DCCP_DIAG
depends on IP_DCCP && IP_TCPDIAG
def_tristate y if (IP_DCCP = y && IP_TCPDIAG = y)
depends on IP_DCCP && IP_INET_DIAG
def_tristate y if (IP_DCCP = y && IP_INET_DIAG = y)
def_tristate m

source "net/dccp/ccids/Kconfig"
Expand Down
4 changes: 2 additions & 2 deletions net/dccp/diag.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

#include "dccp.h"

static void dccp_diag_get_info(struct sock *sk, struct tcpdiagmsg *r,
static void dccp_diag_get_info(struct sock *sk, struct inet_diag_msg *r,
void *_info)
{
r->tcpdiag_rqueue = r->tcpdiag_wqueue = 0;
r->idiag_rqueue = r->idiag_wqueue = 0;
}

static struct inet_diag_handler dccp_diag_handler = {
Expand Down
10 changes: 5 additions & 5 deletions net/ipv4/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -413,13 +413,13 @@ config INET_TUNNEL

If unsure, say Y.

config IP_TCPDIAG
tristate "IP: TCP socket monitoring interface"
config IP_INET_DIAG
tristate "IP: INET socket monitoring interface"
default y
---help---
Support for TCP socket monitoring interface used by native Linux
tools such as ss. ss is included in iproute2, currently downloadable
at <http://developer.osdl.org/dev/iproute2>.
Support for INET (TCP, DCCP, etc) socket monitoring interface used by
native Linux tools such as ss. ss is included in iproute2, currently
downloadable at <http://developer.osdl.org/dev/iproute2>.

If unsure, say Y.

Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ obj-$(CONFIG_IP_ROUTE_MULTIPATH_WRANDOM) += multipath_wrandom.o
obj-$(CONFIG_IP_ROUTE_MULTIPATH_DRR) += multipath_drr.o
obj-$(CONFIG_NETFILTER) += netfilter/
obj-$(CONFIG_IP_VS) += ipvs/
obj-$(CONFIG_IP_TCPDIAG) += tcp_diag.o
obj-$(CONFIG_IP_INET_DIAG) += tcp_diag.o
obj-$(CONFIG_IP_ROUTE_MULTIPATH_CACHED) += multipath.o
obj-$(CONFIG_TCP_CONG_BIC) += tcp_bic.o
obj-$(CONFIG_TCP_CONG_WESTWOOD) += tcp_westwood.o
Expand Down
Loading

0 comments on commit 73c1f4a

Please sign in to comment.