]> err.no Git - linux-2.6/blobdiff - net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
Merge branch 'x86/iommu' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux...
[linux-2.6] / net / ipv4 / netfilter / nf_conntrack_l3proto_ipv4_compat.c
index 9668c3a23efec2e3c16eaa1a40c3c8ecf989211c..3a020720e40b73fdd54add29d972c5f64aa5536b 100644 (file)
 #include <net/netfilter/nf_conntrack_l3proto.h>
 #include <net/netfilter/nf_conntrack_l4proto.h>
 #include <net/netfilter/nf_conntrack_expect.h>
-
-#ifdef CONFIG_NF_CT_ACCT
-static unsigned int
-seq_print_counters(struct seq_file *s,
-                  const struct ip_conntrack_counter *counter)
-{
-       return seq_printf(s, "packets=%llu bytes=%llu ",
-                         (unsigned long long)counter->packets,
-                         (unsigned long long)counter->bytes);
-}
-#else
-#define seq_print_counters(x, y)       0
-#endif
+#include <net/netfilter/nf_conntrack_acct.h>
 
 struct ct_iter_state {
        unsigned int bucket;
@@ -106,21 +94,16 @@ static int ct_seq_show(struct seq_file *s, void *v)
        /* we only want to print DIR_ORIGINAL */
        if (NF_CT_DIRECTION(hash))
                return 0;
-       if (ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.l3num != AF_INET)
+       if (nf_ct_l3num(ct) != AF_INET)
                return 0;
 
-       l3proto = __nf_ct_l3proto_find(ct->tuplehash[IP_CT_DIR_ORIGINAL]
-                                      .tuple.src.l3num);
+       l3proto = __nf_ct_l3proto_find(nf_ct_l3num(ct));
        NF_CT_ASSERT(l3proto);
-       l4proto = __nf_ct_l4proto_find(ct->tuplehash[IP_CT_DIR_ORIGINAL]
-                                      .tuple.src.l3num,
-                                      ct->tuplehash[IP_CT_DIR_ORIGINAL]
-                                      .tuple.dst.protonum);
+       l4proto = __nf_ct_l4proto_find(nf_ct_l3num(ct), nf_ct_protonum(ct));
        NF_CT_ASSERT(l4proto);
 
        if (seq_printf(s, "%-8s %u %ld ",
-                     l4proto->name,
-                     ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum,
+                     l4proto->name, nf_ct_protonum(ct),
                      timer_pending(&ct->timeout)
                      ? (long)(ct->timeout.expires - jiffies)/HZ : 0) != 0)
                return -ENOSPC;
@@ -132,7 +115,7 @@ static int ct_seq_show(struct seq_file *s, void *v)
                        l3proto, l4proto))
                return -ENOSPC;
 
-       if (seq_print_counters(s, &ct->counters[IP_CT_DIR_ORIGINAL]))
+       if (seq_print_acct(s, ct, IP_CT_DIR_ORIGINAL))
                return -ENOSPC;
 
        if (!(test_bit(IPS_SEEN_REPLY_BIT, &ct->status)))
@@ -143,7 +126,7 @@ static int ct_seq_show(struct seq_file *s, void *v)
                        l3proto, l4proto))
                return -ENOSPC;
 
-       if (seq_print_counters(s, &ct->counters[IP_CT_DIR_REPLY]))
+       if (seq_print_acct(s, ct, IP_CT_DIR_REPLY))
                return -ENOSPC;
 
        if (test_bit(IPS_ASSURED_BIT, &ct->status))
@@ -395,13 +378,10 @@ int __init nf_conntrack_ipv4_compat_init(void)
        if (!proc_exp)
                goto err2;
 
-       proc_stat = create_proc_entry("ip_conntrack", S_IRUGO, init_net.proc_net_stat);
+       proc_stat = proc_create("ip_conntrack", S_IRUGO,
+                               init_net.proc_net_stat, &ct_cpu_seq_fops);
        if (!proc_stat)
                goto err3;
-
-       proc_stat->proc_fops = &ct_cpu_seq_fops;
-       proc_stat->owner = THIS_MODULE;
-
        return 0;
 
 err3: