1 /* This file contains all the functions required for the standalone
4 These are not required by the compatibility layer.
7 /* (C) 1999-2001 Paul `Rusty' Russell
8 * (C) 2002-2004 Netfilter Core Team <coreteam@netfilter.org>
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.
14 * 16 Dec 2003: Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp>
15 * - generalize L3 protocol dependent part.
17 * Derived from net/ipv4/netfilter/ip_conntrack_standalone.c
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>
29 #include <linux/sysctl.h>
32 #define ASSERT_READ_LOCK(x)
33 #define ASSERT_WRITE_LOCK(x)
35 #include <net/netfilter/nf_conntrack.h>
36 #include <net/netfilter/nf_conntrack_l3proto.h>
37 #include <net/netfilter/nf_conntrack_protocol.h>
38 #include <net/netfilter/nf_conntrack_core.h>
39 #include <net/netfilter/nf_conntrack_helper.h>
44 #define DEBUGP(format, args...)
47 MODULE_LICENSE("GPL");
49 extern atomic_t nf_conntrack_count
;
50 DECLARE_PER_CPU(struct ip_conntrack_stat
, nf_conntrack_stat
);
52 static int kill_l3proto(struct nf_conn
*i
, void *data
)
54 return (i
->tuplehash
[IP_CT_DIR_ORIGINAL
].tuple
.src
.l3num
==
55 ((struct nf_conntrack_l3proto
*)data
)->l3proto
);
58 static int kill_proto(struct nf_conn
*i
, void *data
)
60 struct nf_conntrack_protocol
*proto
;
61 proto
= (struct nf_conntrack_protocol
*)data
;
62 return (i
->tuplehash
[IP_CT_DIR_ORIGINAL
].tuple
.dst
.protonum
==
64 (i
->tuplehash
[IP_CT_DIR_ORIGINAL
].tuple
.src
.l3num
==
70 print_tuple(struct seq_file
*s
, const struct nf_conntrack_tuple
*tuple
,
71 struct nf_conntrack_l3proto
*l3proto
,
72 struct nf_conntrack_protocol
*proto
)
74 return l3proto
->print_tuple(s
, tuple
) || proto
->print_tuple(s
, tuple
);
77 #ifdef CONFIG_NF_CT_ACCT
79 seq_print_counters(struct seq_file
*s
,
80 const struct ip_conntrack_counter
*counter
)
82 return seq_printf(s
, "packets=%llu bytes=%llu ",
83 (unsigned long long)counter
->packets
,
84 (unsigned long long)counter
->bytes
);
87 #define seq_print_counters(x, y) 0
90 struct ct_iter_state
{
94 static struct list_head
*ct_get_first(struct seq_file
*seq
)
96 struct ct_iter_state
*st
= seq
->private;
99 st
->bucket
< nf_conntrack_htable_size
;
101 if (!list_empty(&nf_conntrack_hash
[st
->bucket
]))
102 return nf_conntrack_hash
[st
->bucket
].next
;
107 static struct list_head
*ct_get_next(struct seq_file
*seq
, struct list_head
*head
)
109 struct ct_iter_state
*st
= seq
->private;
112 while (head
== &nf_conntrack_hash
[st
->bucket
]) {
113 if (++st
->bucket
>= nf_conntrack_htable_size
)
115 head
= nf_conntrack_hash
[st
->bucket
].next
;
120 static struct list_head
*ct_get_idx(struct seq_file
*seq
, loff_t pos
)
122 struct list_head
*head
= ct_get_first(seq
);
125 while (pos
&& (head
= ct_get_next(seq
, head
)))
127 return pos
? NULL
: head
;
130 static void *ct_seq_start(struct seq_file
*seq
, loff_t
*pos
)
132 read_lock_bh(&nf_conntrack_lock
);
133 return ct_get_idx(seq
, *pos
);
136 static void *ct_seq_next(struct seq_file
*s
, void *v
, loff_t
*pos
)
139 return ct_get_next(s
, v
);
142 static void ct_seq_stop(struct seq_file
*s
, void *v
)
144 read_unlock_bh(&nf_conntrack_lock
);
147 /* return 0 on success, 1 in case of error */
148 static int ct_seq_show(struct seq_file
*s
, void *v
)
150 const struct nf_conntrack_tuple_hash
*hash
= v
;
151 const struct nf_conn
*conntrack
= nf_ct_tuplehash_to_ctrack(hash
);
152 struct nf_conntrack_l3proto
*l3proto
;
153 struct nf_conntrack_protocol
*proto
;
155 ASSERT_READ_LOCK(&nf_conntrack_lock
);
156 NF_CT_ASSERT(conntrack
);
158 /* we only want to print DIR_ORIGINAL */
159 if (NF_CT_DIRECTION(hash
))
162 l3proto
= __nf_ct_l3proto_find(conntrack
->tuplehash
[IP_CT_DIR_ORIGINAL
]
165 NF_CT_ASSERT(l3proto
);
166 proto
= __nf_ct_proto_find(conntrack
->tuplehash
[IP_CT_DIR_ORIGINAL
]
168 conntrack
->tuplehash
[IP_CT_DIR_ORIGINAL
]
169 .tuple
.dst
.protonum
);
172 if (seq_printf(s
, "%-8s %u %-8s %u %ld ",
174 conntrack
->tuplehash
[IP_CT_DIR_ORIGINAL
].tuple
.src
.l3num
,
176 conntrack
->tuplehash
[IP_CT_DIR_ORIGINAL
].tuple
.dst
.protonum
,
177 timer_pending(&conntrack
->timeout
)
178 ? (long)(conntrack
->timeout
.expires
- jiffies
)/HZ
: 0) != 0)
181 if (l3proto
->print_conntrack(s
, conntrack
))
184 if (proto
->print_conntrack(s
, conntrack
))
187 if (print_tuple(s
, &conntrack
->tuplehash
[IP_CT_DIR_ORIGINAL
].tuple
,
191 if (seq_print_counters(s
, &conntrack
->counters
[IP_CT_DIR_ORIGINAL
]))
194 if (!(test_bit(IPS_SEEN_REPLY_BIT
, &conntrack
->status
)))
195 if (seq_printf(s
, "[UNREPLIED] "))
198 if (print_tuple(s
, &conntrack
->tuplehash
[IP_CT_DIR_REPLY
].tuple
,
202 if (seq_print_counters(s
, &conntrack
->counters
[IP_CT_DIR_REPLY
]))
205 if (test_bit(IPS_ASSURED_BIT
, &conntrack
->status
))
206 if (seq_printf(s
, "[ASSURED] "))
209 #if defined(CONFIG_NF_CONNTRACK_MARK)
210 if (seq_printf(s
, "mark=%u ", conntrack
->mark
))
214 #ifdef CONFIG_NF_CONNTRACK_SECMARK
215 if (seq_printf(s
, "secmark=%u ", conntrack
->secmark
))
219 if (seq_printf(s
, "use=%u\n", atomic_read(&conntrack
->ct_general
.use
)))
225 static struct seq_operations ct_seq_ops
= {
226 .start
= ct_seq_start
,
232 static int ct_open(struct inode
*inode
, struct file
*file
)
234 struct seq_file
*seq
;
235 struct ct_iter_state
*st
;
238 st
= kmalloc(sizeof(struct ct_iter_state
), GFP_KERNEL
);
241 ret
= seq_open(file
, &ct_seq_ops
);
244 seq
= file
->private_data
;
246 memset(st
, 0, sizeof(struct ct_iter_state
));
253 static struct file_operations ct_file_ops
= {
254 .owner
= THIS_MODULE
,
258 .release
= seq_release_private
,
262 static void *exp_seq_start(struct seq_file
*s
, loff_t
*pos
)
264 struct list_head
*e
= &nf_conntrack_expect_list
;
267 /* strange seq_file api calls stop even if we fail,
268 * thus we need to grab lock since stop unlocks */
269 read_lock_bh(&nf_conntrack_lock
);
274 for (i
= 0; i
<= *pos
; i
++) {
276 if (e
== &nf_conntrack_expect_list
)
282 static void *exp_seq_next(struct seq_file
*s
, void *v
, loff_t
*pos
)
284 struct list_head
*e
= v
;
289 if (e
== &nf_conntrack_expect_list
)
295 static void exp_seq_stop(struct seq_file
*s
, void *v
)
297 read_unlock_bh(&nf_conntrack_lock
);
300 static int exp_seq_show(struct seq_file
*s
, void *v
)
302 struct nf_conntrack_expect
*expect
= v
;
304 if (expect
->timeout
.function
)
305 seq_printf(s
, "%ld ", timer_pending(&expect
->timeout
)
306 ? (long)(expect
->timeout
.expires
- jiffies
)/HZ
: 0);
309 seq_printf(s
, "l3proto = %u proto=%u ",
310 expect
->tuple
.src
.l3num
,
311 expect
->tuple
.dst
.protonum
);
312 print_tuple(s
, &expect
->tuple
,
313 __nf_ct_l3proto_find(expect
->tuple
.src
.l3num
),
314 __nf_ct_proto_find(expect
->tuple
.src
.l3num
,
315 expect
->tuple
.dst
.protonum
));
316 return seq_putc(s
, '\n');
319 static struct seq_operations exp_seq_ops
= {
320 .start
= exp_seq_start
,
321 .next
= exp_seq_next
,
322 .stop
= exp_seq_stop
,
326 static int exp_open(struct inode
*inode
, struct file
*file
)
328 return seq_open(file
, &exp_seq_ops
);
331 static struct file_operations exp_file_ops
= {
332 .owner
= THIS_MODULE
,
336 .release
= seq_release
339 static void *ct_cpu_seq_start(struct seq_file
*seq
, loff_t
*pos
)
344 return SEQ_START_TOKEN
;
346 for (cpu
= *pos
-1; cpu
< NR_CPUS
; ++cpu
) {
347 if (!cpu_possible(cpu
))
350 return &per_cpu(nf_conntrack_stat
, cpu
);
356 static void *ct_cpu_seq_next(struct seq_file
*seq
, void *v
, loff_t
*pos
)
360 for (cpu
= *pos
; cpu
< NR_CPUS
; ++cpu
) {
361 if (!cpu_possible(cpu
))
364 return &per_cpu(nf_conntrack_stat
, cpu
);
370 static void ct_cpu_seq_stop(struct seq_file
*seq
, void *v
)
374 static int ct_cpu_seq_show(struct seq_file
*seq
, void *v
)
376 unsigned int nr_conntracks
= atomic_read(&nf_conntrack_count
);
377 struct ip_conntrack_stat
*st
= v
;
379 if (v
== SEQ_START_TOKEN
) {
380 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");
384 seq_printf(seq
, "%08x %08x %08x %08x %08x %08x %08x %08x "
385 "%08x %08x %08x %08x %08x %08x %08x %08x \n",
407 static struct seq_operations ct_cpu_seq_ops
= {
408 .start
= ct_cpu_seq_start
,
409 .next
= ct_cpu_seq_next
,
410 .stop
= ct_cpu_seq_stop
,
411 .show
= ct_cpu_seq_show
,
414 static int ct_cpu_seq_open(struct inode
*inode
, struct file
*file
)
416 return seq_open(file
, &ct_cpu_seq_ops
);
419 static struct file_operations ct_cpu_seq_fops
= {
420 .owner
= THIS_MODULE
,
421 .open
= ct_cpu_seq_open
,
424 .release
= seq_release_private
,
426 #endif /* CONFIG_PROC_FS */
430 int nf_conntrack_checksum __read_mostly
= 1;
434 /* From nf_conntrack_core.c */
435 extern int nf_conntrack_max
;
436 extern unsigned int nf_conntrack_htable_size
;
438 /* From nf_conntrack_proto_tcp.c */
439 extern unsigned int nf_ct_tcp_timeout_syn_sent
;
440 extern unsigned int nf_ct_tcp_timeout_syn_recv
;
441 extern unsigned int nf_ct_tcp_timeout_established
;
442 extern unsigned int nf_ct_tcp_timeout_fin_wait
;
443 extern unsigned int nf_ct_tcp_timeout_close_wait
;
444 extern unsigned int nf_ct_tcp_timeout_last_ack
;
445 extern unsigned int nf_ct_tcp_timeout_time_wait
;
446 extern unsigned int nf_ct_tcp_timeout_close
;
447 extern unsigned int nf_ct_tcp_timeout_max_retrans
;
448 extern int nf_ct_tcp_loose
;
449 extern int nf_ct_tcp_be_liberal
;
450 extern int nf_ct_tcp_max_retrans
;
452 /* From nf_conntrack_proto_udp.c */
453 extern unsigned int nf_ct_udp_timeout
;
454 extern unsigned int nf_ct_udp_timeout_stream
;
456 /* From nf_conntrack_proto_generic.c */
457 extern unsigned int nf_ct_generic_timeout
;
459 /* Log invalid packets of a given protocol */
460 static int log_invalid_proto_min
= 0;
461 static int log_invalid_proto_max
= 255;
463 static struct ctl_table_header
*nf_ct_sysctl_header
;
465 static ctl_table nf_ct_sysctl_table
[] = {
467 .ctl_name
= NET_NF_CONNTRACK_MAX
,
468 .procname
= "nf_conntrack_max",
469 .data
= &nf_conntrack_max
,
470 .maxlen
= sizeof(int),
472 .proc_handler
= &proc_dointvec
,
475 .ctl_name
= NET_NF_CONNTRACK_COUNT
,
476 .procname
= "nf_conntrack_count",
477 .data
= &nf_conntrack_count
,
478 .maxlen
= sizeof(int),
480 .proc_handler
= &proc_dointvec
,
483 .ctl_name
= NET_NF_CONNTRACK_BUCKETS
,
484 .procname
= "nf_conntrack_buckets",
485 .data
= &nf_conntrack_htable_size
,
486 .maxlen
= sizeof(unsigned int),
488 .proc_handler
= &proc_dointvec
,
491 .ctl_name
= NET_NF_CONNTRACK_CHECKSUM
,
492 .procname
= "nf_conntrack_checksum",
493 .data
= &nf_conntrack_checksum
,
494 .maxlen
= sizeof(unsigned int),
496 .proc_handler
= &proc_dointvec
,
499 .ctl_name
= NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT
,
500 .procname
= "nf_conntrack_tcp_timeout_syn_sent",
501 .data
= &nf_ct_tcp_timeout_syn_sent
,
502 .maxlen
= sizeof(unsigned int),
504 .proc_handler
= &proc_dointvec_jiffies
,
507 .ctl_name
= NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_RECV
,
508 .procname
= "nf_conntrack_tcp_timeout_syn_recv",
509 .data
= &nf_ct_tcp_timeout_syn_recv
,
510 .maxlen
= sizeof(unsigned int),
512 .proc_handler
= &proc_dointvec_jiffies
,
515 .ctl_name
= NET_NF_CONNTRACK_TCP_TIMEOUT_ESTABLISHED
,
516 .procname
= "nf_conntrack_tcp_timeout_established",
517 .data
= &nf_ct_tcp_timeout_established
,
518 .maxlen
= sizeof(unsigned int),
520 .proc_handler
= &proc_dointvec_jiffies
,
523 .ctl_name
= NET_NF_CONNTRACK_TCP_TIMEOUT_FIN_WAIT
,
524 .procname
= "nf_conntrack_tcp_timeout_fin_wait",
525 .data
= &nf_ct_tcp_timeout_fin_wait
,
526 .maxlen
= sizeof(unsigned int),
528 .proc_handler
= &proc_dointvec_jiffies
,
531 .ctl_name
= NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE_WAIT
,
532 .procname
= "nf_conntrack_tcp_timeout_close_wait",
533 .data
= &nf_ct_tcp_timeout_close_wait
,
534 .maxlen
= sizeof(unsigned int),
536 .proc_handler
= &proc_dointvec_jiffies
,
539 .ctl_name
= NET_NF_CONNTRACK_TCP_TIMEOUT_LAST_ACK
,
540 .procname
= "nf_conntrack_tcp_timeout_last_ack",
541 .data
= &nf_ct_tcp_timeout_last_ack
,
542 .maxlen
= sizeof(unsigned int),
544 .proc_handler
= &proc_dointvec_jiffies
,
547 .ctl_name
= NET_NF_CONNTRACK_TCP_TIMEOUT_TIME_WAIT
,
548 .procname
= "nf_conntrack_tcp_timeout_time_wait",
549 .data
= &nf_ct_tcp_timeout_time_wait
,
550 .maxlen
= sizeof(unsigned int),
552 .proc_handler
= &proc_dointvec_jiffies
,
555 .ctl_name
= NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE
,
556 .procname
= "nf_conntrack_tcp_timeout_close",
557 .data
= &nf_ct_tcp_timeout_close
,
558 .maxlen
= sizeof(unsigned int),
560 .proc_handler
= &proc_dointvec_jiffies
,
563 .ctl_name
= NET_NF_CONNTRACK_UDP_TIMEOUT
,
564 .procname
= "nf_conntrack_udp_timeout",
565 .data
= &nf_ct_udp_timeout
,
566 .maxlen
= sizeof(unsigned int),
568 .proc_handler
= &proc_dointvec_jiffies
,
571 .ctl_name
= NET_NF_CONNTRACK_UDP_TIMEOUT_STREAM
,
572 .procname
= "nf_conntrack_udp_timeout_stream",
573 .data
= &nf_ct_udp_timeout_stream
,
574 .maxlen
= sizeof(unsigned int),
576 .proc_handler
= &proc_dointvec_jiffies
,
579 .ctl_name
= NET_NF_CONNTRACK_GENERIC_TIMEOUT
,
580 .procname
= "nf_conntrack_generic_timeout",
581 .data
= &nf_ct_generic_timeout
,
582 .maxlen
= sizeof(unsigned int),
584 .proc_handler
= &proc_dointvec_jiffies
,
587 .ctl_name
= NET_NF_CONNTRACK_LOG_INVALID
,
588 .procname
= "nf_conntrack_log_invalid",
589 .data
= &nf_ct_log_invalid
,
590 .maxlen
= sizeof(unsigned int),
592 .proc_handler
= &proc_dointvec_minmax
,
593 .strategy
= &sysctl_intvec
,
594 .extra1
= &log_invalid_proto_min
,
595 .extra2
= &log_invalid_proto_max
,
598 .ctl_name
= NET_NF_CONNTRACK_TCP_TIMEOUT_MAX_RETRANS
,
599 .procname
= "nf_conntrack_tcp_timeout_max_retrans",
600 .data
= &nf_ct_tcp_timeout_max_retrans
,
601 .maxlen
= sizeof(unsigned int),
603 .proc_handler
= &proc_dointvec_jiffies
,
606 .ctl_name
= NET_NF_CONNTRACK_TCP_LOOSE
,
607 .procname
= "nf_conntrack_tcp_loose",
608 .data
= &nf_ct_tcp_loose
,
609 .maxlen
= sizeof(unsigned int),
611 .proc_handler
= &proc_dointvec
,
614 .ctl_name
= NET_NF_CONNTRACK_TCP_BE_LIBERAL
,
615 .procname
= "nf_conntrack_tcp_be_liberal",
616 .data
= &nf_ct_tcp_be_liberal
,
617 .maxlen
= sizeof(unsigned int),
619 .proc_handler
= &proc_dointvec
,
622 .ctl_name
= NET_NF_CONNTRACK_TCP_MAX_RETRANS
,
623 .procname
= "nf_conntrack_tcp_max_retrans",
624 .data
= &nf_ct_tcp_max_retrans
,
625 .maxlen
= sizeof(unsigned int),
627 .proc_handler
= &proc_dointvec
,
633 #define NET_NF_CONNTRACK_MAX 2089
635 static ctl_table nf_ct_netfilter_table
[] = {
637 .ctl_name
= NET_NETFILTER
,
638 .procname
= "netfilter",
640 .child
= nf_ct_sysctl_table
,
643 .ctl_name
= NET_NF_CONNTRACK_MAX
,
644 .procname
= "nf_conntrack_max",
645 .data
= &nf_conntrack_max
,
646 .maxlen
= sizeof(int),
648 .proc_handler
= &proc_dointvec
,
653 static ctl_table nf_ct_net_table
[] = {
658 .child
= nf_ct_netfilter_table
,
662 EXPORT_SYMBOL(nf_ct_log_invalid
);
663 #endif /* CONFIG_SYSCTL */
665 int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto
*proto
)
669 write_lock_bh(&nf_conntrack_lock
);
670 if (nf_ct_l3protos
[proto
->l3proto
] != &nf_conntrack_generic_l3proto
) {
674 nf_ct_l3protos
[proto
->l3proto
] = proto
;
676 write_unlock_bh(&nf_conntrack_lock
);
681 void nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto
*proto
)
683 write_lock_bh(&nf_conntrack_lock
);
684 nf_ct_l3protos
[proto
->l3proto
] = &nf_conntrack_generic_l3proto
;
685 write_unlock_bh(&nf_conntrack_lock
);
687 /* Somebody could be still looking at the proto in bh. */
690 /* Remove all contrack entries for this protocol */
691 nf_ct_iterate_cleanup(kill_l3proto
, proto
);
694 /* FIXME: Allow NULL functions and sub in pointers to generic for
696 int nf_conntrack_protocol_register(struct nf_conntrack_protocol
*proto
)
701 write_lock_bh(&nf_conntrack_lock
);
702 if (nf_ct_protos
[proto
->l3proto
]) {
703 if (nf_ct_protos
[proto
->l3proto
][proto
->proto
]
704 != &nf_conntrack_generic_protocol
) {
709 /* l3proto may be loaded latter. */
710 struct nf_conntrack_protocol
**proto_array
;
713 write_unlock_bh(&nf_conntrack_lock
);
715 proto_array
= (struct nf_conntrack_protocol
**)
716 kmalloc(MAX_NF_CT_PROTO
*
717 sizeof(struct nf_conntrack_protocol
*),
719 if (proto_array
== NULL
) {
723 for (i
= 0; i
< MAX_NF_CT_PROTO
; i
++)
724 proto_array
[i
] = &nf_conntrack_generic_protocol
;
726 write_lock_bh(&nf_conntrack_lock
);
727 if (nf_ct_protos
[proto
->l3proto
]) {
728 /* bad timing, but no problem */
729 write_unlock_bh(&nf_conntrack_lock
);
732 nf_ct_protos
[proto
->l3proto
] = proto_array
;
733 write_unlock_bh(&nf_conntrack_lock
);
737 * Just once because array is never freed until unloading
743 nf_ct_protos
[proto
->l3proto
][proto
->proto
] = proto
;
746 write_unlock_bh(&nf_conntrack_lock
);
751 void nf_conntrack_protocol_unregister(struct nf_conntrack_protocol
*proto
)
753 write_lock_bh(&nf_conntrack_lock
);
754 nf_ct_protos
[proto
->l3proto
][proto
->proto
]
755 = &nf_conntrack_generic_protocol
;
756 write_unlock_bh(&nf_conntrack_lock
);
758 /* Somebody could be still looking at the proto in bh. */
761 /* Remove all contrack entries for this protocol */
762 nf_ct_iterate_cleanup(kill_proto
, proto
);
765 static int __init
nf_conntrack_standalone_init(void)
767 #ifdef CONFIG_PROC_FS
768 struct proc_dir_entry
*proc
, *proc_exp
, *proc_stat
;
772 ret
= nf_conntrack_init();
776 #ifdef CONFIG_PROC_FS
777 proc
= proc_net_fops_create("nf_conntrack", 0440, &ct_file_ops
);
778 if (!proc
) goto cleanup_init
;
780 proc_exp
= proc_net_fops_create("nf_conntrack_expect", 0440,
782 if (!proc_exp
) goto cleanup_proc
;
784 proc_stat
= create_proc_entry("nf_conntrack", S_IRUGO
, proc_net_stat
);
786 goto cleanup_proc_exp
;
788 proc_stat
->proc_fops
= &ct_cpu_seq_fops
;
789 proc_stat
->owner
= THIS_MODULE
;
792 nf_ct_sysctl_header
= register_sysctl_table(nf_ct_net_table
, 0);
793 if (nf_ct_sysctl_header
== NULL
) {
794 printk("nf_conntrack: can't register to sysctl.\n");
796 goto cleanup_proc_stat
;
804 #ifdef CONFIG_PROC_FS
805 remove_proc_entry("nf_conntrack", proc_net_stat
);
807 proc_net_remove("nf_conntrack_expect");
809 proc_net_remove("nf_conntrack");
811 #endif /* CNFIG_PROC_FS */
812 nf_conntrack_cleanup();
816 static void __exit
nf_conntrack_standalone_fini(void)
819 unregister_sysctl_table(nf_ct_sysctl_header
);
821 #ifdef CONFIG_PROC_FS
822 remove_proc_entry("nf_conntrack", proc_net_stat
);
823 proc_net_remove("nf_conntrack_expect");
824 proc_net_remove("nf_conntrack");
825 #endif /* CNFIG_PROC_FS */
826 nf_conntrack_cleanup();
829 module_init(nf_conntrack_standalone_init
);
830 module_exit(nf_conntrack_standalone_fini
);
832 /* Some modules need us, but don't depend directly on any symbol.
833 They should call this. */
834 void need_conntrack(void)
838 #ifdef CONFIG_NF_CONNTRACK_EVENTS
839 EXPORT_SYMBOL_GPL(nf_conntrack_chain
);
840 EXPORT_SYMBOL_GPL(nf_conntrack_expect_chain
);
841 EXPORT_SYMBOL_GPL(nf_conntrack_register_notifier
);
842 EXPORT_SYMBOL_GPL(nf_conntrack_unregister_notifier
);
843 EXPORT_SYMBOL_GPL(__nf_ct_event_cache_init
);
844 EXPORT_PER_CPU_SYMBOL_GPL(nf_conntrack_ecache
);
845 EXPORT_SYMBOL_GPL(nf_ct_deliver_cached_events
);
847 EXPORT_SYMBOL(nf_ct_l3proto_try_module_get
);
848 EXPORT_SYMBOL(nf_ct_l3proto_module_put
);
849 EXPORT_SYMBOL(nf_conntrack_l3proto_register
);
850 EXPORT_SYMBOL(nf_conntrack_l3proto_unregister
);
851 EXPORT_SYMBOL(nf_conntrack_protocol_register
);
852 EXPORT_SYMBOL(nf_conntrack_protocol_unregister
);
853 EXPORT_SYMBOL(nf_ct_invert_tuplepr
);
854 EXPORT_SYMBOL(nf_conntrack_destroyed
);
855 EXPORT_SYMBOL(need_conntrack
);
856 EXPORT_SYMBOL(nf_conntrack_helper_register
);
857 EXPORT_SYMBOL(nf_conntrack_helper_unregister
);
858 EXPORT_SYMBOL(nf_ct_iterate_cleanup
);
859 EXPORT_SYMBOL(__nf_ct_refresh_acct
);
860 EXPORT_SYMBOL(nf_ct_protos
);
861 EXPORT_SYMBOL(__nf_ct_proto_find
);
862 EXPORT_SYMBOL(nf_ct_proto_find_get
);
863 EXPORT_SYMBOL(nf_ct_proto_put
);
864 EXPORT_SYMBOL(nf_ct_l3proto_find_get
);
865 EXPORT_SYMBOL(nf_ct_l3proto_put
);
866 EXPORT_SYMBOL(nf_ct_l3protos
);
867 EXPORT_SYMBOL_GPL(nf_conntrack_checksum
);
868 EXPORT_SYMBOL(nf_conntrack_expect_alloc
);
869 EXPORT_SYMBOL(nf_conntrack_expect_put
);
870 EXPORT_SYMBOL(nf_conntrack_expect_related
);
871 EXPORT_SYMBOL(nf_conntrack_unexpect_related
);
872 EXPORT_SYMBOL(nf_conntrack_tuple_taken
);
873 EXPORT_SYMBOL(nf_conntrack_htable_size
);
874 EXPORT_SYMBOL(nf_conntrack_lock
);
875 EXPORT_SYMBOL(nf_conntrack_hash
);
876 EXPORT_SYMBOL(nf_conntrack_untracked
);
877 EXPORT_SYMBOL_GPL(nf_conntrack_find_get
);
878 #ifdef CONFIG_IP_NF_NAT_NEEDED
879 EXPORT_SYMBOL(nf_conntrack_tcp_update
);
881 EXPORT_SYMBOL(__nf_conntrack_confirm
);
882 EXPORT_SYMBOL(nf_ct_get_tuple
);
883 EXPORT_SYMBOL(nf_ct_invert_tuple
);
884 EXPORT_SYMBOL(nf_conntrack_in
);
885 EXPORT_SYMBOL(__nf_conntrack_attach
);
886 EXPORT_SYMBOL(nf_conntrack_alloc
);
887 EXPORT_SYMBOL(nf_conntrack_free
);
888 EXPORT_SYMBOL(nf_conntrack_flush
);
889 EXPORT_SYMBOL(nf_ct_remove_expectations
);
890 EXPORT_SYMBOL(nf_ct_helper_find_get
);
891 EXPORT_SYMBOL(nf_ct_helper_put
);
892 EXPORT_SYMBOL(__nf_conntrack_helper_find_byname
);
893 EXPORT_SYMBOL(__nf_conntrack_find
);
894 EXPORT_SYMBOL(nf_ct_unlink_expect
);
895 EXPORT_SYMBOL(nf_conntrack_hash_insert
);
896 EXPORT_SYMBOL(__nf_conntrack_expect_find
);
897 EXPORT_SYMBOL(nf_conntrack_expect_find
);
898 EXPORT_SYMBOL(nf_conntrack_expect_list
);
899 #if defined(CONFIG_NF_CT_NETLINK) || \
900 defined(CONFIG_NF_CT_NETLINK_MODULE)
901 EXPORT_SYMBOL(nf_ct_port_tuple_to_nfattr
);
902 EXPORT_SYMBOL(nf_ct_port_nfattr_to_tuple
);