Linux-2.6.12-rc2
[safe/jmp/linux-2.6] / net / ipv4 / netfilter / ip_conntrack_proto_generic.c
1 /* (C) 1999-2001 Paul `Rusty' Russell
2  * (C) 2002-2004 Netfilter Core Team <coreteam@netfilter.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  */
8
9 #include <linux/types.h>
10 #include <linux/sched.h>
11 #include <linux/timer.h>
12 #include <linux/netfilter.h>
13 #include <linux/netfilter_ipv4/ip_conntrack_protocol.h>
14
15 unsigned long ip_ct_generic_timeout = 600*HZ;
16
17 static int generic_pkt_to_tuple(const struct sk_buff *skb,
18                                 unsigned int dataoff,
19                                 struct ip_conntrack_tuple *tuple)
20 {
21         tuple->src.u.all = 0;
22         tuple->dst.u.all = 0;
23
24         return 1;
25 }
26
27 static int generic_invert_tuple(struct ip_conntrack_tuple *tuple,
28                                 const struct ip_conntrack_tuple *orig)
29 {
30         tuple->src.u.all = 0;
31         tuple->dst.u.all = 0;
32
33         return 1;
34 }
35
36 /* Print out the per-protocol part of the tuple. */
37 static int generic_print_tuple(struct seq_file *s,
38                                const struct ip_conntrack_tuple *tuple)
39 {
40         return 0;
41 }
42
43 /* Print out the private part of the conntrack. */
44 static int generic_print_conntrack(struct seq_file *s,
45                                    const struct ip_conntrack *state)
46 {
47         return 0;
48 }
49
50 /* Returns verdict for packet, or -1 for invalid. */
51 static int packet(struct ip_conntrack *conntrack,
52                   const struct sk_buff *skb,
53                   enum ip_conntrack_info ctinfo)
54 {
55         ip_ct_refresh_acct(conntrack, ctinfo, skb, ip_ct_generic_timeout);
56         return NF_ACCEPT;
57 }
58
59 /* Called when a new connection for this protocol found. */
60 static int new(struct ip_conntrack *conntrack, const struct sk_buff *skb)
61 {
62         return 1;
63 }
64
65 struct ip_conntrack_protocol ip_conntrack_generic_protocol =
66 {
67         .proto                  = 0,
68         .name                   = "unknown",
69         .pkt_to_tuple           = generic_pkt_to_tuple,
70         .invert_tuple           = generic_invert_tuple,
71         .print_tuple            = generic_print_tuple,
72         .print_conntrack        = generic_print_conntrack,
73         .packet                 = packet,
74         .new                    = new,
75 };