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

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