From 08b4600fc361cbab55ae2f89875df7fddf7b657e Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Tue, 28 Jul 2009 14:17:41 +0200 Subject: netlink: fix bitmask element reconstruction mpz_scan1() needs to begin scanning at bit 0 and the loop must accept bit 0 as valid. No more bits were found when ULONG_MAX is returned. Signed-off-by: Patrick McHardy --- src/netlink_delinearize.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/netlink_delinearize.c') diff --git a/src/netlink_delinearize.c b/src/netlink_delinearize.c index a511313e..66690255 100644 --- a/src/netlink_delinearize.c +++ b/src/netlink_delinearize.c @@ -8,6 +8,7 @@ * Development of this code funded by Astaro AG (http://www.astaro.com/) */ +#include #include #include #include @@ -580,9 +581,7 @@ static void expr_postprocess(struct rule_pp_ctx *ctx, expr_free(expr->right); expr->right = list_expr_alloc(&expr->left->left->location); n = 0; - while ((n = mpz_scan1(expr->left->right->value, n + 1))) { - if (n > expr->left->right->len) - break; + while ((n = mpz_scan1(expr->left->right->value, n)) != ULONG_MAX) { i = constant_expr_alloc(&expr->left->right->location, expr->left->left->dtype, expr->left->right->byteorder, @@ -590,6 +589,7 @@ static void expr_postprocess(struct rule_pp_ctx *ctx, mpz_set_ui(i->value, 1); mpz_lshift_ui(i->value, n); compound_expr_add(expr->right, i); + n++; } expr->left = expr->left->left; expr->op = OP_FLAGCMP; -- cgit v1.2.3