]> git.ipfire.org Git - thirdparty/xtables-addons.git/commitdiff
build: remove support for Linux 2.6.18
authorJan Engelhardt <jengelh@inai.de>
Mon, 15 Oct 2012 18:51:19 +0000 (20:51 +0200)
committerJan Engelhardt <jengelh@inai.de>
Tue, 16 Oct 2012 00:36:02 +0000 (02:36 +0200)
doc/changelog.txt
extensions/compat_xtables.c
extensions/compat_xtables.h
extensions/compat_xtnu.h
extensions/ip6table_rawpost.c
extensions/iptable_rawpost.c
extensions/pknock/xt_pknock.c
extensions/xt_CHAOS.c
extensions/xt_RAWNAT.c
extensions/xt_SYSRQ.c

index 1f1f6a00e25ce7dfd5205fd974e433169d7f80ad..4aceb507741489651b17d67aea7eb887e9be7fea 100644 (file)
@@ -2,7 +2,7 @@
 HEAD
 ====
 Changes:
-- remove support for Linux 2.6.17
+- remove support for Linux 2.6.17--2.6.18
 
 
 v1.47.1 (2010-10-15)
index 00b3e413b20f0b72cc8332920782918fb1919c5c..6b8c64928ea567088a5d31750598f27e7d466551 100644 (file)
@@ -88,11 +88,7 @@ static bool xtnu_match_run(const struct sk_buff *skb,
 }
 #endif
 
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18)
-static int xtnu_match_check(const char *table, const void *entry,
-    const struct xt_match *cm, void *matchinfo, unsigned int matchinfosize,
-    unsigned int hook_mask)
-#elif LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 22)
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 22)
 static int xtnu_match_check(const char *table, const void *entry,
     const struct xt_match *cm, void *matchinfo, unsigned int hook_mask)
 #elif LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 27)
@@ -132,10 +128,7 @@ static bool xtnu_match_check(const struct xt_mtchk_param *par)
 }
 #endif
 
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18)
-static void xtnu_match_destroy(const struct xt_match *cm, void *matchinfo,
-    unsigned int matchinfosize)
-#elif LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 27)
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 27)
 static void xtnu_match_destroy(const struct xt_match *cm, void *matchinfo)
 #endif
 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 27)
@@ -232,12 +225,7 @@ void xtnu_unregister_matches(struct xtnu_match *nt, unsigned int num)
 EXPORT_SYMBOL_GPL(xtnu_unregister_matches);
 #endif
 
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18)
-static unsigned int xtnu_target_run(struct sk_buff **pskb,
-    const struct net_device *in, const struct net_device *out,
-    unsigned int hooknum, const struct xt_target *ct, const void *targinfo,
-    void *userdata)
-#elif LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 23)
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 23)
 static unsigned int xtnu_target_run(struct sk_buff **pskb,
     const struct net_device *in, const struct net_device *out,
     unsigned int hooknum, const struct xt_target *ct, const void *targinfo)
@@ -295,11 +283,7 @@ xtnu_target_run(struct sk_buff *skb, const struct xt_action_param *par)
 }
 #endif
 
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18)
-static int xtnu_target_check(const char *table, const void *entry,
-    const struct xt_target *ct, void *targinfo,
-    unsigned int targinfosize, unsigned int hook_mask)
-#elif LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 22)
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 22)
 static int xtnu_target_check(const char *table, const void *entry,
     const struct xt_target *ct, void *targinfo, unsigned int hook_mask)
 #elif LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 27)
@@ -341,13 +325,8 @@ static bool xtnu_target_check(const struct xt_tgchk_param *par)
 }
 #endif
 
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18)
-static void xtnu_target_destroy(const struct xt_target *ct, void *targinfo,
-    unsigned int targinfosize)
-#elif LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 27)
-static void xtnu_target_destroy(const struct xt_target *ct, void *targinfo)
-#endif
 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 27)
+static void xtnu_target_destroy(const struct xt_target *ct, void *targinfo)
 {
        struct xtnu_target *nt = xtcompat_nutarget(ct);
        struct xt_tgdtor_param local_par = {
@@ -540,7 +519,6 @@ void xtnu_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb,
        __be32 diff[] = {~from, to};
        const void *dv = diff; /* kludge for < v2.6.19-555-g72685fc */
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
        if (skb->ip_summed != CHECKSUM_PARTIAL) {
                *sum = csum_fold(csum_partial(dv, sizeof(diff),
                       ~csum_unfold(*sum)));
@@ -551,10 +529,6 @@ void xtnu_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb,
                *sum = ~csum_fold(csum_partial(dv, sizeof(diff),
                       csum_unfold(*sum)));
        }
-#else
-       *sum = csum_fold(csum_partial(dv, sizeof(diff),
-              ~csum_unfold(*sum)));
-#endif
 }
 EXPORT_SYMBOL_GPL(xtnu_proto_csum_replace4);
 #endif
index 45a9a022865f1335d5acd9b3188743f67f3829d5..d98203b88f5b7b0d91e0afdbd6b99d7b284a41af 100644 (file)
@@ -8,8 +8,8 @@
 
 #define DEBUGP Use__pr_debug__instead
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
-#      warning Kernels below 2.6.18 not supported.
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
+#      warning Kernels below 2.6.19 not supported.
 #endif
 
 #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
index 98e8eaf36d35904b9a3fb1855ee37f757b0ba194..71e59468ae2151337766be526b81bfdb879a1354 100644 (file)
@@ -5,10 +5,6 @@
 #include <linux/netfilter/x_tables.h>
 #include <linux/spinlock.h>
 
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18)
-typedef _Bool bool;
-enum { false = 0, true = 1, };
-#endif
 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 19)
 typedef __u16 __bitwise __sum16;
 typedef __u32 __bitwise __wsum;
index 1cd9b263cff1aa02304a992cbe1a0b70622a67e7..abc16bb6fdb5dc66dc987c58d0f297037801d520 100644 (file)
@@ -50,11 +50,7 @@ static unsigned int rawpost6_hook_fn(unsigned int hook, sk_buff_t *skb,
     const struct net_device *in, const struct net_device *out,
     int (*okfn)(struct sk_buff *))
 {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
        return ip6t_do_table(skb, hook, in, out, rawpost6_ptable);
-#else
-       return ip6t_do_table(skb, hook, in, out, rawpost6_ptable, NULL);
-#endif
 }
 
 static struct nf_hook_ops rawpost6_hook_ops __read_mostly = {
index a266c8ec6566435bb29b08a04e8e071cab3f8544..50a45c4c8c2f8f7bef1de70dc1b713556a05a850 100644 (file)
@@ -51,11 +51,7 @@ static unsigned int rawpost4_hook_fn(unsigned int hook, sk_buff_t *skb,
     const struct net_device *in, const struct net_device *out,
     int (*okfn)(struct sk_buff *))
 {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
        return ipt_do_table(skb, hook, in, out, rawpost4_ptable);
-#else
-       return ipt_do_table(skb, hook, in, out, rawpost4_ptable, NULL);
-#endif
 }
 
 static struct nf_hook_ops rawpost4_hook_ops __read_mostly = {
index 8ef9ce3ead3531a838837d43d9a8f85614d731d8..f0026ea15674a29298614caf7af8c02846fca01f 100644 (file)
 #include "xt_pknock.h"
 #include "compat_xtables.h"
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
-#      define PK_CRYPTO 1
-#endif
-
 enum status {
        ST_INIT = 1,
        ST_MATCHING,
@@ -113,7 +109,6 @@ static struct proc_dir_entry *pde;
 
 static DEFINE_SPINLOCK(list_lock);
 
-#ifdef PK_CRYPTO
 static struct {
        const char *algo;
        struct crypto_hash      *tfm;
@@ -124,7 +119,6 @@ static struct {
        .tfm    = NULL,
        .size   = 0
 };
-#endif
 
 module_param(rule_hashsize, int, S_IRUGO);
 MODULE_PARM_DESC(rule_hashsize, "Buckets in rule hash table (default: 8)");
@@ -719,7 +713,6 @@ msg_to_userspace_nl(const struct xt_pknock_mtinfo *info,
        return true;
 }
 
-#ifdef PK_CRYPTO
 /**
  * Transforms a sequence of characters to hexadecimal.
  *
@@ -818,7 +811,6 @@ has_secret(const unsigned char *secret, unsigned int secret_len, uint32_t ipsrc,
        kfree(hexresult);
        return fret;
 }
-#endif /* PK_CRYPTO */
 
 /**
  * If the peer pass the security policy.
@@ -841,13 +833,11 @@ pass_security(struct peer *peer, const struct xt_pknock_mtinfo *info,
                pk_debug("DENIED (anti-spoof protection)", peer);
                return false;
        }
-#ifdef PK_CRYPTO
        /* Check for OPEN secret */
        if (has_secret(info->open_secret,
                                        info->open_secret_len, peer->ip,
                                        payload, payload_len))
                return true;
-#endif
 
        return false;
 }
@@ -939,7 +929,6 @@ static bool
 is_close_knock(const struct peer *peer, const struct xt_pknock_mtinfo *info,
                const unsigned char *payload, unsigned int payload_len)
 {
-#ifdef PK_CRYPTO
        /* Check for CLOSE secret. */
        if (has_secret(info->close_secret,
                                info->close_secret_len, peer->ip,
@@ -948,7 +937,6 @@ is_close_knock(const struct peer *peer, const struct xt_pknock_mtinfo *info,
                pk_debug("BLOCKED", peer);
                return true;
        }
-#endif
        return false;
 }
 
@@ -983,14 +971,8 @@ static bool pknock_mt(const struct sk_buff *skb,
 
        case IPPROTO_UDP:
        case IPPROTO_UDPLITE:
-#ifdef PK_CRYPTO
                hdr_len = (iph->ihl * 4) + sizeof(struct udphdr);
                break;
-#else
-               pr_debug("UDP protocol not supported\n");
-               return false;
-#endif
-
        default:
                pr_debug("IP payload protocol is neither tcp nor udp.\n");
                return false;
@@ -1079,12 +1061,9 @@ static int pknock_mt_check(const struct xt_mtchk_param *par)
 
        if (!(info->option & XT_PKNOCK_NAME))
                RETURN_ERR("You must specify --name option.\n");
-
-#ifndef PK_CRYPTO
        if (info->option & (XT_PKNOCK_OPENSECRET | XT_PKNOCK_CLOSESECRET))
                RETURN_ERR("No crypto support available; "
                        "cannot use opensecret/closescret\n");
-#endif
        if (info->option & XT_PKNOCK_OPENSECRET && info->ports_count != 1)
                RETURN_ERR("--opensecret must have just one knock port\n");
        if (info->option & XT_PKNOCK_KNOCKPORT) {
@@ -1154,7 +1133,6 @@ static int __init xt_pknock_mt_init(void)
 
        if (gc_expir_time < DEFAULT_GC_EXPIRATION_TIME)
                gc_expir_time = DEFAULT_GC_EXPIRATION_TIME;
-#ifdef PK_CRYPTO
        if (request_module(crypto.algo) < 0) {
                printk(KERN_ERR PKNOCK "request_module('%s') error.\n",
                         crypto.algo);
@@ -1171,9 +1149,6 @@ static int __init xt_pknock_mt_init(void)
        crypto.size = crypto_hash_digestsize(crypto.tfm);
        crypto.desc.tfm = crypto.tfm;
        crypto.desc.flags = 0;
-#else
-       pr_info("No crypto support for < 2.6.19\n");
-#endif
 
        pde = proc_mkdir("xt_pknock", init_net__proc_net);
        if (pde == NULL) {
@@ -1188,11 +1163,8 @@ static void __exit xt_pknock_mt_exit(void)
        remove_proc_entry("xt_pknock", init_net__proc_net);
        xt_unregister_match(&xt_pknock_mt_reg);
        kfree(rule_hashtable);
-
-#ifdef PK_CRYPTO
        if (crypto.tfm != NULL)
                crypto_free_hash(crypto.tfm);
-#endif
 }
 
 module_init(xt_pknock_mt_init);
index a3b7b475d6f94e990f9c42682a9bee9ffda9b3af..7c76d6ef82aafba2f2f9df235230140126c4641b 100644 (file)
@@ -94,9 +94,7 @@ xt_chaos_total(struct sk_buff *skb, const struct xt_action_param *par)
                return;
 
        destiny = (info->variant == XTCHAOS_TARPIT) ? xt_tarpit : xt_delude;
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18)
-       destiny->target(&skb, par->in, par->out, par->hooknum, destiny, NULL, NULL);
-#elif LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 23)
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 23)
        destiny->target(&skb, par->in, par->out, par->hooknum, destiny, NULL);
 #elif LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 27)
        destiny->target(skb, par->in, par->out, par->hooknum, destiny, NULL);
@@ -142,10 +140,7 @@ chaos_tg(struct sk_buff **pskb, const struct xt_action_param *par)
        const struct iphdr *iph = ip_hdr(skb);
 
        if ((unsigned int)net_random() <= reject_percentage) {
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18)
-               return xt_reject->target(pskb, par->in, par->out, par->hooknum,
-                      xt_reject, &reject_params, NULL);
-#elif LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 23)
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 23)
                return xt_reject->target(pskb, par->in, par->out, par->hooknum,
                       xt_reject, &reject_params);
 #elif LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 27)
index c15b5e56adb2a5e937efe290c1423a3e262e3fb0..e987776a0d8335aef41bf639de857a0d6a16a279 100644 (file)
@@ -96,9 +96,7 @@ static void rawnat4_update_l4(struct sk_buff *skb, __be32 oldip, __be32 newip)
        case IPPROTO_UDPLITE:
                udph = transport_hdr;
                cond = udph->check != 0;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
                cond |= skb->ip_summed == CHECKSUM_PARTIAL;
-#endif
                if (cond) {
                        inet_proto_csum_replace4(&udph->check, skb,
                                oldip, newip, true);
@@ -225,9 +223,7 @@ static void rawnat6_update_l4(struct sk_buff *skb, unsigned int l4proto,
        case IPPROTO_UDPLITE:
                udph = (void *)iph + l4offset;
                cond = udph->check;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
                cond |= skb->ip_summed == CHECKSUM_PARTIAL;
-#endif
                if (cond) {
                        for (i = 0; i < 4; ++i)
                                inet_proto_csum_replace4(&udph->check, skb,
index 9b5931374b48ae0060599747105f2f06ea24fb71..ab17bd8301fd7cda5241fcdf3d38f25c7f923cd9 100644 (file)
@@ -26,8 +26,7 @@
 #include <net/ip.h>
 #include "compat_xtables.h"
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19) && \
-    (defined(CONFIG_CRYPTO) || defined(CONFIG_CRYPTO_MODULE))
+#if defined(CONFIG_CRYPTO) || defined(CONFIG_CRYPTO_MODULE)
 #      define WITH_CRYPTO 1
 #endif
 #if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
@@ -156,10 +155,8 @@ static unsigned int sysrq_tg(const void *pdata, uint16_t len)
                printk(KERN_INFO KBUILD_MODNAME ": SysRq %c\n", data[i]);
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
                handle_sysrq(data[i]);
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
-               handle_sysrq(data[i], NULL);
 #else
-               handle_sysrq(data[i], NULL, NULL);
+               handle_sysrq(data[i], NULL);
 #endif
        }
        return NF_ACCEPT;
@@ -193,10 +190,8 @@ static unsigned int sysrq_tg(const void *pdata, uint16_t len)
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
        handle_sysrq(c);
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
-       handle_sysrq(c, NULL);
 #else
-       handle_sysrq(c, NULL, NULL);
+       handle_sysrq(c, NULL);
 #endif
        return NF_ACCEPT;
 }
@@ -364,8 +359,9 @@ static int __init sysrq_crypto_init(void)
  fail:
        sysrq_crypto_exit();
        return ret;
-#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
-       printk(KERN_WARNING "xt_SYSRQ does not provide crypto for < 2.6.19\n");
+#else
+       printk(KERN_WARNING "Kernel was compiled without crypto, "
+              "so xt_SYSRQ won't use crypto.\n");
 #endif
        return -EINVAL;
 }