netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH iptables] extensions: libebt_stp: fix range checking
Date: Wed, 24 Jan 2024 15:00:46 +0100	[thread overview]
Message-ID: <ZbEYDliDhUrO73eu@orbyte.nwl.cc> (raw)
In-Reply-To: <20240123164936.14403-1-fw@strlen.de>

Hi Florian,

On Tue, Jan 23, 2024 at 05:49:33PM +0100, Florian Westphal wrote:
> This has to either consider ->nvals > 1 or check the values
> post-no-range-fixup:
> 
> ./iptables-test.py  extensions/libebt_stp.t
> extensions/libebt_stp.t: ERROR: line 12 (cannot load: ebtables -A INPUT --stp-root-cost 1)
> 
> (it tests 0 < 1 and fails, but test should be 1 < 1).
> 
> Fixes: dc6efcfeac38 ("extensions: libebt_stp: Use guided option parser")
> Signed-off-by: Florian Westphal <fw@strlen.de>
> ---
>  extensions/libebt_stp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/extensions/libebt_stp.c b/extensions/libebt_stp.c
> index 81054b26c1f0..371fa04c870f 100644
> --- a/extensions/libebt_stp.c
> +++ b/extensions/libebt_stp.c
> @@ -142,7 +142,7 @@ static void brstp_parse(struct xt_option_call *cb)
>  #define RANGE_ASSIGN(name, fname, val) {				    \
>  		stpinfo->config.fname##l = val[0];			    \
>  		stpinfo->config.fname##u = cb->nvals > 1 ? val[1] : val[0]; \
> -		if (val[1] < val[0])					    \
> +		if (stpinfo->config.fname##u < stpinfo->config.fname##l)    \
>  			xtables_error(PARAMETER_PROBLEM,		    \
>  				      "Bad --stp-" name " range");	    \
>  }

This is odd: xtopt_parse_mint() assigns UINT32_MAX to val[1] for
XTTYPE_UINT32RC if no upper end is given. Also, extensions/libebt_stp.t
passes for me. What's missing on my end?

Cheers, Phil

  reply	other threads:[~2024-01-24 14:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-23 16:49 [PATCH iptables] extensions: libebt_stp: fix range checking Florian Westphal
2024-01-24 14:00 ` Phil Sutter [this message]
2024-01-24 14:37   ` Florian Westphal
2024-01-24 14:57     ` Phil Sutter
2024-01-24 15:42       ` Florian Westphal
2024-01-24 16:13         ` Phil Sutter
2024-01-25 14:44           ` 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=ZbEYDliDhUrO73eu@orbyte.nwl.cc \
    --to=phil@nwl.cc \
    --cc=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.org \
    /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).