mnl: Set NFTNL_SET_DATA_TYPE before dumping set elements
Phil Sutter
reviewerPATCH 1/1 mnl: Set NFTNL_SET_DATA_TYPE before dumping set elements
In combination with libnftnl's commit "set_elem: Fix printing of verdict map elements", This adds the vmap target to netlink dumps. Adjust dumps in tests/py accordingly.
Signed-off-by Phil Sutter <[email protected]>
--- src/mnl.c | 3 + tests/py/any/ct.t.payload | 2 +- tests/py/any/meta.t.payload | 2 +- tests/py/inet/fib.t.payload | 2 +- tests/py/inet/tcp.t.payload | 6 +- tests/py/ip/ip.t.payload | 4 +- tests/py/ip/ip.t.payload.bridge | 4 +- tests/py/ip/ip.t.payload.inet | 4 +- tests/py/ip/ip.t.payload.netdev | 4 +- tests/py/ip/masquerade.t.payload | 2 +- tests/py/ip/redirect.t.payload | 2 +- tests/py/ip6/ip6.t.payload.inet | 4 +- tests/py/ip6/ip6.t.payload.ip6 | 4 +- tests/py/ip6/masquerade.t.payload.ip6 | 2 +- tests/py/ip6/redirect.t.payload.ip6 | 2 +- tests/py/ip6/vmap.t.payload.inet | 84 +++++++++++++-------------- tests/py/ip6/vmap.t.payload.ip6 | 84 +++++++++++++-------------- tests/py/ip6/vmap.t.payload.netdev | 84 +++++++++++++-------------- 18 files changed, 151 insertions(+), 148 deletions(-)
src/mnl.c +3 -0
@@ -1544,6 +1544,9 @@ int mnl_nft_setelem_add(struct netlink_ctx *ctx, const struct set *set,nftnl_set_set_str (nls,NFTNL_SET_NAME , h->set.name);if (h->set_id)nftnl_set_set_u32 (nls,NFTNL_SET_ID , h->set_id); +if (set_is_datamap (set->flags)) +nftnl_set_set_u32 (nls,NFTNL_SET_DATA_TYPE , +dtype_map_to_kernel (set->data->dtype));alloc_setelem_cache (expr, nls);netlink_dump_set (nls, ctx);
tests/py/any/ct.t.payload +1 -1
@@ -485,7 +485,7 @@ ip test-ip4 output # ct state . ct mark vmap { new . 0x12345678 : drop, established . 0x87654321 : accept} __map%d test-ip4 b size 2 __map%d test-ip4 0 - element 00000008 12345678 : 0 [end] element 00000002 87654321 : 0 [end] + element 00000008 12345678 : drop 0 [end] element 00000002 87654321 : accept 0 [end] ip test-ip4 output [ ct load state => reg 1 ] [ ct load mark => reg 9 ]
tests/py/any/meta.t.payload +1 -1
@@ -728,7 +728,7 @@ ip test-ip4 output # meta iif . meta oif vmap { "lo" . "lo" : drop } __map%d test-ip4 b __map%d test-ip4 0 - element 00000001 00000001 : 0 [end] + element 00000001 00000001 : drop 0 [end] ip test-ip4 output [ meta load iif => reg 1 ] [ meta load oif => reg 9 ]
tests/py/inet/fib.t.payload +1 -1
@@ -16,7 +16,7 @@ ip test-ip prerouting # fib daddr . iif type vmap { blackhole : drop, prohibit : drop, unicast : accept } __map%d test-ip b __map%d test-ip 0 - element 00000006 : 0 [end] element 00000008 : 0 [end] element 00000001 : 0 [end] + element 00000006 : drop 0 [end] element 00000008 : drop 0 [end] element 00000001 : accept 0 [end] ip test-ip prerouting [ fib daddr . iif type => reg 1 ] [ lookup reg 1 set __map%d dreg 0 ]
tests/py/inet/tcp.t.payload +3 -3
@@ -81,7 +81,7 @@ inet test-inet input # tcp dport vmap { 22 : accept, 23 : drop } __map%d test-inet b __map%d test-inet 0 - element 00001600 : 0 [end] element 00001700 : 0 [end] + element 00001600 : accept 0 [end] element 00001700 : drop 0 [end] inet test-inet input [ meta load l4proto => reg 1 ] [ cmp eq reg 1 0x00000006 ]
@@ -91,7 +91,7 @@ inet test-inet input # tcp dport vmap { 25:accept, 28:drop } __map%d test-inet b __map%d test-inet 0 - element 00001900 : 0 [end] element 00001c00 : 0 [end] + element 00001900 : accept 0 [end] element 00001c00 : drop 0 [end] inet test-inet input [ meta load l4proto => reg 1 ] [ cmp eq reg 1 0x00000006 ]
@@ -190,7 +190,7 @@ inet test-inet input # tcp sport vmap { 25:accept, 28:drop } __map%d test-inet b __map%d test-inet 0 - element 00001900 : 0 [end] element 00001c00 : 0 [end] + element 00001900 : accept 0 [end] element 00001c00 : drop 0 [end] inet test-inet input [ meta load l4proto => reg 1 ] [ cmp eq reg 1 0x00000006 ]
tests/py/ip/ip.t.payload +2 -2
@@ -43,7 +43,7 @@ ip test-ip4 input # ip dscp vmap { cs1 : continue , cs4 : accept } counter __map%d test-ip4 b size 2 __map%d test-ip4 0 - element 00000020 : 0 [end] element 00000080 : 0 [end] + element 00000020 : continue 0 [end] element 00000080 : accept 0 [end] ip test-ip4 input [ payload load 1b @ network header + 1 => reg 1 ] [ bitwise reg 1 = ( reg 1 & 0x000000fc ) ^ 0x00000000 ]
@@ -526,7 +526,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 : 0 [end] element 00000005 : 0 [end] element 00000006 : 0 [end] element 00000007 : 1 [end] + element 00000000 : drop 0 [end] element 00000005 : accept 0 [end] element 00000006 : continue 0 [end] element 00000007 : drop 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 +2 -2
@@ -55,7 +55,7 @@ bridge test-bridge input # ip dscp vmap { cs1 : continue , cs4 : accept } counter __map%d test-bridge b size 2 __map%d test-bridge 0 - element 00000020 : 0 [end] element 00000080 : 0 [end] + element 00000020 : continue 0 [end] element 00000080 : accept 0 [end] bridge test-bridge input [ meta load protocol => reg 1 ] [ cmp eq reg 1 0x00000008 ]
@@ -686,7 +686,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 : 0 [end] element 00000005 : 0 [end] element 00000006 : 0 [end] element 00000007 : 1 [end] + element 00000000 : drop 0 [end] element 00000005 : accept 0 [end] element 00000006 : continue 0 [end] element 00000007 : drop 1 [end] bridge test-bridge input [ meta load protocol => reg 1 ] [ cmp eq reg 1 0x00000008 ]
tests/py/ip/ip.t.payload.inet +2 -2
@@ -55,7 +55,7 @@ inet test-inet input # ip dscp vmap { cs1 : continue , cs4 : accept } counter __map%d test-inet b size 2 __map%d test-inet 0 - element 00000020 : 0 [end] element 00000080 : 0 [end] + element 00000020 : continue 0 [end] element 00000080 : accept 0 [end] inet test-inet input [ meta load nfproto => reg 1 ] [ cmp eq reg 1 0x00000002 ]
@@ -686,7 +686,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 : 0 [end] element 00000005 : 0 [end] element 00000006 : 0 [end] element 00000007 : 1 [end] + element 00000000 : drop 0 [end] element 00000005 : accept 0 [end] element 00000006 : continue 0 [end] element 00000007 : drop 1 [end] inet test-inet input [ meta load nfproto => reg 1 ] [ cmp eq reg 1 0x00000002 ]
tests/py/ip/ip.t.payload.netdev +2 -2
@@ -585,7 +585,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 : 0 [end] element 00000005 : 0 [end] element 00000006 : 0 [end] element 00000007 : 1 [end] + element 00000000 : drop 0 [end] element 00000005 : accept 0 [end] element 00000006 : continue 0 [end] element 00000007 : drop 1 [end] netdev test-netdev ingress [ meta load protocol => reg 1 ] [ cmp eq reg 1 0x00000008 ]
@@ -686,7 +686,7 @@ netdev test-netdev ingress # ip dscp vmap { cs1 : continue , cs4 : accept } counter __map%d test-netdev b size 2 __map%d test-netdev 0 - element 00000020 : 0 [end] element 00000080 : 0 [end] + element 00000020 : continue 0 [end] element 00000080 : accept 0 [end] netdev test-netdev ingress [ meta load protocol => reg 1 ] [ cmp eq reg 1 0x00000008 ]
tests/py/ip/masquerade.t.payload +1 -1
@@ -112,7 +112,7 @@ ip test-ip4 postrouting # iifname "eth0" ct state established,new tcp dport vmap {22 : drop, 222 : drop } masquerade __map%d test-ip4 b __map%d test-ip4 0 - element 00001600 : 0 [end] element 0000de00 : 0 [end] + element 00001600 : drop 0 [end] element 0000de00 : drop 0 [end] ip test-ip4 postrouting [ meta load iifname => reg 1 ] [ cmp eq reg 1 0x30687465 0x00000000 0x00000000 0x00000000 ]
tests/py/ip/redirect.t.payload +1 -1
@@ -194,7 +194,7 @@ ip test-ip4 output # iifname "eth0" ct state established,new tcp dport vmap {22 : drop, 222 : drop } redirect __map%d test-ip4 b __map%d test-ip4 0 - element 00001600 : 0 [end] element 0000de00 : 0 [end] + element 00001600 : drop 0 [end] element 0000de00 : drop 0 [end] ip test-ip4 output [ meta load iifname => reg 1 ] [ cmp eq reg 1 0x30687465 0x00000000 0x00000000 0x00000000 ]
tests/py/ip6/ip6.t.payload.inet +2 -2
@@ -44,7 +44,7 @@ inet test-inet input # ip6 dscp vmap { 0x04 : accept, 0x3f : continue } counter __map%d test-inet b size 2 __map%d test-inet 0 - element 00000001 : 0 [end] element 0000c00f : 0 [end] + element 00000001 : accept 0 [end] element 0000c00f : continue 0 [end] ip6 test-ip6 input [ meta load nfproto => reg 1 ] [ cmp eq reg 1 0x0000000a ]
@@ -116,7 +116,7 @@ inet test-inet input # ip6 flowlabel vmap { 0 : accept, 2 : continue } __map%d test-inet b size 2 __map%d test-inet 0 - element 00000000 : 0 [end] element 00020000 : 0 [end] + element 00000000 : accept 0 [end] element 00020000 : continue 0 [end] inet test-inet input [ meta load nfproto => reg 1 ] [ cmp eq reg 1 0x0000000a ]
tests/py/ip6/ip6.t.payload.ip6 +2 -2
@@ -34,7 +34,7 @@ ip6 test-ip6 input # ip6 dscp vmap { 0x04 : accept, 0x3f : continue } counter __map%d test-ip6 b size 2 __map%d test-ip6 0 - element 00000001 : 0 [end] element 0000c00f : 0 [end] + element 00000001 : accept 0 [end] element 0000c00f : continue 0 [end] ip6 test-ip6 input [ payload load 2b @ network header + 0 => reg 1 ] [ bitwise reg 1 = ( reg 1 & 0x0000c00f ) ^ 0x00000000 ]
@@ -92,7 +92,7 @@ ip6 test-ip6 input # ip6 flowlabel vmap { 0 : accept, 2 : continue } __map%d test-ip6 b size 2 __map%d test-ip6 0 - element 00000000 : 0 [end] element 00020000 : 0 [end] + element 00000000 : accept 0 [end] element 00020000 : continue 0 [end] ip6 test-ip6 input [ payload load 3b @ network header + 1 => reg 1 ] [ bitwise reg 1 = ( reg 1 & 0x00ffff0f ) ^ 0x00000000 ]
tests/py/ip6/masquerade.t.payload.ip6 +1 -1
@@ -112,7 +112,7 @@ ip6 test-ip6 postrouting # iifname "eth0" ct state established,new tcp dport vmap {22 : drop, 222 : drop } masquerade __map%d test-ip6 b __map%d test-ip6 0 - element 00001600 : 0 [end] element 0000de00 : 0 [end] + element 00001600 : drop 0 [end] element 0000de00 : drop 0 [end] ip6 test-ip6 postrouting [ meta load iifname => reg 1 ] [ cmp eq reg 1 0x30687465 0x00000000 0x00000000 0x00000000 ]
tests/py/ip6/redirect.t.payload.ip6 +1 -1
@@ -178,7 +178,7 @@ ip6 test-ip6 output # iifname "eth0" ct state established,new tcp dport vmap {22 : drop, 222 : drop } redirect __map%d test-ip6 b __map%d test-ip6 0 - element 00001600 : 0 [end] element 0000de00 : 0 [end] + element 00001600 : drop 0 [end] element 0000de00 : drop 0 [end] ip6 test-ip6 output [ meta load iifname => reg 1 ] [ cmp eq reg 1 0x30687465 0x00000000 0x00000000 0x00000000 ]
tests/py/ip6/vmap.t.payload.inet +42 -42
336 lines not on this page · raw message
tests/py/ip6/vmap.t.payload.ip6 +42 -42
336 lines not on this page · raw message
tests/py/ip6/vmap.t.payload.netdev +42 -42
336 lines not on this page · raw message
Signature · 1 line
2.30.1