aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/udp_diag.c
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@parallels.com>2011-12-09 01:23:51 -0500
committerDavid S. Miller <davem@davemloft.net>2011-12-09 14:15:00 -0500
commit52b7c59bc34c1eb73c46e023c9c01231e1cb637a (patch)
tree8f5a7d5ad1a1980293de4c0c21475428e4e30c69 /net/ipv4/udp_diag.c
parentfce823381e3c082ba1b2e15d5151d1aa8afdc9e9 (diff)
udp_diag: Basic skeleton
Introduce the transport level diag handler module for UDP (and UDP-lite) sockets and register (empty for now) callbacks in the inet_diag module. Signed-off-by: Pavel Emelyanov <xemul@parallels.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/udp_diag.c')
-rw-r--r--net/ipv4/udp_diag.c95
1 files changed, 95 insertions, 0 deletions
diff --git a/net/ipv4/udp_diag.c b/net/ipv4/udp_diag.c
new file mode 100644
index 000000000000..75e4e4ada545
--- /dev/null
+++ b/net/ipv4/udp_diag.c
@@ -0,0 +1,95 @@
1/*
2 * udp_diag.c Module for monitoring UDP transport protocols sockets.
3 *
4 * Authors: Pavel Emelyanov, <xemul@parallels.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12
13#include <linux/module.h>
14#include <linux/inet_diag.h>
15#include <linux/udp.h>
16#include <net/udp.h>
17#include <net/udplite.h>
18#include <linux/inet_diag.h>
19#include <linux/sock_diag.h>
20
21static int udp_dump_one(struct udp_table *tbl, struct sk_buff *in_skb,
22 const struct nlmsghdr *nlh, struct inet_diag_req *req)
23{
24 return 0;
25}
26
27static void udp_dump(struct udp_table *table, struct sk_buff *skb, struct netlink_callback *cb,
28 struct inet_diag_req *r, struct nlattr *bc)
29{
30}
31
32static void udp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
33 struct inet_diag_req *r, struct nlattr *bc)
34{
35 udp_dump(&udp_table, skb, cb, r, bc);
36}
37
38static int udp_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr *nlh,
39 struct inet_diag_req *req)
40{
41 return udp_dump_one(&udp_table, in_skb, nlh, req);
42}
43
44static const struct inet_diag_handler udp_diag_handler = {
45 .dump = udp_diag_dump,
46 .dump_one = udp_diag_dump_one,
47 .idiag_type = IPPROTO_UDP,
48};
49
50static void udplite_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
51 struct inet_diag_req *r, struct nlattr *bc)
52{
53 udp_dump(&udplite_table, skb, cb, r, bc);
54}
55
56static int udplite_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr *nlh,
57 struct inet_diag_req *req)
58{
59 return udp_dump_one(&udplite_table, in_skb, nlh, req);
60}
61
62static const struct inet_diag_handler udplite_diag_handler = {
63 .dump = udplite_diag_dump,
64 .dump_one = udplite_diag_dump_one,
65 .idiag_type = IPPROTO_UDPLITE,
66};
67
68static int __init udp_diag_init(void)
69{
70 int err;
71
72 err = inet_diag_register(&udp_diag_handler);
73 if (err)
74 goto out;
75 err = inet_diag_register(&udplite_diag_handler);
76 if (err)
77 goto out_lite;
78out:
79 return err;
80out_lite:
81 inet_diag_unregister(&udp_diag_handler);
82 goto out;
83}
84
85static void __exit udp_diag_exit(void)
86{
87 inet_diag_unregister(&udplite_diag_handler);
88 inet_diag_unregister(&udp_diag_handler);
89}
90
91module_init(udp_diag_init);
92module_exit(udp_diag_exit);
93MODULE_LICENSE("GPL");
94MODULE_ALIAS_NET_PF_PROTO_TYPE(PF_NETLINK, NETLINK_SOCK_DIAG, 17);
95MODULE_ALIAS_NET_PF_PROTO_TYPE(PF_NETLINK, NETLINK_SOCK_DIAG, 136);