All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Phil Sutter <phil@nwl.cc>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [nft PATCH] evaluate: Fix for 'meta hour' ranges spanning date boundaries
Date: Tue, 29 Jul 2025 01:36:08 +0200	[thread overview]
Message-ID: <aIgJUFPS2z6F_sCn@calendula> (raw)
In-Reply-To: <20250725212640.26537-1-phil@nwl.cc>

On Fri, Jul 25, 2025 at 11:26:40PM +0200, Phil Sutter wrote:
> Introduction of EXPR_RANGE_SYMBOL type inadvertently disabled sanitizing
> of meta hour ranges where the lower boundary has a higher value than the
> upper boundary. This may happen outside of user control due to the fact
> that given ranges are converted to UTC which is the kernel's native
> timezone.
> 
> Restore the conditional match and op inversion by matching on the new
> RHS expression type and also expand it so values are comparable. Since
> this replaces the whole range expression, make it replace the
> relational's RHS entirely.

Thanks, I suspect this bug is related to this recent ticket:

https://bugzilla.netfilter.org/show_bug.cgi?id=1805

> While at it extend testsuites to cover these corner-cases.

Thanks for improving coverage for this.

> Fixes: 347039f64509e ("src: add symbol range expression to further compact intervals")
> Signed-off-by: Phil Sutter <phil@nwl.cc>

Reviewed-by: Pablo Neira Ayuso <pablo@netfilter.org>

> @@ -2772,12 +2780,15 @@ static int expr_evaluate_relational(struct eval_ctx *ctx, struct expr **expr)
>  
>  	pctx = eval_proto_ctx(ctx);
>  
> -	if (rel->right->etype == EXPR_RANGE && lhs_is_meta_hour(rel->left)) {
> -		ret = __expr_evaluate_range(ctx, &rel->right);
> +	if (lhs_is_meta_hour(rel->left) &&
> +	    rel->right->etype == EXPR_RANGE_SYMBOL) {

Side note, thanks for reversing this check.

  reply	other threads:[~2025-07-28 23:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-25 21:26 [nft PATCH] evaluate: Fix for 'meta hour' ranges spanning date boundaries Phil Sutter
2025-07-28 23:36 ` Pablo Neira Ayuso [this message]
2025-07-29 13:04   ` 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=aIgJUFPS2z6F_sCn@calendula \
    --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 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.