]> git.ipfire.org Git - people/ms/linux.git/commitdiff
xt_layer7: Remove all preprocessor if/else constructs for older kernels.
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 30 Mar 2014 14:44:46 +0000 (16:44 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 30 Mar 2014 14:45:36 +0000 (16:45 +0200)
net/netfilter/xt_layer7.c

index 42b46de45b1f7afca0e70ce224d47d056fb479b5..da61d485f0863fe953855500e3adf2a4b2bf7bf9 100644 (file)
 #include <linux/netfilter.h>
 #include <net/netfilter/nf_conntrack.h>
 #include <net/netfilter/nf_conntrack_core.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
 #include <net/netfilter/nf_conntrack_extend.h>
 #include <net/netfilter/nf_conntrack_acct.h>
-#endif
 #include <linux/netfilter/x_tables.h>
 #include <linux/netfilter/xt_layer7.h>
 #include <linux/ctype.h>
@@ -65,10 +63,6 @@ DEFINE_SPINLOCK(l7_lock);
 
 static int total_acct_packets(struct nf_conn *ct)
 {
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 26)
-       BUG_ON(ct == NULL);
-       return (ct->counters[IP_CT_DIR_ORIGINAL].packets + ct->counters[IP_CT_DIR_REPLY].packets);
-#else
        struct nf_conn_counter *acct;
 
        BUG_ON(ct == NULL);
@@ -76,7 +70,6 @@ static int total_acct_packets(struct nf_conn *ct)
        if (!acct)
                return 0;
        return (atomic64_read(&acct[IP_CT_DIR_ORIGINAL].packets) + atomic64_read(&acct[IP_CT_DIR_REPLY].packets));
-#endif
 }
 
 #ifdef CONFIG_IP_NF_MATCH_LAYER7_DEBUG
@@ -414,31 +407,12 @@ static int layer7_write_proc(struct file* file, const char* buffer,
        return count;
 }
 
-static bool
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)
-match(const struct sk_buff *skbin, struct xt_action_param *par)
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)
-match(const struct sk_buff *skbin, const struct xt_match_param *par)
-#else
-match(const struct sk_buff *skbin,
-      const struct net_device *in,
-      const struct net_device *out,
-      const struct xt_match *match,
-      const void *matchinfo,
-      int offset,
-      unsigned int protoff,
-      bool *hotdrop)
-#endif
+static bool match(const struct sk_buff *skbin, struct xt_action_param *par)
 {
        /* sidestep const without getting a compiler warning... */
        struct sk_buff * skb = (struct sk_buff *)skbin; 
 
-       const struct xt_layer7_info * info = 
-       #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)
-               par->matchinfo;
-       #else
-               matchinfo;
-       #endif
+       const struct xt_layer7_info * info = par->matchinfo;
 
        enum ip_conntrack_info master_ctinfo, ctinfo;
        struct nf_conn *master_conntrack, *conntrack;
@@ -599,49 +573,21 @@ match(const struct sk_buff *skbin,
 }
 
 // load nf_conntrack_ipv4
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)
-static int
-#else
-static bool
-#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)
-check(const struct xt_mtchk_param *par)
+static int check(const struct xt_mtchk_param *par)
 {
         if (nf_ct_l3proto_try_module_get(par->match->family) < 0) {
                 printk(KERN_WARNING "can't load conntrack support for "
                                     "proto=%d\n", par->match->family);
-#else
-check(const char *tablename, const void *inf,
-                const struct xt_match *match, void *matchinfo,
-                unsigned int hook_mask)
-{
-        if (nf_ct_l3proto_try_module_get(match->family) < 0) {
-                printk(KERN_WARNING "can't load conntrack support for "
-                                    "proto=%d\n", match->family);
-#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)
                return -EINVAL;
        }
        return 0;
-#else
-                return 0;
-        }
-       return 1;
-#endif
 }
 
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)
-       static void destroy(const struct xt_mtdtor_param *par)
-       {
-               nf_ct_l3proto_module_put(par->match->family);
-       }
-#else
-       static void destroy(const struct xt_match *match, void *matchinfo)
-       {
-               nf_ct_l3proto_module_put(match->family);
-       }
-#endif
+static void destroy(const struct xt_mtdtor_param *par)
+{
+       nf_ct_l3proto_module_put(par->match->family);
+}
 
 static struct xt_match xt_layer7_match[] __read_mostly = {
 {