[PATCH nftables] Allow resetting the include search path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
---
 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




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux