Skip to contentSkip to conversation

intervals: use expression location when translating to intervals

PATCH New Pablo Neira Ayuso 1 participant 1 message Mar 27, 2023 netfilter

lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 intervals: use expression location when translating to intervals

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")
---
 src/intervals.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
src/intervals.c +2 -2
index 95e25cf09662..d79c52c58710 100644
@@ -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));
 			}
Signature · 1 line
2.30.2