Skip to contentSkip to conversation

iptables-compat: homogenize error messages with 'R' option

PATCH Applied Ana Rey 2 participants 2 messages Nov 5, 2014 – Nov 10, 2014 netfilter

lore
Share & tools
lore

Ana Rey

author
#0 lore raw

PATCH 1/1 iptables-compat: homogenize error messages with 'R' option

There is a difference between error messages in iptables and iptables-compat:

 # iptables -R INPUT 23 -s 192.168.2.140 -j ACCEPT
iptables: Index of replacement too big.
 # iptables-compat -R INPUT 23 -s 192.168.2.140 -j ACCEPT
iptables: No chain/target/match by that name.

Now, iptables-compat shows the same error message than iptables in this case.

---
 iptables/nft.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
iptables/nft.c +1 -1
index 6cb03a0..64222af 100644
@@ -2358,7 +2358,7 @@ const char *nft_strerror(int err)
 	    { 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_replace, ENOENT, "Index of replacement too big" },
 	    { nft_rule_delete_num, E2BIG, "Index of deletion too big" },
 /*	    { TC_READ_COUNTER, E2BIG, "Index of counter too big" },
 	    { TC_ZERO_COUNTER, E2BIG, "Index of counter too big" }, */
Signature · 1 line
1.7.10.4
maintainer Applied
#1 lore raw
Quoted 10 lines · Ana Rey

There is a difference between error messages in iptables and iptables-compat:

 # iptables -R INPUT 23 -s 192.168.2.140 -j ACCEPT
iptables: Index of replacement too big.
 # iptables-compat -R INPUT 23 -s 192.168.2.140 -j ACCEPT
iptables: No chain/target/match by that name.

Now, iptables-compat shows the same error message than iptables in this case.

Applied, thanks.