#include <libnftnl/table.h>
#include <libnftnl/chain.h>
#include <libnftnl/rule.h>
#include <libnftnl/expr.h>
#include <libnftnl/set.h>
#include <linux/netlink.h>
#include <linux/netfilter/nf_tables.h>
#include <rule.h>
Data Structures | |
struct | netlink_ctx |
struct netlink_ctx More... | |
struct | nft_data_linearize |
struct | nft_data_delinearize |
struct | netlink_mon_handler |
Macros | |
#define | netlink_abi_error() __netlink_abi_error(__FILE__, __LINE__, strerror(errno)); |
Variables | |
const struct input_descriptor | indesc_netlink |
const struct location | netlink_location |
#define netlink_abi_error | ( | ) | __netlink_abi_error(__FILE__, __LINE__, strerror(errno)); |
void __noreturn __netlink_abi_error | ( | const char * | file, |
int | line, | ||
const char * | reason | ||
) |
References NFT_EXIT_FAILURE.
References handle::chain, handle::family, handle::handle, memory_allocation_error, nft_chain_alloc(), NFT_CHAIN_ATTR_FAMILY, NFT_CHAIN_ATTR_HANDLE, NFT_CHAIN_ATTR_NAME, nft_chain_attr_set_str(), nft_chain_attr_set_u32(), nft_chain_attr_set_u64(), NFT_CHAIN_ATTR_TABLE, NULL, and handle::table.
Referenced by netlink_get_chain().
struct nft_rule_expr* alloc_nft_expr | ( | const char * | name | ) |
References memory_allocation_error, nft_rule_expr_alloc(), and NULL.
References handle::chain, handle::comment, handle::family, handle::handle, memory_allocation_error, nft_rule_alloc(), NFT_RULE_ATTR_CHAIN, NFT_RULE_ATTR_FAMILY, NFT_RULE_ATTR_HANDLE, NFT_RULE_ATTR_POSITION, nft_rule_attr_set_data(), nft_rule_attr_set_str(), nft_rule_attr_set_u32(), nft_rule_attr_set_u64(), NFT_RULE_ATTR_TABLE, NFT_RULE_ATTR_USERDATA, NULL, handle::position, and handle::table.
Referenced by netlink_add_rule_batch(), and netlink_del_rule_batch().
References handle::family, memory_allocation_error, nft_set_alloc(), NFT_SET_ATTR_FAMILY, NFT_SET_ATTR_ID, NFT_SET_ATTR_NAME, nft_set_attr_set_str(), nft_set_attr_set_u32(), NFT_SET_ATTR_TABLE, NULL, handle::set, handle::set_id, and handle::table.
Referenced by netlink_get_set(), and netlink_get_setelems().
References handle::family, memory_allocation_error, nft_table_alloc(), NFT_TABLE_ATTR_FAMILY, NFT_TABLE_ATTR_NAME, nft_table_attr_set(), nft_table_attr_set_u32(), NULL, and handle::table.
Referenced by netlink_flush_ruleset(), and netlink_get_table().
int netlink_add_chain | ( | struct netlink_ctx * | ctx, |
const struct handle * | h, | ||
const struct location * | loc, | ||
const struct chain * | chain, | ||
bool | excl | ||
) |
References netlink_ctx::batch_supported.
int netlink_add_rule | ( | struct netlink_ctx * | ctx, |
const struct handle * | h, | ||
const struct rule * | rule, | ||
uint32_t | flags | ||
) |
int netlink_add_rule_batch | ( | struct netlink_ctx * | ctx, |
const struct handle * | h, | ||
const struct rule * | rule, | ||
uint32_t | flags | ||
) |
References alloc_nft_rule(), rule::handle, rule::location, mnl_nft_rule_batch_add(), netlink_io_error(), netlink_linearize_rule(), nft_rule_free(), NLM_F_EXCL, and netlink_ctx::seqnum.
Referenced by netlink_add_rule_list().
int netlink_add_rule_list | ( | struct netlink_ctx * | ctx, |
const struct handle * | h, | ||
struct list_head * | rule_list | ||
) |
References rule::handle, rule::list, list_for_each_entry, netlink_add_rule_batch(), and NLM_F_APPEND.
References netlink_ctx::batch_supported.
int netlink_add_setelems | ( | struct netlink_ctx * | ctx, |
const struct handle * | h, | ||
const struct expr * | expr | ||
) |
References netlink_ctx::batch_supported.
int netlink_add_table | ( | struct netlink_ctx * | ctx, |
const struct handle * | h, | ||
const struct location * | loc, | ||
const struct table * | table, | ||
bool | excl | ||
) |
References netlink_ctx::batch_supported.
struct expr* netlink_alloc_data | ( | const struct location * | loc, |
const struct nft_data_delinearize * | nld, | ||
enum nft_registers | dreg | ||
) |
struct expr* netlink_alloc_value | ( | const struct location * | loc, |
const struct nft_data_delinearize * | nld | ||
) |
References BITS_PER_BYTE, BYTEORDER_INVALID, constant_expr_alloc(), invalid_type, nft_data_delinearize::len, and nft_data_delinearize::value.
Referenced by netlink_alloc_data().
bool netlink_batch_supported | ( | void | ) |
int netlink_del_rule_batch | ( | struct netlink_ctx * | ctx, |
const struct handle * | h, | ||
const struct location * | loc | ||
) |
References alloc_nft_rule(), mnl_nft_rule_batch_del(), netlink_io_error(), nft_rule_free(), and netlink_ctx::seqnum.
Referenced by netlink_flush_chain().
int netlink_delete_chain | ( | struct netlink_ctx * | ctx, |
const struct handle * | h, | ||
const struct location * | loc | ||
) |
References netlink_ctx::batch_supported.
int netlink_delete_rule | ( | struct netlink_ctx * | ctx, |
const struct handle * | h, | ||
const struct location * | loc | ||
) |
int netlink_delete_set | ( | struct netlink_ctx * | ctx, |
const struct handle * | h, | ||
const struct location * | loc | ||
) |
References netlink_ctx::batch_supported.
int netlink_delete_setelems | ( | struct netlink_ctx * | ctx, |
const struct handle * | h, | ||
const struct expr * | expr | ||
) |
References netlink_ctx::batch_supported.
int netlink_delete_table | ( | struct netlink_ctx * | ctx, |
const struct handle * | h, | ||
const struct location * | loc | ||
) |
References netlink_ctx::batch_supported.
References handle::chain, handle::comment, data, handle::family, handle::handle, len, netlink_ctx::msgs, netlink_parse_ctx::msgs, netlink_location, NFT_RULE_ATTR_CHAIN, NFT_RULE_ATTR_FAMILY, nft_rule_attr_get_data(), nft_rule_attr_get_str(), nft_rule_attr_get_u32(), nft_rule_attr_get_u64(), NFT_RULE_ATTR_HANDLE, nft_rule_attr_is_set(), NFT_RULE_ATTR_POSITION, NFT_RULE_ATTR_TABLE, NFT_RULE_ATTR_USERDATA, nft_rule_expr_foreach(), NULL, handle::position, netlink_parse_ctx::rule, rule_alloc(), handle::table, netlink_parse_ctx::table, table_lookup(), xmalloc(), and xstrdup().
void netlink_dump_expr | ( | struct nft_rule_expr * | nle | ) |
References buf, DEBUG_NETLINK, and nft_rule_expr_snprintf().
Referenced by erec_print().
References buf, DEBUG_NETLINK, and nft_rule_snprintf().
Referenced by netlink_linearize_rule().
struct nft_ruleset* netlink_dump_ruleset | ( | struct netlink_ctx * | ctx, |
const struct handle * | h, | ||
const struct location * | loc | ||
) |
References handle::family, mnl_nft_ruleset_dump(), netlink_io_error(), and NULL.
References buf, DEBUG_NETLINK, and nft_set_snprintf().
Referenced by netlink_get_set(), and netlink_get_setelems().
int netlink_flush_ruleset | ( | struct netlink_ctx * | ctx, |
const struct handle * | h, | ||
const struct location * | loc | ||
) |
References alloc_nft_table(), netlink_ctx::batch_supported, mnl_nft_table_batch_del(), netlink_io_error(), nft_table_free(), and netlink_ctx::seqnum.
int netlink_flush_table | ( | struct netlink_ctx * | ctx, |
const struct handle * | h, | ||
const struct location * | loc | ||
) |
void netlink_gen_data | ( | const struct expr * | expr, |
struct nft_data_linearize * | data | ||
) |
References BUG, EXPR_CONCAT, EXPR_VALUE, EXPR_VERDICT, expr_ops::name, expr::ops, and expr_ops::type.
void netlink_gen_raw_data | ( | const mpz_t | value, |
enum byteorder | byteorder, | ||
unsigned int | len, | ||
struct nft_data_linearize * | data | ||
) |
References nft_data_linearize::len, len, mpz_export_data(), and nft_data_linearize::value.
void netlink_genid_get | ( | void | ) |
int netlink_get_chain | ( | struct netlink_ctx * | ctx, |
const struct handle * | h, | ||
const struct location * | loc | ||
) |
References alloc_nft_chain(), chain::chain, netlink_ctx::list, chain::list, mnl_nft_chain_get(), netlink_io_error(), and nft_chain_free().
int netlink_get_set | ( | struct netlink_ctx * | ctx, |
const struct handle * | h, | ||
const struct location * | loc | ||
) |
References alloc_nft_set(), netlink_ctx::list, set::list, mnl_nft_set_get(), netlink_dump_set(), netlink_io_error(), nft_set_free(), and NULL.
int netlink_get_setelems | ( | struct netlink_ctx * | ctx, |
const struct handle * | h, | ||
const struct location * | loc, | ||
struct set * | set | ||
) |
References alloc_nft_set(), set::flags, set::init, interval_map_decompose(), mnl_nft_setelem_get(), netlink_dump_set(), netlink_io_error(), nft_set_elem_foreach(), nft_set_free(), NFT_SET_INTERVAL, NULL, netlink_ctx::set, and set_expr_alloc().
int netlink_get_table | ( | struct netlink_ctx * | ctx, |
const struct handle * | h, | ||
const struct location * | loc | ||
) |
References alloc_nft_table(), mnl_nft_table_get(), netlink_io_error(), and nft_table_free().
int netlink_io_error | ( | struct netlink_ctx * | ctx, |
const struct location * | loc, | ||
const char * | fmt, | ||
... | |||
) |
References EREC_ERROR, erec_vcreate(), netlink_ctx::msgs, netlink_location, and NULL.
Referenced by netlink_add_rule_batch(), netlink_del_rule_batch(), netlink_dump_ruleset(), netlink_flush_ruleset(), netlink_get_chain(), netlink_get_set(), netlink_get_setelems(), netlink_get_table(), netlink_list_chains(), netlink_list_sets(), netlink_list_tables(), and netlink_monitor().
void netlink_linearize_rule | ( | struct netlink_ctx * | ctx, |
struct nft_rule * | nlr, | ||
const struct rule * | rule | ||
) |
References stmt::list, list_for_each_entry, netlink_dump_rule(), NFT_REG_1, netlink_linearize_ctx::nlr, netlink_linearize_ctx::reg_low, and rule::stmts.
Referenced by netlink_add_rule_batch().
int netlink_list_chain | ( | struct netlink_ctx * | ctx, |
const struct handle * | h, | ||
const struct location * | loc | ||
) |
int netlink_list_chains | ( | struct netlink_ctx * | ctx, |
const struct handle * | h, | ||
const struct location * | loc | ||
) |
References handle::chain, chain::chain, netlink_ctx::data, handle::family, chain::handle, netlink_ctx::list, chain::list, list_for_each_entry, mnl_nft_chain_dump(), netlink_io_error(), nft_chain_list_foreach(), nft_chain_list_free(), NULL, and handle::table.
int netlink_list_sets | ( | struct netlink_ctx * | ctx, |
const struct handle * | h, | ||
const struct location * | loc | ||
) |
References handle::family, mnl_nft_set_dump(), netlink_io_error(), nft_set_list_foreach(), nft_set_list_free(), NULL, and handle::table.
int netlink_list_table | ( | struct netlink_ctx * | ctx, |
const struct handle * | h, | ||
const struct location * | loc | ||
) |
int netlink_list_tables | ( | struct netlink_ctx * | ctx, |
const struct handle * | h, | ||
const struct location * | loc | ||
) |
References handle::family, mnl_nft_table_dump(), netlink_io_error(), nft_table_list_foreach(), nft_table_list_free(), and NULL.
int netlink_monitor | ( | struct netlink_mon_handler * | monhandler | ) |
References netlink_mon_handler::ctx, netlink_mon_handler::loc, mnl_nft_event_listener(), MNL_SOCKET_AUTOPID, mnl_socket_bind(), netlink_io_error(), and NFNLGRP_NFTABLES.
void netlink_open_error | ( | void | ) |
References NFT_EXIT_NONL.
int netlink_rename_chain | ( | struct netlink_ctx * | ctx, |
const struct handle * | h, | ||
const struct location * | loc, | ||
const char * | name | ||
) |
References netlink_ctx::batch_supported.
void netlink_restart | ( | void | ) |
const struct input_descriptor indesc_netlink |
Referenced by netlink_delinearize_rule(), and netlink_io_error().