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 <[email protected]>
---
 src/evaluate.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/evaluate.c b/src/evaluate.c
index 33733c0e73075..22b14c972d930 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 "
-- 
2.17.0

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to