Skip to contentSkip to conversation

xt_ECHO, xt_TARPIT: make properly conditional on IPv6

PATCH In review Philip Prindeville 4 participants 10 messages Sep 26, 2021 – Apr 12, 2022 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 xt_ECHO, xt_TARPIT: make properly conditional on IPv6

From: Philip Prindeville <[email protected]>

Not all modules compile equally well when CONFIG_IPv6 is disabled.

---
 extensions/xt_ECHO.c   | 19 ++++++++++++++-----
 extensions/xt_TARPIT.c |  2 ++
 2 files changed, 16 insertions(+), 5 deletions(-)
extensions/xt_ECHO.c +14 -5
index a0b718561db53ab468f86e17a05b5d991771d983..3c419f36f5169212af01cf62afa0b93456401767 100644
@@ -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
extensions/xt_TARPIT.c +2 -0
index 0b70dd9c8d16fe9193125b66f0773af8b00a6e81..9a7ae5cc840683d96a98ba298626b81fee355ac1 100644
@@ -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
Signature · 1 line
2.25.1
#1 lore raw
Quoted 15 lines · Philip Prindeville

From: Philip Prindeville <[email protected]>

Not all modules compile equally well when CONFIG_IPv6 is disabled.

{
.name = "ECHO",
.revision = 0,

extensions/xt_ECHO.c +1 -1
-		.family     = NFPROTO_IPV6,
+		.family     = NFPROTO_IPV4,

.proto = IPPROTO_UDP,
.table = "filter",

extensions/xt_ECHO.c +1 -1
-		.target     = echo_tg6,
+		.target     = echo_tg4,
		.me         = THIS_MODULE,
	},
Quoted 1 line

+#ifdef WITH_IPV6

I put the original order back, makes the diff smaller. So added.

#2 lore raw

Did this get merged?

Last commit I saw was:

commit c90ecf4320289e2567f2b6dee0c6c21d9d51b145

Author: Jeff Carlson <[email protected]>
Date:   Sun Aug 15 18:59:25 2021 -0700

pknock: added UDP options to help and made whitespace consistent

Thanks

Quoted 24 lines · Jan Engelhardt
Quoted 15 lines · Philip Prindeville

From: Philip Prindeville <[email protected]>

Not all modules compile equally well when CONFIG_IPv6 is disabled.

{
.name = "ECHO",
.revision = 0,

extensions/xt_ECHO.c +1 -1
-		.family     = NFPROTO_IPV6,
+		.family     = NFPROTO_IPV4,

.proto = IPPROTO_UDP,
.table = "filter",

extensions/xt_ECHO.c +1 -1
-		.target     = echo_tg6,
+		.target     = echo_tg4,
		.me         = THIS_MODULE,
	},
Quoted 1 line

+#ifdef WITH_IPV6

I put the original order back, makes the diff smaller. So added.

#3 lore raw
Quoted 22 lines · Philip Prindeville
Quoted 5 lines · Jan Engelhardt
Quoted 4 lines · Philip Prindeville

From: Philip Prindeville <[email protected]>

Not all modules compile equally well when CONFIG_IPv6 is disabled.

Quoted 15 lines
Quoted 11 lines

{
.name = "ECHO",
.revision = 0,

extensions/xt_ECHO.c +1 -1
-		.family     = NFPROTO_IPV6,
+		.family     = NFPROTO_IPV4,

.proto = IPPROTO_UDP,
.table = "filter",

extensions/xt_ECHO.c +1 -1
-		.target     = echo_tg6,
+		.target     = echo_tg4,
		.me         = THIS_MODULE,
	},
Quoted 1 line

+#ifdef WITH_IPV6

I put the original order back, makes the diff smaller. So added.

Quoted 1 line

Did this get merged?

It did. It's currently at the tip of master.

Quoted 7 lines

Last commit I saw was:

commit c90ecf4320289e2567f2b6dee0c6c21d9d51b145

Author: Jeff Carlson <[email protected]>
Date:   Sun Aug 15 18:59:25 2021 -0700

pknock: added UDP options to help and made whitespace consistent

J.

#4 lore raw
Quoted 27 lines · Jeremy Sowden
Quoted 22 lines · Philip Prindeville
Quoted 20 lines · Jan Engelhardt
Quoted 15 lines · Philip Prindeville

From: Philip Prindeville <[email protected]>

Not all modules compile equally well when CONFIG_IPv6 is disabled.

{
.name = "ECHO",
.revision = 0,

extensions/xt_ECHO.c +1 -1
-		.family     = NFPROTO_IPV6,
+		.family     = NFPROTO_IPV4,

.proto = IPPROTO_UDP,
.table = "filter",

extensions/xt_ECHO.c +1 -1
-		.target     = echo_tg6,
+		.target     = echo_tg4,
		.me         = THIS_MODULE,
	},
Quoted 1 line

+#ifdef WITH_IPV6

I put the original order back, makes the diff smaller. So added.

Quoted 3 lines
Quoted 1 line

Did this get merged?

It did. It's currently at the tip of master.

Did we change repo sites? I'm not seeing it here:

https://sourceforge.net/p/xtables-addons/xtables-addons/ci/e3ae438e2e23f0849c756604a4518315e097ad62/log/?path=/extensions/xt_ECHO.c

Quoted 10 lines
Quoted 8 lines

Last commit I saw was:

commit c90ecf4320289e2567f2b6dee0c6c21d9d51b145

Author: Jeff Carlson <[email protected]>
Date:   Sun Aug 15 18:59:25 2021 -0700

pknock: added UDP options to help and made whitespace consistent

J.

#5 lore raw
Quoted 24 lines · Philip Prindeville
Quoted 23 lines · Jeremy Sowden
Quoted 22 lines · Philip Prindeville
Quoted 20 lines · Jan Engelhardt
Quoted 15 lines · Philip Prindeville

From: Philip Prindeville <[email protected]>

Not all modules compile equally well when CONFIG_IPv6 is disabled.

{
.name = "ECHO",
.revision = 0,

extensions/xt_ECHO.c +1 -1
-		.family     = NFPROTO_IPV6,
+		.family     = NFPROTO_IPV4,

.proto = IPPROTO_UDP,
.table = "filter",

extensions/xt_ECHO.c +1 -1
-		.target     = echo_tg6,
+		.target     = echo_tg4,
		.me         = THIS_MODULE,
	},
Quoted 1 line

+#ifdef WITH_IPV6

I put the original order back, makes the diff smaller. So added.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Did this get merged?

It did. It's currently at the tip of master.

Did we change repo sites? I'm not seeing it here:

https://sourceforge.net/p/xtables-addons/xtables-addons/ci/e3ae438e2e23f0849c756604a4518315e097ad62/log/?path=/extensions/xt_ECHO.c

Yes:

https://inai.de/projects/xtables-addons/

J.

#6 lore raw
Quoted 16 lines · Jeremy Sowden
Quoted 11 lines · Philip Prindeville
Quoted 7 lines · Jeremy Sowden
Quoted 4 lines · Philip Prindeville
Quoted 1 line · Jan Engelhardt

[snip]

Did this get merged?

It did. It's currently at the tip of master.

Did we change repo sites? I'm not seeing it here:

Quoted 7 lines
Quoted 1 line

https://sourceforge.net/p/xtables-addons/xtables-addons/ci/e3ae438e2e23f0849c756604a4518315e097ad62/log/?path=/extensions/xt_ECHO.c

Yes:

https://inai.de/projects/xtables-addons/

J.

That would do it.

When is 3.19 or 4.0 due out?

Thanks,

-Philip

#7 lore raw
Quoted 3 lines · Philip Prindeville

That would do it.
When is 3.19 or 4.0 due out?

No particular plans, therefore I tagged 3.19 for your enjoyment.

#8 lore raw
Quoted 11 lines · Jan Engelhardt
Quoted 3 lines · Philip Prindeville

That would do it.
When is 3.19 or 4.0 due out?

No particular plans, therefore I tagged 3.19 for your enjoyment.

Cheers.

Rebuilding the packaging for openwrt now.

#9 lore raw
Quoted 14 lines · Philip Prindeville
Quoted 11 lines · Jan Engelhardt
Quoted 3 lines · Philip Prindeville

That would do it.
When is 3.19 or 4.0 due out?

Quoted 7 lines
Quoted 1 line

No particular plans, therefore I tagged 3.19 for your enjoyment.

Cheers.

Rebuilding the packaging for openwrt now.

Update: stalled on getting the package maintainer for openwrt to approve my version bump PR.