43df5c
From c513cc3dd10231f267548d644dcb7632516a2348 Mon Sep 17 00:00:00 2001
43df5c
From: Thomas Woerner <twoerner@redhat.com>
43df5c
Date: Fri, 10 Jun 2016 14:57:58 +0200
43df5c
Subject: ip6tables: Warn about use of DROP in nat table
43df5c
43df5c
Clone of 1eada72b with 9bb76094 and e0390bee on top.
43df5c
43df5c
Signed-off-by: Thomas Woerner <twoerner@redhat.com>
43df5c
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
43df5c
---
43df5c
 iptables/ip6tables.c | 7 +++++++
43df5c
 1 file changed, 7 insertions(+)
43df5c
43df5c
diff --git a/iptables/ip6tables.c b/iptables/ip6tables.c
43df5c
index 2731209..c48ddf9 100644
43df5c
--- a/iptables/ip6tables.c
43df5c
+++ b/iptables/ip6tables.c
43df5c
@@ -1720,6 +1720,13 @@ int do_command6(int argc, char *argv[], char **table,
43df5c
 		cs.invert = FALSE;
43df5c
 	}
43df5c
 
43df5c
+	if (strcmp(*table, "nat") == 0 &&
43df5c
+	    ((policy != NULL && strcmp(policy, "DROP") == 0) ||
43df5c
+	    (cs.jumpto != NULL && strcmp(cs.jumpto, "DROP") == 0)))
43df5c
+		xtables_error(PARAMETER_PROBLEM,
43df5c
+			"\nThe \"nat\" table is not intended for filtering, "
43df5c
+		        "the use of DROP is therefore inhibited.\n\n");
43df5c
+
43df5c
 	for (matchp = cs.matches; matchp; matchp = matchp->next)
43df5c
 		xtables_option_mfcall(matchp->match);
43df5c
 	if (cs.target != NULL)
43df5c
-- 
43df5c
cgit v0.12
43df5c