* [PATCH] iptables-compat: homogenize error messages
@ 2014-10-30 8:31 Ana Rey
2014-10-30 17:11 ` Pablo Neira Ayuso
0 siblings, 1 reply; 2+ messages in thread
From: Ana Rey @ 2014-10-30 8:31 UTC (permalink / raw)
To: netfilter-devel; +Cc: Ana Rey
There are some differences between error messages in iptables and
iptables-compat:
# iptables -C INPUT -s 192.168.2.102 -j ACCEPT
iptables: Bad rule (does a matching rule exist in that chain?).
# iptables-compat -C INPUT -s 192.168.2.102 -j ACCEPT
iptables: No chain/target/match by that name.
# iptables -N new_chain
# iptables -N new_chain
iptables: Chain already exists.
# iptables-compat -N new_chain
# iptables-compat -N new_chain
iptables: File exists.
Now, iptables-compat shows the same error messages than iptables in
those cases.
Signed-off-by: Ana Rey <anarey@gmail.com>
---
iptables/nft.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/iptables/nft.c b/iptables/nft.c
index ac72bfa..1a2c438 100644
--- a/iptables/nft.c
+++ b/iptables/nft.c
@@ -1298,6 +1298,8 @@ int nft_chain_user_add(struct nft_handle *h, const char *chain, const char *tabl
struct nft_chain *c;
int ret;
+ nft_fn = nft_chain_user_add;
+
/* If built-in chains don't exist for this table, create them */
if (nft_xtables_config_load(h, XTABLES_CONFIG_DEFAULT, 0) < 0)
nft_xt_builtin_init(h, table);
@@ -2344,10 +2346,12 @@ const char *nft_strerror(int err)
{
{ nft_chain_user_del, ENOTEMPTY, "Chain is not empty" },
{ nft_chain_user_del, EINVAL, "Can't delete built-in chain" },
+ { nft_chain_user_del, EBUSY, "Directory not empty" },
{ nft_chain_user_del, EMLINK,
"Can't delete chain with references left" },
{ nft_chain_user_add, EEXIST, "Chain already exists" },
{ nft_rule_add, E2BIG, "Index of insertion too big" },
+ { nft_rule_check, ENOENT, "Bad rule (does a matching rule exist in that chain?)" },
{ nft_rule_replace, E2BIG, "Index of replacement too big" },
{ nft_rule_delete_num, E2BIG, "Index of deletion too big" },
/* { TC_READ_COUNTER, E2BIG, "Index of counter too big" },
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] iptables-compat: homogenize error messages
2014-10-30 8:31 [PATCH] iptables-compat: homogenize error messages Ana Rey
@ 2014-10-30 17:11 ` Pablo Neira Ayuso
0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2014-10-30 17:11 UTC (permalink / raw)
To: Ana Rey; +Cc: netfilter-devel
On Thu, Oct 30, 2014 at 09:31:56AM +0100, Ana Rey wrote:
> There are some differences between error messages in iptables and
> iptables-compat:
>
> # iptables -C INPUT -s 192.168.2.102 -j ACCEPT
> iptables: Bad rule (does a matching rule exist in that chain?).
> # iptables-compat -C INPUT -s 192.168.2.102 -j ACCEPT
> iptables: No chain/target/match by that name.
>
> # iptables -N new_chain
> # iptables -N new_chain
> iptables: Chain already exists.
> # iptables-compat -N new_chain
> # iptables-compat -N new_chain
> iptables: File exists.
>
> Now, iptables-compat shows the same error messages than iptables in
> those cases.
Applied, thanks Ana.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-10-30 17:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-30 8:31 [PATCH] iptables-compat: homogenize error messages Ana Rey
2014-10-30 17:11 ` 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).