]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
intervals: use expression location when translating to intervals
authorPablo Neira Ayuso <pablo@netfilter.org>
Mon, 27 Mar 2023 14:36:31 +0000 (16:36 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 28 Mar 2023 08:26:34 +0000 (10:26 +0200)
Otherwise, internal location reports:

 # nft -f ruleset.nft
 internal:0:0-0: Error: Could not process rule: File exists

after this patch:

 # nft -f ruleset.nft
 ruleset.nft:402:1-16: Error: Could not process rule: File exists
 1.2.3.0/30,
 ^^^^^^^^^^^

Fixes: 81e36530fcac ("src: replace interval segment tree overlap and automerge")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/intervals.c

index 95e25cf09662293a372f6d2d703240bc146f7277..d79c52c58710a77a53a920648ef2d1c6fb0ba26d 100644 (file)
@@ -709,9 +709,9 @@ int set_to_intervals(const struct set *set, struct expr *init, bool add)
                        if (set->key->byteorder == BYTEORDER_HOST_ENDIAN)
                                mpz_switch_byteorder(expr->value, set->key->len / BITS_PER_BYTE);
 
-                       newelem = set_elem_expr_alloc(&internal_location, expr);
+                       newelem = set_elem_expr_alloc(&expr->location, expr);
                        if (i->etype == EXPR_MAPPING) {
-                               newelem = mapping_expr_alloc(&internal_location,
+                               newelem = mapping_expr_alloc(&expr->location,
                                                             newelem,
                                                             expr_get(i->right));
                        }