nft: Set errno in nft_rule_flush()
Phil Sutter
reviewerPATCH 1/2 nft: Set errno in nft_rule_flush()
When trying to flush a non-existent chain, errno gets set in nft_xtables_config_load(). That is an unintended side-effect and when support for xtables.conf is later removed, iptables-nft will emit the generic "Incompatible with this kernel." error message instead of "No chain/target/match by that name." as it should.
--- iptables/nft.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
iptables/nft.c +3 -1
@@ -1804,8 +1804,10 @@ int nft_rule_flush(struct nft_handle *h, const char *chain, const char *table,if (chain) { c =nftnl_chain_list_lookup_byname (list, chain); -if (!c) +if (!c) { + errno =ENOENT ;return 0 ; + }__nft_rule_flush (h, table, chain, verbose, false);flush_rule_cache (c);
Signature · 1 line
2.22.0
Phil Sutter
reviewerPATCH 2/2 xtables: Drop support for /etc/xtables.conf
As decided upon at NFWS2019, drop support for configurable nftables base chains to use with iptables-nft.
--- configure.ac | 16 -- iptables/.gitignore | 3 - iptables/Makefile.am | 8 +- iptables/nft.c | 162 +------------------- iptables/nft.h | 16 -- iptables/xtables-config-parser.y | 248 ------------------------------- iptables/xtables-config-syntax.l | 54 ------- 7 files changed, 9 insertions(+), 498 deletions(-) delete mode 100644 iptables/xtables-config-parser.y delete mode 100644 iptables/xtables-config-syntax.l
configure.ac +0 -16
@@ -141,22 +141,6 @@ if test "x$enable_nftables" = "xyes"; then echo " iptables-compat over nftables support." exit 1 fi - - AM_PROG_LEX - AC_PROG_YACC - - if test -z "$ac_cv_prog_YACC" - then - echo "*** Error: No suitable bison/yacc found. ***" - echo " Please install the 'bison' package." - exit 1 - fi - if test -z "$ac_cv_prog_LEX" - then - echo "*** Error: No suitable flex/lex found. ***" - echo " Please install the 'flex' package." - exit 1 - fi fi AM_CONDITIONAL([HAVE_LIBMNL], [test "$mnl" = 1])
iptables/.gitignore +0 -3
@@ -20,9 +20,6 @@ /xtables-multi /xtables-legacy-multi /xtables-nft-multi -/xtables-config-parser.c -/xtables-config-parser.h -/xtables-config-syntax.c /xtables-monitor.8 /xtables.pc
iptables/Makefile.am +1 -7
@@ -2,7 +2,6 @@ AM_CFLAGS = ${regular_CFLAGS} AM_CPPFLAGS = ${regular_CPPFLAGS} -I${top_builddir}/include -I${top_srcdir}/include -I${top_srcdir} ${kinclude_CPPFLAGS} ${libmnl_CFLAGS} ${libnftnl_CFLAGS} ${libnetfilter_conntrack_CFLAGS} -AM_YFLAGS = -d BUILT_SOURCES =
@@ -27,7 +26,6 @@ xtables_legacy_multi_LDADD += ../libxtables/libxtables.la -lm # iptables using nf_tables api if ENABLE_NFTABLES -BUILT_SOURCES += xtables-config-parser.h xtables_nft_multi_SOURCES = xtables-nft-multi.c iptables-xml.c xtables_nft_multi_CFLAGS = ${AM_CFLAGS} xtables_nft_multi_LDADD = ../extensions/libext.a ../extensions/libext_ebt.a
@@ -35,7 +33,6 @@ if ENABLE_STATIC xtables_nft_multi_CFLAGS += -DALL_INCLUSIVE endif xtables_nft_multi_CFLAGS += -DENABLE_NFTABLES -DENABLE_IPV4 -DENABLE_IPV6 -xtables_nft_multi_SOURCES += xtables-config-parser.y xtables-config-syntax.l xtables_nft_multi_SOURCES += xtables-save.c xtables-restore.c \ xtables-standalone.c xtables.c nft.c \ nft-shared.c nft-ipv4.c nft-ipv6.c nft-arp.c \
@@ -46,8 +43,6 @@ xtables_nft_multi_SOURCES += xtables-save.c xtables-restore.c \ xtables-eb-translate.c \ xtables-translate.c xtables_nft_multi_LDADD += ${libmnl_LIBS} ${libnftnl_LIBS} ${libnetfilter_conntrack_LIBS} ../extensions/libext4.a ../extensions/libext6.a ../extensions/libext_ebt.a ../extensions/libext_arpt.a -# yacc and lex generate dirty code -xtables_nft_multi-xtables-config-parser.o xtables_nft_multi-xtables-config-syntax.o: AM_CFLAGS += -Wno-missing-prototypes -Wno-missing-declarations -Wno-implicit-function-declaration -Wno-nested-externs -Wno-undef -Wno-redundant-decls xtables_nft_multi_SOURCES += xshared.c xtables_nft_multi_LDADD += ../libxtables/libxtables.la -lm endif
@@ -68,8 +63,7 @@ man_MANS += xtables-nft.8 xtables-translate.8 xtables-legacy.8 \ ebtables-nft.8 endif CLEANFILES = iptables.8 xtables-monitor.8 \ - iptables-translate.8 ip6tables-translate.8 \ - xtables-config-parser.c xtables-config-syntax.c + iptables-translate.8 ip6tables-translate.8 vx_bin_links = iptables-xml if ENABLE_IPV4
iptables/nft.c +8 -154
216 lines not on this page · raw message
iptables/nft.h +0 -16
@@ -170,22 +170,6 @@ int nft_init_eb(struct nft_handle *h, const char *pname);int ebt_get_current_chain (const char *chain);int do_commandeb (struct nft_handle *h,int argc,char *argv[],char **table,bool restore); -/* -* Parse config for tables and chain helper functions -*/ -#define XTABLES_CONFIG_DEFAULT "/etc/xtables.conf" - -struct nftnl_table_list ; -struct nftnl_chain_list ; - -extern int xtables_config_parse (const char *filename,struct nftnl_table_list *table_list,struct nftnl_chain_list *chain_list); - -enum { -NFT_LOAD_VERBOSE = (1 <<0 ), -}; - -int nft_xtables_config_load (struct nft_handle *h,const char *filename,uint32_t flags); -/* * Translation from iptables to nft */
iptables/xtables-config-parser.y deleted +0 -248
248 lines not on this page · raw message
iptables/xtables-config-syntax.l deleted +0 -54
54 lines not on this page · raw message
Signature · 1 line
2.22.0
Re: [iptables PATCH 2/2] xtables: Drop support for /etc/xtables.conf
Quoted 2 lines · Phil Sutter
As decided upon at NFWS2019, drop support for configurable nftables base chains to use with iptables-nft.
Applied, thanks.
Quoted 5 lines · Phil Sutter
When trying to flush a non-existent chain, errno gets set in
nft_xtables_config_load(). That is an unintended side-effect and when support for xtables.conf is later removed, iptables-nft will emit the generic "Incompatible with this kernel." error message instead of "No chain/target/match by that name." as it should.
Applied, thanks Phil.