Nftables
0.9
Nftables like the firewall for Linux but next generation
|
![]() |
Functions | |
struct nft_batch * | nft_batch_start (struct nft_ctx *nft) |
int | nft_batch_add (struct nft_ctx *nft, struct nft_batch *batch, const char *buf, size_t buflen) |
int | nft_batch_commit (struct nft_ctx *nft, struct nft_batch *batch) |
void | nft_batch_free (struct nft_batch *batch) |
Nftables supports batch or transsaction. It is possible to prepare multiple commands and then run it at once. If one of the commands fails then the complete set of commands is not added to the firewall ruleset.
libnftables support transaction and the synopsis of the usage it the following:
The following example code shows how to use it:
int nft_batch_add | ( | struct nft_ctx * | nft, |
struct nft_batch * | batch, | ||
const char * | buf, | ||
size_t | buflen | ||
) |
Add a command to an already created batch
nft | nftables context initialized with nft_context_new() |
batch | nftables batch initialized with nft_batch_start() |
buf | buffer with command to execute |
buflen | length of buffer string |
Definition at line 390 of file libnftables.c.
int nft_batch_commit | ( | struct nft_ctx * | nft, |
struct nft_batch * | batch | ||
) |
Commit a batch to the kernel
nft | nftables context initialized with nft_context_new() |
batch | nftables batch with commands added via nft_batch_add() |
Definition at line 435 of file libnftables.c.
void nft_batch_free | ( | struct nft_batch * | batch | ) |
Free ressources allocated to a batch
batch | nftables batch initialized with nft_batch_start() |
Definition at line 468 of file libnftables.c.
struct nft_batch* nft_batch_start | ( | struct nft_ctx * | nft | ) |
Start a batch
nft | a pointer to an initalized struct nft_ctx |
Definition at line 355 of file libnftables.c.