* [PATCH nft] cache: fix --echo with index/position
@ 2019-09-05 17:09 Pablo Neira Ayuso
2019-09-05 20:44 ` Eric Garver
0 siblings, 1 reply; 3+ messages in thread
From: Pablo Neira Ayuso @ 2019-09-05 17:09 UTC (permalink / raw)
To: netfilter-devel; +Cc: eric
Check for the index/position in case the echo flag is set on. Set the
NFT_CACHE_UPDATE flag in this case to enable incremental cache updates.
Reported-by: Eric Garver <eric@garver.life>
Fixes: 01e5c6f0ed03 ("src: add cache level flags")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
src/cache.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/cache.c b/src/cache.c
index cffcbb623ced..71d16a0fbeed 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -106,6 +106,9 @@ unsigned int cache_evaluate(struct nft_ctx *nft, struct list_head *cmds)
case CMD_CREATE:
if (nft_output_echo(&nft->output)) {
flags = NFT_CACHE_FULL;
+ if (cmd->handle.index.id ||
+ cmd->handle.position.id)
+ flags |= NFT_CACHE_UPDATE;
break;
}
flags = evaluate_cache_add(cmd, flags);
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH nft] cache: fix --echo with index/position
2019-09-05 17:09 [PATCH nft] cache: fix --echo with index/position Pablo Neira Ayuso
@ 2019-09-05 20:44 ` Eric Garver
2019-09-05 23:27 ` Pablo Neira Ayuso
0 siblings, 1 reply; 3+ messages in thread
From: Eric Garver @ 2019-09-05 20:44 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: netfilter-devel
On Thu, Sep 05, 2019 at 07:09:39PM +0200, Pablo Neira Ayuso wrote:
> Check for the index/position in case the echo flag is set on. Set the
> NFT_CACHE_UPDATE flag in this case to enable incremental cache updates.
>
> Reported-by: Eric Garver <eric@garver.life>
> Fixes: 01e5c6f0ed03 ("src: add cache level flags")
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> ---
> src/cache.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/src/cache.c b/src/cache.c
> index cffcbb623ced..71d16a0fbeed 100644
> --- a/src/cache.c
> +++ b/src/cache.c
> @@ -106,6 +106,9 @@ unsigned int cache_evaluate(struct nft_ctx *nft, struct list_head *cmds)
> case CMD_CREATE:
> if (nft_output_echo(&nft->output)) {
> flags = NFT_CACHE_FULL;
> + if (cmd->handle.index.id ||
> + cmd->handle.position.id)
> + flags |= NFT_CACHE_UPDATE;
> break;
> }
> flags = evaluate_cache_add(cmd, flags);
We can keep the special cases isolated to evaluate_cache_add() by always
calling it.
diff --git a/src/cache.c b/src/cache.c
index cffcbb623ced..f7ca8fe9068f 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -104,11 +104,10 @@ unsigned int cache_evaluate(struct nft_ctx *nft, struct list_head *cmds)
case CMD_ADD:
case CMD_INSERT:
case CMD_CREATE:
+ flags = evaluate_cache_add(cmd, flags);
if (nft_output_echo(&nft->output)) {
- flags = NFT_CACHE_FULL;
- break;
+ flags |= NFT_CACHE_FULL;
}
- flags = evaluate_cache_add(cmd, flags);
break;
case CMD_REPLACE:
flags = NFT_CACHE_FULL;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH nft] cache: fix --echo with index/position
2019-09-05 20:44 ` Eric Garver
@ 2019-09-05 23:27 ` Pablo Neira Ayuso
0 siblings, 0 replies; 3+ messages in thread
From: Pablo Neira Ayuso @ 2019-09-05 23:27 UTC (permalink / raw)
To: Eric Garver, netfilter-devel
On Thu, Sep 05, 2019 at 04:44:32PM -0400, Eric Garver wrote:
> On Thu, Sep 05, 2019 at 07:09:39PM +0200, Pablo Neira Ayuso wrote:
> > Check for the index/position in case the echo flag is set on. Set the
> > NFT_CACHE_UPDATE flag in this case to enable incremental cache updates.
> >
> > Reported-by: Eric Garver <eric@garver.life>
> > Fixes: 01e5c6f0ed03 ("src: add cache level flags")
> > Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> > ---
> > src/cache.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/src/cache.c b/src/cache.c
> > index cffcbb623ced..71d16a0fbeed 100644
> > --- a/src/cache.c
> > +++ b/src/cache.c
> > @@ -106,6 +106,9 @@ unsigned int cache_evaluate(struct nft_ctx *nft, struct list_head *cmds)
> > case CMD_CREATE:
> > if (nft_output_echo(&nft->output)) {
> > flags = NFT_CACHE_FULL;
> > + if (cmd->handle.index.id ||
> > + cmd->handle.position.id)
> > + flags |= NFT_CACHE_UPDATE;
> > break;
> > }
> > flags = evaluate_cache_add(cmd, flags);
>
> We can keep the special cases isolated to evaluate_cache_add() by always
> calling it.
That's fine too, yes. Would you formally submit this patch? Thanks.
> diff --git a/src/cache.c b/src/cache.c
> index cffcbb623ced..f7ca8fe9068f 100644
> --- a/src/cache.c
> +++ b/src/cache.c
> @@ -104,11 +104,10 @@ unsigned int cache_evaluate(struct nft_ctx *nft, struct list_head *cmds)
> case CMD_ADD:
> case CMD_INSERT:
> case CMD_CREATE:
> + flags = evaluate_cache_add(cmd, flags);
> if (nft_output_echo(&nft->output)) {
> - flags = NFT_CACHE_FULL;
> - break;
> + flags |= NFT_CACHE_FULL;
> }
> - flags = evaluate_cache_add(cmd, flags);
> break;
> case CMD_REPLACE:
> flags = NFT_CACHE_FULL;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-09-05 23:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-05 17:09 [PATCH nft] cache: fix --echo with index/position Pablo Neira Ayuso
2019-09-05 20:44 ` Eric Garver
2019-09-05 23:27 ` Pablo Neira Ayuso
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).