blob: b59871f6bdda3b6bcfddfcd24925df64e70e15f2 [file] [log] [blame]
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -08001/* (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.
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -08007 */
8
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -08009#include <linux/types.h>
10#include <linux/netfilter.h>
11#include <linux/module.h>
12#include <linux/skbuff.h>
13#include <linux/proc_fs.h>
14#include <linux/seq_file.h>
15#include <linux/percpu.h>
16#include <linux/netdevice.h>
Eric W. Biederman457c4cb2007-09-12 12:01:34 +020017#include <net/net_namespace.h>
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -080018#ifdef CONFIG_SYSCTL
19#include <linux/sysctl.h>
20#endif
21
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -080022#include <net/netfilter/nf_conntrack.h>
Martin Josefssonf6180122006-11-29 02:35:01 +010023#include <net/netfilter/nf_conntrack_core.h>
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -080024#include <net/netfilter/nf_conntrack_l3proto.h>
Martin Josefsson605dcad2006-11-29 02:35:06 +010025#include <net/netfilter/nf_conntrack_l4proto.h>
Martin Josefsson77ab9cf2006-11-29 02:34:58 +010026#include <net/netfilter/nf_conntrack_expect.h>
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -080027#include <net/netfilter/nf_conntrack_helper.h>
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -080028
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -080029MODULE_LICENSE("GPL");
30
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -080031#ifdef CONFIG_PROC_FS
Martin Josefsson77ab9cf2006-11-29 02:34:58 +010032int
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -080033print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple,
Jan Engelhardt32948582008-01-31 04:53:24 -080034 const struct nf_conntrack_l3proto *l3proto,
35 const struct nf_conntrack_l4proto *l4proto)
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -080036{
Martin Josefsson605dcad2006-11-29 02:35:06 +010037 return l3proto->print_tuple(s, tuple) || l4proto->print_tuple(s, tuple);
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -080038}
Patrick McHardye4bd8bc2006-11-29 02:35:22 +010039EXPORT_SYMBOL_GPL(print_tuple);
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -080040
41#ifdef CONFIG_NF_CT_ACCT
42static unsigned int
43seq_print_counters(struct seq_file *s,
44 const struct ip_conntrack_counter *counter)
45{
46 return seq_printf(s, "packets=%llu bytes=%llu ",
47 (unsigned long long)counter->packets,
48 (unsigned long long)counter->bytes);
49}
50#else
51#define seq_print_counters(x, y) 0
52#endif
53
54struct ct_iter_state {
55 unsigned int bucket;
56};
57
Patrick McHardyf205c5e2007-07-07 22:28:14 -070058static struct hlist_node *ct_get_first(struct seq_file *seq)
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -080059{
60 struct ct_iter_state *st = seq->private;
Patrick McHardy76507f62008-01-31 04:38:38 -080061 struct hlist_node *n;
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -080062
63 for (st->bucket = 0;
64 st->bucket < nf_conntrack_htable_size;
65 st->bucket++) {
Patrick McHardy76507f62008-01-31 04:38:38 -080066 n = rcu_dereference(nf_conntrack_hash[st->bucket].first);
67 if (n)
68 return n;
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -080069 }
70 return NULL;
71}
72
Patrick McHardyf205c5e2007-07-07 22:28:14 -070073static struct hlist_node *ct_get_next(struct seq_file *seq,
74 struct hlist_node *head)
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -080075{
76 struct ct_iter_state *st = seq->private;
77
Patrick McHardy76507f62008-01-31 04:38:38 -080078 head = rcu_dereference(head->next);
Patrick McHardyf205c5e2007-07-07 22:28:14 -070079 while (head == NULL) {
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -080080 if (++st->bucket >= nf_conntrack_htable_size)
81 return NULL;
Patrick McHardy76507f62008-01-31 04:38:38 -080082 head = rcu_dereference(nf_conntrack_hash[st->bucket].first);
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -080083 }
84 return head;
85}
86
Patrick McHardyf205c5e2007-07-07 22:28:14 -070087static struct hlist_node *ct_get_idx(struct seq_file *seq, loff_t pos)
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -080088{
Patrick McHardyf205c5e2007-07-07 22:28:14 -070089 struct hlist_node *head = ct_get_first(seq);
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -080090
91 if (head)
92 while (pos && (head = ct_get_next(seq, head)))
93 pos--;
94 return pos ? NULL : head;
95}
96
97static void *ct_seq_start(struct seq_file *seq, loff_t *pos)
Patrick McHardy76507f62008-01-31 04:38:38 -080098 __acquires(RCU)
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -080099{
Patrick McHardy76507f62008-01-31 04:38:38 -0800100 rcu_read_lock();
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800101 return ct_get_idx(seq, *pos);
102}
103
104static void *ct_seq_next(struct seq_file *s, void *v, loff_t *pos)
105{
106 (*pos)++;
107 return ct_get_next(s, v);
108}
109
110static void ct_seq_stop(struct seq_file *s, void *v)
Patrick McHardy76507f62008-01-31 04:38:38 -0800111 __releases(RCU)
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800112{
Patrick McHardy76507f62008-01-31 04:38:38 -0800113 rcu_read_unlock();
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800114}
115
116/* return 0 on success, 1 in case of error */
117static int ct_seq_show(struct seq_file *s, void *v)
118{
119 const struct nf_conntrack_tuple_hash *hash = v;
Patrick McHardyc88130b2008-01-31 04:42:11 -0800120 const struct nf_conn *ct = nf_ct_tuplehash_to_ctrack(hash);
Jan Engelhardt32948582008-01-31 04:53:24 -0800121 const struct nf_conntrack_l3proto *l3proto;
122 const struct nf_conntrack_l4proto *l4proto;
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800123
Patrick McHardyc88130b2008-01-31 04:42:11 -0800124 NF_CT_ASSERT(ct);
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800125
126 /* we only want to print DIR_ORIGINAL */
127 if (NF_CT_DIRECTION(hash))
128 return 0;
129
Patrick McHardy5e8fbe22008-04-14 11:15:52 +0200130 l3proto = __nf_ct_l3proto_find(nf_ct_l3num(ct));
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800131 NF_CT_ASSERT(l3proto);
Patrick McHardy5e8fbe22008-04-14 11:15:52 +0200132 l4proto = __nf_ct_l4proto_find(nf_ct_l3num(ct), nf_ct_protonum(ct));
Martin Josefsson605dcad2006-11-29 02:35:06 +0100133 NF_CT_ASSERT(l4proto);
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800134
135 if (seq_printf(s, "%-8s %u %-8s %u %ld ",
Patrick McHardy5e8fbe22008-04-14 11:15:52 +0200136 l3proto->name, nf_ct_l3num(ct),
137 l4proto->name, nf_ct_protonum(ct),
Patrick McHardyc88130b2008-01-31 04:42:11 -0800138 timer_pending(&ct->timeout)
139 ? (long)(ct->timeout.expires - jiffies)/HZ : 0) != 0)
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800140 return -ENOSPC;
141
Patrick McHardyc88130b2008-01-31 04:42:11 -0800142 if (l4proto->print_conntrack && l4proto->print_conntrack(s, ct))
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800143 return -ENOSPC;
144
Patrick McHardyc88130b2008-01-31 04:42:11 -0800145 if (print_tuple(s, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple,
Martin Josefsson605dcad2006-11-29 02:35:06 +0100146 l3proto, l4proto))
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800147 return -ENOSPC;
148
Patrick McHardyc88130b2008-01-31 04:42:11 -0800149 if (seq_print_counters(s, &ct->counters[IP_CT_DIR_ORIGINAL]))
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800150 return -ENOSPC;
151
Patrick McHardyc88130b2008-01-31 04:42:11 -0800152 if (!(test_bit(IPS_SEEN_REPLY_BIT, &ct->status)))
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800153 if (seq_printf(s, "[UNREPLIED] "))
154 return -ENOSPC;
155
Patrick McHardyc88130b2008-01-31 04:42:11 -0800156 if (print_tuple(s, &ct->tuplehash[IP_CT_DIR_REPLY].tuple,
Martin Josefsson605dcad2006-11-29 02:35:06 +0100157 l3proto, l4proto))
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800158 return -ENOSPC;
159
Patrick McHardyc88130b2008-01-31 04:42:11 -0800160 if (seq_print_counters(s, &ct->counters[IP_CT_DIR_REPLY]))
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800161 return -ENOSPC;
162
Patrick McHardyc88130b2008-01-31 04:42:11 -0800163 if (test_bit(IPS_ASSURED_BIT, &ct->status))
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800164 if (seq_printf(s, "[ASSURED] "))
165 return -ENOSPC;
166
167#if defined(CONFIG_NF_CONNTRACK_MARK)
Patrick McHardyc88130b2008-01-31 04:42:11 -0800168 if (seq_printf(s, "mark=%u ", ct->mark))
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800169 return -ENOSPC;
170#endif
171
James Morris7c9728c2006-06-09 00:31:46 -0700172#ifdef CONFIG_NF_CONNTRACK_SECMARK
Patrick McHardyc88130b2008-01-31 04:42:11 -0800173 if (seq_printf(s, "secmark=%u ", ct->secmark))
James Morris7c9728c2006-06-09 00:31:46 -0700174 return -ENOSPC;
175#endif
176
Patrick McHardyc88130b2008-01-31 04:42:11 -0800177 if (seq_printf(s, "use=%u\n", atomic_read(&ct->ct_general.use)))
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800178 return -ENOSPC;
YOSHIFUJI Hideakia5d29262007-07-19 10:44:21 +0900179
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800180 return 0;
181}
182
Philippe De Muyter56b3d972007-07-10 23:07:31 -0700183static const struct seq_operations ct_seq_ops = {
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800184 .start = ct_seq_start,
185 .next = ct_seq_next,
186 .stop = ct_seq_stop,
187 .show = ct_seq_show
188};
189
190static int ct_open(struct inode *inode, struct file *file)
191{
Pavel Emelyanove2da5912007-10-10 02:29:58 -0700192 return seq_open_private(file, &ct_seq_ops,
193 sizeof(struct ct_iter_state));
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800194}
195
Arjan van de Venda7071d2007-02-12 00:55:36 -0800196static const struct file_operations ct_file_ops = {
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800197 .owner = THIS_MODULE,
198 .open = ct_open,
199 .read = seq_read,
200 .llseek = seq_lseek,
201 .release = seq_release_private,
202};
203
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800204static void *ct_cpu_seq_start(struct seq_file *seq, loff_t *pos)
205{
206 int cpu;
207
208 if (*pos == 0)
209 return SEQ_START_TOKEN;
210
211 for (cpu = *pos-1; cpu < NR_CPUS; ++cpu) {
212 if (!cpu_possible(cpu))
213 continue;
214 *pos = cpu + 1;
215 return &per_cpu(nf_conntrack_stat, cpu);
216 }
217
218 return NULL;
219}
220
221static void *ct_cpu_seq_next(struct seq_file *seq, void *v, loff_t *pos)
222{
223 int cpu;
224
225 for (cpu = *pos; cpu < NR_CPUS; ++cpu) {
226 if (!cpu_possible(cpu))
227 continue;
228 *pos = cpu + 1;
229 return &per_cpu(nf_conntrack_stat, cpu);
230 }
231
232 return NULL;
233}
234
235static void ct_cpu_seq_stop(struct seq_file *seq, void *v)
236{
237}
238
239static int ct_cpu_seq_show(struct seq_file *seq, void *v)
240{
241 unsigned int nr_conntracks = atomic_read(&nf_conntrack_count);
Jan Engelhardt32948582008-01-31 04:53:24 -0800242 const struct ip_conntrack_stat *st = v;
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800243
244 if (v == SEQ_START_TOKEN) {
245 seq_printf(seq, "entries searched found new invalid ignore delete delete_list insert insert_failed drop early_drop icmp_error expect_new expect_create expect_delete\n");
246 return 0;
247 }
248
249 seq_printf(seq, "%08x %08x %08x %08x %08x %08x %08x %08x "
250 "%08x %08x %08x %08x %08x %08x %08x %08x \n",
251 nr_conntracks,
252 st->searched,
253 st->found,
254 st->new,
255 st->invalid,
256 st->ignore,
257 st->delete,
258 st->delete_list,
259 st->insert,
260 st->insert_failed,
261 st->drop,
262 st->early_drop,
263 st->error,
264
265 st->expect_new,
266 st->expect_create,
267 st->expect_delete
268 );
269 return 0;
270}
271
Philippe De Muyter56b3d972007-07-10 23:07:31 -0700272static const struct seq_operations ct_cpu_seq_ops = {
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800273 .start = ct_cpu_seq_start,
274 .next = ct_cpu_seq_next,
275 .stop = ct_cpu_seq_stop,
276 .show = ct_cpu_seq_show,
277};
278
279static int ct_cpu_seq_open(struct inode *inode, struct file *file)
280{
281 return seq_open(file, &ct_cpu_seq_ops);
282}
283
Arjan van de Venda7071d2007-02-12 00:55:36 -0800284static const struct file_operations ct_cpu_seq_fops = {
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800285 .owner = THIS_MODULE,
286 .open = ct_cpu_seq_open,
287 .read = seq_read,
288 .llseek = seq_lseek,
Pavel Emelyanov665bba12008-02-29 11:39:17 -0800289 .release = seq_release,
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800290};
Alexey Dobriyanb916f7d2008-03-20 15:15:43 +0100291
292static int nf_conntrack_standalone_init_proc(void)
293{
294 struct proc_dir_entry *pde;
295
296 pde = proc_net_fops_create(&init_net, "nf_conntrack", 0440, &ct_file_ops);
297 if (!pde)
298 goto out_nf_conntrack;
299 pde = create_proc_entry("nf_conntrack", S_IRUGO, init_net.proc_net_stat);
300 if (!pde)
301 goto out_stat_nf_conntrack;
302 pde->proc_fops = &ct_cpu_seq_fops;
303 pde->owner = THIS_MODULE;
304 return 0;
305
306out_stat_nf_conntrack:
307 proc_net_remove(&init_net, "nf_conntrack");
308out_nf_conntrack:
309 return -ENOMEM;
310}
311
312static void nf_conntrack_standalone_fini_proc(void)
313{
314 remove_proc_entry("nf_conntrack", init_net.proc_net_stat);
315 proc_net_remove(&init_net, "nf_conntrack");
316}
317#else
318static int nf_conntrack_standalone_init_proc(void)
319{
320 return 0;
321}
322
323static void nf_conntrack_standalone_fini_proc(void)
324{
325}
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800326#endif /* CONFIG_PROC_FS */
327
328/* Sysctl support */
329
Brian Haley94aec082006-09-18 00:05:22 -0700330int nf_conntrack_checksum __read_mostly = 1;
Patrick McHardy13b18332006-12-02 22:11:25 -0800331EXPORT_SYMBOL_GPL(nf_conntrack_checksum);
Adrian Bunk72b55822006-07-24 22:53:12 -0700332
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800333#ifdef CONFIG_SYSCTL
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800334/* Log invalid packets of a given protocol */
335static int log_invalid_proto_min = 0;
336static int log_invalid_proto_max = 255;
337
338static struct ctl_table_header *nf_ct_sysctl_header;
339
340static ctl_table nf_ct_sysctl_table[] = {
341 {
342 .ctl_name = NET_NF_CONNTRACK_MAX,
343 .procname = "nf_conntrack_max",
344 .data = &nf_conntrack_max,
345 .maxlen = sizeof(int),
346 .mode = 0644,
347 .proc_handler = &proc_dointvec,
348 },
349 {
350 .ctl_name = NET_NF_CONNTRACK_COUNT,
351 .procname = "nf_conntrack_count",
352 .data = &nf_conntrack_count,
353 .maxlen = sizeof(int),
354 .mode = 0444,
355 .proc_handler = &proc_dointvec,
356 },
357 {
358 .ctl_name = NET_NF_CONNTRACK_BUCKETS,
359 .procname = "nf_conntrack_buckets",
360 .data = &nf_conntrack_htable_size,
361 .maxlen = sizeof(unsigned int),
362 .mode = 0444,
363 .proc_handler = &proc_dointvec,
364 },
365 {
Patrick McHardy39a27a32006-05-29 18:23:54 -0700366 .ctl_name = NET_NF_CONNTRACK_CHECKSUM,
367 .procname = "nf_conntrack_checksum",
368 .data = &nf_conntrack_checksum,
369 .maxlen = sizeof(unsigned int),
370 .mode = 0644,
371 .proc_handler = &proc_dointvec,
372 },
373 {
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800374 .ctl_name = NET_NF_CONNTRACK_LOG_INVALID,
375 .procname = "nf_conntrack_log_invalid",
376 .data = &nf_ct_log_invalid,
377 .maxlen = sizeof(unsigned int),
378 .mode = 0644,
379 .proc_handler = &proc_dointvec_minmax,
380 .strategy = &sysctl_intvec,
381 .extra1 = &log_invalid_proto_min,
382 .extra2 = &log_invalid_proto_max,
383 },
Patrick McHardyf264a7d2007-07-07 22:36:24 -0700384 {
385 .ctl_name = CTL_UNNUMBERED,
386 .procname = "nf_conntrack_expect_max",
387 .data = &nf_ct_expect_max,
388 .maxlen = sizeof(int),
389 .mode = 0644,
390 .proc_handler = &proc_dointvec,
391 },
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800392 { .ctl_name = 0 }
393};
394
395#define NET_NF_CONNTRACK_MAX 2089
396
397static ctl_table nf_ct_netfilter_table[] = {
398 {
399 .ctl_name = NET_NETFILTER,
400 .procname = "netfilter",
401 .mode = 0555,
402 .child = nf_ct_sysctl_table,
403 },
404 {
405 .ctl_name = NET_NF_CONNTRACK_MAX,
406 .procname = "nf_conntrack_max",
407 .data = &nf_conntrack_max,
408 .maxlen = sizeof(int),
409 .mode = 0644,
410 .proc_handler = &proc_dointvec,
411 },
412 { .ctl_name = 0 }
413};
414
Patrick McHardy9e232492008-01-31 04:54:45 -0800415static struct ctl_path nf_ct_path[] = {
Pavel Emelyanov3d7cc2b2008-01-09 00:33:11 -0800416 { .procname = "net", .ctl_name = CTL_NET, },
417 { }
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800418};
Pavel Emelyanov3d7cc2b2008-01-09 00:33:11 -0800419
Patrick McHardy13b18332006-12-02 22:11:25 -0800420EXPORT_SYMBOL_GPL(nf_ct_log_invalid);
Alexey Dobriyanb916f7d2008-03-20 15:15:43 +0100421
422static int nf_conntrack_standalone_init_sysctl(void)
423{
424 nf_ct_sysctl_header =
425 register_sysctl_paths(nf_ct_path, nf_ct_netfilter_table);
426 if (nf_ct_sysctl_header == NULL) {
427 printk("nf_conntrack: can't register to sysctl.\n");
428 return -ENOMEM;
429 }
430 return 0;
431
432}
433
434static void nf_conntrack_standalone_fini_sysctl(void)
435{
436 unregister_sysctl_table(nf_ct_sysctl_header);
437}
438#else
439static int nf_conntrack_standalone_init_sysctl(void)
440{
441 return 0;
442}
443
444static void nf_conntrack_standalone_fini_sysctl(void)
445{
446}
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800447#endif /* CONFIG_SYSCTL */
448
Andrew Morton65b4b4e2006-03-28 16:37:06 -0800449static int __init nf_conntrack_standalone_init(void)
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800450{
Alexey Dobriyanb916f7d2008-03-20 15:15:43 +0100451 int ret;
Patrick McHardy32292a72006-04-06 14:11:30 -0700452
453 ret = nf_conntrack_init();
454 if (ret < 0)
Alexey Dobriyanb916f7d2008-03-20 15:15:43 +0100455 goto out;
456 ret = nf_conntrack_standalone_init_proc();
457 if (ret < 0)
458 goto out_proc;
459 ret = nf_conntrack_standalone_init_sysctl();
460 if (ret < 0)
461 goto out_sysctl;
462 return 0;
Patrick McHardy32292a72006-04-06 14:11:30 -0700463
Alexey Dobriyanb916f7d2008-03-20 15:15:43 +0100464out_sysctl:
465 nf_conntrack_standalone_fini_proc();
466out_proc:
Patrick McHardy32292a72006-04-06 14:11:30 -0700467 nf_conntrack_cleanup();
Alexey Dobriyanb916f7d2008-03-20 15:15:43 +0100468out:
Patrick McHardy32292a72006-04-06 14:11:30 -0700469 return ret;
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800470}
471
Andrew Morton65b4b4e2006-03-28 16:37:06 -0800472static void __exit nf_conntrack_standalone_fini(void)
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800473{
Alexey Dobriyanb916f7d2008-03-20 15:15:43 +0100474 nf_conntrack_standalone_fini_sysctl();
475 nf_conntrack_standalone_fini_proc();
Patrick McHardy32292a72006-04-06 14:11:30 -0700476 nf_conntrack_cleanup();
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800477}
478
Andrew Morton65b4b4e2006-03-28 16:37:06 -0800479module_init(nf_conntrack_standalone_init);
480module_exit(nf_conntrack_standalone_fini);
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800481
482/* Some modules need us, but don't depend directly on any symbol.
483 They should call this. */
Harald Welte2e4e6a12006-01-12 13:30:04 -0800484void need_conntrack(void)
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800485{
486}
Patrick McHardy13b18332006-12-02 22:11:25 -0800487EXPORT_SYMBOL_GPL(need_conntrack);