Named sets may contain adjacent interval nodes, when equal in key, look at the flags. Those with EXPR_F_INTERVAL_END should come in first place. Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx> --- src/segtree.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/segtree.c b/src/segtree.c index 75f02b9..d8f98fa 100644 --- a/src/segtree.c +++ b/src/segtree.c @@ -487,8 +487,15 @@ static int expr_value_cmp(const void *p1, const void *p2) { struct expr *e1 = *(void * const *)p1; struct expr *e2 = *(void * const *)p2; + int ret; - return mpz_cmp(expr_value(e1)->value, expr_value(e2)->value); + ret = mpz_cmp(expr_value(e1)->value, expr_value(e2)->value); + if (ret == 0 && (e1->flags & EXPR_F_INTERVAL_END)) + return -1; + else + return 1; + + return ret; } void interval_map_decompose(struct expr *set) -- 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