]> git.ipfire.org Git - thirdparty/xtables-addons.git/commitdiff
xt_ECHO, xt_TARPIT: make properly conditional on IPv6
authorPhilip Prindeville <philipp@redfish-solutions.com>
Sun, 26 Sep 2021 19:57:34 +0000 (21:57 +0200)
committerJan Engelhardt <jengelh@inai.de>
Tue, 28 Sep 2021 09:42:47 +0000 (11:42 +0200)
Not all modules compile equally well when CONFIG_IPv6 is disabled.

extensions/xt_ECHO.c
extensions/xt_TARPIT.c

index a0b718561db53ab468f86e17a05b5d991771d983..1ead749d08c2be69a199f640df91e640c2d6248f 100644 (file)
 #include <net/ip6_route.h>
 #include <net/route.h>
 #include "compat_xtables.h"
+#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
+#      define WITH_IPV6 1
+#endif
 
+#ifdef WITH_IPV6
 static unsigned int
 echo_tg6(struct sk_buff *oldskb, const struct xt_action_param *par)
 {
@@ -124,6 +128,7 @@ echo_tg6(struct sk_buff *oldskb, const struct xt_action_param *par)
        kfree_skb(newskb);
        return NF_DROP;
 }
+#endif
 
 static unsigned int
 echo_tg4(struct sk_buff *oldskb, const struct xt_action_param *par)
@@ -216,6 +221,7 @@ echo_tg4(struct sk_buff *oldskb, const struct xt_action_param *par)
 }
 
 static struct xt_target echo_tg_reg[] __read_mostly = {
+#ifdef WITH_IPV6
        {
                .name       = "ECHO",
                .revision   = 0,
@@ -225,6 +231,7 @@ static struct xt_target echo_tg_reg[] __read_mostly = {
                .target     = echo_tg6,
                .me         = THIS_MODULE,
        },
+#endif
        {
                .name       = "ECHO",
                .revision   = 0,
@@ -251,5 +258,7 @@ module_exit(echo_tg_exit);
 MODULE_AUTHOR("Jan Engelhardt ");
 MODULE_DESCRIPTION("Xtables: ECHO diagnosis target");
 MODULE_LICENSE("GPL");
+#ifdef WITH_IPV6
 MODULE_ALIAS("ip6t_ECHO");
+#endif
 MODULE_ALIAS("ipt_ECHO");
index 0b70dd9c8d16fe9193125b66f0773af8b00a6e81..9a7ae5cc840683d96a98ba298626b81fee355ac1 100644 (file)
@@ -532,4 +532,6 @@ MODULE_DESCRIPTION("Xtables: \"TARPIT\", capture and hold TCP connections");
 MODULE_AUTHOR("Jan Engelhardt ");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS("ipt_TARPIT");
+#ifdef WITH_IPV6
 MODULE_ALIAS("ip6t_TARPIT");
+#endif