The first patch replaces the current assertion failure for invalid mapping expression in stateful-object statements with an error message. This brings it in line with map statements. It is possible to use a variable to initialize a map, which is then used in a map statement, but if one tries to use the variable directly, nft rejects it. The second patch adds support for doing this. Changes since v2 * Patch 2: error-checking (and test-cases) added for variables that do not contain maps Changes since v1 * Patch 1 is new. * Patch 2 updated to add support for map variables in stateful object statements. Jeremy Sowden (2): evaluate: handle invalid mapping expressions in stateful object statements gracefully. evaluate: add support for variables in map expressions src/evaluate.c | 17 +- .../shell/testcases/maps/0024named_objects_1 | 31 ++++ .../shell/testcases/maps/0024named_objects_2 | 23 +++ .../shell/testcases/maps/anonymous_snat_map_1 | 16 ++ .../shell/testcases/maps/anonymous_snat_map_2 | 23 +++ .../maps/dumps/0024named_objects_1.json-nft | 147 ++++++++++++++++++ .../maps/dumps/0024named_objects_1.nft | 23 +++ .../maps/dumps/anonymous_snat_map_1.json-nft | 58 +++++++ .../maps/dumps/anonymous_snat_map_1.nft | 5 + 9 files changed, 341 insertions(+), 2 deletions(-) create mode 100755 tests/shell/testcases/maps/0024named_objects_1 create mode 100755 tests/shell/testcases/maps/0024named_objects_2 create mode 100755 tests/shell/testcases/maps/anonymous_snat_map_1 create mode 100755 tests/shell/testcases/maps/anonymous_snat_map_2 create mode 100644 tests/shell/testcases/maps/dumps/0024named_objects_1.json-nft create mode 100644 tests/shell/testcases/maps/dumps/0024named_objects_1.nft create mode 100644 tests/shell/testcases/maps/dumps/anonymous_snat_map_1.json-nft create mode 100644 tests/shell/testcases/maps/dumps/anonymous_snat_map_1.nft -- 2.43.0