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>
40 #include <linux/netfilter_ipv4/listhelp.h>
45 #define DEBUGP(format, args...)
48 MODULE_LICENSE("GPL");
50 extern atomic_t nf_conntrack_count
;
51 DECLARE_PER_CPU(struct ip_conntrack_stat
, nf_conntrack_stat
);
53 static int kill_l3proto(struct nf_conn
*i
, void *data
)
55 return (i
->tuplehash
[IP_CT_DIR_ORIGINAL
].tuple
.src
.l3num
==
56 ((struct nf_conntrack_l3proto
*)data
)->l3proto
);
59 static int kill_proto(struct nf_conn
*i
, void *data
)
61 struct nf_conntrack_protocol
*proto
;
62 proto
= (struct nf_conntrack_protocol
*)data
;
63 return (i
->tuplehash
[IP_CT_DIR_ORIGINAL
].tuple
.dst
.protonum
==
65 (i
->tuplehash
[IP_CT_DIR_ORIGINAL
].tuple
.src
.l3num
==
71 print_tuple(struct seq_file
*s
, const struct nf_conntrack_tuple
*tuple
,
72 struct nf_conntrack_l3proto
*l3proto
,
73 struct nf_conntrack_protocol
*proto
)
75 return l3proto
->print_tuple(s
, tuple
) || proto
->print_tuple(s
, tuple
);
78 #ifdef CONFIG_NF_CT_ACCT
80 seq_print_counters(struct seq_file
*s
,
81 const struct ip_conntrack_counter
*counter
)
83 return seq_printf(s
, "packets=%llu bytes=%llu ",
84 (unsigned long long)counter
->packets
,
85 (unsigned long long)counter
->bytes
);
88 #define seq_print_counters(x, y) 0
91 struct ct_iter_state
{
95 static struct list_head
*ct_get_first(struct seq_file
*seq
)
97 struct ct_iter_state
*st
= seq
->private;
100 st
->bucket
< nf_conntrack_htable_size
;
102 if (!list_empty(&nf_conntrack_hash
[st
->bucket
]))
103 return nf_conntrack_hash
[st
->bucket
].next
;
108 static struct list_head
*ct_get_next(struct seq_file
*seq
, struct list_head
*head
)
110 struct ct_iter_state
*st
= seq
->private;
113 while (head
== &nf_conntrack_hash
[st
->bucket
]) {
114 if (++st
->bucket
>= nf_conntrack_htable_size
)
116 head
= nf_conntrack_hash
[st
->bucket
].next
;
121 static struct list_head
*ct_get_idx(struct seq_file
*seq
, loff_t pos
)
123 struct list_head
*head
= ct_get_first(seq
);
126 while (pos
&& (head
= ct_get_next(seq
, head
)))
128 return pos
? NULL
: head
;
131 static void *ct_seq_start(struct seq_file
*seq
, loff_t
*pos
)
133 read_lock_bh(&nf_conntrack_lock
);
134 return ct_get_idx(seq
, *pos
);
137 static void *ct_seq_next(struct seq_file
*s
, void *v
, loff_t
*pos
)
140 return ct_get_next(s
, v
);
143 static void ct_seq_stop(struct seq_file
*s
, void *v
)
145 read_unlock_bh(&nf_conntrack_lock
);
148 /* return 0 on success, 1 in case of error */
149 static int ct_seq_show(struct seq_file
*s
, void *v
)
151 const struct nf_conntrack_tuple_hash
*hash
= v
;
152 const struct nf_conn
*conntrack
= nf_ct_tuplehash_to_ctrack(hash
);
153 struct nf_conntrack_l3proto
*l3proto
;
154 struct nf_conntrack_protocol
*proto
;
156 ASSERT_READ_LOCK(&nf_conntrack_lock
);
157 NF_CT_ASSERT(conntrack
);
159 /* we only want to print DIR_ORIGINAL */
160 if (NF_CT_DIRECTION(hash
))
163 l3proto
= __nf_ct_l3proto_find(conntrack
->tuplehash
[IP_CT_DIR_ORIGINAL
]
166 NF_CT_ASSERT(l3proto
);
167 proto
= __nf_ct_proto_find(conntrack
->tuplehash
[IP_CT_DIR_ORIGINAL
]
169 conntrack
->tuplehash
[IP_CT_DIR_ORIGINAL
]
170 .tuple
.dst
.protonum
);
173 if (seq_printf(s
, "%-8s %u %-8s %u %ld ",
175 conntrack
->tuplehash
[IP_CT_DIR_ORIGINAL
].tuple
.src
.l3num
,
177 conntrack
->tuplehash
[IP_CT_DIR_ORIGINAL
].tuple
.dst
.protonum
,
178 timer_pending(&conntrack
->timeout
)
179 ? (long)(conntrack
->timeout
.expires
- jiffies
)/HZ
: 0) != 0)
182 if (l3proto
->print_conntrack(s
, conntrack
))
185 if (proto
->print_conntrack(s
, conntrack
))
188 if (print_tuple(s
, &conntrack
->tuplehash
[IP_CT_DIR_ORIGINAL
].tuple
,
192 if (seq_print_counters(s
, &conntrack
->counters
[IP_CT_DIR_ORIGINAL
]))
195 if (!(test_bit(IPS_SEEN_REPLY_BIT
, &conntrack
->status
)))
196 if (seq_printf(s
, "[UNREPLIED] "))
199 if (print_tuple(s
, &conntrack
->tuplehash
[IP_CT_DIR_REPLY
].tuple
,
203 if (seq_print_counters(s
, &conntrack
->counters
[IP_CT_DIR_REPLY
]))
206 if (test_bit(IPS_ASSURED_BIT
, &conntrack
->status
))
207 if (seq_printf(s
, "[ASSURED] "))
210 #if defined(CONFIG_NF_CONNTRACK_MARK)
211 if (seq_printf(s
, "mark=%u ", conntrack
->mark
))
215 #ifdef CONFIG_NF_CONNTRACK_SECMARK
216 if (seq_printf(s
, "secmark=%u ", conntrack
->secmark
))
220 if (seq_printf(s
, "use=%u\n", atomic_read(&conntrack
->ct_general
.use
)))
226 static struct seq_operations ct_seq_ops
= {
227 .start
= ct_seq_start
,
233 static int ct_open(struct inode
*inode
, struct file
*file
)
235 struct seq_file
*seq
;
236 struct ct_iter_state
*st
;
239 st
= kmalloc(sizeof(struct ct_iter_state
), GFP_KERNEL
);
242 ret
= seq_open(file
, &ct_seq_ops
);
245 seq
= file
->private_data
;
247 memset(st
, 0, sizeof(struct ct_iter_state
));
254 static struct file_operations ct_file_ops
= {
255 .owner
= THIS_MODULE
,
259 .release
= seq_release_private
,
263 static void *exp_seq_start(struct seq_file
*s
, loff_t
*pos
)
265 struct list_head
*e
= &nf_conntrack_expect_list
;
268 /* strange seq_file api calls stop even if we fail,
269 * thus we need to grab lock since stop unlocks */
270 read_lock_bh(&nf_conntrack_lock
);
275 for (i
= 0; i
<= *pos
; i
++) {
277 if (e
== &nf_conntrack_expect_list
)
283 static void *exp_seq_next(struct seq_file
*s
, void *v
, loff_t
*pos
)
285 struct list_head
*e
= v
;
290 if (e
== &nf_conntrack_expect_list
)
296 static void exp_seq_stop(struct seq_file
*s
, void *v
)
298 read_unlock_bh(&nf_conntrack_lock
);
301 static int exp_seq_show(struct seq_file
*s
, void *v
)
303 struct nf_conntrack_expect
*expect
= v
;
305 if (expect
->timeout
.function
)
306 seq_printf(s
, "%ld ", timer_pending(&expect
->timeout
)
307 ? (long)(expect
->timeout
.expires
- jiffies
)/HZ
: 0);
310 seq_printf(s
, "l3proto = %u proto=%u ",
311 expect
->tuple
.src
.l3num
,
312 expect
->tuple
.dst
.protonum
);
313 print_tuple(s
, &expect
->tuple
,
314 __nf_ct_l3proto_find(expect
->tuple
.src
.l3num
),
315 __nf_ct_proto_find(expect
->tuple
.src
.l3num
,
316 expect
->tuple
.dst
.protonum
));
317 return seq_putc(s
, '\n');
320 static struct seq_operations exp_seq_ops
= {
321 .start
= exp_seq_start
,
322 .next
= exp_seq_next
,
323 .stop
= exp_seq_stop
,
327 static int exp_open(struct inode
*inode
, struct file
*file
)
329 return seq_open(file
, &exp_seq_ops
);
332 static struct file_operations exp_file_ops
= {
333 .owner
= THIS_MODULE
,
337 .release
= seq_release
340 static void *ct_cpu_seq_start(struct seq_file
*seq
, loff_t
*pos
)
345 return SEQ_START_TOKEN
;
347 for (cpu
= *pos
-1; cpu
< NR_CPUS
; ++cpu
) {
348 if (!cpu_possible(cpu
))
351 return &per_cpu(nf_conntrack_stat
, cpu
);
357 static void *ct_cpu_seq_next(struct seq_file
*seq
, void *v
, loff_t
*pos
)
361 for (cpu
= *pos
; cpu
< NR_CPUS
; ++cpu
) {
362 if (!cpu_possible(cpu
))
365 return &per_cpu(nf_conntrack_stat
, cpu
);
371 static void ct_cpu_seq_stop(struct seq_file
*seq
, void *v
)
375 static int ct_cpu_seq_show(struct seq_file
*seq
, void *v
)
377 unsigned int nr_conntracks
= atomic_read(&nf_conntrack_count
);
378 struct ip_conntrack_stat
*st
= v
;
380 if (v
== SEQ_START_TOKEN
) {
381 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");
385 seq_printf(seq
, "%08x %08x %08x %08x %08x %08x %08x %08x "
386 "%08x %08x %08x %08x %08x %08x %08x %08x \n",
408 static struct seq_operations ct_cpu_seq_ops
= {
409 .start
= ct_cpu_seq_start
,
410 .next
= ct_cpu_seq_next
,
411 .stop
= ct_cpu_seq_stop
,
412 .show
= ct_cpu_seq_show
,
415 static int ct_cpu_seq_open(struct inode
*inode
, struct file
*file
)
417 return seq_open(file
, &ct_cpu_seq_ops
);
420 static struct file_operations ct_cpu_seq_fops
= {
421 .owner
= THIS_MODULE
,
422 .open
= ct_cpu_seq_open
,
425 .release
= seq_release_private
,
427 #endif /* CONFIG_PROC_FS */
431 int nf_conntrack_checksum
= 1;
435 /* From nf_conntrack_core.c */
436 extern int nf_conntrack_max
;
437 extern unsigned int nf_conntrack_htable_size
;
439 /* From nf_conntrack_proto_tcp.c */
440 extern unsigned int nf_ct_tcp_timeout_syn_sent
;
441 extern unsigned int nf_ct_tcp_timeout_syn_recv
;
442 extern unsigned int nf_ct_tcp_timeout_established
;
443 extern unsigned int nf_ct_tcp_timeout_fin_wait
;
444 extern unsigned int nf_ct_tcp_timeout_close_wait
;
445 extern unsigned int nf_ct_tcp_timeout_last_ack
;
446 extern unsigned int nf_ct_tcp_timeout_time_wait
;
447 extern unsigned int nf_ct_tcp_timeout_close
;
448 extern unsigned int nf_ct_tcp_timeout_max_retrans
;
449 extern int nf_ct_tcp_loose
;
450 extern int nf_ct_tcp_be_liberal
;
451 extern int nf_ct_tcp_max_retrans
;
453 /* From nf_conntrack_proto_udp.c */
454 extern unsigned int nf_ct_udp_timeout
;
455 extern unsigned int nf_ct_udp_timeout_stream
;
457 /* From nf_conntrack_proto_generic.c */
458 extern unsigned int nf_ct_generic_timeout
;
460 /* Log invalid packets of a given protocol */
461 static int log_invalid_proto_min
= 0;
462 static int log_invalid_proto_max
= 255;
464 static struct ctl_table_header
*nf_ct_sysctl_header
;
466 static ctl_table nf_ct_sysctl_table
[] = {
468 .ctl_name
= NET_NF_CONNTRACK_MAX
,
469 .procname
= "nf_conntrack_max",
470 .data
= &nf_conntrack_max
,
471 .maxlen
= sizeof(int),
473 .proc_handler
= &proc_dointvec
,
476 .ctl_name
= NET_NF_CONNTRACK_COUNT
,
477 .procname
= "nf_conntrack_count",
478 .data
= &nf_conntrack_count
,
479 .maxlen
= sizeof(int),
481 .proc_handler
= &proc_dointvec
,
484 .ctl_name
= NET_NF_CONNTRACK_BUCKETS
,
485 .procname
= "nf_conntrack_buckets",
486 .data
= &nf_conntrack_htable_size
,
487 .maxlen
= sizeof(unsigned int),
489 .proc_handler
= &proc_dointvec
,
492 .ctl_name
= NET_NF_CONNTRACK_CHECKSUM
,
493 .procname
= "nf_conntrack_checksum",
494 .data
= &nf_conntrack_checksum
,
495 .maxlen
= sizeof(unsigned int),
497 .proc_handler
= &proc_dointvec
,
500 .ctl_name
= NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT
,
501 .procname
= "nf_conntrack_tcp_timeout_syn_sent",
502 .data
= &nf_ct_tcp_timeout_syn_sent
,
503 .maxlen
= sizeof(unsigned int),
505 .proc_handler
= &proc_dointvec_jiffies
,
508 .ctl_name
= NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_RECV
,
509 .procname
= "nf_conntrack_tcp_timeout_syn_recv",
510 .data
= &nf_ct_tcp_timeout_syn_recv
,
511 .maxlen
= sizeof(unsigned int),
513 .proc_handler
= &proc_dointvec_jiffies
,
516 .ctl_name
= NET_NF_CONNTRACK_TCP_TIMEOUT_ESTABLISHED
,
517 .procname
= "nf_conntrack_tcp_timeout_established",
518 .data
= &nf_ct_tcp_timeout_established
,
519 .maxlen
= sizeof(unsigned int),
521 .proc_handler
= &proc_dointvec_jiffies
,
524 .ctl_name
= NET_NF_CONNTRACK_TCP_TIMEOUT_FIN_WAIT
,
525 .procname
= "nf_conntrack_tcp_timeout_fin_wait",
526 .data
= &nf_ct_tcp_timeout_fin_wait
,
527 .maxlen
= sizeof(unsigned int),
529 .proc_handler
= &proc_dointvec_jiffies
,
532 .ctl_name
= NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE_WAIT
,
533 .procname
= "nf_conntrack_tcp_timeout_close_wait",
534 .data
= &nf_ct_tcp_timeout_close_wait
,
535 .maxlen
= sizeof(unsigned int),
537 .proc_handler
= &proc_dointvec_jiffies
,
540 .ctl_name
= NET_NF_CONNTRACK_TCP_TIMEOUT_LAST_ACK
,
541 .procname
= "nf_conntrack_tcp_timeout_last_ack",
542 .data
= &nf_ct_tcp_timeout_last_ack
,
543 .maxlen
= sizeof(unsigned int),
545 .proc_handler
= &proc_dointvec_jiffies
,
548 .ctl_name
= NET_NF_CONNTRACK_TCP_TIMEOUT_TIME_WAIT
,
549 .procname
= "nf_conntrack_tcp_timeout_time_wait",
550 .data
= &nf_ct_tcp_timeout_time_wait
,
551 .maxlen
= sizeof(unsigned int),
553 .proc_handler
= &proc_dointvec_jiffies
,
556 .ctl_name
= NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE
,
557 .procname
= "nf_conntrack_tcp_timeout_close",
558 .data
= &nf_ct_tcp_timeout_close
,
559 .maxlen
= sizeof(unsigned int),
561 .proc_handler
= &proc_dointvec_jiffies
,
564 .ctl_name
= NET_NF_CONNTRACK_UDP_TIMEOUT
,
565 .procname
= "nf_conntrack_udp_timeout",
566 .data
= &nf_ct_udp_timeout
,
567 .maxlen
= sizeof(unsigned int),
569 .proc_handler
= &proc_dointvec_jiffies
,
572 .ctl_name
= NET_NF_CONNTRACK_UDP_TIMEOUT_STREAM
,
573 .procname
= "nf_conntrack_udp_timeout_stream",
574 .data
= &nf_ct_udp_timeout_stream
,
575 .maxlen
= sizeof(unsigned int),
577 .proc_handler
= &proc_dointvec_jiffies
,
580 .ctl_name
= NET_NF_CONNTRACK_GENERIC_TIMEOUT
,
581 .procname
= "nf_conntrack_generic_timeout",
582 .data
= &nf_ct_generic_timeout
,
583 .maxlen
= sizeof(unsigned int),
585 .proc_handler
= &proc_dointvec_jiffies
,
588 .ctl_name
= NET_NF_CONNTRACK_LOG_INVALID
,
589 .procname
= "nf_conntrack_log_invalid",
590 .data
= &nf_ct_log_invalid
,
591 .maxlen
= sizeof(unsigned int),
593 .proc_handler
= &proc_dointvec_minmax
,
594 .strategy
= &sysctl_intvec
,
595 .extra1
= &log_invalid_proto_min
,
596 .extra2
= &log_invalid_proto_max
,
599 .ctl_name
= NET_NF_CONNTRACK_TCP_TIMEOUT_MAX_RETRANS
,
600 .procname
= "nf_conntrack_tcp_timeout_max_retrans",
601 .data
= &nf_ct_tcp_timeout_max_retrans
,
602 .maxlen
= sizeof(unsigned int),
604 .proc_handler
= &proc_dointvec_jiffies
,
607 .ctl_name
= NET_NF_CONNTRACK_TCP_LOOSE
,
608 .procname
= "nf_conntrack_tcp_loose",
609 .data
= &nf_ct_tcp_loose
,
610 .maxlen
= sizeof(unsigned int),
612 .proc_handler
= &proc_dointvec
,
615 .ctl_name
= NET_NF_CONNTRACK_TCP_BE_LIBERAL
,
616 .procname
= "nf_conntrack_tcp_be_liberal",
617 .data
= &nf_ct_tcp_be_liberal
,
618 .maxlen
= sizeof(unsigned int),
620 .proc_handler
= &proc_dointvec
,
623 .ctl_name
= NET_NF_CONNTRACK_TCP_MAX_RETRANS
,
624 .procname
= "nf_conntrack_tcp_max_retrans",
625 .data
= &nf_ct_tcp_max_retrans
,
626 .maxlen
= sizeof(unsigned int),
628 .proc_handler
= &proc_dointvec
,
634 #define NET_NF_CONNTRACK_MAX 2089
636 static ctl_table nf_ct_netfilter_table
[] = {
638 .ctl_name
= NET_NETFILTER
,
639 .procname
= "netfilter",
641 .child
= nf_ct_sysctl_table
,
644 .ctl_name
= NET_NF_CONNTRACK_MAX
,
645 .procname
= "nf_conntrack_max",
646 .data
= &nf_conntrack_max
,
647 .maxlen
= sizeof(int),
649 .proc_handler
= &proc_dointvec
,
654 static ctl_table nf_ct_net_table
[] = {
659 .child
= nf_ct_netfilter_table
,
663 EXPORT_SYMBOL(nf_ct_log_invalid
);
664 #endif /* CONFIG_SYSCTL */
666 int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto
*proto
)
670 write_lock_bh(&nf_conntrack_lock
);
671 if (nf_ct_l3protos
[proto
->l3proto
] != &nf_conntrack_generic_l3proto
) {
675 nf_ct_l3protos
[proto
->l3proto
] = proto
;
677 write_unlock_bh(&nf_conntrack_lock
);
682 void nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto
*proto
)
684 write_lock_bh(&nf_conntrack_lock
);
685 nf_ct_l3protos
[proto
->l3proto
] = &nf_conntrack_generic_l3proto
;
686 write_unlock_bh(&nf_conntrack_lock
);
688 /* Somebody could be still looking at the proto in bh. */
691 /* Remove all contrack entries for this protocol */
692 nf_ct_iterate_cleanup(kill_l3proto
, proto
);
695 /* FIXME: Allow NULL functions and sub in pointers to generic for
697 int nf_conntrack_protocol_register(struct nf_conntrack_protocol
*proto
)
702 write_lock_bh(&nf_conntrack_lock
);
703 if (nf_ct_protos
[proto
->l3proto
]) {
704 if (nf_ct_protos
[proto
->l3proto
][proto
->proto
]
705 != &nf_conntrack_generic_protocol
) {
710 /* l3proto may be loaded latter. */
711 struct nf_conntrack_protocol
**proto_array
;
714 write_unlock_bh(&nf_conntrack_lock
);
716 proto_array
= (struct nf_conntrack_protocol
**)
717 kmalloc(MAX_NF_CT_PROTO
*
718 sizeof(struct nf_conntrack_protocol
*),
720 if (proto_array
== NULL
) {
724 for (i
= 0; i
< MAX_NF_CT_PROTO
; i
++)
725 proto_array
[i
] = &nf_conntrack_generic_protocol
;
727 write_lock_bh(&nf_conntrack_lock
);
728 if (nf_ct_protos
[proto
->l3proto
]) {
729 /* bad timing, but no problem */
730 write_unlock_bh(&nf_conntrack_lock
);
733 nf_ct_protos
[proto
->l3proto
] = proto_array
;
734 write_unlock_bh(&nf_conntrack_lock
);
738 * Just once because array is never freed until unloading
744 nf_ct_protos
[proto
->l3proto
][proto
->proto
] = proto
;
747 write_unlock_bh(&nf_conntrack_lock
);
752 void nf_conntrack_protocol_unregister(struct nf_conntrack_protocol
*proto
)
754 write_lock_bh(&nf_conntrack_lock
);
755 nf_ct_protos
[proto
->l3proto
][proto
->proto
]
756 = &nf_conntrack_generic_protocol
;
757 write_unlock_bh(&nf_conntrack_lock
);
759 /* Somebody could be still looking at the proto in bh. */
762 /* Remove all contrack entries for this protocol */
763 nf_ct_iterate_cleanup(kill_proto
, proto
);
766 static int __init
nf_conntrack_standalone_init(void)
768 #ifdef CONFIG_PROC_FS
769 struct proc_dir_entry
*proc
, *proc_exp
, *proc_stat
;
773 ret
= nf_conntrack_init();
777 #ifdef CONFIG_PROC_FS
778 proc
= proc_net_fops_create("nf_conntrack", 0440, &ct_file_ops
);
779 if (!proc
) goto cleanup_init
;
781 proc_exp
= proc_net_fops_create("nf_conntrack_expect", 0440,
783 if (!proc_exp
) goto cleanup_proc
;
785 proc_stat
= create_proc_entry("nf_conntrack", S_IRUGO
, proc_net_stat
);
787 goto cleanup_proc_exp
;
789 proc_stat
->proc_fops
= &ct_cpu_seq_fops
;
790 proc_stat
->owner
= THIS_MODULE
;
793 nf_ct_sysctl_header
= register_sysctl_table(nf_ct_net_table
, 0);
794 if (nf_ct_sysctl_header
== NULL
) {
795 printk("nf_conntrack: can't register to sysctl.\n");
797 goto cleanup_proc_stat
;
805 #ifdef CONFIG_PROC_FS
806 remove_proc_entry("nf_conntrack", proc_net_stat
);
808 proc_net_remove("nf_conntrack_expect");
810 proc_net_remove("nf_conntrack");
812 #endif /* CNFIG_PROC_FS */
813 nf_conntrack_cleanup();
817 static void __exit
nf_conntrack_standalone_fini(void)
820 unregister_sysctl_table(nf_ct_sysctl_header
);
822 #ifdef CONFIG_PROC_FS
823 remove_proc_entry("nf_conntrack", proc_net_stat
);
824 proc_net_remove("nf_conntrack_expect");
825 proc_net_remove("nf_conntrack");
826 #endif /* CNFIG_PROC_FS */
827 nf_conntrack_cleanup();
830 module_init(nf_conntrack_standalone_init
);
831 module_exit(nf_conntrack_standalone_fini
);
833 /* Some modules need us, but don't depend directly on any symbol.
834 They should call this. */
835 void need_conntrack(void)
839 #ifdef CONFIG_NF_CONNTRACK_EVENTS
840 EXPORT_SYMBOL_GPL(nf_conntrack_chain
);
841 EXPORT_SYMBOL_GPL(nf_conntrack_expect_chain
);
842 EXPORT_SYMBOL_GPL(nf_conntrack_register_notifier
);
843 EXPORT_SYMBOL_GPL(nf_conntrack_unregister_notifier
);
844 EXPORT_SYMBOL_GPL(__nf_ct_event_cache_init
);
845 EXPORT_PER_CPU_SYMBOL_GPL(nf_conntrack_ecache
);
846 EXPORT_SYMBOL_GPL(nf_ct_deliver_cached_events
);
848 EXPORT_SYMBOL(nf_ct_l3proto_try_module_get
);
849 EXPORT_SYMBOL(nf_ct_l3proto_module_put
);
850 EXPORT_SYMBOL(nf_conntrack_l3proto_register
);
851 EXPORT_SYMBOL(nf_conntrack_l3proto_unregister
);
852 EXPORT_SYMBOL(nf_conntrack_protocol_register
);
853 EXPORT_SYMBOL(nf_conntrack_protocol_unregister
);
854 EXPORT_SYMBOL(nf_ct_invert_tuplepr
);
855 EXPORT_SYMBOL(nf_conntrack_destroyed
);
856 EXPORT_SYMBOL(need_conntrack
);
857 EXPORT_SYMBOL(nf_conntrack_helper_register
);
858 EXPORT_SYMBOL(nf_conntrack_helper_unregister
);
859 EXPORT_SYMBOL(nf_ct_iterate_cleanup
);
860 EXPORT_SYMBOL(__nf_ct_refresh_acct
);
861 EXPORT_SYMBOL(nf_ct_protos
);
862 EXPORT_SYMBOL(__nf_ct_proto_find
);
863 EXPORT_SYMBOL(nf_ct_proto_find_get
);
864 EXPORT_SYMBOL(nf_ct_proto_put
);
865 EXPORT_SYMBOL(nf_ct_l3proto_find_get
);
866 EXPORT_SYMBOL(nf_ct_l3proto_put
);
867 EXPORT_SYMBOL(nf_ct_l3protos
);
868 EXPORT_SYMBOL_GPL(nf_conntrack_checksum
);
869 EXPORT_SYMBOL(nf_conntrack_expect_alloc
);
870 EXPORT_SYMBOL(nf_conntrack_expect_put
);
871 EXPORT_SYMBOL(nf_conntrack_expect_related
);
872 EXPORT_SYMBOL(nf_conntrack_unexpect_related
);
873 EXPORT_SYMBOL(nf_conntrack_tuple_taken
);
874 EXPORT_SYMBOL(nf_conntrack_htable_size
);
875 EXPORT_SYMBOL(nf_conntrack_lock
);
876 EXPORT_SYMBOL(nf_conntrack_hash
);
877 EXPORT_SYMBOL(nf_conntrack_untracked
);
878 EXPORT_SYMBOL_GPL(nf_conntrack_find_get
);
879 #ifdef CONFIG_IP_NF_NAT_NEEDED
880 EXPORT_SYMBOL(nf_conntrack_tcp_update
);
882 EXPORT_SYMBOL(__nf_conntrack_confirm
);
883 EXPORT_SYMBOL(nf_ct_get_tuple
);
884 EXPORT_SYMBOL(nf_ct_invert_tuple
);
885 EXPORT_SYMBOL(nf_conntrack_in
);
886 EXPORT_SYMBOL(__nf_conntrack_attach
);
887 EXPORT_SYMBOL(nf_conntrack_alloc
);
888 EXPORT_SYMBOL(nf_conntrack_free
);
889 EXPORT_SYMBOL(nf_conntrack_flush
);
890 EXPORT_SYMBOL(nf_ct_remove_expectations
);
891 EXPORT_SYMBOL(nf_ct_helper_find_get
);
892 EXPORT_SYMBOL(nf_ct_helper_put
);
893 EXPORT_SYMBOL(__nf_conntrack_helper_find_byname
);
894 EXPORT_SYMBOL(__nf_conntrack_find
);
895 EXPORT_SYMBOL(nf_ct_unlink_expect
);
896 EXPORT_SYMBOL(nf_conntrack_hash_insert
);
897 EXPORT_SYMBOL(__nf_conntrack_expect_find
);
898 EXPORT_SYMBOL(nf_conntrack_expect_find
);
899 EXPORT_SYMBOL(nf_conntrack_expect_list
);
900 #if defined(CONFIG_NF_CT_NETLINK) || \
901 defined(CONFIG_NF_CT_NETLINK_MODULE)
902 EXPORT_SYMBOL(nf_ct_port_tuple_to_nfattr
);
903 EXPORT_SYMBOL(nf_ct_port_nfattr_to_tuple
);