diff --git a/doc/changelog.txt b/doc/changelog.txt index 6fde3fd..306a07a 100644 --- a/doc/changelog.txt +++ b/doc/changelog.txt @@ -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 diff --git a/extensions/compat_xtables.c b/extensions/compat_xtables.c index b79a891..503ca94 100644 --- a/extensions/compat_xtables.c +++ b/extensions/compat_xtables.c @@ -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) { diff --git a/extensions/xt_TARPIT.c b/extensions/xt_TARPIT.c index ac69364..a56f2bd 100644 --- a/extensions/xt_TARPIT.c +++ b/extensions/xt_TARPIT.c @@ -55,6 +55,9 @@ #include #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)