|
|
b144b7 |
From 1695f552d3947299e54978bcd5bc1cdc3a5c14f7 Mon Sep 17 00:00:00 2001
|
|
|
b144b7 |
From: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
|
b144b7 |
Date: Wed, 15 Apr 2020 18:16:41 +0200
|
|
|
b144b7 |
Subject: [PATCH] extensions: libxt_CT: add translation for NOTRACK
|
|
|
b144b7 |
|
|
|
b144b7 |
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
|
b144b7 |
(cherry picked from commit f3d4a3ddbcfca15a00dd9758f481420038f6de10)
|
|
|
b144b7 |
Signed-off-by: Phil Sutter <psutter@redhat.com>
|
|
|
b144b7 |
---
|
|
|
b144b7 |
extensions/libxt_CT.c | 16 ++++++++++++++++
|
|
|
b144b7 |
extensions/libxt_NOTRACK.txlate | 2 ++
|
|
|
b144b7 |
2 files changed, 18 insertions(+)
|
|
|
b144b7 |
create mode 100644 extensions/libxt_NOTRACK.txlate
|
|
|
b144b7 |
|
|
|
b144b7 |
diff --git a/extensions/libxt_CT.c b/extensions/libxt_CT.c
|
|
|
b144b7 |
index 371b21766c56c..fbbbe2660e9fc 100644
|
|
|
b144b7 |
--- a/extensions/libxt_CT.c
|
|
|
b144b7 |
+++ b/extensions/libxt_CT.c
|
|
|
b144b7 |
@@ -348,6 +348,20 @@ static void notrack_ct2_tg_init(struct xt_entry_target *target)
|
|
|
b144b7 |
info->flags = XT_CT_NOTRACK | XT_CT_NOTRACK_ALIAS;
|
|
|
b144b7 |
}
|
|
|
b144b7 |
|
|
|
b144b7 |
+static int xlate_ct1_tg(struct xt_xlate *xl,
|
|
|
b144b7 |
+ const struct xt_xlate_tg_params *params)
|
|
|
b144b7 |
+{
|
|
|
b144b7 |
+ struct xt_ct_target_info_v1 *info =
|
|
|
b144b7 |
+ (struct xt_ct_target_info_v1 *)params->target->data;
|
|
|
b144b7 |
+
|
|
|
b144b7 |
+ if (info->flags & XT_CT_NOTRACK)
|
|
|
b144b7 |
+ xt_xlate_add(xl, "notrack");
|
|
|
b144b7 |
+ else
|
|
|
b144b7 |
+ return 0;
|
|
|
b144b7 |
+
|
|
|
b144b7 |
+ return 1;
|
|
|
b144b7 |
+}
|
|
|
b144b7 |
+
|
|
|
b144b7 |
static struct xtables_target ct_target_reg[] = {
|
|
|
b144b7 |
{
|
|
|
b144b7 |
.family = NFPROTO_UNSPEC,
|
|
|
b144b7 |
@@ -387,6 +401,7 @@ static struct xtables_target ct_target_reg[] = {
|
|
|
b144b7 |
.alias = ct_print_name_alias,
|
|
|
b144b7 |
.x6_parse = ct_parse_v1,
|
|
|
b144b7 |
.x6_options = ct_opts_v1,
|
|
|
b144b7 |
+ .xlate = xlate_ct1_tg,
|
|
|
b144b7 |
},
|
|
|
b144b7 |
{
|
|
|
b144b7 |
.family = NFPROTO_UNSPEC,
|
|
|
b144b7 |
@@ -418,6 +433,7 @@ static struct xtables_target ct_target_reg[] = {
|
|
|
b144b7 |
.size = XT_ALIGN(sizeof(struct xt_ct_target_info_v1)),
|
|
|
b144b7 |
.userspacesize = offsetof(struct xt_ct_target_info_v1, ct),
|
|
|
b144b7 |
.init = notrack_ct2_tg_init,
|
|
|
b144b7 |
+ .xlate = xlate_ct1_tg,
|
|
|
b144b7 |
},
|
|
|
b144b7 |
{
|
|
|
b144b7 |
.family = NFPROTO_UNSPEC,
|
|
|
b144b7 |
diff --git a/extensions/libxt_NOTRACK.txlate b/extensions/libxt_NOTRACK.txlate
|
|
|
b144b7 |
new file mode 100644
|
|
|
b144b7 |
index 0000000000000..9d35619d3dbdd
|
|
|
b144b7 |
--- /dev/null
|
|
|
b144b7 |
+++ b/extensions/libxt_NOTRACK.txlate
|
|
|
b144b7 |
@@ -0,0 +1,2 @@
|
|
|
b144b7 |
+iptables-translate -A PREROUTING -t raw -j NOTRACK
|
|
|
b144b7 |
+nft add rule ip raw PREROUTING counter notrack
|
|
|
b144b7 |
--
|
|
|
b144b7 |
2.28.0
|
|
|
b144b7 |
|