[NETFILTER]: nf_conntrack: remove ASSERT_{READ,WRITE}_LOCK
[pandora-kernel.git] / net / netfilter / nf_conntrack_standalone.c
1 /* This file contains all the functions required for the standalone
2    nf_conntrack module.
3
4    These are not required by the compatibility layer.
5 */
6
7 /* (C) 1999-2001 Paul `Rusty' Russell
8  * (C) 2002-2004 Netfilter Core Team <coreteam@netfilter.org>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License version 2 as
12  * published by the Free Software Foundation.
13  *
14  * 16 Dec 2003: Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp>
15  *      - generalize L3 protocol dependent part.
16  *
17  * Derived from net/ipv4/netfilter/ip_conntrack_standalone.c
18  */
19
20 #include <linux/types.h>
21 #include <linux/netfilter.h>
22 #include <linux/module.h>
23 #include <linux/skbuff.h>
24 #include <linux/proc_fs.h>
25 #include <linux/seq_file.h>
26 #include <linux/percpu.h>
27 #include <linux/netdevice.h>
28 #ifdef CONFIG_SYSCTL
29 #include <linux/sysctl.h>
30 #endif
31
32 #include <net/netfilter/nf_conntrack.h>
33 #include <net/netfilter/nf_conntrack_core.h>
34 #include <net/netfilter/nf_conntrack_l3proto.h>
35 #include <net/netfilter/nf_conntrack_l4proto.h>
36 #include <net/netfilter/nf_conntrack_expect.h>
37 #include <net/netfilter/nf_conntrack_helper.h>
38
39 #if 0
40 #define DEBUGP printk
41 #else
42 #define DEBUGP(format, args...)
43 #endif
44
45 MODULE_LICENSE("GPL");
46
47 extern atomic_t nf_conntrack_count;
48 DECLARE_PER_CPU(struct ip_conntrack_stat, nf_conntrack_stat);
49
50 #ifdef CONFIG_PROC_FS
51 int
52 print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple,
53             struct nf_conntrack_l3proto *l3proto,
54             struct nf_conntrack_l4proto *l4proto)
55 {
56         return l3proto->print_tuple(s, tuple) || l4proto->print_tuple(s, tuple);
57 }
58
59 #ifdef CONFIG_NF_CT_ACCT
60 static unsigned int
61 seq_print_counters(struct seq_file *s,
62                    const struct ip_conntrack_counter *counter)
63 {
64         return seq_printf(s, "packets=%llu bytes=%llu ",
65                           (unsigned long long)counter->packets,
66                           (unsigned long long)counter->bytes);
67 }
68 #else
69 #define seq_print_counters(x, y)        0
70 #endif
71
72 struct ct_iter_state {
73         unsigned int bucket;
74 };
75
76 static struct list_head *ct_get_first(struct seq_file *seq)
77 {
78         struct ct_iter_state *st = seq->private;
79
80         for (st->bucket = 0;
81              st->bucket < nf_conntrack_htable_size;
82              st->bucket++) {
83                 if (!list_empty(&nf_conntrack_hash[st->bucket]))
84                         return nf_conntrack_hash[st->bucket].next;
85         }
86         return NULL;
87 }
88
89 static struct list_head *ct_get_next(struct seq_file *seq, struct list_head *head)
90 {
91         struct ct_iter_state *st = seq->private;
92
93         head = head->next;
94         while (head == &nf_conntrack_hash[st->bucket]) {
95                 if (++st->bucket >= nf_conntrack_htable_size)
96                         return NULL;
97                 head = nf_conntrack_hash[st->bucket].next;
98         }
99         return head;
100 }
101
102 static struct list_head *ct_get_idx(struct seq_file *seq, loff_t pos)
103 {
104         struct list_head *head = ct_get_first(seq);
105
106         if (head)
107                 while (pos && (head = ct_get_next(seq, head)))
108                         pos--;
109         return pos ? NULL : head;
110 }
111
112 static void *ct_seq_start(struct seq_file *seq, loff_t *pos)
113 {
114         read_lock_bh(&nf_conntrack_lock);
115         return ct_get_idx(seq, *pos);
116 }
117
118 static void *ct_seq_next(struct seq_file *s, void *v, loff_t *pos)
119 {
120         (*pos)++;
121         return ct_get_next(s, v);
122 }
123
124 static void ct_seq_stop(struct seq_file *s, void *v)
125 {
126         read_unlock_bh(&nf_conntrack_lock);
127 }
128
129 /* return 0 on success, 1 in case of error */
130 static int ct_seq_show(struct seq_file *s, void *v)
131 {
132         const struct nf_conntrack_tuple_hash *hash = v;
133         const struct nf_conn *conntrack = nf_ct_tuplehash_to_ctrack(hash);
134         struct nf_conntrack_l3proto *l3proto;
135         struct nf_conntrack_l4proto *l4proto;
136
137         NF_CT_ASSERT(conntrack);
138
139         /* we only want to print DIR_ORIGINAL */
140         if (NF_CT_DIRECTION(hash))
141                 return 0;
142
143         l3proto = __nf_ct_l3proto_find(conntrack->tuplehash[IP_CT_DIR_ORIGINAL]
144                                        .tuple.src.l3num);
145
146         NF_CT_ASSERT(l3proto);
147         l4proto = __nf_ct_l4proto_find(conntrack->tuplehash[IP_CT_DIR_ORIGINAL]
148                                    .tuple.src.l3num,
149                                    conntrack->tuplehash[IP_CT_DIR_ORIGINAL]
150                                    .tuple.dst.protonum);
151         NF_CT_ASSERT(l4proto);
152
153         if (seq_printf(s, "%-8s %u %-8s %u %ld ",
154                        l3proto->name,
155                        conntrack->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.l3num,
156                        l4proto->name,
157                        conntrack->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum,
158                        timer_pending(&conntrack->timeout)
159                        ? (long)(conntrack->timeout.expires - jiffies)/HZ : 0) != 0)
160                 return -ENOSPC;
161
162         if (l3proto->print_conntrack(s, conntrack))
163                 return -ENOSPC;
164
165         if (l4proto->print_conntrack(s, conntrack))
166                 return -ENOSPC;
167
168         if (print_tuple(s, &conntrack->tuplehash[IP_CT_DIR_ORIGINAL].tuple,
169                         l3proto, l4proto))
170                 return -ENOSPC;
171
172         if (seq_print_counters(s, &conntrack->counters[IP_CT_DIR_ORIGINAL]))
173                 return -ENOSPC;
174
175         if (!(test_bit(IPS_SEEN_REPLY_BIT, &conntrack->status)))
176                 if (seq_printf(s, "[UNREPLIED] "))
177                         return -ENOSPC;
178
179         if (print_tuple(s, &conntrack->tuplehash[IP_CT_DIR_REPLY].tuple,
180                         l3proto, l4proto))
181                 return -ENOSPC;
182
183         if (seq_print_counters(s, &conntrack->counters[IP_CT_DIR_REPLY]))
184                 return -ENOSPC;
185
186         if (test_bit(IPS_ASSURED_BIT, &conntrack->status))
187                 if (seq_printf(s, "[ASSURED] "))
188                         return -ENOSPC;
189
190 #if defined(CONFIG_NF_CONNTRACK_MARK)
191         if (seq_printf(s, "mark=%u ", conntrack->mark))
192                 return -ENOSPC;
193 #endif
194
195 #ifdef CONFIG_NF_CONNTRACK_SECMARK
196         if (seq_printf(s, "secmark=%u ", conntrack->secmark))
197                 return -ENOSPC;
198 #endif
199
200         if (seq_printf(s, "use=%u\n", atomic_read(&conntrack->ct_general.use)))
201                 return -ENOSPC;
202         
203         return 0;
204 }
205
206 static struct seq_operations ct_seq_ops = {
207         .start = ct_seq_start,
208         .next  = ct_seq_next,
209         .stop  = ct_seq_stop,
210         .show  = ct_seq_show
211 };
212
213 static int ct_open(struct inode *inode, struct file *file)
214 {
215         struct seq_file *seq;
216         struct ct_iter_state *st;
217         int ret;
218
219         st = kmalloc(sizeof(struct ct_iter_state), GFP_KERNEL);
220         if (st == NULL)
221                 return -ENOMEM;
222         ret = seq_open(file, &ct_seq_ops);
223         if (ret)
224                 goto out_free;
225         seq          = file->private_data;
226         seq->private = st;
227         memset(st, 0, sizeof(struct ct_iter_state));
228         return ret;
229 out_free:
230         kfree(st);
231         return ret;
232 }
233
234 static struct file_operations ct_file_ops = {
235         .owner   = THIS_MODULE,
236         .open    = ct_open,
237         .read    = seq_read,
238         .llseek  = seq_lseek,
239         .release = seq_release_private,
240 };
241
242 static void *ct_cpu_seq_start(struct seq_file *seq, loff_t *pos)
243 {
244         int cpu;
245
246         if (*pos == 0)
247                 return SEQ_START_TOKEN;
248
249         for (cpu = *pos-1; cpu < NR_CPUS; ++cpu) {
250                 if (!cpu_possible(cpu))
251                         continue;
252                 *pos = cpu + 1;
253                 return &per_cpu(nf_conntrack_stat, cpu);
254         }
255
256         return NULL;
257 }
258
259 static void *ct_cpu_seq_next(struct seq_file *seq, void *v, loff_t *pos)
260 {
261         int cpu;
262
263         for (cpu = *pos; cpu < NR_CPUS; ++cpu) {
264                 if (!cpu_possible(cpu))
265                         continue;
266                 *pos = cpu + 1;
267                 return &per_cpu(nf_conntrack_stat, cpu);
268         }
269
270         return NULL;
271 }
272
273 static void ct_cpu_seq_stop(struct seq_file *seq, void *v)
274 {
275 }
276
277 static int ct_cpu_seq_show(struct seq_file *seq, void *v)
278 {
279         unsigned int nr_conntracks = atomic_read(&nf_conntrack_count);
280         struct ip_conntrack_stat *st = v;
281
282         if (v == SEQ_START_TOKEN) {
283                 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");
284                 return 0;
285         }
286
287         seq_printf(seq, "%08x  %08x %08x %08x %08x %08x %08x %08x "
288                         "%08x %08x %08x %08x %08x  %08x %08x %08x \n",
289                    nr_conntracks,
290                    st->searched,
291                    st->found,
292                    st->new,
293                    st->invalid,
294                    st->ignore,
295                    st->delete,
296                    st->delete_list,
297                    st->insert,
298                    st->insert_failed,
299                    st->drop,
300                    st->early_drop,
301                    st->error,
302
303                    st->expect_new,
304                    st->expect_create,
305                    st->expect_delete
306                 );
307         return 0;
308 }
309
310 static struct seq_operations ct_cpu_seq_ops = {
311         .start  = ct_cpu_seq_start,
312         .next   = ct_cpu_seq_next,
313         .stop   = ct_cpu_seq_stop,
314         .show   = ct_cpu_seq_show,
315 };
316
317 static int ct_cpu_seq_open(struct inode *inode, struct file *file)
318 {
319         return seq_open(file, &ct_cpu_seq_ops);
320 }
321
322 static struct file_operations ct_cpu_seq_fops = {
323         .owner   = THIS_MODULE,
324         .open    = ct_cpu_seq_open,
325         .read    = seq_read,
326         .llseek  = seq_lseek,
327         .release = seq_release_private,
328 };
329 #endif /* CONFIG_PROC_FS */
330
331 /* Sysctl support */
332
333 int nf_conntrack_checksum __read_mostly = 1;
334
335 #ifdef CONFIG_SYSCTL
336
337 /* From nf_conntrack_core.c */
338 extern int nf_conntrack_max;
339 extern unsigned int nf_conntrack_htable_size;
340
341 /* From nf_conntrack_proto_tcp.c */
342 extern unsigned int nf_ct_tcp_timeout_syn_sent;
343 extern unsigned int nf_ct_tcp_timeout_syn_recv;
344 extern unsigned int nf_ct_tcp_timeout_established;
345 extern unsigned int nf_ct_tcp_timeout_fin_wait;
346 extern unsigned int nf_ct_tcp_timeout_close_wait;
347 extern unsigned int nf_ct_tcp_timeout_last_ack;
348 extern unsigned int nf_ct_tcp_timeout_time_wait;
349 extern unsigned int nf_ct_tcp_timeout_close;
350 extern unsigned int nf_ct_tcp_timeout_max_retrans;
351 extern int nf_ct_tcp_loose;
352 extern int nf_ct_tcp_be_liberal;
353 extern int nf_ct_tcp_max_retrans;
354
355 /* From nf_conntrack_proto_udp.c */
356 extern unsigned int nf_ct_udp_timeout;
357 extern unsigned int nf_ct_udp_timeout_stream;
358
359 /* From nf_conntrack_proto_generic.c */
360 extern unsigned int nf_ct_generic_timeout;
361
362 /* Log invalid packets of a given protocol */
363 static int log_invalid_proto_min = 0;
364 static int log_invalid_proto_max = 255;
365
366 static struct ctl_table_header *nf_ct_sysctl_header;
367
368 static ctl_table nf_ct_sysctl_table[] = {
369         {
370                 .ctl_name       = NET_NF_CONNTRACK_MAX,
371                 .procname       = "nf_conntrack_max",
372                 .data           = &nf_conntrack_max,
373                 .maxlen         = sizeof(int),
374                 .mode           = 0644,
375                 .proc_handler   = &proc_dointvec,
376         },
377         {
378                 .ctl_name       = NET_NF_CONNTRACK_COUNT,
379                 .procname       = "nf_conntrack_count",
380                 .data           = &nf_conntrack_count,
381                 .maxlen         = sizeof(int),
382                 .mode           = 0444,
383                 .proc_handler   = &proc_dointvec,
384         },
385         {
386                 .ctl_name       = NET_NF_CONNTRACK_BUCKETS,
387                 .procname       = "nf_conntrack_buckets",
388                 .data           = &nf_conntrack_htable_size,
389                 .maxlen         = sizeof(unsigned int),
390                 .mode           = 0444,
391                 .proc_handler   = &proc_dointvec,
392         },
393         {
394                 .ctl_name       = NET_NF_CONNTRACK_CHECKSUM,
395                 .procname       = "nf_conntrack_checksum",
396                 .data           = &nf_conntrack_checksum,
397                 .maxlen         = sizeof(unsigned int),
398                 .mode           = 0644,
399                 .proc_handler   = &proc_dointvec,
400         },
401         {
402                 .ctl_name       = NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT,
403                 .procname       = "nf_conntrack_tcp_timeout_syn_sent",
404                 .data           = &nf_ct_tcp_timeout_syn_sent,
405                 .maxlen         = sizeof(unsigned int),
406                 .mode           = 0644,
407                 .proc_handler   = &proc_dointvec_jiffies,
408         },
409         {
410                 .ctl_name       = NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_RECV,
411                 .procname       = "nf_conntrack_tcp_timeout_syn_recv",
412                 .data           = &nf_ct_tcp_timeout_syn_recv,
413                 .maxlen         = sizeof(unsigned int),
414                 .mode           = 0644,
415                 .proc_handler   = &proc_dointvec_jiffies,
416         },
417         {
418                 .ctl_name       = NET_NF_CONNTRACK_TCP_TIMEOUT_ESTABLISHED,
419                 .procname       = "nf_conntrack_tcp_timeout_established",
420                 .data           = &nf_ct_tcp_timeout_established,
421                 .maxlen         = sizeof(unsigned int),
422                 .mode           = 0644,
423                 .proc_handler   = &proc_dointvec_jiffies,
424         },
425         {
426                 .ctl_name       = NET_NF_CONNTRACK_TCP_TIMEOUT_FIN_WAIT,
427                 .procname       = "nf_conntrack_tcp_timeout_fin_wait",
428                 .data           = &nf_ct_tcp_timeout_fin_wait,
429                 .maxlen         = sizeof(unsigned int),
430                 .mode           = 0644,
431                 .proc_handler   = &proc_dointvec_jiffies,
432         },
433         {
434                 .ctl_name       = NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE_WAIT,
435                 .procname       = "nf_conntrack_tcp_timeout_close_wait",
436                 .data           = &nf_ct_tcp_timeout_close_wait,
437                 .maxlen         = sizeof(unsigned int),
438                 .mode           = 0644,
439                 .proc_handler   = &proc_dointvec_jiffies,
440         },
441         {
442                 .ctl_name       = NET_NF_CONNTRACK_TCP_TIMEOUT_LAST_ACK,
443                 .procname       = "nf_conntrack_tcp_timeout_last_ack",
444                 .data           = &nf_ct_tcp_timeout_last_ack,
445                 .maxlen         = sizeof(unsigned int),
446                 .mode           = 0644,
447                 .proc_handler   = &proc_dointvec_jiffies,
448         },
449         {
450                 .ctl_name       = NET_NF_CONNTRACK_TCP_TIMEOUT_TIME_WAIT,
451                 .procname       = "nf_conntrack_tcp_timeout_time_wait",
452                 .data           = &nf_ct_tcp_timeout_time_wait,
453                 .maxlen         = sizeof(unsigned int),
454                 .mode           = 0644,
455                 .proc_handler   = &proc_dointvec_jiffies,
456         },
457         {
458                 .ctl_name       = NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE,
459                 .procname       = "nf_conntrack_tcp_timeout_close",
460                 .data           = &nf_ct_tcp_timeout_close,
461                 .maxlen         = sizeof(unsigned int),
462                 .mode           = 0644,
463                 .proc_handler   = &proc_dointvec_jiffies,
464         },
465         {
466                 .ctl_name       = NET_NF_CONNTRACK_UDP_TIMEOUT,
467                 .procname       = "nf_conntrack_udp_timeout",
468                 .data           = &nf_ct_udp_timeout,
469                 .maxlen         = sizeof(unsigned int),
470                 .mode           = 0644,
471                 .proc_handler   = &proc_dointvec_jiffies,
472         },
473         {
474                 .ctl_name       = NET_NF_CONNTRACK_UDP_TIMEOUT_STREAM,
475                 .procname       = "nf_conntrack_udp_timeout_stream",
476                 .data           = &nf_ct_udp_timeout_stream,
477                 .maxlen         = sizeof(unsigned int),
478                 .mode           = 0644,
479                 .proc_handler   = &proc_dointvec_jiffies,
480         },
481         {
482                 .ctl_name       = NET_NF_CONNTRACK_GENERIC_TIMEOUT,
483                 .procname       = "nf_conntrack_generic_timeout",
484                 .data           = &nf_ct_generic_timeout,
485                 .maxlen         = sizeof(unsigned int),
486                 .mode           = 0644,
487                 .proc_handler   = &proc_dointvec_jiffies,
488         },
489         {
490                 .ctl_name       = NET_NF_CONNTRACK_LOG_INVALID,
491                 .procname       = "nf_conntrack_log_invalid",
492                 .data           = &nf_ct_log_invalid,
493                 .maxlen         = sizeof(unsigned int),
494                 .mode           = 0644,
495                 .proc_handler   = &proc_dointvec_minmax,
496                 .strategy       = &sysctl_intvec,
497                 .extra1         = &log_invalid_proto_min,
498                 .extra2         = &log_invalid_proto_max,
499         },
500         {
501                 .ctl_name       = NET_NF_CONNTRACK_TCP_TIMEOUT_MAX_RETRANS,
502                 .procname       = "nf_conntrack_tcp_timeout_max_retrans",
503                 .data           = &nf_ct_tcp_timeout_max_retrans,
504                 .maxlen         = sizeof(unsigned int),
505                 .mode           = 0644,
506                 .proc_handler   = &proc_dointvec_jiffies,
507         },
508         {
509                 .ctl_name       = NET_NF_CONNTRACK_TCP_LOOSE,
510                 .procname       = "nf_conntrack_tcp_loose",
511                 .data           = &nf_ct_tcp_loose,
512                 .maxlen         = sizeof(unsigned int),
513                 .mode           = 0644,
514                 .proc_handler   = &proc_dointvec,
515         },
516         {
517                 .ctl_name       = NET_NF_CONNTRACK_TCP_BE_LIBERAL,
518                 .procname       = "nf_conntrack_tcp_be_liberal",
519                 .data           = &nf_ct_tcp_be_liberal,
520                 .maxlen         = sizeof(unsigned int),
521                 .mode           = 0644,
522                 .proc_handler   = &proc_dointvec,
523         },
524         {
525                 .ctl_name       = NET_NF_CONNTRACK_TCP_MAX_RETRANS,
526                 .procname       = "nf_conntrack_tcp_max_retrans",
527                 .data           = &nf_ct_tcp_max_retrans,
528                 .maxlen         = sizeof(unsigned int),
529                 .mode           = 0644,
530                 .proc_handler   = &proc_dointvec,
531         },
532
533         { .ctl_name = 0 }
534 };
535
536 #define NET_NF_CONNTRACK_MAX 2089
537
538 static ctl_table nf_ct_netfilter_table[] = {
539         {
540                 .ctl_name       = NET_NETFILTER,
541                 .procname       = "netfilter",
542                 .mode           = 0555,
543                 .child          = nf_ct_sysctl_table,
544         },
545         {
546                 .ctl_name       = NET_NF_CONNTRACK_MAX,
547                 .procname       = "nf_conntrack_max",
548                 .data           = &nf_conntrack_max,
549                 .maxlen         = sizeof(int),
550                 .mode           = 0644,
551                 .proc_handler   = &proc_dointvec,
552         },
553         { .ctl_name = 0 }
554 };
555
556 static ctl_table nf_ct_net_table[] = {
557         {
558                 .ctl_name       = CTL_NET,
559                 .procname       = "net",
560                 .mode           = 0555,
561                 .child          = nf_ct_netfilter_table,
562         },
563         { .ctl_name = 0 }
564 };
565 EXPORT_SYMBOL(nf_ct_log_invalid);
566 #endif /* CONFIG_SYSCTL */
567
568 static int __init nf_conntrack_standalone_init(void)
569 {
570 #ifdef CONFIG_PROC_FS
571         struct proc_dir_entry *proc, *proc_exp, *proc_stat;
572 #endif
573         int ret = 0;
574
575         ret = nf_conntrack_init();
576         if (ret < 0)
577                 return ret;
578
579 #ifdef CONFIG_PROC_FS
580         proc = proc_net_fops_create("nf_conntrack", 0440, &ct_file_ops);
581         if (!proc) goto cleanup_init;
582
583         proc_exp = proc_net_fops_create("nf_conntrack_expect", 0440,
584                                         &exp_file_ops);
585         if (!proc_exp) goto cleanup_proc;
586
587         proc_stat = create_proc_entry("nf_conntrack", S_IRUGO, proc_net_stat);
588         if (!proc_stat)
589                 goto cleanup_proc_exp;
590
591         proc_stat->proc_fops = &ct_cpu_seq_fops;
592         proc_stat->owner = THIS_MODULE;
593 #endif
594 #ifdef CONFIG_SYSCTL
595         nf_ct_sysctl_header = register_sysctl_table(nf_ct_net_table, 0);
596         if (nf_ct_sysctl_header == NULL) {
597                 printk("nf_conntrack: can't register to sysctl.\n");
598                 ret = -ENOMEM;
599                 goto cleanup_proc_stat;
600         }
601 #endif
602         return ret;
603
604 #ifdef CONFIG_SYSCTL
605  cleanup_proc_stat:
606 #endif
607 #ifdef CONFIG_PROC_FS
608         remove_proc_entry("nf_conntrack", proc_net_stat);
609  cleanup_proc_exp:
610         proc_net_remove("nf_conntrack_expect");
611  cleanup_proc:
612         proc_net_remove("nf_conntrack");
613  cleanup_init:
614 #endif /* CNFIG_PROC_FS */
615         nf_conntrack_cleanup();
616         return ret;
617 }
618
619 static void __exit nf_conntrack_standalone_fini(void)
620 {
621 #ifdef CONFIG_SYSCTL
622         unregister_sysctl_table(nf_ct_sysctl_header);
623 #endif
624 #ifdef CONFIG_PROC_FS
625         remove_proc_entry("nf_conntrack", proc_net_stat);
626         proc_net_remove("nf_conntrack_expect");
627         proc_net_remove("nf_conntrack");
628 #endif /* CNFIG_PROC_FS */
629         nf_conntrack_cleanup();
630 }
631
632 module_init(nf_conntrack_standalone_init);
633 module_exit(nf_conntrack_standalone_fini);
634
635 /* Some modules need us, but don't depend directly on any symbol.
636    They should call this. */
637 void need_conntrack(void)
638 {
639 }
640
641 #ifdef CONFIG_NF_CONNTRACK_EVENTS
642 EXPORT_SYMBOL_GPL(nf_conntrack_chain);
643 EXPORT_SYMBOL_GPL(nf_conntrack_expect_chain);
644 EXPORT_SYMBOL_GPL(nf_conntrack_register_notifier);
645 EXPORT_SYMBOL_GPL(nf_conntrack_unregister_notifier);
646 EXPORT_SYMBOL_GPL(__nf_ct_event_cache_init);
647 EXPORT_PER_CPU_SYMBOL_GPL(nf_conntrack_ecache);
648 EXPORT_SYMBOL_GPL(nf_ct_deliver_cached_events);
649 #endif
650 EXPORT_SYMBOL(nf_ct_l3proto_try_module_get);
651 EXPORT_SYMBOL(nf_ct_l3proto_module_put);
652 EXPORT_SYMBOL(nf_conntrack_l3proto_register);
653 EXPORT_SYMBOL(nf_conntrack_l3proto_unregister);
654 EXPORT_SYMBOL(nf_conntrack_l4proto_register);
655 EXPORT_SYMBOL(nf_conntrack_l4proto_unregister);
656 EXPORT_SYMBOL(nf_ct_invert_tuplepr);
657 EXPORT_SYMBOL(nf_conntrack_destroyed);
658 EXPORT_SYMBOL(need_conntrack);
659 EXPORT_SYMBOL(nf_conntrack_helper_register);
660 EXPORT_SYMBOL(nf_conntrack_helper_unregister);
661 EXPORT_SYMBOL(nf_ct_iterate_cleanup);
662 EXPORT_SYMBOL(__nf_ct_refresh_acct);
663 EXPORT_SYMBOL(nf_ct_protos);
664 EXPORT_SYMBOL(__nf_ct_l4proto_find);
665 EXPORT_SYMBOL(nf_ct_l4proto_find_get);
666 EXPORT_SYMBOL(nf_ct_l4proto_put);
667 EXPORT_SYMBOL(nf_ct_l3proto_find_get);
668 EXPORT_SYMBOL(nf_ct_l3proto_put);
669 EXPORT_SYMBOL(nf_ct_l3protos);
670 EXPORT_SYMBOL_GPL(nf_conntrack_checksum);
671 EXPORT_SYMBOL(nf_conntrack_expect_alloc);
672 EXPORT_SYMBOL(nf_conntrack_expect_put);
673 EXPORT_SYMBOL(nf_conntrack_expect_related);
674 EXPORT_SYMBOL(nf_conntrack_unexpect_related);
675 EXPORT_SYMBOL(nf_conntrack_tuple_taken);
676 EXPORT_SYMBOL(nf_conntrack_htable_size);
677 EXPORT_SYMBOL(nf_conntrack_lock);
678 EXPORT_SYMBOL(nf_conntrack_hash);
679 EXPORT_SYMBOL(nf_conntrack_untracked);
680 EXPORT_SYMBOL_GPL(nf_conntrack_find_get);
681 #ifdef CONFIG_IP_NF_NAT_NEEDED
682 EXPORT_SYMBOL(nf_conntrack_tcp_update);
683 #endif
684 EXPORT_SYMBOL(__nf_conntrack_confirm);
685 EXPORT_SYMBOL(nf_ct_get_tuple);
686 EXPORT_SYMBOL(nf_ct_invert_tuple);
687 EXPORT_SYMBOL(nf_conntrack_in);
688 EXPORT_SYMBOL(__nf_conntrack_attach);
689 EXPORT_SYMBOL(nf_conntrack_alloc);
690 EXPORT_SYMBOL(nf_conntrack_free);
691 EXPORT_SYMBOL(nf_conntrack_flush);
692 EXPORT_SYMBOL(nf_ct_remove_expectations);
693 EXPORT_SYMBOL(nf_ct_helper_find_get);
694 EXPORT_SYMBOL(nf_ct_helper_put);
695 EXPORT_SYMBOL(__nf_conntrack_helper_find_byname);
696 EXPORT_SYMBOL(__nf_conntrack_find);
697 EXPORT_SYMBOL(nf_ct_unlink_expect);
698 EXPORT_SYMBOL(nf_conntrack_hash_insert);
699 EXPORT_SYMBOL(__nf_conntrack_expect_find);
700 EXPORT_SYMBOL(nf_conntrack_expect_find);
701 EXPORT_SYMBOL(nf_conntrack_expect_list);
702 #if defined(CONFIG_NF_CT_NETLINK) || \
703     defined(CONFIG_NF_CT_NETLINK_MODULE)
704 EXPORT_SYMBOL(nf_ct_port_tuple_to_nfattr);
705 EXPORT_SYMBOL(nf_ct_port_nfattr_to_tuple);
706 #endif