From: Pablo Neira Ayuso <pablo@netfilter.org>
To: "Daniel Gröber" <dxld@darkboxed.org>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nftables] Allow resetting the include search path
Date: Tue, 28 Jun 2022 19:13:02 +0200 [thread overview]
Message-ID: <Yrs2nn/amfnaUDk8@salvia> (raw)
In-Reply-To: <20220627222304.93139-1-dxld@darkboxed.org>
Hi,
On Tue, Jun 28, 2022 at 12:23:04AM +0200, Daniel Gröber wrote:
> Currently there is no way to disable searching in DEFAULT_INCLUDE_PATH
> first. This is needed when testing nftables configurations spanning
> multiple files without overwriting the globally installed ones.
You can do
# cat x.nft
include "./z.nft"
# cat z.nft
add table x
then:
# nft -f x.nft
using ./ at the beginning of the path overrides DEFAULT_INCLUDE_PATH.
Is this what you are searching for?
> ---
> doc/nft.txt | 4 ++--
> src/main.c | 4 +++-
> 2 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/doc/nft.txt b/doc/nft.txt
> index f7a53ac9..f04c3e20 100644
> --- a/doc/nft.txt
> +++ b/doc/nft.txt
> @@ -55,8 +55,8 @@ understanding of their meaning. You can get information about options by running
>
> *-I*::
> *--includepath directory*::
> - Add the directory 'directory' to the list of directories to be searched for included files. This
> - option may be specified multiple times.
> + Append a directory to the end of the search path for the *include* statement. If the empty
> + string is passed the list is reset. This option may be specified multiple times.
>
> *-c*::
> *--check*::
> diff --git a/src/main.c b/src/main.c
> index 9bd25db8..f5dd3dba 100644
> --- a/src/main.c
> +++ b/src/main.c
> @@ -411,7 +411,9 @@ int main(int argc, char * const *argv)
> interactive = true;
> break;
> case OPT_INCLUDEPATH:
> - if (nft_ctx_add_include_path(nft, optarg)) {
> + if (strcmp(optarg, "") == 0) {
> + nft_ctx_clear_include_paths(nft);
> + } else if (nft_ctx_add_include_path(nft, optarg)) {
> fprintf(stderr,
> "Failed to add include path '%s'\n",
> optarg);
> --
> 2.30.2
>
next prev parent reply other threads:[~2022-06-28 17:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-27 22:23 [PATCH nftables] Allow resetting the include search path Daniel Gröber
2022-06-28 17:13 ` Pablo Neira Ayuso [this message]
2022-06-28 17:17 ` Pablo Neira Ayuso
2022-06-28 19:01 ` Daniel Gröber
2022-06-29 17:20 ` Pablo Neira Ayuso
2022-06-30 20:56 ` Daniel Gröber
2022-07-01 1:31 ` Peter Tirsek
2022-07-04 18:03 ` Daniel Gröber
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=Yrs2nn/amfnaUDk8@salvia \
--to=pablo@netfilter.org \
--cc=dxld@darkboxed.org \
--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 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.