iptables-compat: nft: fix user chain addition, deletion and rename

Add the glue code to use the chain batching for user chain commands.

Reported-by: Giuseppe Longo <giuseppelng@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
iptables-compat: nft: fix error reporting

This fixes

 # iptables-compat -X test4345
 iptables: No chain/target/match by that name.

 # iptables-compat -N test4345
 # iptables-compat -N test4345
 iptables: File exists.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
arptables-compat: fix missing error reporting

# arptables-compat -D INPUT -j ACCEPT
 arptables: Bad rule (does a matching rule exist in that chain?)

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
arptables-compat: allow to not specify a target

arptables allows this:

 # arptables -I INPUT

however, arptables-compat says:

 arptables v1.4.21: No target provided or initalization failed
 Try `arptables -h' or 'arptables --help' for more information.

the compat utility must mimic the same behaviour.

Fix this by introducing the arptables_command_state abstraction that
is already available in ip{6}tables.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
arptables-compat: get output in sync with arptables -L -n --line-numbers

 # arptables-compat -L -n --line-numbers
 Chain INPUT (policy ACCEPT)
 num  target     prot opt source               destination <--

This header is not shown by arptables.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
arptables-compat: remove save code

There is not native arptables-save. The original author provides
perl scripts to implement arptables-save and arptables-restore.
We should use them to mimic arptables behaviour.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
refresh nf_tables.h cached copy

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>