tests: py: remove verdict from closing end interval
Pablo Neira Ayuso
maintainerPATCH 1/2 tests: py: remove verdict from closing end interval
Kernel does not allow for NFT_SET_ELEM_INTERVAL_END flag and NFTA_SET_ELEM_DATA. The closing end interval represents a mismatch, therefore, no verdict can be applied. The existing payload files show the drop verdict when this is unset (because NF_DROP=0).
This update is required to fix payload warnings in tests/py after libnftnl's ("set: use NFTNL_SET_ELEM_VERDICT to print verdict").
--- tests/py/ip/ip.t.payload | 2 +- tests/py/ip/ip.t.payload.bridge | 2 +- tests/py/ip/ip.t.payload.inet | 2 +- tests/py/ip/ip.t.payload.netdev | 2 +- tests/py/ip6/vmap.t.payload.inet | 2 +- tests/py/ip6/vmap.t.payload.ip6 | 2 +- tests/py/ip6/vmap.t.payload.netdev | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-)
tests/py/ip/ip.t.payload +1 -1
@@ -430,7 +430,7 @@ ip test-ip4 input # ip hdrlength vmap { 0-4 : drop, 5 : accept, 6 : continue } counter __map%d test-ip4 f size 4 __map%d test-ip4 0 - element 00000000 : drop 0 [end] element 00000005 : accept 0 [end] element 00000006 : continue 0 [end] element 00000007 : drop 1 [end] + element 00000000 : drop 0 [end] element 00000005 : accept 0 [end] element 00000006 : continue 0 [end] element 00000007 : 1 [end] ip test-ip4 input [ payload load 1b @ network header + 0 => reg 1 ] [ bitwise reg 1 = ( reg 1 & 0x0000000f ) ^ 0x00000000 ]
tests/py/ip/ip.t.payload.bridge +1 -1
@@ -566,7 +566,7 @@ bridge test-bridge input # ip hdrlength vmap { 0-4 : drop, 5 : accept, 6 : continue } counter __map%d test-bridge f size 4 __map%d test-bridge 0 - element 00000000 : drop 0 [end] element 00000005 : accept 0 [end] element 00000006 : continue 0 [end] element 00000007 : drop 1 [end] + element 00000000 : drop 0 [end] element 00000005 : accept 0 [end] element 00000006 : continue 0 [end] element 00000007 : 1 [end] bridge test-bridge input [ meta load protocol => reg 1 ] [ cmp eq reg 1 0x00000008 ]
tests/py/ip/ip.t.payload.inet +1 -1
@@ -566,7 +566,7 @@ inet test-inet input # ip hdrlength vmap { 0-4 : drop, 5 : accept, 6 : continue } counter __map%d test-inet f size 4 __map%d test-inet 0 - element 00000000 : drop 0 [end] element 00000005 : accept 0 [end] element 00000006 : continue 0 [end] element 00000007 : drop 1 [end] + element 00000000 : drop 0 [end] element 00000005 : accept 0 [end] element 00000006 : continue 0 [end] element 00000007 : 1 [end] inet test-inet input [ meta load nfproto => reg 1 ] [ cmp eq reg 1 0x00000002 ]
tests/py/ip/ip.t.payload.netdev +1 -1
@@ -465,7 +465,7 @@ netdev test-netdev ingress # ip hdrlength vmap { 0-4 : drop, 5 : accept, 6 : continue } counter __map%d test-netdev f size 4 __map%d test-netdev 0 - element 00000000 : drop 0 [end] element 00000005 : accept 0 [end] element 00000006 : continue 0 [end] element 00000007 : drop 1 [end] + element 00000000 : drop 0 [end] element 00000005 : accept 0 [end] element 00000006 : continue 0 [end] element 00000007 : 1 [end] netdev test-netdev ingress [ meta load protocol => reg 1 ] [ cmp eq reg 1 0x00000008 ]
tests/py/ip6/vmap.t.payload.inet +1 -1
@@ -371,7 +371,7 @@ inet test-inet input # ip6 saddr vmap { ::/64 : accept} __map%d test-inet f __map%d test-inet 0 - element 00000000 00000000 00000000 00000000 : accept 0 [end] element 00000000 01000000 00000000 00000000 : drop 1 [end] + element 00000000 00000000 00000000 00000000 : accept 0 [end] element 00000000 01000000 00000000 00000000 : 1 [end] inet test-inet input [ meta load nfproto => reg 1 ] [ cmp eq reg 1 0x0000000a ]
tests/py/ip6/vmap.t.payload.ip6 +1 -1
@@ -297,7 +297,7 @@ ip6 test-ip6 input # ip6 saddr vmap { ::/64 : accept} __map%d test-ip6 f __map%d test-ip6 0 - element 00000000 00000000 00000000 00000000 : accept 0 [end] element 00000000 01000000 00000000 00000000 : drop 1 [end] + element 00000000 00000000 00000000 00000000 : accept 0 [end] element 00000000 01000000 00000000 00000000 : 1 [end] ip6 test-ip6 input [ payload load 16b @ network header + 8 => reg 1 ] [ lookup reg 1 set __map%d dreg 0 ]
tests/py/ip6/vmap.t.payload.netdev +1 -1
@@ -371,7 +371,7 @@ netdev test-netdev ingress # ip6 saddr vmap { ::/64 : accept} __map%d test-netdev f __map%d test-netdev 0 - element 00000000 00000000 00000000 00000000 : accept 0 [end] element 00000000 01000000 00000000 00000000 : drop 1 [end] + element 00000000 00000000 00000000 00000000 : accept 0 [end] element 00000000 01000000 00000000 00000000 : 1 [end] netdev test-netdev ingress [ meta load protocol => reg 1 ] [ cmp eq reg 1 0x0000dd86 ]
Signature · 1 line
2.30.2
Pablo Neira Ayuso
maintainerPATCH 2/2 mnl: do not build nftnl_set element list
Do not call alloc_setelem_cache() to build the set element list in nftnl_set. Instead, translate one single set element expression to nftnl_set_elem object at a time and use this object to build the netlink header.
This is reduce userspace memory consumption, using a huge test set containing 1.1 million element blocklist, this patch is reducing userspace memory consumption by 40%.
--- include/netlink.h | 2 + src/mnl.c | 112 ++++++++++++++++++++++++++++++++++++---------- src/netlink.c | 4 +- 3 files changed, 93 insertions(+), 25 deletions(-)
include/netlink.h +2 -0
@@ -72,6 +72,8 @@ struct netlink_ctx {extern struct nftnl_expr *alloc_nft_expr (const char *name);extern void alloc_setelem_cache (const struct expr *set,struct nftnl_set *nls); +struct nftnl_set_elem *alloc_nftnl_setelem (const struct expr *set, +const struct expr *expr);extern struct nftnl_table *netlink_table_alloc (const struct nlmsghdr *nlh);extern struct nftnl_chain *netlink_chain_alloc (const struct nlmsghdr *nlh);
src/mnl.c +89 -23
145 lines not on this page · raw message
src/netlink.c +2 -2
@@ -100,8 +100,8 @@ struct nftnl_expr *alloc_nft_expr(const char *name)void __netlink_gen_data (const struct expr *expr,struct nft_data_linearize *data,bool expand); -static struct nftnl_set_elem *alloc_nftnl_setelem (const struct expr *set, -const struct expr *expr) +struct nftnl_set_elem *alloc_nftnl_setelem (const struct expr *set, +const struct expr *expr) {const struct expr *elem, *data;struct nftnl_set_elem *nlse;
Signature · 1 line
2.30.2