]> git.ipfire.org Git - thirdparty/xtables-addons.git/commitdiff
build: do not attempt to build IPv6 parts if CONFIG_IPV6=n
authorJan Engelhardt <jengelh@inai.de>
Sat, 14 Jul 2012 20:55:39 +0000 (22:55 +0200)
committerJan Engelhardt <jengelh@inai.de>
Sat, 14 Jul 2012 20:55:39 +0000 (22:55 +0200)
doc/changelog.txt
extensions/compat_xtables.c
extensions/xt_TARPIT.c

index 6fde3fd07038ed47d6da8ff88a9e392af7f93cfc..306a07a13c99263ff503ed4cd0b3ed8aaa2b592a 100644 (file)
@@ -3,6 +3,7 @@ HEAD
 ====
 Fixes:
 - SYSRQ: fix double target initialization at module load
+- build: do not attempt to build IPv6 parts if CONFIG_IPV6=n
 Enhancements:
 - TARPIT gained IPv6 support
 
index b79a8919d703fa0065778ca609f6347371fb586c..503ca94286786f3393de8a8ffd97735199b3eebf 100644 (file)
@@ -26,6 +26,9 @@
 #endif
 #include "compat_skbuff.h"
 #include "compat_xtnu.h"
+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+#      define WITH_IPV6 1
+#endif
 
 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 22)
 static int xtnu_match_run(const struct sk_buff *skb,
@@ -614,7 +617,7 @@ void *HX_memmem(const void *space, size_t spacesize,
 }
 EXPORT_SYMBOL_GPL(HX_memmem);
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0) && defined(WITH_IPV6)
 int xtnu_ipv6_skip_exthdr(const struct sk_buff *skb, int start,
     uint8_t *nexthdrp, __be16 *fragoffp)
 {
@@ -622,7 +625,7 @@ int xtnu_ipv6_skip_exthdr(const struct sk_buff *skb, int start,
 }
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 5, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 5, 0) && defined(WITH_IPV6)
 int xtnu_ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
     int target, unsigned short *fragoff, int *fragflg)
 {
index ac693644e9776ae4f75a691a5f753749bf4ccf88..a56f2bd028a16fc52a3e9fa762f09bac6639159c 100644 (file)
@@ -55,6 +55,9 @@
 #include <net/tcp.h>
 #include "compat_xtables.h"
 #include "xt_TARPIT.h"
+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+#      define WITH_IPV6 1
+#endif
 
 static bool xttarpit_tarpit(struct tcphdr *tcph, const struct tcphdr *oth)
 {
@@ -298,6 +301,7 @@ static void tarpit_tcp4(struct sk_buff *oldskb, unsigned int hook,
        kfree_skb(nskb);
 }
 
+#ifdef WITH_IPV6
 static void tarpit_tcp6(struct sk_buff *oldskb, unsigned int hook,
     unsigned int mode)
 {
@@ -420,6 +424,7 @@ static void tarpit_tcp6(struct sk_buff *oldskb, unsigned int hook,
  free_nskb:
        kfree_skb(nskb);
 }
+#endif
 
 static unsigned int
 tarpit_tg4(struct sk_buff **pskb, const struct xt_action_param *par)
@@ -457,6 +462,7 @@ tarpit_tg4(struct sk_buff **pskb, const struct xt_action_param *par)
        return NF_DROP;
 }
 
+#ifdef WITH_IPV6
 static unsigned int
 tarpit_tg6(struct sk_buff **pskb, const struct xt_action_param *par)
 {
@@ -498,6 +504,7 @@ tarpit_tg6(struct sk_buff **pskb, const struct xt_action_param *par)
        tarpit_tcp6(*pskb, par->hooknum, info->variant);
        return NF_DROP;
 }
+#endif
 
 static struct xt_target tarpit_tg_reg[] __read_mostly = {
        {
@@ -510,6 +517,7 @@ static struct xt_target tarpit_tg_reg[] __read_mostly = {
                .targetsize = sizeof(struct xt_tarpit_tginfo),
                .me         = THIS_MODULE,
        },
+#ifdef WITH_IPV6
        {
                .name       = "TARPIT",
                .revision   = 0,
@@ -520,6 +528,7 @@ static struct xt_target tarpit_tg_reg[] __read_mostly = {
                .targetsize = sizeof(struct xt_tarpit_tginfo),
                .me         = THIS_MODULE,
        },
+#endif
 };
 
 static int __init tarpit_tg_init(void)