This helper function returns a expression value type that represents the set element key. This functions currently expects two kind of expressions: set elements and mappings. Bail out otherwise, if we see anything else, we have to fix our code. Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx> --- src/segtree.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/segtree.c b/src/segtree.c index 060951c..5b69ffb 100644 --- a/src/segtree.c +++ b/src/segtree.c @@ -473,10 +473,14 @@ extern void interval_map_decompose(struct expr *set); static struct expr *expr_value(struct expr *expr) { - if (expr->ops->type == EXPR_MAPPING) + switch (expr->ops->type) { + case EXPR_MAPPING: return expr->left->key; - else + case EXPR_SET_ELEM: return expr->key; + default: + BUG("invalid expression type %s\n", expr->ops->name); + } } static int expr_value_cmp(const void *p1, const void *p2) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html