All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/1] xt_ECHO, xt_TARPIT: make properly conditional on IPv6
@ 2021-09-26 19:57 Philip Prindeville
  2021-09-28  9:43 ` Jan Engelhardt
  0 siblings, 1 reply; 10+ messages in thread
From: Philip Prindeville @ 2021-09-26 19:57 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Jan Engelhardt, Philip Prindeville

From: Philip Prindeville <philipp@redfish-solutions.com>

Not all modules compile equally well when CONFIG_IPv6 is disabled.

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
---
 extensions/xt_ECHO.c   | 19 ++++++++++++++-----
 extensions/xt_TARPIT.c |  2 ++
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/extensions/xt_ECHO.c b/extensions/xt_ECHO.c
index a0b718561db53ab468f86e17a05b5d991771d983..3c419f36f5169212af01cf62afa0b93456401767 100644
--- a/extensions/xt_ECHO.c
+++ b/extensions/xt_ECHO.c
@@ -22,7 +22,11 @@
 #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)
@@ -219,21 +224,23 @@ static struct xt_target echo_tg_reg[] __read_mostly = {
 	{
 		.name       = "ECHO",
 		.revision   = 0,
-		.family     = NFPROTO_IPV6,
+		.family     = NFPROTO_IPV4,
 		.proto      = IPPROTO_UDP,
 		.table      = "filter",
-		.target     = echo_tg6,
+		.target     = echo_tg4,
 		.me         = THIS_MODULE,
 	},
+#ifdef WITH_IPV6
 	{
 		.name       = "ECHO",
 		.revision   = 0,
-		.family     = NFPROTO_IPV4,
+		.family     = NFPROTO_IPV6,
 		.proto      = IPPROTO_UDP,
 		.table      = "filter",
-		.target     = echo_tg4,
+		.target     = echo_tg6,
 		.me         = THIS_MODULE,
 	},
+#endif
 };
 
 static int __init echo_tg_init(void)
@@ -251,5 +258,7 @@ module_exit(echo_tg_exit);
 MODULE_AUTHOR("Jan Engelhardt ");
 MODULE_DESCRIPTION("Xtables: ECHO diagnosis target");
 MODULE_LICENSE("GPL");
-MODULE_ALIAS("ip6t_ECHO");
 MODULE_ALIAS("ipt_ECHO");
+#ifdef WITH_IPV6
+MODULE_ALIAS("ip6t_ECHO");
+#endif
diff --git a/extensions/xt_TARPIT.c b/extensions/xt_TARPIT.c
index 0b70dd9c8d16fe9193125b66f0773af8b00a6e81..9a7ae5cc840683d96a98ba298626b81fee355ac1 100644
--- a/extensions/xt_TARPIT.c
+++ b/extensions/xt_TARPIT.c
@@ -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
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-04-12 18:28 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-26 19:57 [PATCH v2 1/1] xt_ECHO, xt_TARPIT: make properly conditional on IPv6 Philip Prindeville
2021-09-28  9:43 ` Jan Engelhardt
2022-01-31  4:53   ` Philip Prindeville
2022-01-31 10:24     ` Jeremy Sowden
2022-01-31 18:27       ` Philip Prindeville
2022-01-31 18:31         ` Jeremy Sowden
2022-01-31 18:35           ` Philip Prindeville
2022-02-01 17:32             ` Jan Engelhardt
2022-02-01 18:22               ` Philip Prindeville
2022-04-12 18:18                 ` Philip Prindeville

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.