netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Subject: [PATCH nft 2/3] segtree: reset element size counter before adding intervals to set
Date: Wed, 24 May 2017 11:53:17 +0200	[thread overview]
Message-ID: <1495619598-22759-2-git-send-email-pablo@netfilter.org> (raw)
In-Reply-To: <1495619598-22759-1-git-send-email-pablo@netfilter.org>

Otherwise we get double the real size in terms of set elements during
the interval expansion to individual elements.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 src/segtree.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/segtree.c b/src/segtree.c
index 8df82a801ae4..15e8849cd684 100644
--- a/src/segtree.c
+++ b/src/segtree.c
@@ -552,6 +552,7 @@ int set_to_intervals(struct list_head *errs, struct set *set,
 		return -1;
 	segtree_linearize(&list, set, init, &tree, add);
 
+	init->size = 0;
 	list_for_each_entry_safe(ei, next, &list, list) {
 		if (segtree_debug()) {
 			pr_gmp_debug("list: [%.*Zx %.*Zx]\n",
@@ -566,6 +567,7 @@ int set_to_intervals(struct list_head *errs, struct set *set,
 		expr_print(init);
 		pr_gmp_debug("\n");
 	}
+
 	return 0;
 }
 
-- 
2.1.4


  reply	other threads:[~2017-05-24  9:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-24  9:53 [PATCH nft 1/3] rule: adjust set expression size accordingly with intervals Pablo Neira Ayuso
2017-05-24  9:53 ` Pablo Neira Ayuso [this message]
2017-05-24  9:53 ` [PATCH nft 3/3] netlink: add size description for constant sets 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=1495619598-22759-2-git-send-email-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).