During delinearization we attempt to remove masks, for instance
ip saddr $x/32. (mask matches the entire size).
However, in some special cases the lhs size is unknown (0), this
happens f.e. with
'ct saddr original 1.2.3.4/24' which had its '/24' chopped off.
Signed-off-by: Florian Westphal <fw@strlen.de>
mpz_ior(m, m, o);
}
- if (mpz_scan0(m, 0) != left->len) {
+ if (left->len > 0 && mpz_scan0(m, 0) == left->len) {
+ /* mask encompasses the entire value */
+ expr_free(mask);
+ } else {
mpz_set(mask->value, m);
expr = binop_expr_alloc(loc, OP_AND, expr, mask);
expr->len = left->len;
- } else
- expr_free(mask);
+ }
if (mpz_cmp_ui(x, 0)) {
mpz_set(xor->value, x);