Blame SOURCES/0016-evaluate-explicitly-deny-concatenated-types-in-inter.patch

a05102
From d8f1860f72840104bff3742f477c572b57a9c3c1 Mon Sep 17 00:00:00 2001
a05102
From: Phil Sutter <psutter@redhat.com>
a05102
Date: Wed, 20 Jun 2018 09:38:55 +0200
a05102
Subject: [PATCH] evaluate: explicitly deny concatenated types in interval sets
a05102
a05102
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1576426
a05102
Upstream Status: nftables commit 9a3d80172a61e
a05102
a05102
commit 9a3d80172a61e89c2862bcf41cb58313c236b308
a05102
Author: Phil Sutter <phil@nwl.cc>
a05102
Date:   Wed Jun 6 13:21:49 2018 +0200
a05102
a05102
    evaluate: explicitly deny concatenated types in interval sets
a05102
a05102
    Previously, this triggered a program abort:
a05102
a05102
    | # nft add table ip t
a05102
    | # nft add set ip t my_set '{ type ipv4_addr . inet_service ; flags interval ; }'
a05102
    | # nft add element ip t my_set '{10.0.0.1 . tcp }'
a05102
    | BUG: invalid range expression type concat
a05102
    | nft: expression.c:1085: range_expr_value_low: Assertion `0' failed.
a05102
a05102
    With this patch in place, the 'add set' command above gives an error
a05102
    message:
a05102
a05102
    | # nft add set ip t my_set3 '{ type ipv4_addr . inet_service ; flags interval ; }'
a05102
    | Error: concatenated types not supported in interval sets
a05102
    | add set ip t my_set3 { type ipv4_addr . inet_service ; flags interval ; }
a05102
    |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
a05102
a05102
    Signed-off-by: Phil Sutter <phil@nwl.cc>
a05102
    Signed-off-by: Florian Westphal <fw@strlen.de>
a05102
---
a05102
 src/evaluate.c | 4 ++++
a05102
 1 file changed, 4 insertions(+)
a05102
a05102
diff --git a/src/evaluate.c b/src/evaluate.c
a05102
index 8552e4a..ab1347f 100644
a05102
--- a/src/evaluate.c
a05102
+++ b/src/evaluate.c
a05102
@@ -2865,6 +2865,10 @@ static int set_evaluate(struct eval_ctx *ctx, struct set *set)
a05102
 					 "specified in %s definition",
a05102
 					 set->key->dtype->name, type);
a05102
 	}
a05102
+	if (set->flags & NFT_SET_INTERVAL &&
a05102
+	    set->key->ops->type == EXPR_CONCAT)
a05102
+		return set_error(ctx, set, "concatenated types not supported in interval sets");
a05102
+
a05102
 	if (set->flags & NFT_SET_MAP) {
a05102
 		if (set->datatype == NULL)
a05102
 			return set_error(ctx, set, "map definition does not "
a05102
-- 
a05102
1.8.3.1
a05102