[PATCH nft] intervals: unset EXPR_F_KERNEL for adjusted elements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>
---
 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




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux