add typeof keyword
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest10 patches 0 repliesNew
- v211 patches 0 repliesSuperseded
Patches in v3 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/10 | parser: add a helper for concat expression handlingsrc/ | +43 | 0 replies | |
| 2/10 | src: store expr, not dtype to track data in setsinclude/ include/ include/ +11 more | +81 | 0 replies | |
| 3/10 | proto: add proto_desc_id enumerationinclude/ src/ | +73 | 0 replies | |
| 4/10 | expr: add expr_ops_by_type()include/ src/ | +13 | 0 replies | |
| 5/10 | parser: add typeof keyword for declarationssrc/ src/ | +45 | 0 replies | |
| 6/10 | src: add "typeof" build/parse/print supportinclude/ include/ src/ +3 more | +255 | 0 replies | |
| 7/10 | mnl: round up the map data size toosrc/ | +1 | 0 replies | |
| 8/10 | evaluate: print a hint about 'typeof' syntax on 0 keylensrc/ | +18 | 0 replies | |
| 9/10 | doc: mention 'typeof' as alternative to 'type' keyworddoc/ | +9 | 0 replies | |
| 10/10 | tests: add typeof test casestests/ tests/ tests/ +1 more | +91 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.
Cover letter [PATCH nft v3 00/10] add typeof keyword
This patch series adds the typeof keyword.
This depends on Pablos extensions to libnftnls udata parsing facilities.
named set can be configured as follows:
set os {
typeof osf name
elements = { "Linux", "Windows" }
}
The type is stored in the kernel via the udata infrastructure. On listing -- if a udata type is present -- nft will validate that this type matches the set key length and, if so, will print back the 'typeof' information.
Note that while 'typeof' can be used with concatenations, they only work as aliases for known types -- its currently not possible to use integer/string types via the 'typeof' keyword (its rejected at evaluation stage due to 0-length sub expression types).
Doing so requires a bit more work to dissect the correct key geometry on netlink dumps.
In case typeof udata is not there/invalid, the normal 'type' syntax is used.
This patch set isn't complete -- the test cases will not work yet because 'meta' and 'osf' lack the udata parse/buil callbacks.
This is caught at the parsing stage.
The following changes since commit ddbe652bf0f4ed300bae9497250130d68e4cbf5b:
py: load the SONAME-versioned shared object (2019-12-10 19:07:16 +0100)
are available in the Git repository at:
git://git.breakpoint.cc/fw/nftables.git typeof_rework_09
for you to fetch changes up to 02485d775dea55a067c6dbea0826ab3fc9ff7398:
tests: add typeof test cases (2019-12-17 12:19:51 +0100)
----------------------------------------------------------------
Florian Westphal (7):
parser: add a helper for concat expression handling
src: store expr, not dtype to track data in sets
src: add "typeof" build/parse/print support
mnl: round up the map data size too
evaluate: print a hint about 'typeof' syntax on 0 keylen
doc: mention 'typeof' as alternative to 'type' keyword
tests: add typeof test cases
Pablo Neira Ayuso (3):
proto: add proto_desc_id enumeration
expr: add expr_ops_by_type()
parser: add typeof keyword for declarations
doc/nft.txt | 12 +- include/datatype.h | 1 - include/expression.h | 5 + include/netlink.h | 1 - include/proto.h | 27 ++++ include/rule.h | 7 +- src/datatype.c | 5 - src/evaluate.c | 81 +++++++---- src/expression.c | 14 +- src/json.c | 4 +- src/mnl.c | 30 ++++- src/monitor.c | 2 +- src/netlink.c | 149 +++++++++++++++++---- src/parser_bison.y | 148 +++++++++++--------- src/parser_json.c | 8 +- src/payload.c | 75 +++++++++++ src/proto.c | 46 +++++++ src/rule.c | 48 +++++-- src/scanner.l | 1 + src/segtree.c | 8 +- tests/shell/testcases/maps/dumps/typeof_maps_0.nft | 16 +++ tests/shell/testcases/maps/typeof_maps_0 | 27 ++++ tests/shell/testcases/sets/dumps/typeof_sets_0.nft | 19 +++ tests/shell/testcases/sets/typeof_sets_0 | 29 ++++ 24 files changed, 621 insertions(+), 142 deletions(-) create mode 100644 tests/shell/testcases/maps/dumps/typeof_maps_0.nft create mode 100755 tests/shell/testcases/maps/typeof_maps_0 create mode 100644 tests/shell/testcases/sets/dumps/typeof_sets_0.nft create mode 100755 tests/shell/testcases/sets/typeof_sets_0