netfilter
firewalling, NAT, and packet mangling for linux
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
netlink.h File Reference
#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>
Include dependency graph for netlink.h:
This graph shows which files directly or indirectly include this file:

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));
 

Functions

struct nft_tablealloc_nft_table (const struct handle *h)
 
struct nft_chainalloc_nft_chain (const struct handle *h)
 
struct nft_rulealloc_nft_rule (const struct handle *h)
 
struct nft_rule_expralloc_nft_expr (const char *name)
 
struct nft_setalloc_nft_set (const struct handle *h)
 
void netlink_gen_data (const struct expr *expr, struct nft_data_linearize *data)
 
void netlink_gen_raw_data (const mpz_t value, enum byteorder byteorder, unsigned int len, struct nft_data_linearize *data)
 
struct exprnetlink_alloc_value (const struct location *loc, const struct nft_data_delinearize *nld)
 
struct exprnetlink_alloc_data (const struct location *loc, const struct nft_data_delinearize *nld, enum nft_registers dreg)
 
void netlink_linearize_rule (struct netlink_ctx *ctx, struct nft_rule *nlr, const struct rule *rule)
 
struct rulenetlink_delinearize_rule (struct netlink_ctx *ctx, const struct nft_rule *r)
 
int netlink_add_rule (struct netlink_ctx *ctx, const struct handle *h, const struct rule *rule, uint32_t flags)
 
int netlink_delete_rule (struct netlink_ctx *ctx, const struct handle *h, const struct location *loc)
 
int netlink_add_rule_list (struct netlink_ctx *ctx, const struct handle *h, struct list_head *rule_list)
 
int netlink_add_rule_batch (struct netlink_ctx *ctx, const struct handle *h, const struct rule *rule, uint32_t flags)
 
int netlink_del_rule_batch (struct netlink_ctx *ctx, const struct handle *h, const struct location *loc)
 
int netlink_add_chain (struct netlink_ctx *ctx, const struct handle *h, const struct location *loc, const struct chain *chain, bool excl)
 
int netlink_rename_chain (struct netlink_ctx *ctx, const struct handle *h, const struct location *loc, const char *name)
 
int netlink_delete_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)
 
int netlink_get_chain (struct netlink_ctx *ctx, const struct handle *h, const struct location *loc)
 
int netlink_list_chain (struct netlink_ctx *ctx, const struct handle *h, const struct location *loc)
 
int netlink_flush_chain (struct netlink_ctx *ctx, const struct handle *h, const struct location *loc)
 
int netlink_add_table (struct netlink_ctx *ctx, const struct handle *h, const struct location *loc, const struct table *table, bool excl)
 
int netlink_delete_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)
 
int netlink_get_table (struct netlink_ctx *ctx, const struct handle *h, const struct location *loc)
 
int netlink_list_table (struct netlink_ctx *ctx, const struct handle *h, const struct location *loc)
 
int netlink_flush_table (struct netlink_ctx *ctx, const struct handle *h, const struct location *loc)
 
int netlink_add_set (struct netlink_ctx *ctx, const struct handle *h, struct set *set)
 
int netlink_delete_set (struct netlink_ctx *ctx, const struct handle *h, const struct location *loc)
 
int netlink_list_sets (struct netlink_ctx *ctx, const struct handle *h, const struct location *loc)
 
int netlink_get_set (struct netlink_ctx *ctx, const struct handle *h, const struct location *loc)
 
int netlink_add_setelems (struct netlink_ctx *ctx, const struct handle *h, const struct expr *expr)
 
int netlink_delete_setelems (struct netlink_ctx *ctx, const struct handle *h, const struct expr *expr)
 
int netlink_get_setelems (struct netlink_ctx *ctx, const struct handle *h, const struct location *loc, struct set *set)
 
void netlink_dump_table (struct nft_table *nlt)
 
void netlink_dump_chain (struct nft_chain *nlc)
 
void netlink_dump_rule (struct nft_rule *nlr)
 
void netlink_dump_expr (struct nft_rule_expr *nle)
 
void netlink_dump_set (struct nft_set *nls)
 
int netlink_batch_send (struct list_head *err_list)
 
void netlink_genid_get (void)
 
void netlink_restart (void)
 
void __noreturn __netlink_abi_error (const char *file, int line, const char *reason)
 
int netlink_io_error (struct netlink_ctx *ctx, const struct location *loc, const char *fmt,...)
 
void netlink_open_error (void) __noreturn
 
int netlink_flush_ruleset (struct netlink_ctx *ctx, const struct handle *h, const struct location *loc)
 
struct nft_rulesetnetlink_dump_ruleset (struct netlink_ctx *ctx, const struct handle *h, const struct location *loc)
 
int netlink_monitor (struct netlink_mon_handler *monhandler)
 
bool netlink_batch_supported (void)
 

Variables

const struct input_descriptor indesc_netlink
 
const struct location netlink_location
 

Macro Definition Documentation

#define netlink_abi_error ( )    __netlink_abi_error(__FILE__, __LINE__, strerror(errno));

Function Documentation

void __noreturn __netlink_abi_error ( const char *  file,
int  line,
const char *  reason 
)

References NFT_EXIT_FAILURE.

struct nft_rule_expr* alloc_nft_expr ( const char *  name)

References memory_allocation_error, nft_rule_expr_alloc(), and NULL.

Here is the call graph for this function:

struct nft_set* alloc_nft_set ( const struct handle h)
struct nft_table* alloc_nft_table ( const struct handle h)

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

Here is the call graph for this function:

Here is the caller graph for this function:

int netlink_add_chain ( struct netlink_ctx ctx,
const struct handle h,
const struct location loc,
const struct chain chain,
bool  excl 
)
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().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Here is the call graph for this function:

int netlink_add_set ( struct netlink_ctx ctx,
const struct handle h,
struct set set 
)
int netlink_add_setelems ( struct netlink_ctx ctx,
const struct handle h,
const struct expr expr 
)
int netlink_add_table ( struct netlink_ctx ctx,
const struct handle h,
const struct location loc,
const struct table table,
bool  excl 
)
struct expr* netlink_alloc_data ( const struct location loc,
const struct nft_data_delinearize nld,
enum nft_registers  dreg 
)

References netlink_alloc_value(), and NFT_REG_VERDICT.

Here is the call graph for this function:

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

Here is the call graph for this function:

Here is the caller graph for this function:

int netlink_batch_send ( struct list_head err_list)

References mnl_batch_talk().

Here is the call graph for this function:

bool netlink_batch_supported ( void  )

References mnl_batch_supported().

Here is the call graph for this function:

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

Here is the call graph for this function:

Here is the caller graph for this function:

int netlink_delete_chain ( struct netlink_ctx ctx,
const struct handle h,
const struct location loc 
)
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 
)
int netlink_delete_setelems ( struct netlink_ctx ctx,
const struct handle h,
const struct expr expr 
)
int netlink_delete_table ( struct netlink_ctx ctx,
const struct handle h,
const struct location loc 
)
void netlink_dump_chain ( struct nft_chain nlc)

References buf, DEBUG_NETLINK, and nft_chain_snprintf().

Here is the call graph for this function:

void netlink_dump_expr ( struct nft_rule_expr nle)

References buf, DEBUG_NETLINK, and nft_rule_expr_snprintf().

Referenced by erec_print().

Here is the call graph for this function:

Here is the caller graph for this function:

void netlink_dump_rule ( struct nft_rule nlr)

References buf, DEBUG_NETLINK, and nft_rule_snprintf().

Referenced by netlink_linearize_rule().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Here is the call graph for this function:

void netlink_dump_set ( struct nft_set nls)

References buf, DEBUG_NETLINK, and nft_set_snprintf().

Referenced by netlink_get_set(), and netlink_get_setelems().

Here is the call graph for this function:

Here is the caller graph for this function:

void netlink_dump_table ( struct nft_table nlt)

References buf, DEBUG_NETLINK, and nft_table_snprintf().

Here is the call graph for this function:

int netlink_flush_chain ( struct netlink_ctx ctx,
const struct handle h,
const struct location loc 
)

References netlink_del_rule_batch().

Here is the call graph for this function:

int netlink_flush_ruleset ( struct netlink_ctx ctx,
const struct handle h,
const struct location loc 
)
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 
)
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.

Here is the call graph for this function:

void netlink_genid_get ( void  )

References mnl_genid_get().

Here is the call graph for this function:

int netlink_get_chain ( struct netlink_ctx ctx,
const struct handle h,
const struct location loc 
)
int netlink_get_set ( struct netlink_ctx ctx,
const struct handle h,
const struct location loc 
)
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().

Here is the call graph for this function:

int netlink_io_error ( struct netlink_ctx ctx,
const struct location loc,
const char *  fmt,
  ... 
)
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().

Here is the call graph for this function:

Here is the caller graph for this function:

int netlink_list_chain ( struct netlink_ctx ctx,
const struct handle h,
const struct location loc 
)
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.

Here is the call graph for this function:

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.

Here is the call graph for this function:

int netlink_monitor ( struct netlink_mon_handler monhandler)
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 
)
void netlink_restart ( void  )

Referenced by nft_run().

Here is the caller graph for this function:

Variable Documentation

const struct input_descriptor indesc_netlink
const struct location netlink_location