Nftables
0.9
Nftables like the firewall for Linux but next generation
|
![]() |
Functions | |
int | nft_run_command_from_buffer (struct nft_ctx *nft, char *buf, size_t buflen) |
int | nft_run_command_from_filename (struct nft_ctx *nft, const char *filename) |
Once a nftables context has been initialized with nft_context_new() it is possible to run nftables commands via the following functions:
It is also possible to run multiple commands via Batch support
int nft_run_command_from_buffer | ( | struct nft_ctx * | nft, |
char * | buf, | ||
size_t | buflen | ||
) |
Run nftables command contained in provided buffer
This function accept nft command with the same syntax as nft
in interactive mode. For instance, this is a valid command if your ruleset has a filter output
chain:
nft | a pointer to a initialized struct nft_ctx |
buf | buffer containing the command to execute |
buflen | the length of the buffer |
Definition at line 237 of file libnftables.c.
int nft_run_command_from_filename | ( | struct nft_ctx * | nft, |
const char * | filename | ||
) |
Run all nftables commands contained in a file
This function provides away to programmatically get an equivalent of the -f
option of nft
. For instance For instance, this is a valid content for a file if your ruleset has a filter output
chain:
nft | a pointer to a initialized struct nft_ctx |
filename | path to the file containing nft rules |
Definition at line 276 of file libnftables.c.