From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: phil@nwl.cc
Subject: [PATCH nft] intervals: unset EXPR_F_KERNEL for adjusted elements
Date: Wed, 13 Apr 2022 15:42:30 +0200 [thread overview]
Message-ID: <20220413134230.488620-1-pablo@netfilter.org> (raw)
This element is adjusted, hence it is new and it is purged from the
kernel.
The existing list of elements in the kernel is spliced to the elements
to be removed, then merge-sorted. EXPR_F_REMOVE flag specifies that this
element represents a deletion.
The EXPR_F_REMOVE and EXPR_F_KERNEL allows to track objects: whether
element is in the kernel (EXPR_F_KERNEL), element is new (no flag) or
element represents a removal (EXPR_F_REMOVE).
Reported-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
src/intervals.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/intervals.c b/src/intervals.c
index 451bc4dd4dd4..cdda9e38ca5e 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -279,7 +279,7 @@ static void remove_elem(struct expr *prev, struct set *set, struct expr *purge)
static void __adjust_elem_left(struct set *set, struct expr *prev, struct expr *i,
struct expr *add)
{
- prev->flags &= EXPR_F_KERNEL;
+ prev->flags &= ~EXPR_F_KERNEL;
expr_free(prev->key->left);
prev->key->left = expr_get(i->key->right);
mpz_add_ui(prev->key->left->value, prev->key->left->value, 1);
@@ -304,7 +304,7 @@ static void adjust_elem_left(struct set *set, struct expr *prev, struct expr *i,
static void __adjust_elem_right(struct set *set, struct expr *prev, struct expr *i,
struct expr *add)
{
- prev->flags &= EXPR_F_KERNEL;
+ prev->flags &= ~EXPR_F_KERNEL;
expr_free(prev->key->right);
prev->key->right = expr_get(i->key->left);
mpz_sub_ui(prev->key->right->value, prev->key->right->value, 1);
@@ -334,7 +334,7 @@ static void split_range(struct set *set, struct expr *prev, struct expr *i,
clone = expr_clone(prev);
list_move_tail(&clone->list, &purge->expressions);
- prev->flags &= EXPR_F_KERNEL;
+ prev->flags &= ~EXPR_F_KERNEL;
clone = expr_clone(prev);
expr_free(clone->key->left);
clone->key->left = expr_get(i->key->right);
--
2.30.2
reply other threads:[~2022-04-13 13:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220413134230.488620-1-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=phil@nwl.cc \
/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).