diff options
author | Phil Sutter <phil@nwl.cc> | 2018-06-06 13:21:49 +0200 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2018-06-06 14:17:56 +0200 |
commit | 9a3d80172a61e89c2862bcf41cb58313c236b308 (patch) | |
tree | 4c7f10e91bfa681c802abcd4ee922bb8535a6a8b /src | |
parent | 9b3036bb9f00d6e244ed92e0e782c5617ae40b84 (diff) |
evaluate: explicitly deny concatenated types in interval sets
Previously, this triggered a program abort:
| # nft add table ip t
| # nft add set ip t my_set '{ type ipv4_addr . inet_service ; flags interval ; }'
| # nft add element ip t my_set '{10.0.0.1 . tcp }'
| BUG: invalid range expression type concat
| nft: expression.c:1085: range_expr_value_low: Assertion `0' failed.
With this patch in place, the 'add set' command above gives an error
message:
| # nft add set ip t my_set3 '{ type ipv4_addr . inet_service ; flags interval ; }'
| Error: concatenated types not supported in interval sets
| add set ip t my_set3 { type ipv4_addr . inet_service ; flags interval ; }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'src')
-rw-r--r-- | src/evaluate.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/evaluate.c b/src/evaluate.c index 33733c0e..22b14c97 100644 --- a/src/evaluate.c +++ b/src/evaluate.c @@ -2801,6 +2801,10 @@ static int set_evaluate(struct eval_ctx *ctx, struct set *set) "specified in %s definition", set->key->dtype->name, type); } + if (set->flags & NFT_SET_INTERVAL && + set->key->ops->type == EXPR_CONCAT) + return set_error(ctx, set, "concatenated types not supported in interval sets"); + if (set->flags & NFT_SET_MAP) { if (set->datatype == NULL) return set_error(ctx, set, "map definition does not " |