From: Florian Westphal <fw@strlen.de>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org, phil@nwl.cc
Subject: Re: [PATCH nft 1/5] libnftables: report EPERM to non-root users with -f/--filename
Date: Wed, 8 Apr 2026 14:03:24 +0200 [thread overview]
Message-ID: <adZEAkrcCcXEau_1@strlen.de> (raw)
In-Reply-To: <20260408115922.48676-2-pablo@netfilter.org>
Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> Similar to 3cfb9e4b3e40 ("src: report EPERM for non-root users").
>
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> ---
> src/libnftables.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/src/libnftables.c b/src/libnftables.c
> index 66b03a1170bb..e3218da9f48f 100644
> --- a/src/libnftables.c
> +++ b/src/libnftables.c
> @@ -767,8 +767,13 @@ static int __nft_run_cmd_from_filename(struct nft_ctx *nft, const char *filename
> nft_optimize(nft, &cmds);
>
> rc = nft_evaluate(nft, &msgs, &cmds);
> - if (rc < 0)
> + if (rc < 0) {
> + if (errno == EPERM) {
> + fprintf(stderr, "%s (you must be root)\n",
> + strerror(errno));
> + }
> goto err;
> + }
Hmm, should the library leave stderr alone?
next prev parent reply other threads:[~2026-04-08 12:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-08 11:59 [PATCH nft 0/5] support for several list and reset commands Pablo Neira Ayuso
2026-04-08 11:59 ` [PATCH nft 1/5] libnftables: report EPERM to non-root users with -f/--filename Pablo Neira Ayuso
2026-04-08 12:03 ` Florian Westphal [this message]
2026-04-08 14:12 ` Pablo Neira Ayuso
2026-04-08 11:59 ` [PATCH nft 2/5] libnftables: add nft_run_cmd_release() helper and use it Pablo Neira Ayuso
2026-04-08 11:59 ` [PATCH nft 3/5] libnftables: consolidate evaluation and netlink run Pablo Neira Ayuso
2026-04-08 11:59 ` [PATCH nft 4/5] libnftables: use nft_eval_run_cmds() in nft_run_cmd_from_filename() Pablo Neira Ayuso
2026-04-08 11:59 ` [PATCH nft 5/5] libnftables: support for several list and reset commands Pablo Neira Ayuso
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=adZEAkrcCcXEau_1@strlen.de \
--to=fw@strlen.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox