netfilter
firewalling, NAT, and packet mangling for linux
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
chain.c File Reference
#include "internal.h"
#include <time.h>
#include <endian.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <string.h>
#include <netinet/in.h>
#include <errno.h>
#include <inttypes.h>
#include <libmnl/libmnl.h>
#include <linux/netfilter/nfnetlink.h>
#include <linux/netfilter/nf_tables.h>
#include <linux/netfilter.h>
#include <linux/netfilter_arp.h>
#include <libnftnl/chain.h>
#include <buffer.h>
Include dependency graph for chain.c:

Data Structures

struct  nft_chain
 
struct  nft_chain_list
 
struct  nft_chain_list_iter
 

Functions

struct nft_chainnft_chain_alloc (void)
 
 EXPORT_SYMBOL (nft_chain_alloc)
 
void nft_chain_free (struct nft_chain *c)
 
 EXPORT_SYMBOL (nft_chain_free)
 
bool nft_chain_attr_is_set (const struct nft_chain *c, uint16_t attr)
 
 EXPORT_SYMBOL (nft_chain_attr_is_set)
 
void nft_chain_attr_unset (struct nft_chain *c, uint16_t attr)
 
 EXPORT_SYMBOL (nft_chain_attr_unset)
 
void nft_chain_attr_set_data (struct nft_chain *c, uint16_t attr, const void *data, uint32_t data_len)
 
 EXPORT_SYMBOL (nft_chain_attr_set_data)
 
void nft_chain_attr_set (struct nft_chain *c, uint16_t attr, const void *data)
 
 EXPORT_SYMBOL (nft_chain_attr_set)
 
void nft_chain_attr_set_u32 (struct nft_chain *c, uint16_t attr, uint32_t data)
 
 EXPORT_SYMBOL (nft_chain_attr_set_u32)
 
void nft_chain_attr_set_s32 (struct nft_chain *c, uint16_t attr, int32_t data)
 
 EXPORT_SYMBOL (nft_chain_attr_set_s32)
 
void nft_chain_attr_set_u64 (struct nft_chain *c, uint16_t attr, uint64_t data)
 
 EXPORT_SYMBOL (nft_chain_attr_set_u64)
 
void nft_chain_attr_set_u8 (struct nft_chain *c, uint16_t attr, uint8_t data)
 
 EXPORT_SYMBOL (nft_chain_attr_set_u8)
 
void nft_chain_attr_set_str (struct nft_chain *c, uint16_t attr, const char *str)
 
 EXPORT_SYMBOL (nft_chain_attr_set_str)
 
const void * nft_chain_attr_get_data (struct nft_chain *c, uint16_t attr, uint32_t *data_len)
 
 EXPORT_SYMBOL (nft_chain_attr_get_data)
 
const void * nft_chain_attr_get (struct nft_chain *c, uint16_t attr)
 
 EXPORT_SYMBOL (nft_chain_attr_get)
 
const char * nft_chain_attr_get_str (struct nft_chain *c, uint16_t attr)
 
 EXPORT_SYMBOL (nft_chain_attr_get_str)
 
uint32_t nft_chain_attr_get_u32 (struct nft_chain *c, uint16_t attr)
 
 EXPORT_SYMBOL (nft_chain_attr_get_u32)
 
int32_t nft_chain_attr_get_s32 (struct nft_chain *c, uint16_t attr)
 
 EXPORT_SYMBOL (nft_chain_attr_get_s32)
 
uint64_t nft_chain_attr_get_u64 (struct nft_chain *c, uint16_t attr)
 
 EXPORT_SYMBOL (nft_chain_attr_get_u64)
 
uint8_t nft_chain_attr_get_u8 (struct nft_chain *c, uint16_t attr)
 
 EXPORT_SYMBOL (nft_chain_attr_get_u8)
 
void nft_chain_nlmsg_build_payload (struct nlmsghdr *nlh, const struct nft_chain *c)
 
 EXPORT_SYMBOL (nft_chain_nlmsg_build_payload)
 
int nft_chain_nlmsg_parse (const struct nlmsghdr *nlh, struct nft_chain *c)
 
 EXPORT_SYMBOL (nft_chain_nlmsg_parse)
 
int nft_chain_parse (struct nft_chain *c, enum nft_parse_type type, const char *data, struct nft_parse_err *err)
 
 EXPORT_SYMBOL (nft_chain_parse)
 
int nft_chain_parse_file (struct nft_chain *c, enum nft_parse_type type, FILE *fp, struct nft_parse_err *err)
 
 EXPORT_SYMBOL (nft_chain_parse_file)
 
int nft_chain_snprintf (char *buf, size_t size, struct nft_chain *c, uint32_t type, uint32_t flags)
 
 EXPORT_SYMBOL (nft_chain_snprintf)
 
int nft_chain_fprintf (FILE *fp, struct nft_chain *c, uint32_t type, uint32_t flags)
 
 EXPORT_SYMBOL (nft_chain_fprintf)
 
struct nft_chain_listnft_chain_list_alloc (void)
 
 EXPORT_SYMBOL (nft_chain_list_alloc)
 
void nft_chain_list_free (struct nft_chain_list *list)
 
 EXPORT_SYMBOL (nft_chain_list_free)
 
int nft_chain_list_is_empty (struct nft_chain_list *list)
 
 EXPORT_SYMBOL (nft_chain_list_is_empty)
 
void nft_chain_list_add (struct nft_chain *r, struct nft_chain_list *list)
 
 EXPORT_SYMBOL (nft_chain_list_add)
 
void nft_chain_list_add_tail (struct nft_chain *r, struct nft_chain_list *list)
 
 EXPORT_SYMBOL (nft_chain_list_add_tail)
 
void nft_chain_list_del (struct nft_chain *r)
 
 EXPORT_SYMBOL (nft_chain_list_del)
 
int nft_chain_list_foreach (struct nft_chain_list *chain_list, int(*cb)(struct nft_chain *r, void *data), void *data)
 
 EXPORT_SYMBOL (nft_chain_list_foreach)
 
struct nft_chain_list_iternft_chain_list_iter_create (struct nft_chain_list *l)
 
 EXPORT_SYMBOL (nft_chain_list_iter_create)
 
struct nft_chainnft_chain_list_iter_next (struct nft_chain_list_iter *iter)
 
 EXPORT_SYMBOL (nft_chain_list_iter_next)
 
void nft_chain_list_iter_destroy (struct nft_chain_list_iter *iter)
 
 EXPORT_SYMBOL (nft_chain_list_iter_destroy)
 

Function Documentation

EXPORT_SYMBOL ( nft_chain_alloc  )
EXPORT_SYMBOL ( nft_chain_free  )
EXPORT_SYMBOL ( nft_chain_attr_is_set  )
EXPORT_SYMBOL ( nft_chain_attr_unset  )
EXPORT_SYMBOL ( nft_chain_attr_set_data  )
EXPORT_SYMBOL ( nft_chain_attr_set  )
EXPORT_SYMBOL ( nft_chain_attr_set_u32  )
EXPORT_SYMBOL ( nft_chain_attr_set_s32  )
EXPORT_SYMBOL ( nft_chain_attr_set_u64  )
EXPORT_SYMBOL ( nft_chain_attr_set_u8  )
EXPORT_SYMBOL ( nft_chain_attr_set_str  )
EXPORT_SYMBOL ( nft_chain_attr_get_data  )
EXPORT_SYMBOL ( nft_chain_attr_get  )
EXPORT_SYMBOL ( nft_chain_attr_get_str  )
EXPORT_SYMBOL ( nft_chain_attr_get_u32  )
EXPORT_SYMBOL ( nft_chain_attr_get_s32  )
EXPORT_SYMBOL ( nft_chain_attr_get_u64  )
EXPORT_SYMBOL ( nft_chain_attr_get_u8  )
EXPORT_SYMBOL ( nft_chain_nlmsg_build_payload  )
EXPORT_SYMBOL ( nft_chain_nlmsg_parse  )
EXPORT_SYMBOL ( nft_chain_parse  )
EXPORT_SYMBOL ( nft_chain_parse_file  )
EXPORT_SYMBOL ( nft_chain_snprintf  )
EXPORT_SYMBOL ( nft_chain_fprintf  )
EXPORT_SYMBOL ( nft_chain_list_alloc  )
EXPORT_SYMBOL ( nft_chain_list_free  )
EXPORT_SYMBOL ( nft_chain_list_is_empty  )
EXPORT_SYMBOL ( nft_chain_list_add  )
EXPORT_SYMBOL ( nft_chain_list_add_tail  )
EXPORT_SYMBOL ( nft_chain_list_del  )
EXPORT_SYMBOL ( nft_chain_list_foreach  )
EXPORT_SYMBOL ( nft_chain_list_iter_create  )
EXPORT_SYMBOL ( nft_chain_list_iter_next  )
EXPORT_SYMBOL ( nft_chain_list_iter_destroy  )
struct nft_chain* nft_chain_alloc ( void  )

Referenced by alloc_nft_chain(), nft_chain_user_add(), and nft_chain_user_rename().

Here is the caller graph for this function:

const void* nft_chain_attr_get ( struct nft_chain c,
uint16_t  attr 
)

References nft_chain_attr_get_data().

Referenced by nft_chain_attr_get_str(), nft_chain_zero_counters(), nft_rule_list(), and nft_xtables_config_load().

Here is the call graph for this function:

Here is the caller graph for this function:

int32_t nft_chain_attr_get_s32 ( struct nft_chain c,
uint16_t  attr 
)

References nft_assert, and nft_chain_attr_get_data().

Here is the call graph for this function:

const char* nft_chain_attr_get_str ( struct nft_chain c,
uint16_t  attr 
)

References nft_chain_attr_get().

Referenced by nft_chain_list_find(), nft_chain_save(), nft_chain_user_del(), nft_rule_flush(), nft_rule_list(), nft_rule_list_save(), and nft_table_purge_chains().

Here is the call graph for this function:

Here is the caller graph for this function:

uint32_t nft_chain_attr_get_u32 ( struct nft_chain c,
uint16_t  attr 
)

References nft_assert, and nft_chain_attr_get_data().

Referenced by mnl_nft_chain_add(), mnl_nft_chain_batch_add(), mnl_nft_chain_batch_del(), mnl_nft_chain_delete(), mnl_nft_chain_get(), nft_rule_list(), and nft_xtables_config_load().

Here is the call graph for this function:

Here is the caller graph for this function:

uint64_t nft_chain_attr_get_u64 ( struct nft_chain c,
uint16_t  attr 
)

References nft_assert, and nft_chain_attr_get_data().

Referenced by nft_chain_user_rename(), and nft_rule_list().

Here is the call graph for this function:

Here is the caller graph for this function:

uint8_t nft_chain_attr_get_u8 ( struct nft_chain c,
uint16_t  attr 
)

References nft_assert, and nft_chain_attr_get_data().

Here is the call graph for this function:

bool nft_chain_attr_is_set ( const struct nft_chain c,
uint16_t  attr 
)

References nft_chain::flags.

void nft_chain_attr_set ( struct nft_chain c,
uint16_t  attr,
const void *  data 
)

References nft_chain_attr_set_data().

Referenced by nft_chain_user_add(), and nft_chain_user_rename().

Here is the call graph for this function:

Here is the caller graph for this function:

void nft_chain_attr_set_s32 ( struct nft_chain c,
uint16_t  attr,
int32_t  data 
)

References nft_chain_attr_set_data().

Here is the call graph for this function:

void nft_chain_attr_set_str ( struct nft_chain c,
uint16_t  attr,
const char *  str 
)

References nft_chain_attr_set_data().

Referenced by alloc_nft_chain().

Here is the call graph for this function:

Here is the caller graph for this function:

void nft_chain_attr_set_u32 ( struct nft_chain c,
uint16_t  attr,
uint32_t  data 
)

References nft_chain_attr_set_data().

Referenced by alloc_nft_chain().

Here is the call graph for this function:

Here is the caller graph for this function:

void nft_chain_attr_set_u64 ( struct nft_chain c,
uint16_t  attr,
uint64_t  data 
)

References nft_chain_attr_set_data().

Referenced by alloc_nft_chain(), nft_chain_user_rename(), and nft_chain_zero_counters().

Here is the call graph for this function:

Here is the caller graph for this function:

void nft_chain_attr_set_u8 ( struct nft_chain c,
uint16_t  attr,
uint8_t  data 
)

References nft_chain_attr_set_data().

Here is the call graph for this function:

int nft_chain_fprintf ( FILE *  fp,
struct nft_chain c,
uint32_t  type,
uint32_t  flags 
)

References nft_fprintf().

Here is the call graph for this function:

void nft_chain_free ( struct nft_chain c)

References NULL, nft_chain::table, nft_chain::type, and xfree.

Referenced by netlink_get_chain(), nft_chain_add(), nft_chain_list_free(), nft_chain_user_add(), and nft_chain_user_rename().

Here is the caller graph for this function:

void nft_chain_list_add ( struct nft_chain r,
struct nft_chain_list list 
)
void nft_chain_list_add_tail ( struct nft_chain r,
struct nft_chain_list list 
)
struct nft_chain_list* nft_chain_list_alloc ( void  )

References INIT_LIST_HEAD, nft_chain_list::list, and NULL.

Referenced by mnl_chain_dump(), mnl_nft_chain_dump(), and nft_xtables_config_load().

Here is the caller graph for this function:

void nft_chain_list_del ( struct nft_chain r)

References nft_chain::head.

int nft_chain_list_foreach ( struct nft_chain_list chain_list,
int(*)(struct nft_chain *r, void *data cb,
void *  data 
)
int nft_chain_list_is_empty ( struct nft_chain_list list)

References nft_chain_list::list.

Referenced by nft_ruleset_fprintf().

Here is the caller graph for this function:

int nft_chain_parse ( struct nft_chain c,
enum nft_parse_type  type,
const char *  data,
struct nft_parse_err err 
)

References NFT_PARSE_BUFFER.

int nft_chain_parse_file ( struct nft_chain c,
enum nft_parse_type  type,
FILE *  fp,
struct nft_parse_err err 
)

References NFT_PARSE_FILE.

int nft_chain_snprintf ( char *  buf,
size_t  size,
struct nft_chain c,
uint32_t  type,
uint32_t  flags 
)

References nft_event_footer_snprintf(), nft_event_header_snprintf(), NFT_OUTPUT_DEFAULT, NFT_OUTPUT_JSON, NFT_OUTPUT_XML, size, and SNPRINTF_BUFFER_SIZE.

Referenced by netlink_dump_chain(), and nft_chain_add().

Here is the call graph for this function:

Here is the caller graph for this function: