add ct expectation support
v4 cover add ct expectation support
Please find here the second part of the ct expectation support. When needed, please ask me for the third part: nft patch.
Stéphane Veyret (2):
src: add ct expectation support
examples: add ct expectation examples
examples/Makefile.am | 16 ++ examples/nft-ct-expectation-add.c | 153 ++++++++++++++++++ examples/nft-ct-expectation-del.c | 126 +++++++++++++++ examples/nft-ct-expectation-get.c | 142 +++++++++++++++++ examples/nft-rule-ct-expectation-add.c | 163 +++++++++++++++++++ include/libnftnl/object.h | 8 + include/linux/netfilter/nf_tables.h | 14 +- include/obj.h | 8 + src/Makefile.am | 1 + src/obj/ct_expect.c | 213 +++++++++++++++++++++++++ src/object.c | 1 + 11 files changed, 844 insertions(+), 1 deletion(-) create mode 100644 examples/nft-ct-expectation-add.c create mode 100644 examples/nft-ct-expectation-del.c create mode 100644 examples/nft-ct-expectation-get.c create mode 100644 examples/nft-rule-ct-expectation-add.c create mode 100644 src/obj/ct_expect.c
Signature · 1 line
2.21.0
PATCH v4 1/2 src: add ct expectation support
Add support for ct expectation objects, used to define specific expectations.
--- include/libnftnl/object.h | 8 ++ include/linux/netfilter/nf_tables.h | 14 +- include/obj.h | 8 ++ src/Makefile.am | 1 + src/obj/ct_expect.c | 213 ++++++++++++++++++++++++++++ src/object.c | 1 + 6 files changed, 244 insertions(+), 1 deletion(-) create mode 100644 src/obj/ct_expect.c
include/libnftnl/object.h +8 -0
@@ -70,6 +70,14 @@ enum { NFTNL_OBJ_CT_TIMEOUT_ARRAY, }; +enum { +NFTNL_OBJ_CT_EXPECT_L3PROTO =NFTNL_OBJ_BASE , +NFTNL_OBJ_CT_EXPECT_L4PROTO , +NFTNL_OBJ_CT_EXPECT_DPORT , +NFTNL_OBJ_CT_EXPECT_TIMEOUT , +NFTNL_OBJ_CT_EXPECT_SIZE , +}; +enum {NFTNL_OBJ_LIMIT_RATE =NFTNL_OBJ_BASE ,NFTNL_OBJ_LIMIT_UNIT ,
include/linux/netfilter/nf_tables.h +13 -1
@@ -1429,6 +1429,17 @@ enum nft_ct_timeout_attributes { };#define NFTA_CT_TIMEOUT_MAX (__NFTA_CT_TIMEOUT_MAX - 1) +enum nft_ct_expectation_attributes { +NFTA_CT_EXPECT_UNSPEC , +NFTA_CT_EXPECT_L3PROTO , +NFTA_CT_EXPECT_L4PROTO , +NFTA_CT_EXPECT_DPORT , +NFTA_CT_EXPECT_TIMEOUT , +NFTA_CT_EXPECT_SIZE , + __NFTA_CT_EXPECT_MAX, +}; +#define NFTA_CT_EXPECT_MAX (__NFTA_CT_EXPECT_MAX - 1) +#define NFT_OBJECT_UNSPEC 0#define NFT_OBJECT_COUNTER 1#define NFT_OBJECT_QUOTA 2
@@ -1438,7 +1449,8 @@ enum nft_ct_timeout_attributes {#define NFT_OBJECT_TUNNEL 6#define NFT_OBJECT_CT_TIMEOUT 7#define NFT_OBJECT_SECMARK 8 -#define __NFT_OBJECT_MAX 9 +#define NFT_OBJECT_CT_EXPECT 9 +#define __NFT_OBJECT_MAX 10#define NFT_OBJECT_MAX (__NFT_OBJECT_MAX - 1)/**
include/obj.h +8 -0
@@ -42,6 +42,13 @@ struct nftnl_obj {uint8_t l4proto;uint32_t timeout[NFTNL_CTTIMEOUT_ARRAY_MAX ]; } ct_timeout; +struct nftnl_obj_ct_expect { +uint16_t l3proto; +uint16_t dport; +uint8_t l4proto; +uint8_t size; +uint32_t timeout; + } ct_expect;struct nftnl_obj_limit {uint64_t rate;uint64_t unit;
@@ -99,6 +106,7 @@ extern struct obj_ops obj_ops_counter;extern struct obj_ops obj_ops_quota;extern struct obj_ops obj_ops_ct_helper;extern struct obj_ops obj_ops_ct_timeout; +extern struct obj_ops obj_ops_ct_expect;extern struct obj_ops obj_ops_limit;extern struct obj_ops obj_ops_tunnel;extern struct obj_ops obj_ops_secmark;
src/Makefile.am +1 -0
@@ -65,4 +65,5 @@ libnftnl_la_SOURCES = utils.c \ obj/limit.c \ obj/ct_timeout.c \ obj/secmark.c \ + obj/ct_expect.c \ libnftnl.map
src/obj/ct_expect.c new file +213 -0
213 lines not on this page · raw message
src/object.c +1 -0
@@ -33,6 +33,7 @@ static struct obj_ops *obj_ops[__NFT_OBJECT_MAX] = { [NFT_OBJECT_TUNNEL] = &obj_ops_tunnel, [NFT_OBJECT_CT_TIMEOUT] = &obj_ops_ct_timeout, [NFT_OBJECT_SECMARK] = &obj_ops_secmark, + [NFT_OBJECT_CT_EXPECT] = &obj_ops_ct_expect, };static struct obj_ops *nftnl_obj_ops_lookup (uint32_t type)
Signature · 1 line
2.21.0
PATCH v4 2/2 examples: add ct expectation examples
In reply to Stéphane VeyretAdd examples for ct expectations.
Add, list and delete ct expectation objects from specified table. Add expectation object to rule.
--- examples/Makefile.am | 16 +++ examples/nft-ct-expectation-add.c | 153 +++++++++++++++++++++++ examples/nft-ct-expectation-del.c | 126 +++++++++++++++++++ examples/nft-ct-expectation-get.c | 142 +++++++++++++++++++++ examples/nft-rule-ct-expectation-add.c | 163 +++++++++++++++++++++++++ 5 files changed, 600 insertions(+) create mode 100644 examples/nft-ct-expectation-add.c create mode 100644 examples/nft-ct-expectation-del.c create mode 100644 examples/nft-ct-expectation-get.c create mode 100644 examples/nft-rule-ct-expectation-add.c
examples/Makefile.am +16 -0
@@ -29,10 +29,14 @@ check_PROGRAMS = nft-table-add \ nft-flowtable-get \ nft-ruleset-get \ nft-compat-get \ + nft-ct-expectation-add \ + nft-ct-expectation-del \ + nft-ct-expectation-get \ nft-ct-helper-add \ nft-ct-helper-get \ nft-ct-helper-del \ nft-rule-ct-helper-add \ + nft-rule-ct-expectation-add \ nft-rule-ct-timeout-add nft_table_add_SOURCES = nft-table-add.c
@@ -122,6 +126,15 @@ nft_ruleset_get_LDADD = ../src/libnftnl.la ${LIBMNL_LIBS} nft_compat_get_SOURCES = nft-compat-get.c nft_compat_get_LDADD = ../src/libnftnl.la ${LIBMNL_LIBS} +nft_ct_expectation_add_SOURCES = nft-ct-expectation-add.c +nft_ct_expectation_add_LDADD = ../src/libnftnl.la ${LIBMNL_LIBS} + +nft_ct_expectation_del_SOURCES = nft-ct-expectation-del.c +nft_ct_expectation_del_LDADD = ../src/libnftnl.la ${LIBMNL_LIBS} + +nft_ct_expectation_get_SOURCES = nft-ct-expectation-get.c +nft_ct_expectation_get_LDADD = ../src/libnftnl.la ${LIBMNL_LIBS} + nft_ct_helper_add_SOURCES = nft-ct-helper-add.c nft_ct_helper_add_LDADD = ../src/libnftnl.la ${LIBMNL_LIBS}
@@ -134,5 +147,8 @@ nft_ct_helper_del_LDADD = ../src/libnftnl.la ${LIBMNL_LIBS} nft_rule_ct_helper_add_SOURCES = nft-rule-ct-helper-add.c nft_rule_ct_helper_add_LDADD = ../src/libnftnl.la ${LIBMNL_LIBS} +nft_rule_ct_expectation_add_SOURCES = nft-rule-ct-expectation-add.c +nft_rule_ct_expectation_add_LDADD = ../src/libnftnl.la ${LIBMNL_LIBS} + nft_rule_ct_timeout_add_SOURCES = nft-rule-ct-timeout-add.c nft_rule_ct_timeout_add_LDADD = ../src/libnftnl.la ${LIBMNL_LIBS}
examples/nft-ct-expectation-add.c new file +153 -0
153 lines not on this page · raw message
examples/nft-ct-expectation-del.c new file +126 -0
126 lines not on this page · raw message
examples/nft-ct-expectation-get.c new file +142 -0
142 lines not on this page · raw message
examples/nft-rule-ct-expectation-add.c new file +163 -0
163 lines not on this page · raw message
Signature · 1 line
2.21.0
Hi Pablo,
Is this enough for you to test the “netfilter: nft_ct: add ct expectations support” patch or would you like me to also send the nft patch ?
Quoted 26 lines · Stéphane Veyret
Please find here the second part of the ct expectation support. When needed, please ask me for the third part: nft patch.
Stéphane Veyret (2):
src: add ct expectation support
examples: add ct expectation examplesexamples/Makefile.am | 16 ++ examples/nft-ct-expectation-add.c | 153 ++++++++++++++++++ examples/nft-ct-expectation-del.c | 126 +++++++++++++++ examples/nft-ct-expectation-get.c | 142 +++++++++++++++++ examples/nft-rule-ct-expectation-add.c | 163 +++++++++++++++++++ include/libnftnl/object.h | 8 + include/linux/netfilter/nf_tables.h | 14 +- include/obj.h | 8 + src/Makefile.am | 1 + src/obj/ct_expect.c | 213 +++++++++++++++++++++++++ src/object.c | 1 + 11 files changed, 844 insertions(+), 1 deletion(-) create mode 100644 examples/nft-ct-expectation-add.c create mode 100644 examples/nft-ct-expectation-del.c create mode 100644 examples/nft-ct-expectation-get.c create mode 100644 examples/nft-rule-ct-expectation-add.c create mode 100644 src/obj/ct_expect.c
Quoted 3 lines
--
2.21.0
Stéphane Veyret
Pablo Neira Ayuso
maintainerQuoted 5 lines · Stéphane Veyret
Hi Pablo,
Is this enough for you to test the “netfilter:
nft_ct: add ct expectations support” patch or would you like me to also send the nft patch ?
Please, submit this too, thanks.
Quoted 5 lines · Pablo Neira Ayuso
Quoted 3 lines
Is this enough for you to test the “netfilter:
nft_ct: add ct expectations support” patch or would you like me to also send the nft patch ?Please, submit this too, thanks.
Done… :-)
Signature · 1 line
Stéphane Veyret
Pablo Neira Ayuso
maintainerQuoted 2 lines · Stéphane Veyret
Please find here the second part of the ct expectation support. When needed, please ask me for the third part: nft patch.
Series for libnftnl applied, thanks Stephane.