From: Phil Sutter <phil@nwl.cc>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: [PATCH] xtables-translate: Support setting standard chain policy
Date: Fri, 25 Nov 2016 18:06:46 +0100 [thread overview]
Message-ID: <20161125170646.8620-1-phil@nwl.cc> (raw)
Looks like this bit was simply forgotten when implementing
xlate_chain_set() as everything needed was there to just print the
desired policy along with the chain definition.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
iptables/xtables-translate.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/iptables/xtables-translate.c b/iptables/xtables-translate.c
index 689533f3d4d85..0c706dcc2b9db 100644
--- a/iptables/xtables-translate.c
+++ b/iptables/xtables-translate.c
@@ -354,16 +354,22 @@ static int xlate_chain_set(struct nft_handle *h, const char *table,
{
printf("add chain %s %s %s ", family2str[h->family], table, chain);
if (strcmp(chain, "PREROUTING") == 0)
- printf("{ type filter hook prerouting priority 0; }\n");
+ printf("{ type filter hook prerouting priority 0; ");
else if (strcmp(chain, "INPUT") == 0)
- printf("{ type filter hook input priority 0; }\n");
+ printf("{ type filter hook input priority 0; ");
else if (strcmp(chain, "FORWARD") == 0)
- printf("{ type filter hook forward priority 0; }\n");
+ printf("{ type filter hook forward priority 0; ");
else if (strcmp(chain, "OUTPUT") == 0)
- printf("{ type filter hook output priority 0; }\n");
+ printf("{ type filter hook output priority 0; ");
else if (strcmp(chain, "POSTROUTING") == 0)
- printf("{ type filter hook postrouting priority 0; }\n");
+ printf("{ type filter hook postrouting priority 0; ");
+ if (strcmp(policy, "ACCEPT") == 0)
+ printf("policy accept; ");
+ else if (strcmp(policy, "DROP") == 0)
+ printf("policy drop; ");
+
+ printf("}\n");
return 1;
}
--
2.10.0
next reply other threads:[~2016-11-25 17:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-25 17:06 Phil Sutter [this message]
2016-11-29 22:00 ` [PATCH] xtables-translate: Support setting standard chain policy Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161125170646.8620-1-phil@nwl.cc \
--to=phil@nwl.cc \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).