Committer: Michael Beasley <mike@snafu.setup>
[mikesnafu-overlay.git] / net / netfilter / nf_conntrack_proto_generic.c
blob55458915575f20d604205f038cde9b457df4856a
1 /* (C) 1999-2001 Paul `Rusty' Russell
2 * (C) 2002-2004 Netfilter Core Team <coreteam@netfilter.org>
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 */
9 #include <linux/types.h>
10 #include <linux/jiffies.h>
11 #include <linux/timer.h>
12 #include <linux/netfilter.h>
13 #include <net/netfilter/nf_conntrack_l4proto.h>
15 static unsigned int nf_ct_generic_timeout __read_mostly = 600*HZ;
17 static int generic_pkt_to_tuple(const struct sk_buff *skb,
18 unsigned int dataoff,
19 struct nf_conntrack_tuple *tuple)
21 tuple->src.u.all = 0;
22 tuple->dst.u.all = 0;
24 return 1;
27 static int generic_invert_tuple(struct nf_conntrack_tuple *tuple,
28 const struct nf_conntrack_tuple *orig)
30 tuple->src.u.all = 0;
31 tuple->dst.u.all = 0;
33 return 1;
36 /* Print out the per-protocol part of the tuple. */
37 static int generic_print_tuple(struct seq_file *s,
38 const struct nf_conntrack_tuple *tuple)
40 return 0;
43 /* Returns verdict for packet, or -1 for invalid. */
44 static int packet(struct nf_conn *ct,
45 const struct sk_buff *skb,
46 unsigned int dataoff,
47 enum ip_conntrack_info ctinfo,
48 int pf,
49 unsigned int hooknum)
51 nf_ct_refresh_acct(ct, ctinfo, skb, nf_ct_generic_timeout);
52 return NF_ACCEPT;
55 /* Called when a new connection for this protocol found. */
56 static int new(struct nf_conn *ct, const struct sk_buff *skb,
57 unsigned int dataoff)
59 return 1;
62 #ifdef CONFIG_SYSCTL
63 static struct ctl_table_header *generic_sysctl_header;
64 static struct ctl_table generic_sysctl_table[] = {
66 .procname = "nf_conntrack_generic_timeout",
67 .data = &nf_ct_generic_timeout,
68 .maxlen = sizeof(unsigned int),
69 .mode = 0644,
70 .proc_handler = &proc_dointvec_jiffies,
73 .ctl_name = 0
76 #ifdef CONFIG_NF_CONNTRACK_PROC_COMPAT
77 static struct ctl_table generic_compat_sysctl_table[] = {
79 .procname = "ip_conntrack_generic_timeout",
80 .data = &nf_ct_generic_timeout,
81 .maxlen = sizeof(unsigned int),
82 .mode = 0644,
83 .proc_handler = &proc_dointvec_jiffies,
86 .ctl_name = 0
89 #endif /* CONFIG_NF_CONNTRACK_PROC_COMPAT */
90 #endif /* CONFIG_SYSCTL */
92 struct nf_conntrack_l4proto nf_conntrack_l4proto_generic __read_mostly =
94 .l3proto = PF_UNSPEC,
95 .l4proto = 0,
96 .name = "unknown",
97 .pkt_to_tuple = generic_pkt_to_tuple,
98 .invert_tuple = generic_invert_tuple,
99 .print_tuple = generic_print_tuple,
100 .packet = packet,
101 .new = new,
102 #ifdef CONFIG_SYSCTL
103 .ctl_table_header = &generic_sysctl_header,
104 .ctl_table = generic_sysctl_table,
105 #ifdef CONFIG_NF_CONNTRACK_PROC_COMPAT
106 .ctl_compat_table = generic_compat_sysctl_table,
107 #endif
108 #endif