netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xtables-compat-restore: fix translation of mangle's OUTPUT
@ 2017-09-10  0:39 Louis Sautier
  2017-09-10 18:35 ` Louis Sautier
  0 siblings, 1 reply; 3+ messages in thread
From: Louis Sautier @ 2017-09-10  0:39 UTC (permalink / raw)
  To: netfilter-devel


[-- Attachment #1.1.1: Type: text/plain, Size: 319 bytes --]

Hello,
I noticed that the iptables-restore-translate tool does not properly
translate the OUTPUT chain from the mangle table. It creates a filter
chain when it should be creating a route chain.
Here is a rather simple patch that should fix the issue.

Please CC me, I'm not subscribed.

Kind regards,

Louis

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.1.2: 0001-xtables-compat-restore-fix-translation-of-mangle-s-O.patch --]
[-- Type: text/x-patch; name="0001-xtables-compat-restore-fix-translation-of-mangle-s-O.patch", Size: 930 bytes --]

From 4eb328c7756044279243419dd3f116754f924a3e Mon Sep 17 00:00:00 2001
From: Louis Sautier <sautier.louis@gmail.com>
Date: Sun, 10 Sep 2017 02:13:18 +0200
Subject: [PATCH] xtables-compat-restore: fix translation of mangle's OUTPUT
 chain

This chain should be translated as a route chain, not as a filter chain.
---
 iptables/xtables-translate.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/iptables/xtables-translate.c b/iptables/xtables-translate.c
index 3e6c7051..4f6a9caf 100644
--- a/iptables/xtables-translate.c
+++ b/iptables/xtables-translate.c
@@ -357,6 +357,8 @@ static int xlate_chain_set(struct nft_handle *h, const char *table,
 
 	if (strcmp(table, "nat") == 0)
 		type = "nat";
+	else if (strcmp(table, "mangle") == 0 && strcmp(chain, "OUTPUT") == 0)
+		type = "route";
 
 	printf("add chain %s %s %s { type %s ",
 	       family2str[h->family], table, chain, type);
-- 
2.14.1


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2017-09-10 20:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-10  0:39 [PATCH] xtables-compat-restore: fix translation of mangle's OUTPUT Louis Sautier
2017-09-10 18:35 ` Louis Sautier
2017-09-10 20:05   ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).