netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH nft 0/9] mark statement support for non-constant expression
@ 2023-03-17  9:58 Pablo Neira Ayuso
  2023-03-17  9:58 ` [PATCH nft 1/9] evaluate: insert byte-order conversions for expressions between 9 and 15 bits Pablo Neira Ayuso
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Pablo Neira Ayuso @ 2023-03-17  9:58 UTC (permalink / raw)
  To: netfilter-devel

Hi,

This patchset recovers the initial effort from Jeremy Sowden to enhance
mark statement support for variable expression, eg. use an existing
selector to set the meta and ct mark.

This also includes support for bitwise arithmetics, including shift
operations.

Selectors in network byte order are turned into host byte order before
the assignment to ensure ruleset portability.

No kernel updates are required in this batch.

Patches 1 to 5 are preparation work for patch 5, which finally adds support
for mark statements compatibility with selectors using integer basetype:

Patch #1 provides a fix for missing byteorder conversion in network byteorder
         field between 9 and 15 bytes such as ip6 dscp.

Patch #2 prepares for listing bitwise expression in hexadecimal, instead of
         using symbolic values specific of the datatype of the expression.

Patch #3 upgrade length of shift to the mark statement size, to allow for
	 larger shift than the expression length.

Patch #4 remove redundant evaluation of unary expression arguments.

Patch #5 use length of mark statements for the bitwise expression, instead of
	 the length of the r-value expression.

Finally patch #6 allows for datatype compatibility between mark statements
and rvalue expression of integer datatype. This includes byteorder
compatibility conversion.

Patch 7 to 9 add more tests.

Jeremy Sowden (6):
  evaluate: insert byte-order conversions for expressions between 9 and 15 bits
  netlink_delinearize: correct type and byte-order of shifts
  evaluate: support shifts larger than the width of the left operand
  evaluate: don't eval unary arguments
  tests: shell: rename and move bitwise test-cases
  tests: shell: add test-cases for ct and packet mark payload expressions

Pablo Neira Ayuso (3):
  evaluate: get length from statement instead of lhs expression
  evaluate: relax type-checking for integer arguments in mark statements
  tests: py: add test-cases for ct and packet mark payload expressions

 src/evaluate.c                                | 46 +++++++----
 src/netlink_delinearize.c                     | 17 +++-
 tests/py/ip/ct.t                              |  2 +
 tests/py/ip/ct.t.json                         | 58 ++++++++++++++
 tests/py/ip/ct.t.payload                      | 18 +++++
 tests/py/ip/meta.t                            |  5 ++
 tests/py/ip/meta.t.json                       | 78 +++++++++++++++++++
 tests/py/ip/meta.t.payload                    | 25 ++++++
 tests/py/ip6/ct.t                             |  6 ++
 tests/py/ip6/ct.t.payload                     | 19 +++++
 tests/py/ip6/meta.t                           |  3 +
 tests/py/ip6/meta.t.json                      | 58 ++++++++++++++
 tests/py/ip6/meta.t.payload                   | 20 +++++
 .../0040mark_binop_0}                         |  2 +-
 .../0040mark_binop_1}                         |  2 +-
 .../shell/testcases/bitwise/0040mark_binop_2  | 11 +++
 .../shell/testcases/bitwise/0040mark_binop_3  | 11 +++
 .../shell/testcases/bitwise/0040mark_binop_4  | 11 +++
 .../shell/testcases/bitwise/0040mark_binop_5  | 11 +++
 .../shell/testcases/bitwise/0040mark_binop_6  | 11 +++
 .../shell/testcases/bitwise/0040mark_binop_7  | 11 +++
 .../shell/testcases/bitwise/0040mark_binop_8  | 11 +++
 .../shell/testcases/bitwise/0040mark_binop_9  | 11 +++
 .../dumps/0040mark_binop_0.nft}               |  2 +-
 .../dumps/0040mark_binop_1.nft}               |  2 +-
 .../bitwise/dumps/0040mark_binop_2.nft        |  6 ++
 .../bitwise/dumps/0040mark_binop_3.nft        |  6 ++
 .../bitwise/dumps/0040mark_binop_4.nft        |  6 ++
 .../bitwise/dumps/0040mark_binop_5.nft        |  6 ++
 .../bitwise/dumps/0040mark_binop_6.nft        |  6 ++
 .../bitwise/dumps/0040mark_binop_7.nft        |  6 ++
 .../bitwise/dumps/0040mark_binop_8.nft        |  6 ++
 .../bitwise/dumps/0040mark_binop_9.nft        |  6 ++
 33 files changed, 474 insertions(+), 25 deletions(-)
 create mode 100644 tests/py/ip6/ct.t
 create mode 100644 tests/py/ip6/ct.t.payload
 rename tests/shell/testcases/{chains/0040mark_shift_0 => bitwise/0040mark_binop_0} (68%)
 rename tests/shell/testcases/{chains/0040mark_shift_1 => bitwise/0040mark_binop_1} (70%)
 create mode 100755 tests/shell/testcases/bitwise/0040mark_binop_2
 create mode 100755 tests/shell/testcases/bitwise/0040mark_binop_3
 create mode 100755 tests/shell/testcases/bitwise/0040mark_binop_4
 create mode 100755 tests/shell/testcases/bitwise/0040mark_binop_5
 create mode 100755 tests/shell/testcases/bitwise/0040mark_binop_6
 create mode 100755 tests/shell/testcases/bitwise/0040mark_binop_7
 create mode 100755 tests/shell/testcases/bitwise/0040mark_binop_8
 create mode 100755 tests/shell/testcases/bitwise/0040mark_binop_9
 rename tests/shell/testcases/{chains/dumps/0040mark_shift_0.nft => bitwise/dumps/0040mark_binop_0.nft} (58%)
 rename tests/shell/testcases/{chains/dumps/0040mark_shift_1.nft => bitwise/dumps/0040mark_binop_1.nft} (64%)
 create mode 100644 tests/shell/testcases/bitwise/dumps/0040mark_binop_2.nft
 create mode 100644 tests/shell/testcases/bitwise/dumps/0040mark_binop_3.nft
 create mode 100644 tests/shell/testcases/bitwise/dumps/0040mark_binop_4.nft
 create mode 100644 tests/shell/testcases/bitwise/dumps/0040mark_binop_5.nft
 create mode 100644 tests/shell/testcases/bitwise/dumps/0040mark_binop_6.nft
 create mode 100644 tests/shell/testcases/bitwise/dumps/0040mark_binop_7.nft
 create mode 100644 tests/shell/testcases/bitwise/dumps/0040mark_binop_8.nft
 create mode 100644 tests/shell/testcases/bitwise/dumps/0040mark_binop_9.nft

-- 
2.40.0


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-03-17  9:58 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-17  9:58 [PATCH nft 0/9] mark statement support for non-constant expression Pablo Neira Ayuso
2023-03-17  9:58 ` [PATCH nft 1/9] evaluate: insert byte-order conversions for expressions between 9 and 15 bits Pablo Neira Ayuso
2023-03-17  9:58 ` [PATCH nft 2/9] netlink_delinearize: correct type and byte-order of shifts Pablo Neira Ayuso
2023-03-17  9:58 ` [PATCH nft 3/9] evaluate: support shifts larger than the width of the left operand Pablo Neira Ayuso
2023-03-17  9:58 ` [PATCH nft 4/9] evaluate: don't eval unary arguments Pablo Neira Ayuso
2023-03-17  9:58 ` [PATCH nft 5/9] evaluate: get length from statement instead of lhs expression Pablo Neira Ayuso
2023-03-17  9:58 ` [PATCH nft 6/9] evaluate: relax type-checking for integer arguments in mark statements Pablo Neira Ayuso
2023-03-17  9:58 ` [PATCH nft 7/9] tests: py: add test-cases for ct and packet mark payload expressions Pablo Neira Ayuso
2023-03-17  9:58 ` [PATCH nft 8/9] tests: shell: rename and move bitwise test-cases Pablo Neira Ayuso
2023-03-17  9:58 ` [PATCH nft 9/9] tests: shell: add test-cases for ct and packet mark payload expressions Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).