ct helper set support
Florian Westphal
maintainerv2 cover ct helper set support
v2, with updated syntax to force type and protocol keywords into same statement, i.e.
ct helper ftp-standard {
type "ftp" protocol tcp
}
I also cleaned up the changes to bison (reuse family_spec_explicit) and added a test for an invalid helper (l3proto ip6 in ip table).
doc/nft.xml | 76 +++++++++++++++++ include/ct.h | 1 include/linux/netfilter/nf_tables.h | 12 ++ include/rule.h | 12 ++ src/ct.c | 10 ++ src/evaluate.c | 37 +++++--- src/netlink.c | 16 +++ src/parser_bison.y | 156 +++++++++++++++++++++++++++++++++++- src/rule.c | 45 ++++++++++ src/statement.c | 10 ++ tests/py/ip/objects.t | 5 + tests/py/ip/objects.t.payload | 14 +++ tests/py/nft-test.py | 28 +++++- 13 files changed, 399 insertions(+), 23 deletions(-)
Florian Westphal
maintainerPATCH v2 1/7 src: add initial ct helper support
This adds initial support for defining conntrack helper objects which can then be assigned to connections using the objref infrastructure:
table ip filter {
ct helper ftp-standard {
type "ftp" protocol tcp
}
chain y {
tcp dport 21 ct helper set "ftp-standard"
}
}
---
Changes since v1:
- tweak user syntax
- minor cleanup
- fix parsing of l3proto: v1 used to set l4proto instead of l3.
include/ct.h | 1 + include/linux/netfilter/nf_tables.h | 12 +++++- include/rule.h | 7 ++++ src/ct.c | 10 +++++ src/netlink.c | 16 ++++++++ src/parser_bison.y | 74 ++++++++++++++++++++++++++++++++++++- src/rule.c | 21 ++++++++++- src/statement.c | 10 ++++- 8 files changed, 146 insertions(+), 5 deletions(-)
include/ct.h +1 -0
@@ -31,6 +31,7 @@ extern struct error_record *ct_dir_parse(const struct location *loc, const char *str, int8_t *dir);extern struct error_record *ct_key_parse (const struct location *loc,const char *str,unsigned int *key); +extern struct error_record *ct_objtype_parse (const struct location *loc,const char *str,int *type);extern struct stmt *notrack_stmt_alloc (const struct location *loc);
include/linux/netfilter/nf_tables.h +11 -1
@@ -1260,10 +1260,20 @@ enum nft_fib_flags { NFTA_FIB_F_PRESENT = 1 << 5, /* check existence only */ }; +enum nft_ct_helper_attributes { +NFTA_CT_HELPER_UNSPEC , +NFTA_CT_HELPER_NAME , +NFTA_CT_HELPER_L3PROTO , +NFTA_CT_HELPER_L4PROTO , + __NFTA_CT_HELPER_MAX, +}; +#define NFTA_CT_HELPER_MAX (__NFTA_CT_HELPER_MAX - 1) +#define NFT_OBJECT_UNSPEC 0#define NFT_OBJECT_COUNTER 1#define NFT_OBJECT_QUOTA 2 -#define __NFT_OBJECT_MAX 3 +#define NFT_OBJECT_CT_HELPER 3 +#define __NFT_OBJECT_MAX 4#define NFT_OBJECT_MAX (__NFT_OBJECT_MAX - 1)/**
include/rule.h +7 -0
@@ -260,6 +260,12 @@ struct quota {uint32_t flags; }; +struct ct { +char helper_name[16 ]; +uint16_t l3proto; +uint8_t l4proto; +}; +/** * struct obj - nftables stateful object statement *
@@ -277,6 +283,7 @@ struct obj {union {struct counter counter;struct quota quota; +struct ct ct; }; };
src/ct.c +10 -0
@@ -353,6 +353,16 @@ struct error_record *ct_key_parse(const struct location *loc, const char *str,return error (loc,"syntax error, unexpected %s, known keys are %s" , str, buf); } +struct error_record *ct_objtype_parse (const struct location *loc,const char *str,int *type) +{ +if (strcmp (str,"helper" ) ==0 ) { + *type =NFT_OBJECT_CT_HELPER ; +return NULL ; + } + +return error (loc,"unknown ct class '%s', want 'helper'" , str); +} +struct expr *ct_expr_alloc (const struct location *loc,enum nft_ct_keys key,int8_t direction) {
src/netlink.c +16 -0
@@ -317,6 +317,15 @@ alloc_nftnl_obj(const struct handle *h, struct obj *obj)nftnl_obj_set_u32 (nlo,NFTNL_OBJ_QUOTA_FLAGS , obj->quota.flags);break ; +case NFT_OBJECT_CT_HELPER : +nftnl_obj_set_str (nlo,NFTNL_OBJ_CT_HELPER_NAME , + obj->ct.helper_name); +nftnl_obj_set_u8 (nlo,NFTNL_OBJ_CT_HELPER_L4PROTO , + obj->ct.l4proto); +if (obj->ct.l3proto) +nftnl_obj_set_u16 (nlo,NFTNL_OBJ_CT_HELPER_L3PROTO , + obj->ct.l3proto); +break ;default :BUG ("Unknown type %d\n" , obj->type);break ;
@@ -1814,6 +1823,13 @@ static struct obj *netlink_delinearize_obj(struct netlink_ctx *ctx,nftnl_obj_get_u64 (nlo,NFTNL_OBJ_QUOTA_CONSUMED ); obj->quota.flags =nftnl_obj_get_u32 (nlo,NFTNL_OBJ_QUOTA_FLAGS ); +break ; +case NFT_OBJECT_CT_HELPER : +snprintf (obj->ct.helper_name,sizeof (obj->ct.helper_name),"%s" , +nftnl_obj_get_str (nlo,NFTNL_OBJ_CT_HELPER_NAME )); + obj->ct.l3proto =nftnl_obj_get_u16 (nlo,NFTNL_OBJ_CT_HELPER_L3PROTO ); + obj->ct.l4proto =nftnl_obj_get_u8 (nlo,NFTNL_OBJ_CT_HELPER_L4PROTO ); +break ; } obj->type = type;
src/parser_bison.y +72 -2
116 lines not on this page · raw message
src/rule.c +20 -1
@@ -19,6 +19,7 @@#include <statement.h> #include <rule.h> #include <utils.h> +#include <netdb.h> #include <netlink.h> #include <libnftnl/common.h>
@@ -1172,6 +1173,16 @@ struct obj *obj_lookup(const struct table *table, const char *name,return NULL ; } +static void print_proto_name_proto (uint8_t l4) +{ +const struct protoent *p =getprotobynumber (l4); + +if (p) +printf ("%s\n" , p->p_name); +else +printf ("%d\n" , l4); +} +static void obj_print_data (const struct obj *obj,struct print_fmt_options *opts) {
@@ -1202,6 +1213,13 @@ static void obj_print_data(const struct obj *obj, } }break ; +case NFT_OBJECT_CT_HELPER : { +printf ("ct helper %s {\n" , obj->handle.obj); +printf ("\t\ttype \"%s\" protocol " , obj->ct.helper_name); +print_proto_name_proto (obj->ct.l4proto); +printf ("\t\tl3proto %s" ,family2str (obj->ct.l3proto)); +break ; + }default :printf ("unknown {%s" , opts->nl);break ;
@@ -1211,11 +1229,12 @@ static void obj_print_data(const struct obj *obj,static const char *obj_type_name_array[] = { [NFT_OBJECT_COUNTER ] ="counter" , [NFT_OBJECT_QUOTA ] ="quota" , + [NFT_OBJECT_CT_HELPER ] ="" , };const char *obj_type_name (enum stmt_types type) { -assert (type <=NFT_OBJECT_QUOTA && obj_type_name_array[type]); +assert (type <=NFT_OBJECT_CT_HELPER && obj_type_name_array[type]);return obj_type_name_array[type]; }
src/statement.c +9 -1
@@ -174,6 +174,7 @@ struct stmt *counter_stmt_alloc(const struct location *loc)static const char *objref_type[NFT_OBJECT_MAX +1 ] = { [NFT_OBJECT_COUNTER ] ="counter" , [NFT_OBJECT_QUOTA ] ="quota" , + [NFT_OBJECT_CT_HELPER ] ="cthelper" , };static const char *objref_type_name (uint32_t type)
@@ -186,7 +187,14 @@ static const char *objref_type_name(uint32_t type)static void objref_stmt_print (const struct stmt *stmt) { -printf ("%s name " ,objref_type_name (stmt->objref.type)); +switch (stmt->objref.type) { +case NFT_OBJECT_CT_HELPER : +printf ("ct helper set " ); +break ; +default : +printf ("%s name " ,objref_type_name (stmt->objref.type)); +break ; + }expr_print (stmt->objref.expr); }
Signature · 1 line
2.10.2
Florian Westphal
maintainerPATCH v2 2/7 evaluate: refactor CMD_OBJ_QUOTA/COUNTER handling
In reply to Florian Westphal... to make adding CMD_OBJ_CT_HELPER support easier.
---
no changes since v1.
src/evaluate.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-)
src/evaluate.c +20 -12
@@ -2940,12 +2940,29 @@ static int cmd_evaluate_delete(struct eval_ctx *ctx, struct cmd *cmd) } } +static int cmd_evaluate_list_obj (struct eval_ctx *ctx,const struct cmd *cmd, +uint32_t obj_type) +{ +const struct table *table; + +if (obj_type ==NFT_OBJECT_UNSPEC ) + obj_type =NFT_OBJECT_COUNTER ; + + table =table_lookup (&cmd->handle); +if (table ==NULL ) +return cmd_error (ctx,"Could not process rule: Table '%s' does not exist" , + cmd->handle.table); +if (obj_lookup (table, cmd->handle.obj, obj_type) ==NULL ) +return cmd_error (ctx,"Could not process rule: Object '%s' does not exist" , + cmd->handle.obj); +return 0 ; +} +static int cmd_evaluate_list (struct eval_ctx *ctx,struct cmd *cmd) {struct table *table;struct set *set;int ret; -uint32_t obj_type =NFT_OBJECT_UNSPEC ; ret =cache_update (cmd->op, ctx->msgs);if (ret <0 )
@@ -3001,18 +3018,9 @@ static int cmd_evaluate_list(struct eval_ctx *ctx, struct cmd *cmd) cmd->handle.chain);return 0 ;case CMD_OBJ_QUOTA : - obj_type =NFT_OBJECT_QUOTA ; +return cmd_evaluate_list_obj (ctx, cmd,NFT_OBJECT_QUOTA );case CMD_OBJ_COUNTER : -if (obj_type ==NFT_OBJECT_UNSPEC ) - obj_type =NFT_OBJECT_COUNTER ; - table =table_lookup (&cmd->handle); -if (table ==NULL ) -return cmd_error (ctx,"Could not process rule: Table '%s' does not exist" , - cmd->handle.table); -if (obj_lookup (table, cmd->handle.obj, obj_type) ==NULL ) -return cmd_error (ctx,"Could not process rule: Object '%s' does not exist" , - cmd->handle.obj); -return 0 ; +return cmd_evaluate_list_obj (ctx, cmd,NFT_OBJECT_COUNTER );case CMD_OBJ_COUNTERS :case CMD_OBJ_QUOTAS :if (cmd->handle.table ==NULL )
Signature · 1 line
2.10.2
Florian Westphal
maintainerPATCH v2 3/7 src: allow listing all ct helpers
In reply to Florian Westphalthis implements
nft list ct helpers table filter
table ip filter {
ct helper ftp-standard {..
---
no changes since v1.
include/rule.h | 1 + src/evaluate.c | 1 + src/parser_bison.y | 19 +++++++++++++++++++ src/rule.c | 2 ++ 4 files changed, 23 insertions(+)
include/rule.h +1 -0
@@ -370,6 +370,7 @@ enum cmd_obj {CMD_OBJ_COUNTERS ,CMD_OBJ_QUOTA ,CMD_OBJ_QUOTAS , + CMD_OBJ_CT_HELPERS, }; struct export {
src/evaluate.c +1 -0
@@ -3023,6 +3023,7 @@ static int cmd_evaluate_list(struct eval_ctx *ctx, struct cmd *cmd)return cmd_evaluate_list_obj (ctx, cmd,NFT_OBJECT_COUNTER );case CMD_OBJ_COUNTERS :case CMD_OBJ_QUOTAS : +case CMD_OBJ_CT_HELPERS :if (cmd->handle.table ==NULL )return 0 ;if (table_lookup (&cmd->handle) ==NULL )
src/parser_bison.y +19 -0
@@ -1016,6 +1016,25 @@ list_cmd : TABLE table_spec { $$ = cmd_alloc(CMD_LIST, CMD_OBJ_MAP, &$2, &@$, NULL); } + | CT STRING TABLE table_spec + { + int cmd; + + if (strcmp($2, "helpers") == 0) { + cmd = CMD_OBJ_CT_HELPERS; + } else { + struct error_record *erec; + + erec = error(&@$, "unknown ct class '%s', want 'helpers'", $2); + + if (erec != NULL) { + erec_queue(erec, state->msgs); + YYERROR; + } + } + + $$ = cmd_alloc(CMD_LIST, cmd, &$4, &@$, NULL); + } ; reset_cmd : COUNTERS ruleset_spec
src/rule.c +2 -0
@@ -1455,6 +1455,8 @@ static int do_command_list(struct netlink_ctx *ctx, struct cmd *cmd)case CMD_OBJ_QUOTA :case CMD_OBJ_QUOTAS :return do_list_obj (ctx, cmd,NFT_OBJECT_QUOTA ); +case CMD_OBJ_CT_HELPERS : +return do_list_obj (ctx, cmd,NFT_OBJECT_CT_HELPER );default :BUG ("invalid command object type %u\n" , cmd->obj); }
Signature · 1 line
2.10.2
Florian Westphal
maintainerPATCH v2 4/7 src: implement add/create/delete for ct helper objects
In reply to Florian Westphal---
no changes since v1.
include/rule.h | 4 ++++ src/evaluate.c | 4 ++++ src/parser_bison.y | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- src/rule.c | 22 +++++++++++++++++++ 4 files changed, 91 insertions(+), 2 deletions(-)
include/rule.h +4 -0
@@ -370,6 +370,7 @@ enum cmd_obj {CMD_OBJ_COUNTERS ,CMD_OBJ_QUOTA ,CMD_OBJ_QUOTAS , +CMD_OBJ_CT_HELPER , CMD_OBJ_CT_HELPERS, };
@@ -438,6 +439,9 @@ struct cmd {extern struct cmd *cmd_alloc (enum cmd_ops op,enum cmd_obj obj,const struct handle *h,const struct location *loc,void *data); +extern struct cmd *cmd_alloc_obj_ct (enum cmd_ops op,int type, +const struct handle *h, +const struct location *loc,void *data);extern void cmd_free (struct cmd *cmd);#include <payload.h>
src/evaluate.c +4 -0
@@ -2911,6 +2911,7 @@ static int cmd_evaluate_add(struct eval_ctx *ctx, struct cmd *cmd)return table_evaluate (ctx, cmd->table);case CMD_OBJ_COUNTER :case CMD_OBJ_QUOTA : +case CMD_OBJ_CT_HELPER :return 0 ;default :BUG ("invalid command object type %u\n" , cmd->obj);
@@ -2934,6 +2935,7 @@ static int cmd_evaluate_delete(struct eval_ctx *ctx, struct cmd *cmd)case CMD_OBJ_TABLE :case CMD_OBJ_COUNTER :case CMD_OBJ_QUOTA : +case CMD_OBJ_CT_HELPER :return 0 ;default :BUG ("invalid command object type %u\n" , cmd->obj);
@@ -3021,6 +3023,8 @@ static int cmd_evaluate_list(struct eval_ctx *ctx, struct cmd *cmd)return cmd_evaluate_list_obj (ctx, cmd,NFT_OBJECT_QUOTA );case CMD_OBJ_COUNTER :return cmd_evaluate_list_obj (ctx, cmd,NFT_OBJECT_COUNTER ); +case CMD_OBJ_CT_HELPER : +return cmd_evaluate_list_obj (ctx, cmd,NFT_OBJECT_CT_HELPER );case CMD_OBJ_COUNTERS :case CMD_OBJ_QUOTAS :case CMD_OBJ_CT_HELPERS :
src/parser_bison.y +61 -2
99 lines not on this page · raw message
src/rule.c +22 -0
@@ -885,6 +885,7 @@ void cmd_free(struct cmd *cmd)break ;case CMD_OBJ_COUNTER :case CMD_OBJ_QUOTA : +case CMD_OBJ_CT_HELPER :obj_free (cmd->object);break ;default :
@@ -1001,6 +1002,7 @@ static int do_command_add(struct netlink_ctx *ctx, struct cmd *cmd, bool excl)return do_add_setelems (ctx, &cmd->handle, cmd->expr, excl);case CMD_OBJ_COUNTER :case CMD_OBJ_QUOTA : +case CMD_OBJ_CT_HELPER :return netlink_add_obj (ctx, &cmd->handle, cmd->object, excl);default :BUG ("invalid command object type %u\n" , cmd->obj);
@@ -1071,6 +1073,9 @@ static int do_command_delete(struct netlink_ctx *ctx, struct cmd *cmd)case CMD_OBJ_QUOTA :return netlink_delete_obj (ctx, &cmd->handle, &cmd->location,NFT_OBJECT_QUOTA ); +case CMD_OBJ_CT_HELPER : +return netlink_delete_obj (ctx, &cmd->handle, &cmd->location, +NFT_OBJECT_CT_HELPER );default :BUG ("invalid command object type %u\n" , cmd->obj); }
@@ -1455,6 +1460,7 @@ static int do_command_list(struct netlink_ctx *ctx, struct cmd *cmd)case CMD_OBJ_QUOTA :case CMD_OBJ_QUOTAS :return do_list_obj (ctx, cmd,NFT_OBJECT_QUOTA ); +case CMD_OBJ_CT_HELPER :case CMD_OBJ_CT_HELPERS :return do_list_obj (ctx, cmd,NFT_OBJECT_CT_HELPER );default :
@@ -1603,6 +1609,22 @@ static int do_command_describe(struct netlink_ctx *ctx, struct cmd *cmd)return 0 ; } +struct cmd *cmd_alloc_obj_ct (enum cmd_ops op,int type,const struct handle *h, +const struct location *loc,void *data) +{ +enum cmd_obj cmd_obj; + +switch (type) { +case NFT_OBJECT_CT_HELPER : + cmd_obj =CMD_OBJ_CT_HELPER ; +break ; +default : +BUG ("missing type mapping" ); + } + +return cmd_alloc (op, cmd_obj, h, loc, data); +} +int do_command (struct netlink_ctx *ctx,struct cmd *cmd) {switch (cmd->op) {
Signature · 1 line
2.10.2
Florian Westphal
maintainerPATCH v2 5/7 tests: py: add ct helper tests
In reply to Florian Westphalneeds minor tweak to nft-test.py so we don't zap the ';' withhin the {}.
---
no changes since v1.
tests/py/ip/objects.t | 4 ++++ tests/py/ip/objects.t.payload | 14 ++++++++++++++ tests/py/nft-test.py | 11 ++++++++++- 3 files changed, 28 insertions(+), 1 deletion(-)
tests/py/ip/objects.t +4 -0
@@ -13,3 +13,7 @@ counter name tcp dport map {443 : "cnt1", 80 : "cnt2", 22 : "cnt1"};ok ip saddr 192.168.1.3 quota name "qt1";ok ip saddr 192.168.1.3 quota name "qt3";fail quota name tcp dport map {443 : "qt1", 80 : "qt2", 22 : "qt1"};ok + +%cthelp1 type ct helper { type \"ftp\" protocol tcp\; };ok +ct helper set "cthelp1";ok +ct helper set tcp dport map {21 : "cthelp1", 2121 : "cthelp1" };ok
tests/py/ip/objects.t.payload +14 -0
@@ -29,3 +29,17 @@ ip test-ip4 output [ cmp eq reg 1 0x00000006 ] [ payload load 2b @ transport header + 2 => reg 1 ] [ objref sreg 1 set __objmap%d id 1 ] + +# ct helper set "cthelp1" +ip test-ip4 output + [ objref type 3 name cthelp1 ] + +# ct helper set tcp dport map {21 : "cthelp1", 2121 : "cthelp1" } +__objmap%d test-ip4 43 +__objmap%d test-ip4 0 + element 00001500 : 0 [end] element 00004908 : 0 [end] +ip test-ip4 output + [ payload load 1b @ network header + 9 => reg 1 ] + [ cmp eq reg 1 0x00000006 ] + [ payload load 2b @ transport header + 2 => reg 1 ] + [ objref sreg 1 set __objmap%d id 1 ]
tests/py/nft-test.py +10 -1
@@ -885,6 +885,10 @@ def obj_process(obj_line, filename, lineno): obj_type = tokens[2] obj_spcf = "" + if obj_type == "ct" and tokens[3] == "helper": + obj_type = "ct helper" + tokens[3] = "" + if len(tokens) > 3: obj_spcf = " ".join(tokens[3:])
@@ -985,7 +989,12 @@ def run_test_file(filename, force_all_family_option, specific_file): continue if line[0] == "%": # Adds this object - obj_line = line.rstrip()[1:].split(";") + brace = line.rfind("}") + if brace < 0: + obj_line = line.rstrip()[1:].split(";") + else: + obj_line = (line[1:brace+1], line[brace+2:].rstrip()) + ret = obj_process(obj_line, filename, lineno) tests += 1 if ret == -1:
Signature · 1 line
2.10.2
Florian Westphal
maintainerPATCH v2 6/7 tests: add insert-failure test
In reply to Florian WestphalIt should not be possible to add a ip6 restricted helper to ip family.
---
not part of v1 series.
tests/py/ip/objects.t | 1 + tests/py/nft-test.py | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-)
tests/py/ip/objects.t +1 -0
@@ -6,6 +6,7 @@ %cnt2 type counter;ok %qt1 type quota 25 mbytes;ok %qt2 type quota over 1 kbytes;ok +%cthelp2 type ct helper { type \"ftp\" protocol tcp\; l3proto ip6\; };fail ip saddr 192.168.1.3 counter name "cnt2";ok ip saddr 192.168.1.3 counter name "cnt3";fail
tests/py/nft-test.py +14 -3
@@ -517,12 +517,23 @@ def obj_add(o, test_result, filename, lineno): print_error(reason, filename, lineno) return -1 - if not _obj_exist(o, filename, lineno): - reason = "I have just added the " + obj_handle + \ - " to the table " + table.name + " but it does not exist" + exist = _obj_exist(o, filename, lineno) + + if exist: + if test_result == "ok": + return 0 + reason = "I added the " + obj_handle + \ + " to the table " + table.name + " but it should have failed" print_error(reason, filename, lineno) return -1 + if test_result == "fail": + return 0 + + reason = "I have just added the " + obj_handle + \ + " to the table " + table.name + " but it does not exist" + print_error(reason, filename, lineno) + return -1 def obj_delete(table, filename=None, lineno=None): '''
Signature · 1 line
2.10.2
Florian Westphal
maintainerPATCH v2 7/7 doc: ct helper objects and helper set support
In reply to Florian Westphal---
changes since v1:
use <replaceable> in cmdsynopsis, update example
doc/nft.xml | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+)
doc/nft.xml +76 -0
@@ -950,6 +950,77 @@ filter input iif $int_ifs accept </variablelist> <refsect2> + <title>Ct</title> + <para> + <cmdsynopsis> + <command>ct</command> + <arg choice="req">helper</arg> + <arg choice="req">type</arg> + <arg choice="req"><replaceable>type</replaceable></arg> + <arg choice="req">protocol</arg> + <arg choice="req"><replaceable>protocol</replaceable></arg> + <arg choice="opt">l3proto</arg> + <arg choice="opt"><replaceable>family</replaceable></arg> + </cmdsynopsis> + </para> + <para> + Ct helper is used to define connection tracking helpers that can then be used in combination with the <literal>"ct helper set"</literal> statement. + type and protocol are mandatory, l3proto is derived from the table family by default, i.e. in the inet table the kernel will + try to load both the ipv4 and ipv6 helper backends, if they are supported by the kernel. + </para> + <table frame="all"> + <title>conntrack helper specifications</title> + <tgroup cols='3' align='left' colsep='1' rowsep='1'> + <colspec colname='c1'/> + <colspec colname='c2'/> + <colspec colname='c3'/> + <thead> + <row> + <entry>Keyword</entry> + <entry>Description</entry> + <entry>Type</entry> + </row> + </thead> + <tbody> + <row> + <entry>type</entry> + <entry>name of helper type</entry> + <entry>quoted string (e.g. "ftp")</entry> + </row> + <row> + <entry>protocol</entry> + <entry>layer 4 protocol of the helper</entry> + <entry>string (e.g. tcp)</entry> + </row> + <row> + <entry>l3proto</entry> + <entry>layer 3 protocol of the helper</entry> + <entry>address family (e.g. ip)</entry> + </row> + </tbody> + </tgroup> + </table> + <example> + <title>defining and assigning ftp helper</title> + <para> + Unlike iptables, helper assignment needs to be performed after the conntrack lookup has completed, for example + with the default 0 hook priority. + </para> + <programlisting> +table inet myhelpers { + ct helper ftp-standard { + type "ftp" protocol tcp + } + chain prerouting { + type filter hook prerouting priority 0; + tcp dport 21 ct helper set "ftp-standard" + } +} + </programlisting> + </example> + </refsect2> + + <refsect2> <title>Counter</title> <para> <cmdsynopsis>
@@ -3376,6 +3447,11 @@ ip6 filter output log flags all </thead> <tbody> <row> + <entry>helper</entry> + <entry>name of ct helper object to assign to the connection</entry> + <entry>quoted string</entry> + </row> + <row> <entry>mark</entry> <entry>Connection tracking mark</entry> <entry>mark</entry>
Signature · 1 line
2.10.2
Quoted 9 lines · Florian Westphal
v2, with updated syntax to force type and protocol keywords into same statement, i.e.
ct helper ftp-standard {
type "ftp" protocol tcp
}I also cleaned up the changes to bison (reuse
family_spec_explicit) and added a test for an invalid helper (l3proto ip6 in ip table).