All of lore.kernel.org
 help / color / mirror / Atom feed
* [nft PATCH v2 0/5] Store multiple payload dependencies
@ 2022-01-15 18:27 Jeremy Sowden
  2022-01-15 18:27 ` [nft PATCH v2 1/5] tests: py: fix inet/ip.t bridge payload Jeremy Sowden
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Jeremy Sowden @ 2022-01-15 18:27 UTC (permalink / raw)
  To: Florian Westphal; +Cc: Netfilter Devel

The purpose of this patch-set is to eliminate more redundant
payload-dependencies.

Here's the netlink dump for a test where such a dependency is not
eliminated.

  [ meta load nfproto => reg 1 ]
  [ cmp eq reg 1 0x00000002 ]
  [ meta load l4proto => reg 1 ]
  [ cmp eq reg 1 0x00000006 ]
  [ payload load 4b @ network header + 12 => reg 1 ]
  [ payload load 4b @ network header + 16 => reg 9 ]
  [ payload load 2b @ transport header + 2 => reg 10 ]
  [ lookup reg 1 set set3 ]
  [ immediate reg 0 accept ]

The reason the `meta nfproto` match is not eliminated is that it is
overwritten in the dependency context by the `meta l4proto` match before
we get to the `ip saddr` and `ip daddr` expressions which would have
caused it to be eliminated.  By contrast, the `meta l4proto` match _is_
eliminated because it is still present in the context we get to the `tcp
dport` expression.  Therefore, this patch-set extends the payload-
dependency context to store not just a single dependency, but one per
protocol layer.

Patch 1 fixes a mistake in a Python test-case.  Patch 2 makes some
preliminary changes.  Patch 3 adds the extra dependencies.  Patches 4 &
5 remove redundant protocol matches which are now eliminated from
test-cases.

At the end of this series all tests pass.

Changes since v1.

  * The first seven v1 patches have been merged.  The remaining four
    form patches 2-5 in this series.
  * Patch 1 is new: it fixes a test-case that was supposed to be fixed
    by patch 2 in v1.
  * The helper added by patch 2 has been changed to return the
    expression from the payload dependency statement, not the statement
    itself.  The removal of the redundant `ctx->pbase` check is new.

Jeremy Sowden (5):
  tests: py: fix inet/ip.t bridge payload
  src: add a helper that returns a payload dependency for a particular
    base
  src: store more than one payload dependency
  tests: py: remove redundant payload expressions
  tests: shell: remove redundant payload expressions

 include/payload.h                             | 15 ++--
 src/netlink_delinearize.c                     | 18 +++--
 src/payload.c                                 | 72 ++++++++++++++-----
 tests/py/inet/icmpX.t                         |  2 +-
 tests/py/inet/icmpX.t.json.output             |  9 ---
 tests/py/inet/ip.t.payload.bridge             |  2 +-
 tests/py/inet/sets.t.json                     | 11 ---
 .../testcases/maps/dumps/0010concat_map_0.nft |  2 +-
 .../testcases/maps/dumps/nat_addr_port.nft    |  8 +--
 9 files changed, 79 insertions(+), 60 deletions(-)

-- 
2.34.1


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

end of thread, other threads:[~2022-01-15 19:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-15 18:27 [nft PATCH v2 0/5] Store multiple payload dependencies Jeremy Sowden
2022-01-15 18:27 ` [nft PATCH v2 1/5] tests: py: fix inet/ip.t bridge payload Jeremy Sowden
2022-01-15 18:27 ` [nft PATCH v2 2/5] src: add a helper that returns a payload dependency for a particular base Jeremy Sowden
2022-01-15 18:27 ` [nft PATCH v2 3/5] src: store more than one payload dependency Jeremy Sowden
2022-01-15 18:27 ` [nft PATCH v2 4/5] tests: py: remove redundant payload expressions Jeremy Sowden
2022-01-15 18:27 ` [nft PATCH v2 5/5] tests: shell: " Jeremy Sowden
2022-01-15 19:29 ` [nft PATCH v2 0/5] Store multiple payload dependencies Florian Westphal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.