From: Florian Westphal <fw@strlen.de>
To: YuPeng <yupeng@kylinos.cn>
Cc: netfilter-devel@vger.kernel.org, phil@nwl.cc, debianyu@163.com
Subject: Re: [PATCH] extensions: ebt_string: Remove spurious inverse check for --string-icase
Date: Mon, 19 Oct 2026 10:50:28 +0200 [thread overview]
Message-ID: <atXZ1Fc4HOy--Wam@strlen.de> (raw)
In-Reply-To: <20261016032501.2AA453AAF44@smtp.subspace.kernel.org>
YuPeng <yupeng@kylinos.cn> wrote:
> --string-icase is registered as a no_argument option, so getopt_long
> always sets optarg to NULL when it is parsed. The ebt_check_inverse2()
> macro contains a mandatory-argument guard:
>
> if (!optarg) {
> __ebt_print_error("Option without (mandatory) argument");
> return -1;
> }
>
> so every use of --string-icase aborts parsing with the misleading error
> "Option without (mandatory) argument." and XT_STRING_FLAG_IGNORECASE
> can never be set. The option has been broken since it was added in
> commit b1cdae8 ("extensions: Add string filter to ebtables").
>
> Reproducer (no privileges required):
>
> $ ebtables-legacy --string-icase
> Option without (mandatory) argument.
>
> The inverse check makes no sense for a flag option that takes no
> argument, so simply remove it.
>
> This fix was originally carried in the Kylin Linux SRPM since 2022;
> the commit message has been rewritten to describe the actual failure
> mode observed on current master.
> diff --git a/extensions/ebt_string.c b/extensions/ebt_string.c
> index 97fbe19..74a1bfa 100644
> --- a/extensions/ebt_string.c
> +++ b/extensions/ebt_string.c
> @@ -174,8 +174,6 @@ static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry,
> break;
> case STRING_ICASE:
> ebt_check_option2(flags, OPT_STRING_ICASE);
> - if (ebt_check_inverse2(optarg))
> - ebt_print_error2("Unexpected `!' after --string-icase");
Are you sure? Probably:
- if (ebt_check_inverse2(optarg))
+ if (ebt_check_inverse(optarg))
?
next parent reply other threads:[~2026-10-19 8:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20261016032501.2AA453AAF44@smtp.subspace.kernel.org>
2026-10-19 8:50 ` Florian Westphal [this message]
2026-10-16 3:24 [PATCH] extensions: ebt_string: Remove spurious inverse check for --string-icase YuPeng
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=atXZ1Fc4HOy--Wam@strlen.de \
--to=fw@strlen.de \
--cc=debianyu@163.com \
--cc=netfilter-devel@vger.kernel.org \
--cc=phil@nwl.cc \
--cc=yupeng@kylinos.cn \
/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.