[nft PATCH v2 0/5] Store multiple payload dependencies

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux