10 #include <linux/types.h>
17 #include <linux/netfilter.h>
24 #include <linux/export.h>
33 struct net *
net = seq_file_net(seq);
38 st->
bucket < net->ct.htable_size;
41 hlist_nulls_first_rcu(&net->ct.hash[st->
bucket]));
51 struct net *
net = seq_file_net(seq);
55 while (is_a_nulls(head)) {
57 if (++st->
bucket >= net->ct.htable_size)
61 hlist_nulls_first_rcu(&net->ct.hash[st->
bucket]));
71 while (pos && (head = ct_get_next(seq, head)))
76 static void *ct_seq_start(
struct seq_file *seq, loff_t *pos)
80 return ct_get_idx(seq, *pos);
83 static void *ct_seq_next(
struct seq_file *
s,
void *
v, loff_t *pos)
86 return ct_get_next(s, v);
89 static void ct_seq_stop(
struct seq_file *
s,
void *
v)
95 #ifdef CONFIG_NF_CONNTRACK_SECMARK
112 static inline int ct_show_secctx(
struct seq_file *s,
const struct nf_conn *ct)
118 static int ct_seq_show(
struct seq_file *s,
void *
v)
121 struct nf_conn *ct = nf_ct_tuplehash_to_ctrack(hash);
134 if (nf_ct_l3num(ct) !=
AF_INET)
137 l3proto = __nf_ct_l3proto_find(nf_ct_l3num(ct));
144 l4proto->
name, nf_ct_protonum(ct),
146 ? (
long)(ct->
timeout.expires - jiffies)/
HZ : 0) != 0)
174 #ifdef CONFIG_NF_CONNTRACK_MARK
179 if (ct_show_secctx(s, ct))
191 .start = ct_seq_start,
219 struct net *net = seq_file_net(seq);
225 hlist_first_rcu(&net->ct.expect_hash[st->
bucket]));
235 struct net *net = seq_file_net(seq);
239 while (head ==
NULL) {
240 if (++st->
bucket >= nf_ct_expect_hsize)
243 hlist_first_rcu(&net->ct.expect_hash[st->
bucket]));
250 struct hlist_node *head = ct_expect_get_first(seq);
253 while (pos && (head = ct_expect_get_next(seq, head)))
258 static void *exp_seq_start(
struct seq_file *seq, loff_t *pos)
262 return ct_expect_get_idx(seq, *pos);
265 static void *exp_seq_next(
struct seq_file *seq,
void *v, loff_t *pos)
268 return ct_expect_get_next(seq, v);
271 static void exp_seq_stop(
struct seq_file *seq,
void *v)
277 static int exp_seq_show(
struct seq_file *s,
void *v)
289 ? (
long)(exp->
timeout.expires - jiffies)/
HZ : 0);
296 __nf_ct_l3proto_find(exp->
tuple.src.l3num),
298 exp->
tuple.dst.protonum));
303 .start = exp_seq_start,
304 .next = exp_seq_next,
305 .stop = exp_seq_stop,
309 static int exp_open(
struct inode *inode,
struct file *file)
323 static void *ct_cpu_seq_start(
struct seq_file *seq, loff_t *pos)
325 struct net *net = seq_file_net(seq);
341 static void *ct_cpu_seq_next(
struct seq_file *seq,
void *v, loff_t *pos)
343 struct net *net = seq_file_net(seq);
346 for (cpu = *pos; cpu < nr_cpu_ids; ++
cpu) {
356 static void ct_cpu_seq_stop(
struct seq_file *seq,
void *v)
360 static int ct_cpu_seq_show(
struct seq_file *seq,
void *v)
362 struct net *net = seq_file_net(seq);
367 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 search_restart\n");
371 seq_printf(seq,
"%08x %08x %08x %08x %08x %08x %08x %08x "
372 "%08x %08x %08x %08x %08x %08x %08x %08x %08x\n",
396 .start = ct_cpu_seq_start,
397 .next = ct_cpu_seq_next,
398 .stop = ct_cpu_seq_stop,
399 .show = ct_cpu_seq_show,
402 static int ct_cpu_seq_open(
struct inode *inode,
struct file *file)
410 .open = ct_cpu_seq_open,
416 static int __net_init ip_conntrack_net_init(
struct net *net)
429 proc_stat = proc_create(
"ip_conntrack",
S_IRUGO,
443 static void __net_exit ip_conntrack_net_exit(
struct net *net)
451 .init = ip_conntrack_net_init,
452 .exit = ip_conntrack_net_exit,