diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2016-11-09 00:19:45 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2016-11-09 20:03:51 +0100 |
commit | e26bf1db610464fd3c3b5040715ddbcb68bcbcab (patch) | |
tree | 206a388fa60eaa8395e553411fbdaf42b5850fbe /src | |
parent | 9bee0c86f1794c6c5418f256420758dc15d91f77 (diff) |
segtree: keep element comments in set intervals
The conversion from the set element range representation to element
intervals doesn't keep the comment information around.
Fixes: https://bugzilla.netfilter.org/show_bug.cgi?id=1090
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Tested-by: Arturo Borrero Gonzalez <arturo@debian.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/segtree.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/segtree.c b/src/segtree.c index fa11967a..32e071f6 100644 --- a/src/segtree.c +++ b/src/segtree.c @@ -522,9 +522,13 @@ static void set_insert_interval(struct expr *set, struct seg_tree *tree, mpz_set(expr->value, ei->left); expr = set_elem_expr_alloc(&internal_location, expr); - if (ei->expr != NULL && ei->expr->ops->type == EXPR_MAPPING) - expr = mapping_expr_alloc(&ei->expr->location, expr, - expr_get(ei->expr->right)); + if (ei->expr != NULL) { + if (ei->expr->comment) + expr->comment = xstrdup(ei->expr->comment); + if (ei->expr->ops->type == EXPR_MAPPING) + expr = mapping_expr_alloc(&ei->expr->location, expr, + expr_get(ei->expr->right)); + } if (ei->flags & EI_F_INTERVAL_END) expr->flags |= EXPR_F_INTERVAL_END; |