Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4f5736c4 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by David S. Miller
Browse files

[TCPDIAG]: Introduce inet_diag_{register,unregister}



Next changeset will rename tcp_diag to inet_diag and move the tcp_diag code out
of it and into a new tcp_diag.c, similar to the net/dccp/diag.c introduced in
this changeset, completing the transition to a generic inet_diag
infrastructure.

Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5324a040
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -5,6 +5,8 @@
#define TCPDIAG_GETSOCK 18
#define DCCPDIAG_GETSOCK 19

#define INET_DIAG_GETSOCK_MAX 24

/* Socket identity */
struct tcpdiag_sockid
{
@@ -125,4 +127,21 @@ struct tcpvegas_info {
	__u32	tcpv_minrtt;
};

#ifdef __KERNEL__
struct sock;
struct inet_hashinfo;

struct inet_diag_handler {
	struct inet_hashinfo    *idiag_hashinfo;
	void			(*idiag_get_info)(struct sock *sk,
						  struct tcpdiagmsg *r,
						  void *info);
	__u16                   idiag_info_size;
	__u16                   idiag_type;
};

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_ */
+5 −0
Original line number Diff line number Diff line
@@ -19,6 +19,11 @@ 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)
	def_tristate m

source "net/dccp/ccids/Kconfig"

endmenu
+4 −0
Original line number Diff line number Diff line
@@ -3,4 +3,8 @@ obj-$(CONFIG_IP_DCCP) += dccp.o
dccp-y := ccid.o input.o ipv4.o minisocks.o options.o output.o proto.o \
	  timer.o packet_history.o

obj-$(CONFIG_IP_DCCP_DIAG) += dccp_diag.o

obj-y += ccids/

dccp_diag-y := diag.o

net/dccp/diag.c

0 → 100644
+47 −0
Original line number Diff line number Diff line
/*
 *  net/dccp/diag.c
 *
 *  An implementation of the DCCP protocol
 *  Arnaldo Carvalho de Melo <acme@mandriva.com>
 *
 *	This program is free software; you can redistribute it and/or modify it
 *	under the terms of the GNU General Public License version 2 as
 *	published by the Free Software Foundation.
 */

#include <linux/config.h>

#include <linux/module.h>
#include <linux/tcp_diag.h>

#include "dccp.h"

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

static struct inet_diag_handler dccp_diag_handler = {
	.idiag_hashinfo	 = &dccp_hashinfo,
	.idiag_get_info	 = dccp_diag_get_info,
	.idiag_type	 = DCCPDIAG_GETSOCK,
	.idiag_info_size = 0,
};

static int __init dccp_diag_init(void)
{
	return inet_diag_register(&dccp_diag_handler);
}

static void __exit dccp_diag_fini(void)
{
	inet_diag_unregister(&dccp_diag_handler);
}

module_init(dccp_diag_init);
module_exit(dccp_diag_fini);

MODULE_LICENSE("GPL");
MODULE_AUTHOR("Arnaldo Carvalho de Melo <acme@mandriva.com>");
MODULE_DESCRIPTION("DCCP inet_diag handler");
+0 −3
Original line number Diff line number Diff line
@@ -423,9 +423,6 @@ config IP_TCPDIAG
	  
	  If unsure, say Y.

config IP_TCPDIAG_DCCP
	def_bool (IP_TCPDIAG=y && IP_DCCP=y) || (IP_TCPDIAG=m && IP_DCCP)

config TCP_CONG_ADVANCED
	bool "TCP: advanced congestion control"
	---help---
Loading