diff options
author | Phil Sutter <phil@nwl.cc> | 2017-10-23 17:33:19 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2017-10-24 15:23:56 +0200 |
commit | 7aa53c6c9bbe20631b63c6996bdaf0ce431b8d3e (patch) | |
tree | a808cbd45fac9a67b2c8a6c4f2e4601a3a015f0f /src/scanner.l | |
parent | 4c15b4008c249b768ca1ec958747a9033f8235b9 (diff) |
libnftables: Introduce getters and setters for everything
This introduces getter/setter pairs for all parts in struct nft_ctx (and
contained structs) which should be configurable.
Most of them are simple ones, just allowing to get/set a given field:
* nft_ctx_{get,set}_dry_run() -> ctx->check
* nft_ctx_output_{get,set}_numeric() -> ctx->output.numeric
* nft_ctx_output_{get,set}_stateless() -> ctx->output.stateless
* nft_ctx_output_{get,set}_ip2name() -> ctx->output.ip2name
* nft_ctx_output_{get,set}_debug() -> ctx->debug_mask
* nft_ctx_output_{get,set}_handle() -> ctx->output.handle
* nft_ctx_output_{get,set}_echo() -> ctx->output.echo
A more complicated case is include paths handling: In order to keep the
API simple, remove INCLUDE_PATHS_MAX restraint and dynamically allocate
nft_ctx field include_paths instead. So there is:
* nft_ctx_add_include_path() -> add an include path to the list
* nft_ctx_clear_include_paths() -> flush the list of include paths
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/scanner.l')
-rw-r--r-- | src/scanner.l | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/scanner.l b/src/scanner.l index 59407366..ee09775e 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -794,9 +794,7 @@ int scanner_include_file(struct nft_ctx *nft, void *scanner, int ret = -1; if (search_in_include_path(filename)) { - for (i = 0; i < INCLUDE_PATHS_MAX; i++) { - if (nft->include_paths[i] == NULL) - break; + for (i = 0; i < nft->num_include_paths; i++) { ret = snprintf(buf, sizeof(buf), "%s/%s", nft->include_paths[i], filename); if (ret < 0 || ret >= PATH_MAX) { |