All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Subject: [PATCH nft 2/6] intervals: do not merge intervals with different timeout
Date: Tue, 17 Dec 2024 22:15:12 +0100	[thread overview]
Message-ID: <20241217211516.1644623-3-pablo@netfilter.org> (raw)
In-Reply-To: <20241217211516.1644623-1-pablo@netfilter.org>

If timeout/expiration of contiguous intervals is different, then do not
merge them.

Fixes: 81e36530fcac ("src: replace interval segment tree overlap and automerge")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 src/intervals.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/intervals.c b/src/intervals.c
index 44fdda36e35f..6308cc8e2c08 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -175,7 +175,9 @@ static void setelem_automerge(struct set_automerge_ctx *ctx)
 		range_expr_value_low(range.low, i);
 		range_expr_value_high(range.high, i);
 
-		if (!prev) {
+		if (!prev ||
+		    interval_expr_key(prev)->timeout != interval_expr_key(i)->timeout ||
+		    interval_expr_key(prev)->expiration != interval_expr_key(i)->expiration) {
 			set_prev_elem(&prev, i, &prev_range, &range);
 			continue;
 		}
-- 
2.30.2


  parent reply	other threads:[~2024-12-17 21:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-17 21:15 [PATCH nft 0/6] shrink memory usage for interval sets Pablo Neira Ayuso
2024-12-17 21:15 ` [PATCH nft 1/6] intervals: add helper function to set previous element Pablo Neira Ayuso
2024-12-17 21:15 ` Pablo Neira Ayuso [this message]
2024-12-17 21:15 ` [PATCH nft 3/6] src: add EXPR_RANGE_VALUE expression and use it Pablo Neira Ayuso
2024-12-17 21:15 ` [PATCH nft 4/6] rule: constify set_is_non_concat_range() Pablo Neira Ayuso
2024-12-17 21:15 ` [PATCH nft 5/6] mnl: rename list of expression in mnl_nft_setelem_batch() Pablo Neira Ayuso
2024-12-17 21:15 ` [PATCH nft 6/6] src: rework singleton interval transformation to reduce memory consumption Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241217211516.1644623-3-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.