All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Garver <eric@garver.life>
To: Phil Sutter <phil@nwl.cc>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>, netfilter-devel@vger.kernel.org
Subject: Re: [nft PATCH v4 1/7] src: Fix cache_flush() in cache_needs_more() logic
Date: Tue, 28 May 2019 17:32:44 -0400	[thread overview]
Message-ID: <20190528213244.teiqi7y7rxz5b5ri@egarver.localdomain> (raw)
In-Reply-To: <20190528210323.14605-2-phil@nwl.cc>

On Tue, May 28, 2019 at 11:03:17PM +0200, Phil Sutter wrote:
> Commit 34a20645d54fa enabled cache updates depending on command causing

Actual hash is eeda228c2d17. 

> it. As a side-effect, this disabled measures in cache_flush() preventing
> a later cache update. Re-establish this by setting cache->cmd in
> addition to cache->genid after dropping cache entries.
> 
> While being at it, set cache->cmd in cache_release() as well. This
> shouldn't be necessary since zeroing cache->genid should suffice for
> cache_update(), but better be consistent (and future-proof) here.
> 
> Fixes: 34a20645d54fa ("src: update cache if cmd is more specific")

Actual hash is eeda228c2d17. 

> Signed-off-by: Phil Sutter <phil@nwl.cc>
> ---
> Changes since v1:
> - Adjust cache_release() as well, just to make sure.
> ---
>  src/rule.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/rule.c b/src/rule.c
> index 326edb5dd459a..966948cd7ae90 100644
> --- a/src/rule.c
> +++ b/src/rule.c
> @@ -299,12 +299,15 @@ void cache_flush(struct nft_ctx *nft, enum cmd_ops cmd, struct list_head *msgs)
>  
>  	__cache_flush(&cache->list);
>  	cache->genid = mnl_genid_get(&ctx);
> +	cache->cmd = CMD_LIST;
>  }
>  
>  void cache_release(struct nft_cache *cache)
>  {
>  	__cache_flush(&cache->list);
>  	cache->genid = 0;
> +	cache->cmd = CMD_INVALID;
> +
>  }
>  
>  /* internal ID to uniquely identify a set in the batch */
> -- 
> 2.21.0

Otherwise looks good.

  reply	other threads:[~2019-05-28 21:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-28 21:03 [nft PATCH v4 0/7] Cache update fix && intra-transaction rule references Phil Sutter
2019-05-28 21:03 ` [nft PATCH v4 1/7] src: Fix cache_flush() in cache_needs_more() logic Phil Sutter
2019-05-28 21:32   ` Eric Garver [this message]
2019-05-28 22:23     ` Phil Sutter
2019-05-28 21:03 ` [nft PATCH v4 2/7] libnftables: Keep list of commands in nft context Phil Sutter
2019-05-28 21:03 ` [nft PATCH v4 3/7] src: Make {table,chain}_not_found() public Phil Sutter
2019-05-28 21:03 ` [nft PATCH v4 4/7] src: Restore local entries after cache update Phil Sutter
2019-05-28 21:03 ` [nft PATCH v4 5/7] rule: Introduce rule_lookup_by_index() Phil Sutter
2019-05-28 21:03 ` [nft PATCH v4 6/7] src: Make cache_is_complete() public Phil Sutter
2019-05-28 21:03 ` [nft PATCH v4 7/7] src: Support intra-transaction rule references Phil Sutter
2019-05-31 16:56   ` Eric Garver
2019-06-03 16:59     ` Pablo Neira Ayuso
2019-06-04  7:17       ` Phil Sutter

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=20190528213244.teiqi7y7rxz5b5ri@egarver.localdomain \
    --to=eric@garver.life \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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 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.