include: cache ip_tables.h, ip6_tables.h, arp_tables.h and ebtables.h
Subsystems (2)
Pablo Neira Ayuso
maintainerPATCH v2 1/3 include: cache ip_tables.h, ip6_tables.h, arp_tables.h and ebtables.h
The xt over nft support that comes in follow up patches need this, and update the corresponding Makefile.am.
Based on patch from Arturo Borrero Gonzalez.
--- configure.ac | 4 + include/linux/Makefile.am | 7 +- include/linux/netfilter_arp/Makefile.am | 1 + include/linux/netfilter_arp/arp_tables.h | 204 +++++++++++++++++++++ include/linux/netfilter_bridge/Makefile.am | 1 + include/linux/netfilter_bridge/ebtables.h | 266 ++++++++++++++++++++++++++++ include/linux/netfilter_ipv4/Makefile.am | 1 + include/linux/netfilter_ipv4/ip_tables.h | 227 ++++++++++++++++++++++++ include/linux/netfilter_ipv6/Makefile.am | 1 + include/linux/netfilter_ipv6/ip6_tables.h | 265 +++++++++++++++++++++++++++ 10 files changed, 976 insertions(+), 1 deletion(-) create mode 100644 include/linux/netfilter_arp/Makefile.am create mode 100644 include/linux/netfilter_arp/arp_tables.h create mode 100644 include/linux/netfilter_bridge/Makefile.am create mode 100644 include/linux/netfilter_bridge/ebtables.h create mode 100644 include/linux/netfilter_ipv4/Makefile.am create mode 100644 include/linux/netfilter_ipv4/ip_tables.h create mode 100644 include/linux/netfilter_ipv6/Makefile.am create mode 100644 include/linux/netfilter_ipv6/ip6_tables.h
configure.ac +4 -0
@@ -126,6 +126,10 @@ AC_CONFIG_FILES([ \ include/Makefile \ include/linux/Makefile \ include/linux/netfilter/Makefile \ + include/linux/netfilter_arp/Makefile \ + include/linux/netfilter_bridge/Makefile \ + include/linux/netfilter_ipv4/Makefile \ + include/linux/netfilter_ipv6/Makefile \ doc/Makefile \ files/Makefile \ files/nftables/Makefile \
include/linux/Makefile.am +6 -1
@@ -1,4 +1,9 @@ -SUBDIRS = netfilter +SUBDIRS = netfilter \ + netfilter_arp \ + netfilter_bridge \ + netfilter_ipv4 \ + netfilter_ipv6 + noinst_HEADERS = netfilter_arp.h \ netfilter_bridge.h \ netfilter_decnet.h \
include/linux/netfilter_arp/Makefile.am new file +1 -0
@@ -0,0 +1 @@ +noinst_HEADERS = arp_tables.h
include/linux/netfilter_arp/arp_tables.h new file +204 -0
204 lines not on this page · raw message
include/linux/netfilter_bridge/Makefile.am new file +1 -0
@@ -0,0 +1 @@ +noinst_HEADERS = ebtables.h
include/linux/netfilter_bridge/ebtables.h new file +266 -0
266 lines not on this page · raw message
include/linux/netfilter_ipv4/Makefile.am new file +1 -0
@@ -0,0 +1 @@ +noinst_HEADERS = ip_tables.h
include/linux/netfilter_ipv4/ip_tables.h new file +227 -0
227 lines not on this page · raw message
include/linux/netfilter_ipv6/Makefile.am new file +1 -0
@@ -0,0 +1 @@ +noinst_HEADERS = ip6_tables.h
include/linux/netfilter_ipv6/ip6_tables.h new file +265 -0
265 lines not on this page · raw message
Signature · 1 line
1.7.10.4
Pablo Neira Ayuso
maintainerPATCH v2 2/3 src: expose delinearize/linearize structures and stmt_error()
Needed by the follow up xt compatibility layer patch.
---
v2: no need to include <rule.h> in erec.h.
include/erec.h | 12 ++++++++++++ include/netlink.h | 40 +++++++++++++++++++++++++++++++++++++++- src/erec.c | 17 +++++++++++++++++ src/evaluate.c | 26 ++------------------------ src/netlink_delinearize.c | 13 ------------- src/netlink_linearize.c | 5 ----- 6 files changed, 70 insertions(+), 43 deletions(-)
include/erec.h +12 -0
@@ -61,4 +61,16 @@ static inline void erec_queue(struct error_record *erec, extern void erec_print(FILE *f, const struct error_record *erec); extern void erec_print_list(FILE *f, struct list_head *list); +struct eval_ctx; + +extern int __fmtstring(4, 5) __binary_error(struct eval_ctx *ctx, + const struct location *l1, + const struct location *l2, + const char *fmt, ...); + +#define stmt_error(ctx, s1, fmt, args...) \ + __binary_error(ctx, &(s1)->location, NULL, fmt, ## args) +#define stmt_binary_error(ctx, s1, s2, fmt, args...) \ + __binary_error(ctx, &(s1)->location, &(s2)->location, fmt, ## args) + #endif /* NFTABLES_EREC_H */
include/netlink.h +39 -1
@@ -12,10 +12,48 @@#include <rule.h> +/** struct netlink_linearize_ctx +* +* @nlr: nftnl rule object +* @reg_low: next spare register +*/ +struct netlink_linearize_ctx { +struct nft_rule *nlr; +unsigned int reg_low; +}; + +/** +* struct netlink_parse_ctx +* +* @msgs: message queue +* @table: current table +* @rule: pointer to current rule that is being delinearized +* @expr: registers +*/ +struct netlink_parse_ctx { +struct list_head *msgs; +struct table *table; +struct rule *rule; +struct expr *registers[NFT_REG_MAX +1 ]; +}; + +/** +* struct rule_pp_ctx +* +* @pctx: protocol context +* @pbase: protocol base +* @pdep: dependency statement +*/ +struct rule_pp_ctx { +struct proto_ctx pctx; +enum proto_bases pbase; +struct stmt *pdep; +}; +extern const struct input_descriptor indesc_netlink;extern const struct location netlink_location; -/** +/** * struct netlink_ctx * * @msgs: message queue
src/erec.c +17 -0
@@ -166,3 +166,20 @@ void erec_print_list(FILE *f, struct list_head *list)erec_destroy (erec); } } + +int __fmtstring(4, 5) __binary_error(struct eval_ctx *ctx, + const struct location *l1, + const struct location *l2, + const char *fmt, ...) +{ + struct error_record *erec; +va_list ap; + +va_start (ap, fmt); + erec =erec_vcreate (EREC_ERROR , l1, fmt, ap); +if (l2 !=NULL ) +erec_add_location (erec, l2); +va_end (ap); +erec_queue (erec, ctx->msgs); +return -1 ; +}
src/evaluate.c +2 -24
@@ -36,32 +36,10 @@ static const char *byteorder_names[] = { [BYTEORDER_BIG_ENDIAN] = "big endian", }; -static int __fmtstring(4, 5) __stmt_binary_error(struct eval_ctx *ctx, - const struct location *l1, - const struct location *l2, - const char *fmt, ...) -{ - struct error_record *erec; - va_list ap; - - va_start(ap, fmt); - erec = erec_vcreate(EREC_ERROR, l1, fmt, ap); - if (l2 != NULL) - erec_add_location(erec, l2); - va_end(ap); - erec_queue(erec, ctx->msgs); - return -1; - -} - -#define stmt_error(ctx, s1, fmt, args...) \ - __stmt_binary_error(ctx, &(s1)->location, NULL, fmt, ## args) -#define stmt_binary_error(ctx, s1, s2, fmt, args...) \ - __stmt_binary_error(ctx, &(s1)->location, &(s2)->location, fmt, ## args) #define chain_error(ctx, s1, fmt, args...) \ - __stmt_binary_error(ctx, &(s1)->location, NULL, fmt, ## args) + __binary_error(ctx, &(s1)->location, NULL, fmt, ## args) #define monitor_error(ctx, s1, fmt, args...) \ - __stmt_binary_error(ctx, &(s1)->location, NULL, fmt, ## args) + __binary_error(ctx, &(s1)->location, NULL, fmt, ## args) static int __fmtstring(3, 4) set_error(struct eval_ctx *ctx, const struct set *set,
src/netlink_delinearize.c +0 -13
@@ -26,13 +26,6 @@#include <erec.h> #include <sys/socket.h> -struct netlink_parse_ctx { -struct list_head *msgs; -struct table *table; -struct rule *rule; -struct expr *registers[NFT_REG_MAX +1 ]; -}; - static void __fmtstring(3, 4) netlink_error(struct netlink_parse_ctx *ctx, const struct location *loc, const char *fmt, ...)
@@ -741,12 +734,6 @@ static int netlink_parse_expr(struct nft_rule_expr *nle, void *arg)return 0 ; } -struct rule_pp_ctx { -struct proto_ctx pctx; -enum proto_bases pbase; -struct stmt *pdep; -}; -/* * Kill a redundant payload dependecy that is implied by a higher layer payload expression. */
src/netlink_linearize.c +0 -5
@@ -19,11 +19,6 @@#include <gmputil.h> #include <utils.h> -struct netlink_linearize_ctx { -struct nft_rule *nlr; -unsigned int reg_low; -}; -static void netlink_put_register (struct nft_rule_expr *nle,uint32_t attr,uint32_t reg) {
Signature · 1 line
1.7.10.4
Pablo Neira Ayuso
maintainerPATCH v2 3/3 src: add xt compat support
In reply to Pablo Neira AyusoAt compilation time, you have to pass this option.
# ./configure --with-xtables
And libxtables needs to be installed in your system.
This patch allows you to use xt extensions from nft, eg.
# nft add rule filter output \
tcp flags syn xt target TCPMSS [ --clamp-mss-to-pmtu ]This feature requires that libxtables is installed in your system.
This provides access to all existing xt modules from nft. Users can meanwhile use xt extension until we can provide native expressions.
You can build this optionally, if disabled it displays an error:
# nft add rule filter output tcp flags syn xt target TCPMSS [ --clamp-mss-to-pmtu ]
<cmdline>:1:38-77: Error: this build does not support xtables
add rule filter output tcp flags syn xt target TCPMSS [ --clamp-mss-to-pmtu ]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^so you know your build doesn't support this.
---
v2: revisit #include headers dependencies and don't define dummy union
nft_entry from headers.
configure.ac | 13 +- include/linux/netfilter/nf_tables_compat.h | 38 ++ include/statement.h | 34 ++ include/xt.h | 57 +++ src/Makefile.am | 8 + src/evaluate.c | 3 + src/main.c | 12 +- src/netlink_delinearize.c | 6 + src/netlink_linearize.c | 3 + src/parser_bison.y | 57 +++ src/scanner.l | 15 + src/statement.c | 41 ++ src/xt.c | 682 ++++++++++++++++++++++++++++ 13 files changed, 966 insertions(+), 3 deletions(-) create mode 100644 include/linux/netfilter/nf_tables_compat.h create mode 100644 include/xt.h create mode 100644 src/xt.c
configure.ac +12 -1
@@ -92,6 +92,16 @@ AC_DEFINE([HAVE_LIBREADLINE], [1], []) AC_SUBST(with_cli) AM_CONDITIONAL([BUILD_CLI], [test "x$with_cli" != xno]) +AC_ARG_WITH([xtables], [AS_HELP_STRING([--with-xtables], + [Use libxtables for iptables interaction)])], + [with_libxtables=yes], [with_libxtables=no]) +AS_IF([test "x$with_libxtables" != xno], [ +PKG_CHECK_MODULES([XTABLES], [xtables >= 1.4.21]) +AC_DEFINE([HAVE_LIBXTABLES], [1], [0]) +]) +AC_SUBST(with_libxtables) +AM_CONDITIONAL([BUILD_XTABLES], [test "x$with_libxtables" == xyes]) + # Checks for header files. AC_HEADER_STDC AC_HEADER_ASSERT
@@ -140,4 +150,5 @@ echo " nft configuration: cli support: ${with_cli} enable debugging: ${with_debug} - use mini-gmp: ${with_mini_gmp}" + use mini-gmp: ${with_mini_gmp} + libxtables support: ${with_libxtables}"
include/linux/netfilter/nf_tables_compat.h new file +38 -0
@@ -0,0 +1,38 @@ +#ifndef _NFT_COMPAT_NFNETLINK_H_ +#define _NFT_COMPAT_NFNETLINK_H_ + +enum nft_target_attributes { +NFTA_TARGET_UNSPEC , +NFTA_TARGET_NAME , +NFTA_TARGET_REV , +NFTA_TARGET_INFO , + __NFTA_TARGET_MAX +}; +#define NFTA_TARGET_MAX (__NFTA_TARGET_MAX - 1) + +enum nft_match_attributes { +NFTA_MATCH_UNSPEC , +NFTA_MATCH_NAME , +NFTA_MATCH_REV , +NFTA_MATCH_INFO , + __NFTA_MATCH_MAX +}; +#define NFTA_MATCH_MAX (__NFTA_MATCH_MAX - 1) + +#define NFT_COMPAT_NAME_MAX 32 + +enum { +NFNL_MSG_COMPAT_GET , +NFNL_MSG_COMPAT_MAX +}; + +enum { +NFTA_COMPAT_UNSPEC =0 , +NFTA_COMPAT_NAME , +NFTA_COMPAT_REV , +NFTA_COMPAT_TYPE , + __NFTA_COMPAT_MAX, +}; +#define NFTA_COMPAT_MAX (__NFTA_COMPAT_MAX - 1) + +#endif
include/statement.h +34 -0
@@ -105,6 +105,37 @@ extern struct stmt *ct_stmt_alloc(const struct location *loc, struct expr *expr);/** +* enum nft_xt_type - xtables statement types +* +* @NFT_XT_MATCH: match +* @NFT_XT_TARGET: target +* @NFT_XT_WATCHER: watcher (only for the bridge family) +*/ +enum nft_xt_type { +NFT_XT_MATCH =0 , +NFT_XT_TARGET , +NFT_XT_WATCHER , +NFT_XT_MAX +}; + +struct xtables_match ; +struct xtables_target ; + +struct xt_stmt { +const char *name; +enum nft_xt_type type; +uint32_t proto; +union { +struct xtables_match *match; +struct xtables_target *target; + }; +const char *opts; +void *entry; +}; + +extern struct stmt *xt_stmt_alloc (const struct location *loc); + +/** * enum stmt_types - statement types * * @STMT_INVALID: uninitialised
@@ -120,6 +151,7 @@ extern struct stmt *ct_stmt_alloc(const struct location *loc,* @STMT_REDIR: redirect statement * @STMT_QUEUE: QUEUE statement * @STMT_CT: conntrack statement +* @STMT_XT: XT statement */ enum stmt_types {STMT_INVALID ,
@@ -135,6 +167,7 @@ enum stmt_types {STMT_REDIR ,STMT_QUEUE ,STMT_CT , + STMT_XT, };/**
@@ -184,6 +217,7 @@ struct stmt {struct redir_stmt redir;struct queue_stmt queue;struct ct_stmt ct; +struct xt_stmt xt; }; };
include/xt.h new file +57 -0
57 lines not on this page · raw message
src/Makefile.am +8 -0
@@ -8,6 +8,9 @@ AM_CPPFLAGS += -DDEFAULT_INCLUDE_PATH="\"${sysconfdir}\"" \ if BUILD_DEBUG AM_CPPFLAGS += -g -DDEBUG endif +if BUILD_XTABLES +AM_CPPFLAGS += ${XTABLES_CFLAGS} +endif AM_CFLAGS = -Wall \ -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations \
@@ -59,3 +62,8 @@ nft_SOURCES += mini-gmp.c endif nft_LDADD = ${LIBMNL_LIBS} ${LIBNFTNL_LIBS} + +if BUILD_XTABLES +nft_SOURCES += xt.c +nft_LDADD += ${XTABLES_LIBS} +endif
src/evaluate.c +3 -0
@@ -27,6 +27,7 @@#include <erec.h> #include <gmputil.h> #include <utils.h> +#include <xt.h> static int expr_evaluate (struct eval_ctx *ctx,struct expr **expr);
@@ -1658,6 +1659,8 @@ int stmt_evaluate(struct eval_ctx *ctx, struct stmt *stmt)return stmt_evaluate_redir (ctx, stmt);case STMT_QUEUE :return stmt_evaluate_queue (ctx, stmt); +case STMT_XT : +return stmt_evaluate_xt (ctx, stmt);default :BUG ("unknown statement type %s\n" , stmt->ops->name); }
src/main.c +10 -2
@@ -260,10 +260,18 @@ int main(int argc, char * const *argv)char *buf =NULL , *filename =NULL ;unsigned int len;bool interactive = false; -int i, val, rc =NFT_EXIT_SUCCESS ; +int i, val, rc =NFT_EXIT_SUCCESS , fake_argc = argc; + +/* This avoids a clash with libxtables getopt_long parser */ +for (i =0 ; i < argc; i++) { +if (argv[i][0 ] =='[' ) { + fake_argc = i; +break ; + } + }while (1 ) { - val =getopt_long (argc, argv,OPTSTRING , options,NULL ); + val =getopt_long (fake_argc, argv,OPTSTRING , options,NULL );if (val ==-1 )break ;
src/netlink_delinearize.c +6 -0
@@ -25,6 +25,7 @@#include <utils.h> #include <erec.h> #include <sys/socket.h> +#include <xt.h> static void __fmtstring(3, 4) netlink_error(struct netlink_parse_ctx *ctx, const struct location *loc,
@@ -710,6 +711,8 @@ static const struct { { .name = "masq", .parse = netlink_parse_masq }, { .name = "redir", .parse = netlink_parse_redir }, { .name = "queue", .parse = netlink_parse_queue }, + { .name = "target", .parse = netlink_parse_target }, + { .name = "match", .parse = netlink_parse_match }, };static int netlink_parse_expr (struct nft_rule_expr *nle,void *arg)
@@ -1124,6 +1127,9 @@ static void rule_parse_postprocess(struct netlink_parse_ctx *ctx, struct rule *rcase STMT_REJECT :stmt_reject_postprocess (rctx, stmt);break ; +case STMT_XT : +stmt_xt_postprocess (&rctx, stmt, rule); +break ;default :break ; }
src/netlink_linearize.c +3 -0
@@ -18,6 +18,7 @@#include <netlink.h> #include <gmputil.h> #include <utils.h> +#include <xt.h> static void netlink_put_register (struct nft_rule_expr *nle,uint32_t attr,uint32_t reg)
@@ -821,6 +822,8 @@ static void netlink_gen_stmt(struct netlink_linearize_ctx *ctx,return netlink_gen_queue_stmt (ctx, stmt);case STMT_CT :return netlink_gen_ct_stmt (ctx, stmt); +case STMT_XT : +return netlink_gen_xt_stmt (ctx, stmt);default :BUG ("unknown statement type %s\n" , stmt->ops->name); }
src/parser_bison.y +57 -0
81 lines not on this page · raw message
src/scanner.l +15 -0
@@ -113,6 +113,7 @@ hexstring 0[xX]{hexdigit}+ range ({decstring}?:{decstring}?) letter [a-zA-Z] string ({letter})({letter}|{digit}|[/\-_\.])* +xtopts \[({letter}|{digit}|[!/\-_\.\"\:\, ])*\] quotedstring \"[^"]*\" comment #.*$ slash \/
@@ -449,6 +450,15 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr}) "proto-dst" { return PROTO_DST; } "label" { return LABEL; } +"xt" { return XT; } +"match" { return MATCH; } +"target" { return TARGET; } +"watcher" { return WATCHER; } +"802_3" { + yylval->string = xstrdup("802_3"); + return STRING; + } + "xml" { return XML; } "json" { return JSON; }
@@ -488,6 +498,11 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr}) return STRING; } +{xtopts} { + yylval->string = xstrdup(yytext); + return XTOPTS; + } + \\{newline} { reset_pos(yyget_extra(yyscanner), yylloc); }
src/statement.c +41 -0
50 lines not on this page · raw message
src/xt.c new file +682 -0
682 lines not on this page · raw message
Signature · 1 line
1.7.10.4
Re: [PATCH nft v2 3/3] src: add xt compat support
Quoted 16 lines · Pablo Neira Ayuso
At compilation time, you have to pass this option.
# ./configure --with-xtablesAnd libxtables needs to be installed in your system.
This patch allows you to use xt extensions from nft, eg.
# nft add rule filter output \ tcp flags syn xt target TCPMSS [ --clamp-mss-to-pmtu ]This feature requires that libxtables is installed in your system.
This provides access to all existing xt modules from nft. Users can meanwhile use xt extension until we can provide native expressions.
Quoted 8 lines
You can build this optionally, if disabled it displays an error:
# nft add rule filter output tcp flags syn xt target TCPMSS [ --clamp-mss-to-pmtu ] <cmdline>:1:38-77: Error: this build does not support xtables add rule filter output tcp flags syn xt target TCPMSS [ --clamp-mss-to-pmtu ] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^so you know your build doesn't support this.
Before review this patch, my main question is - are we sure we want to do this? How will this affect our plans to get rid of the iptables code at some point in the future? Arguably its a compatibility question, if we support this in nft people will use it and we can't simply remove it.
Florian Westphal
maintainerRe: [PATCH nft v2 3/3] src: add xt compat support
Quoted 24 lines · Patrick McHardy
Quoted 23 lines · Pablo Neira Ayuso
At compilation time, you have to pass this option.
# ./configure --with-xtablesAnd libxtables needs to be installed in your system.
This patch allows you to use xt extensions from nft, eg.
# nft add rule filter output \ tcp flags syn xt target TCPMSS [ --clamp-mss-to-pmtu ]This feature requires that libxtables is installed in your system.
This provides access to all existing xt modules from nft. Users can meanwhile use xt extension until we can provide native expressions.
You can build this optionally, if disabled it displays an error:
# nft add rule filter output tcp flags syn xt target TCPMSS [ --clamp-mss-to-pmtu ] <cmdline>:1:38-77: Error: this build does not support xtables add rule filter output tcp flags syn xt target TCPMSS [ --clamp-mss-to-pmtu ] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Quoted 6 lines
Quoted 1 line
so you know your build doesn't support this.
Before review this patch, my main question is - are we sure we want to do this? How will this affect our plans to get rid of the iptables code at some point in the future? Arguably its a compatibility question, if we support this in nft people will use it and we can't simply remove it.
FWIW I think Patricks concerns are well-founded, if we do this we cannot remove those extensions, ever.
And this will include several dubious modules (time match for example).
Why would I want to re-write a working nft+compat ruleset to one that only uses native expressions?
Whats the point of providing a 'native' replacement for an existing xtables target if we can just use the xtables version?
Thus I'm leaning towards not adding any compat support in nft.
Pablo Neira Ayuso
maintainerRe: [PATCH nft v2 3/3] src: add xt compat support
Quoted 2 lines · Florian Westphal
Why would I want to re-write a working nft+compat ruleset to one that only uses native expressions?
The fact is that we cannot push users to use nf_tables, but we can provide good reasons to adopt the native replacements and tools to migrate easily.
Quoted 2 lines
Whats the point of providing a 'native' replacement for an existing xtables target if we can just use the xtables version?
Have a look a hashlimit, multiport and all of our existing combo match/targets. They are a mess. We're now going towards a way more flexible and generic (lego fashion) framework that will provide all kind of combos without relying on this kind of Frankenstein extensions.
Florian Westphal
maintainerRe: [PATCH nft v2 3/3] src: add xt compat support
Quoted 7 lines · Pablo Neira Ayuso
Quoted 2 lines · Florian Westphal
Why would I want to re-write a working nft+compat ruleset to one that only uses native expressions?
The fact is that we cannot push users to use
nf_tables, but we can provide good reasons to adopt the native replacements and tools to migrate easily.
I think dictionaries are a pretty good reason :-)
Quoted 8 lines
Quoted 2 lines
Whats the point of providing a 'native' replacement for an existing xtables target if we can just use the xtables version?
Have a look a hashlimit, multiport and all of our existing combo match/targets. They are a mess. We're now going towards a way more flexible and generic (lego fashion) framework that will provide all kind of combos without relying on this kind of Frankenstein extensions.
Sure, but do you really want to add native expression equivalents for things like quota match, '-m time', '-j CLUSTERIP' ... ?
And wrt. the existing combos, are you positive that your xlate tool will always be able to translate everything to nft native expressions?
I'm specifically thinking about side-effects, e.g. -m recent which can also be manipulated externally to ruleset via /proc...
So i am afraid that 100% compat is not doable except by retaining all matches/targets (or at least some of them).
Pablo Neira Ayuso
maintainerRe: [PATCH nft v2 3/3] src: add xt compat support
Quoted 5 lines · Florian Westphal
Quoted 3 lines · Pablo Neira Ayuso
Quoted 2 lines
Whats the point of providing a 'native' replacement for an existing xtables target if we can just use the xtables version?
Quoted 8 lines
Quoted 5 lines
Have a look a hashlimit, multiport and all of our existing combo match/targets. They are a mess. We're now going towards a way more flexible and generic (lego fashion) framework that will provide all kind of combos without relying on this kind of Frankenstein extensions.
Sure, but do you really want to add native expression equivalents for things like quota match, '-m time', '-j CLUSTERIP' ... ?
We don't want to rush to add a native expression that is going to map 1:1 to these matches/targets. We need time to think and to discuss how to implement these in a nice (generic) fashion.
But if users need these features, they can migrate to nftables while keeping those in their ruleset through compat.
Quoted 8 lines
And wrt. the existing combos, are you positive that your xlate tool will always be able to translate everything to nft native expressions?
I'm specifically thinking about side-effects, e.g. -m recent which can also be manipulated externally to ruleset via /proc...
So i am afraid that 100% compat is not doable except by retaining all matches/targets (or at least some of them).
We'll provide a translation which means that the returns the closest approximation to what they need.
That will not save them from reading the new documentation and familiarizing with the new framework and tools. But we'll relieve the pain of migration in some way.
As I said, the only way to get people moving forward is to provide good reasons to learn the new tool and start using it.
Re: [PATCH nft v2 3/3] src: add xt compat support
Quoted 15 lines · Pablo Neira Ayuso
Quoted 5 lines · Florian Westphal
Quoted 3 lines · Pablo Neira Ayuso
Quoted 2 lines
Whats the point of providing a 'native' replacement for an existing xtables target if we can just use the xtables version?
Quoted 8 lines
Quoted 5 lines
Have a look a hashlimit, multiport and all of our existing combo match/targets. They are a mess. We're now going towards a way more flexible and generic (lego fashion) framework that will provide all kind of combos without relying on this kind of Frankenstein extensions.
Sure, but do you really want to add native expression equivalents for things like quota match, '-m time', '-j CLUSTERIP' ... ?
Quoted 6 lines
We don't want to rush to add a native expression that is going to map 1:1 to these matches/targets. We need time to think and to discuss how to implement these in a nice (generic) fashion.
But if users need these features, they can migrate to nftables while keeping those in their ruleset through compat.
But if they don't tell us what they need, how are we supposed to know? This removes it from decision making and our sight entirely.
Quoted 12 lines
Quoted 8 lines
And wrt. the existing combos, are you positive that your xlate tool will always be able to translate everything to nft native expressions?
I'm specifically thinking about side-effects, e.g. -m recent which can also be manipulated externally to ruleset via /proc...
So i am afraid that 100% compat is not doable except by retaining all matches/targets (or at least some of them).
We'll provide a translation which means that the returns the closest approximation to what they need.
Quoted 6 lines
That will not save them from reading the new documentation and familiarizing with the new framework and tools. But we'll relieve the pain of migration in some way.
As I said, the only way to get people moving forward is to provide good reasons to learn the new tool and start using it.
I think we already have pretty good reasons, and they soon will get a lot stronger with concatenations and generic state keeping.
Pablo Neira Ayuso
maintainerRe: [PATCH nft v2 3/3] src: add xt compat support
Quoted 20 lines · Patrick McHardy
Quoted 19 lines · Pablo Neira Ayuso
Quoted 5 lines · Florian Westphal
Quoted 3 lines · Pablo Neira Ayuso
Quoted 2 lines
Whats the point of providing a 'native' replacement for an existing xtables target if we can just use the xtables version?
Quoted 8 lines
Quoted 5 lines
Have a look a hashlimit, multiport and all of our existing combo match/targets. They are a mess. We're now going towards a way more flexible and generic (lego fashion) framework that will provide all kind of combos without relying on this kind of Frankenstein extensions.
Sure, but do you really want to add native expression equivalents for things like quota match, '-m time', '-j CLUSTERIP' ... ?
We don't want to rush to add a native expression that is going to map 1:1 to these matches/targets. We need time to think and to discuss how to implement these in a nice (generic) fashion.
Quoted 5 lines
Quoted 2 lines
But if users need these features, they can migrate to nftables while keeping those in their ruleset through compat.
But if they don't tell us what they need, how are we supposed to know? This removes it from decision making and our sight entirely.
We know we have to provide native replacements for what we have already.
Quoted 16 lines
Quoted 16 lines
Quoted 8 lines
And wrt. the existing combos, are you positive that your xlate tool will always be able to translate everything to nft native expressions?
I'm specifically thinking about side-effects, e.g. -m recent which can also be manipulated externally to ruleset via /proc...
So i am afraid that 100% compat is not doable except by retaining all matches/targets (or at least some of them).
We'll provide a translation which means that the returns the closest approximation to what they need.
That will not save them from reading the new documentation and familiarizing with the new framework and tools. But we'll relieve the pain of migration in some way.
Quoted 5 lines
Quoted 2 lines
As I said, the only way to get people moving forward is to provide good reasons to learn the new tool and start using it.
I think we already have pretty good reasons, and they soon will get a lot stronger with concatenations and generic state keeping.
Agreed, the only way to get users moving forward is through features.
Re: [PATCH nft v2 3/3] src: add xt compat support
Quoted 21 lines · Pablo Neira Ayuso
Quoted 20 lines · Patrick McHardy
Quoted 19 lines · Pablo Neira Ayuso
Quoted 5 lines · Florian Westphal
Quoted 3 lines · Pablo Neira Ayuso
Quoted 2 lines
Whats the point of providing a 'native' replacement for an existing xtables target if we can just use the xtables version?
Quoted 8 lines
Quoted 5 lines
Have a look a hashlimit, multiport and all of our existing combo match/targets. They are a mess. We're now going towards a way more flexible and generic (lego fashion) framework that will provide all kind of combos without relying on this kind of Frankenstein extensions.
Sure, but do you really want to add native expression equivalents for things like quota match, '-m time', '-j CLUSTERIP' ... ?
We don't want to rush to add a native expression that is going to map 1:1 to these matches/targets. We need time to think and to discuss how to implement these in a nice (generic) fashion.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
But if users need these features, they can migrate to nftables while keeping those in their ruleset through compat.
But if they don't tell us what they need, how are we supposed to know? This removes it from decision making and our sight entirely.
We know we have to provide native replacements for what we have already.
Not necessarily. iptables has accumulated tons of cruft that probably nobody in the world uses, CLUSTERIP being the prime example. The fact is that we don't know and we will never know if we simply add support for everything we had.
I want this decision to be made based on what users actually need and on what they need it for. Not basically pull in everything from iptables in one go without even thinking about it.
As a middle ground, I think I could agree to adding the xt compat framework, but only allow selective extensions to be used where we are sure we need them.
Pablo Neira Ayuso
maintainerRe: [PATCH nft v2 3/3] src: add xt compat support
On Fri, Apr 10, 2015 at 12:45:05AM +0100, Patrick McHardy wrote:
[...]:
Quoted 7 lines
I want this decision to be made based on what users actually need and on what they need it for. Not basically pull in everything from iptables in one go without even thinking about it.
As a middle ground, I think I could agree to adding the xt compat framework, but only allow selective extensions to be used where we are sure we need them.
The framework fully supports this, imposing an artificial limitation makes no sense to me at all.
And more importantly, without this patch nft breaks when users load their ruleset throught iptables-compat-restore.
With that artificial limitation, some rulesets will break, some other not.
Admit it, there is no way we can control what users will do in the future. The only way out is to move forward in an evolutionary fashion.
Re: [PATCH nft v2 3/3] src: add xt compat support
Quoted 6 lines · Pablo Neira Ayuso
On Fri, Apr 10, 2015 at 12:45:05AM +0100, Patrick McHardy wrote:
[...]:Quoted 4 lines
I want this decision to be made based on what users actually need and on what they need it for. Not basically pull in everything from iptables in one go without even thinking about it.
Quoted 6 lines
Quoted 3 lines
As a middle ground, I think I could agree to adding the xt compat framework, but only allow selective extensions to be used where we are sure we need them.
The framework fully supports this, imposing an artificial limitation makes no sense to me at all.
I'm aware that its technically possible, the question is a different one.
Quoted 2 lines
And more importantly, without this patch nft breaks when users load their ruleset throught iptables-compat-restore.
How will it break if we don't support it so far?
Quoted 6 lines
With that artificial limitation, some rulesets will break, some other not.
Admit it, there is no way we can control what users will do in the future. The only way out is to move forward in an evolutionary fashion.
Right. But this is not evolutionary. It pulls everything we have in iptables in nftables in one big dump. Its the opposite of evolution. An evolutionary process would be to grow things as they are needed, which is what I'm suggesting.
Don't you see the difference? If people are using the translation layer, they will by definition translate their old ruleset again on every load. Once they have the xt stuff in their nftables ruleset, we don't have any control over it anymore. Unless you want to pull the nft translation layer into nft, which would be ridiculous.
We can't decide anymore how we want to map an old extension to the new framework. We loose all control and are stuck with the worst case, which is that people might be using all the old crap in compat mode.
Pablo Neira Ayuso
maintainerRe: [PATCH nft v2 3/3] src: add xt compat support
Quoted 7 lines · Patrick McHardy
Quoted 6 lines · Pablo Neira Ayuso
On Fri, Apr 10, 2015 at 12:45:05AM +0100, Patrick McHardy wrote:
[...]:Quoted 4 lines
I want this decision to be made based on what users actually need and on what they need it for. Not basically pull in everything from iptables in one go without even thinking about it.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
As a middle ground, I think I could agree to adding the xt compat framework, but only allow selective extensions to be used where we are sure we need them.
The framework fully supports this, imposing an artificial limitation makes no sense to me at all.
I'm aware that its technically possible, the question is a different one.
Then, if it's technically possible with the existing kernel framework (and exposed to userspace), there is basically no way that we can limit what userspace can do with this.
Quoted 4 lines
Quoted 2 lines
And more importantly, without this patch nft breaks when users load their ruleset throught iptables-compat-restore.
How will it break if we don't support it so far?
It's currently broken, and we have already distro packaging iptables-compat.
Quoted 11 lines
Quoted 6 lines
With that artificial limitation, some rulesets will break, some other not.
Admit it, there is no way we can control what users will do in the future. The only way out is to move forward in an evolutionary fashion.
Right. But this is not evolutionary. It pulls everything we have in iptables in nftables in one big dump. Its the opposite of evolution. An evolutionary process would be to grow things as they are needed, which is what I'm suggesting.
No. Evolution is to extend things from what you already have, and let just things extinct by providing better alternatives.
Re: [PATCH nft v2 3/3] src: add xt compat support
Quoted 12 lines · Pablo Neira Ayuso
Quoted 11 lines · Patrick McHardy
Quoted 10 lines · Pablo Neira Ayuso
On Fri, Apr 10, 2015 at 12:45:05AM +0100, Patrick McHardy wrote:
[...]:Quoted 7 lines
I want this decision to be made based on what users actually need and on what they need it for. Not basically pull in everything from iptables in one go without even thinking about it.
As a middle ground, I think I could agree to adding the xt compat framework, but only allow selective extensions to be used where we are sure we need them.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
The framework fully supports this, imposing an artificial limitation makes no sense to me at all.
I'm aware that its technically possible, the question is a different one.
Then, if it's technically possible with the existing kernel framework (and exposed to userspace), there is basically no way that we can limit what userspace can do with this.
I'm repeating myself. We'll have iptables in the nft ruleset. We can't get rid of it because we don't understand it and we don't want to understand it.
This is the major difference to translating on every load. Once its in the nft ruleset, it stays there. We loose control. We can't transform it anymore. Its an opaque blob.
Quoted 11 lines
Quoted 8 lines
Quoted 3 lines
Admit it, there is no way we can control what users will do in the future. The only way out is to move forward in an evolutionary fashion.
Right. But this is not evolutionary. It pulls everything we have in iptables in nftables in one big dump. Its the opposite of evolution. An evolutionary process would be to grow things as they are needed, which is what I'm suggesting.
No. Evolution is to extend things from what you already have, and let just things extinct by providing better alternatives.
So we're evolving nft into supporting iptables in order to extinct it? That makes absolutely no sense.
I agree that we need to provide a way to move people over smoothly. But I'm absolutely against doing this without even considering the consequences and arguing about it on this level.
It starts with a problem statement *why* we would want to do this. And this is to provide access to features we do not support so far. This implies its about features we actually do want to support at all, and excludes features we do already support. This means selectively enabling the remaining ones is what makes sense, and even that is a hard call for the reasons stated above.
Re: [PATCH nft v2 3/3] src: add xt compat support
In reply to Florian WestphalQuoted 23 lines · Florian Westphal
Quoted 7 lines · Pablo Neira Ayuso
Quoted 2 lines · Florian Westphal
Why would I want to re-write a working nft+compat ruleset to one that only uses native expressions?
The fact is that we cannot push users to use
nf_tables, but we can provide good reasons to adopt the native replacements and tools to migrate easily.I think dictionaries are a pretty good reason :-)
Quoted 8 lines
Quoted 2 lines
Whats the point of providing a 'native' replacement for an existing xtables target if we can just use the xtables version?
Have a look a hashlimit, multiport and all of our existing combo match/targets. They are a mess. We're now going towards a way more flexible and generic (lego fashion) framework that will provide all kind of combos without relying on this kind of Frankenstein extensions.
Sure, but do you really want to add native expression equivalents for things like quota match, '-m time', '-j CLUSTERIP' ... ?
Quoted 8 lines
And wrt. the existing combos, are you positive that your xlate tool will always be able to translate everything to nft native expressions?
I'm specifically thinking about side-effects, e.g. -m recent which can also be manipulated externally to ruleset via /proc...
So i am afraid that 100% compat is not doable except by retaining all matches/targets (or at least some of them).
That's my biggest fear as well. I very much prefer to selectively add what people are actually requesting or what obviously makes sense.
That way we at least know that something is needed and why.
Re: [PATCH nft v2 3/3] src: add xt compat support
In reply to Pablo Neira AyusoQuoted 7 lines · Pablo Neira Ayuso
Quoted 2 lines · Florian Westphal
Why would I want to re-write a working nft+compat ruleset to one that only uses native expressions?
The fact is that we cannot push users to use
nf_tables, but we can provide good reasons to adopt the native replacements and tools to migrate easily.
We actually can by translating their iptables ruleset transparently.
Quoted 8 lines
Quoted 2 lines
Whats the point of providing a 'native' replacement for an existing xtables target if we can just use the xtables version?
Have a look a hashlimit, multiport and all of our existing combo match/targets. They are a mess. We're now going towards a way more flexible and generic (lego fashion) framework that will provide all kind of combos without relying on this kind of Frankenstein extensions.
The thing is, my adding missing features we can make a case by case decision of whether it makes sense and how to implement it properly.
The "whether it makes sense" decision is taken away from us by providing the xt compat thing. It might very well not make sense to have a 1:1 mapping in nft but to express things differently.
Pablo Neira Ayuso
maintainerRe: [PATCH nft v2 3/3] src: add xt compat support
Quoted 10 lines · Patrick McHardy
Quoted 7 lines · Pablo Neira Ayuso
Quoted 2 lines · Florian Westphal
Why would I want to re-write a working nft+compat ruleset to one that only uses native expressions?
The fact is that we cannot push users to use
nf_tables, but we can provide good reasons to adopt the native replacements and tools to migrate easily.We actually can by translating their iptables ruleset transparently.
Users' ruleset can be very sophisticated, some of them may just not move forward because only one single feature that they need is missing. So they will postpone migration. That is not good.
The translation is a complementary thing, not a replacement of the compatibility layer.
Re: [PATCH nft v2 3/3] src: add xt compat support
Quoted 10 lines · Pablo Neira Ayuso
Quoted 9 lines · Patrick McHardy
Quoted 7 lines · Pablo Neira Ayuso
Quoted 2 lines · Florian Westphal
Why would I want to re-write a working nft+compat ruleset to one that only uses native expressions?
The fact is that we cannot push users to use
nf_tables, but we can provide good reasons to adopt the native replacements and tools to migrate easily.
Quoted 8 lines
Quoted 1 line
We actually can by translating their iptables ruleset transparently.
Users' ruleset can be very sophisticated, some of them may just not move forward because only one single feature that they need is missing. So they will postpone migration. That is not good.
The translation is a complementary thing, not a replacement of the compatibility layer.
The difference is that the translation layer doesn't restrict us in future decisions, and this one does.
And actually if you consider what the majority of users are, its people using distro provided firewalls, the translation layer will actually get us the huge majority of users.
People who actively want to switch won't mind changing their ruleset, so they might as well tell us if some feature is missing and we can then discuss how to implement it in nftables.
Pablo Neira Ayuso
maintainerRe: [PATCH nft v2 3/3] src: add xt compat support
Quoted 17 lines · Patrick McHardy
Quoted 16 lines · Pablo Neira Ayuso
Quoted 10 lines · Patrick McHardy
Quoted 7 lines · Pablo Neira Ayuso
Quoted 2 lines · Florian Westphal
Why would I want to re-write a working nft+compat ruleset to one that only uses native expressions?
The fact is that we cannot push users to use
nf_tables, but we can provide good reasons to adopt the native replacements and tools to migrate easily.We actually can by translating their iptables ruleset transparently.
Users' ruleset can be very sophisticated, some of them may just not move forward because only one single feature that they need is missing. So they will postpone migration. That is not good.
Quoted 5 lines
Quoted 2 lines
The translation is a complementary thing, not a replacement of the compatibility layer.
The difference is that the translation layer doesn't restrict us in future decisions, and this one does.
The user will run translation and will notice than some feature is missing. Bad luck, he will retry months later. It will keep repeating the process until it gets the features it needs. No matter how nice nftables features are, because he still don't have access to what it needs.
Quoted 7 lines
And actually if you consider what the majority of users are, its people using distro provided firewalls, the translation layer will actually get us the huge majority of users.
People who actively want to switch won't mind changing their ruleset, so they might as well tell us if some feature is missing and we can then discuss how to implement it in nftables.
They will tell us what they need, then they will sit down waiting until distributors start packaging the new feature, which means another wait of ~2 years. Most people rely on Linux distributions, not bleeding edge kernels. You know how behind people can remain from mainstream to feel -stable.
Re: [PATCH nft v2 3/3] src: add xt compat support
Quoted 21 lines · Pablo Neira Ayuso
Quoted 20 lines · Patrick McHardy
Quoted 18 lines · Pablo Neira Ayuso
Quoted 10 lines · Patrick McHardy
Quoted 7 lines · Pablo Neira Ayuso
Quoted 2 lines · Florian Westphal
Why would I want to re-write a working nft+compat ruleset to one that only uses native expressions?
The fact is that we cannot push users to use
nf_tables, but we can provide good reasons to adopt the native replacements and tools to migrate easily.We actually can by translating their iptables ruleset transparently.
Users' ruleset can be very sophisticated, some of them may just not move forward because only one single feature that they need is missing. So they will postpone migration. That is not good.
The translation is a complementary thing, not a replacement of the compatibility layer.
Quoted 8 lines
Quoted 2 lines
The difference is that the translation layer doesn't restrict us in future decisions, and this one does.
The user will run translation and will notice than some feature is missing. Bad luck, he will retry months later. It will keep repeating the process until it gets the features it needs. No matter how nice nftables features are, because he still don't have access to what it needs.
How are things missing in the translation layer? That one already supports compat and that is fine.
Its nft that might be missing features for him. So if it doesn't suit him, he'll try a different time. What's the big deal? Or ideally, he'll let us know. This is exactly how iptables gained in features.
Quoted 8 lines
Quoted 7 lines
And actually if you consider what the majority of users are, its people using distro provided firewalls, the translation layer will actually get us the huge majority of users.
People who actively want to switch won't mind changing their ruleset, so they might as well tell us if some feature is missing and we can then discuss how to implement it in nftables.
Quoted 5 lines
They will tell us what they need, then they will sit down waiting until distributors start packaging the new feature, which means another wait of ~2 years. Most people rely on Linux distributions, not bleeding edge kernels. You know how behind people can remain from mainstream to feel -stable.
Some distributions are *a lot* faster than that. I don't buy that argument, this is how development has always worked, people state what they need, it gets done.
Pablo Neira Ayuso
maintainerRe: [PATCH nft v2 3/3] src: add xt compat support
Quoted 1 line · Patrick McHardy
On 10.04, Pablo Neira Ayuso wrote:
[...]
Quoted 6 lines
Quoted 5 lines
The user will run translation and will notice than some feature is missing. Bad luck, he will retry months later. It will keep repeating the process until it gets the features it needs. No matter how nice nftables features are, because he still don't have access to what it needs.
Quoted 6 lines
How are things missing in the translation layer? That one already supports compat and that is fine.
Its nft that might be missing features for him. So if it doesn't suit him, he'll try a different time. What's the big deal? Or ideally, he'll let us know. This is exactly how iptables gained in features.
ipchains was way more simple tool, and even though we needed *more than 10 years* to get rid of that code.
Quoted 14 lines
Quoted 8 lines
Quoted 7 lines
And actually if you consider what the majority of users are, its people using distro provided firewalls, the translation layer will actually get us the huge majority of users.
People who actively want to switch won't mind changing their ruleset, so they might as well tell us if some feature is missing and we can then discuss how to implement it in nftables.
Quoted 5 lines
They will tell us what they need, then they will sit down waiting until distributors start packaging the new feature, which means another wait of ~2 years. Most people rely on Linux distributions, not bleeding edge kernels. You know how behind people can remain from mainstream to feel -stable.
Quoted 3 lines
Some distributions are *a lot* faster than that. I don't buy that argument, this is how development has always worked, people state what they need, it gets done.
Even most skilled sysadmin that I know tend to stick to conservative distributions to relieve their workload, specially when they have to maintain hundred, thousands of systems.
Propagation timing of nftables to production will take quite some time and will have to coexist with iptables for long time.
Fact is that we won't be able to get rid of iptables for years.
Re: [PATCH nft v2 3/3] src: add xt compat support
Quoted 20 lines · Pablo Neira Ayuso
Quoted 15 lines · Patrick McHardy
Quoted 8 lines · Pablo Neira Ayuso
Quoted 7 lines
And actually if you consider what the majority of users are, its people using distro provided firewalls, the translation layer will actually get us the huge majority of users.
People who actively want to switch won't mind changing their ruleset, so they might as well tell us if some feature is missing and we can then discuss how to implement it in nftables.
Quoted 5 lines
They will tell us what they need, then they will sit down waiting until distributors start packaging the new feature, which means another wait of ~2 years. Most people rely on Linux distributions, not bleeding edge kernels. You know how behind people can remain from mainstream to feel -stable.
Quoted 3 lines
Some distributions are *a lot* faster than that. I don't buy that argument, this is how development has always worked, people state what they need, it gets done.
Quoted 8 lines
Even most skilled sysadmin that I know tend to stick to conservative distributions to relieve their workload, specially when they have to maintain hundred, thousands of systems.
Propagation timing of nftables to production will take quite some time and will have to coexist with iptables for long time.
Fact is that we won't be able to get rid of iptables for years.
Nobody doubts that. You still have to consider the consequences, and they are not pretty. Lets stick to the other thread to avoid repeating ourselves.
Pablo Neira Ayuso
maintainerRe: [PATCH nft v2 3/3] src: add xt compat support
Quoted 25 lines · Patrick McHardy
Quoted 24 lines · Pablo Neira Ayuso
Quoted 15 lines · Patrick McHardy
Quoted 8 lines · Pablo Neira Ayuso
Quoted 7 lines
And actually if you consider what the majority of users are, its people using distro provided firewalls, the translation layer will actually get us the huge majority of users.
People who actively want to switch won't mind changing their ruleset, so they might as well tell us if some feature is missing and we can then discuss how to implement it in nftables.
Quoted 5 lines
They will tell us what they need, then they will sit down waiting until distributors start packaging the new feature, which means another wait of ~2 years. Most people rely on Linux distributions, not bleeding edge kernels. You know how behind people can remain from mainstream to feel -stable.
Quoted 3 lines
Some distributions are *a lot* faster than that. I don't buy that argument, this is how development has always worked, people state what they need, it gets done.
Even most skilled sysadmin that I know tend to stick to conservative distributions to relieve their workload, specially when they have to maintain hundred, thousands of systems.
Quoted 8 lines
Quoted 4 lines
Propagation timing of nftables to production will take quite some time and will have to coexist with iptables for long time.
Fact is that we won't be able to get rid of iptables for years.
Nobody doubts that. You still have to consider the consequences, and they are not pretty. Lets stick to the other thread to avoid repeating ourselves.
I'm stopping here Patrick, enough work and discussion for today.
Pablo Neira Ayuso
maintainerRe: [PATCH nft v2 3/3] src: add xt compat support
In reply to Patrick McHardyQuoted 24 lines · Patrick McHardy
Quoted 23 lines · Pablo Neira Ayuso
At compilation time, you have to pass this option.
# ./configure --with-xtablesAnd libxtables needs to be installed in your system.
This patch allows you to use xt extensions from nft, eg.
# nft add rule filter output \ tcp flags syn xt target TCPMSS [ --clamp-mss-to-pmtu ]This feature requires that libxtables is installed in your system.
This provides access to all existing xt modules from nft. Users can meanwhile use xt extension until we can provide native expressions.
You can build this optionally, if disabled it displays an error:
# nft add rule filter output tcp flags syn xt target TCPMSS [ --clamp-mss-to-pmtu ] <cmdline>:1:38-77: Error: this build does not support xtables add rule filter output tcp flags syn xt target TCPMSS [ --clamp-mss-to-pmtu ] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Quoted 6 lines
Quoted 1 line
so you know your build doesn't support this.
Before review this patch, my main question is - are we sure we want to do this? How will this affect our plans to get rid of the iptables code at some point in the future? Arguably its a compatibility question, if we support this in nft people will use it and we can't simply remove it.
Good question.
I think we'll have to live with both codebases for quite a while anyway, unfortunately we cannot skip that.
I think this code provides a way for users to easily migrate from iptables to nftables.
They will only need to:
iptables-compat-restore < ipt-ruleset.file
then, switch to nft and type:
nft list ruleset > nft-ruleset.file
and start to replacing to native expressions progressively.
We also have a prototype translation layer (see xlate in the iptables tree), that will provide an automatic translation whenever possible.
The idea is that they will periodically run something like:
nft --migrate nft-ruleset.file
that will detect xt statements and will translate them to native expressions whenever possible.
I think we have to ease adoption through these facilities, and new nice features, of course.
Re: [PATCH nft v2 3/3] src: add xt compat support
Quoted 17 lines · Pablo Neira Ayuso
Quoted 8 lines · Patrick McHardy
Quoted 8 lines
At compilation time, you have to pass this option.
# ./configure --with-xtablesAnd libxtables needs to be installed in your system.
This patch allows you to use xt extensions from nft, eg.
Quoted 7 lines
Quoted 2 lines
# nft add rule filter output \ tcp flags syn xt target TCPMSS [ --clamp-mss-to-pmtu ]Before review this patch, my main question is - are we sure we want to do this? How will this affect our plans to get rid of the iptables code at some point in the future? Arguably its a compatibility question, if we support this in nft people will use it and we can't simply remove it.
Quoted 4 lines
Good question.
I think we'll have to live with both codebases for quite a while anyway, unfortunately we cannot skip that.
Absolutely. I just want to make sure we don't prolong it unnecessarily, or even for ever.
Quoted 7 lines
I think this code provides a way for users to easily migrate from iptables to nftables.
They will only need to:
iptables-compat-restore < ipt-ruleset.file
Quoted 8 lines
then, switch to nft and type:
nft list ruleset > nft-ruleset.file
and start to replacing to native expressions progressively.
We also have a prototype translation layer (see xlate in the iptables tree), that will provide an automatic translation whenever possible.
Yes, that's a very good thing to have.
Quoted 9 lines
The idea is that they will periodically run something like:
nft --migrate nft-ruleset.filethat will detect xt statements and will translate them to native expressions whenever possible.
I think we have to ease adoption through these facilities, and new nice features, of course.
I agree, my concern is just putting this into nft where we can't remove it easily again. Having the translation to native is great. Supporting xt natively is an entirely different story since chances are very high that people will just leave the xt compat expressions in the ruleset.
We can tell them to periodically update their rulesets. They still won't do it, and there are legitimate reasons not to since the nft ruleset might have been changed.