]> git.ipfire.org Git - thirdparty/nftables.git/commit
src: store expr, not dtype to track data in sets
authorFlorian Westphal <fw@strlen.de>
Tue, 16 Jul 2019 17:03:55 +0000 (19:03 +0200)
committerFlorian Westphal <fw@strlen.de>
Mon, 16 Dec 2019 16:06:18 +0000 (17:06 +0100)
commit343a51702656a6476e37cfb84609a82155c7fc5e
tree10ce1fa0bf256982709d8a89c4a52cb1a8f9cfe3
parent10f114806ccd9d64f9d72eaa813babb04d719688
src: store expr, not dtype to track data in sets

This will be needed once we add support for the 'typeof' keyword to
handle maps that could e.g. store 'ct helper' "type" values.

Instead of:

set foo {
type ipv4_addr . mark;

this would allow

set foo {
typeof(ip saddr) . typeof(ct mark);

(exact syntax TBD).

This would be needed to allow sets that store variable-sized data types
(string, integer and the like) that can't be used at at the moment.

Adding special data types for everything is problematic due to the
large amount of different types needed.

For anonymous sets, e.g. "string" can be used because the needed size can
be inferred from the statement, e.g.  'osf name { "Windows", "Linux }',
but in case of named sets that won't work because 'type string' lacks the
context needed to derive the size information.

With 'typeof(osf name)' the context is there, but at the moment it won't
help because the expression is discarded instantly and only the data
type is retained.

Signed-off-by: Florian Westphal <fw@strlen.de>
14 files changed:
include/datatype.h
include/netlink.h
include/rule.h
src/datatype.c
src/evaluate.c
src/expression.c
src/json.c
src/mnl.c
src/monitor.c
src/netlink.c
src/parser_bison.y
src/parser_json.c
src/rule.c
src/segtree.c