netfilter
firewalling, NAT, and packet mangling for linux
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
rule.c File Reference
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <inttypes.h>
#include <errno.h>
#include <statement.h>
#include <rule.h>
#include <utils.h>
#include <netlink.h>
#include <libnftnl/common.h>
#include <libnftnl/ruleset.h>
#include <netinet/ip.h>
#include <linux/netfilter.h>
#include <linux/netfilter_arp.h>
Include dependency graph for rule.c:

Data Structures

struct  print_fmt_options
 

Functions

void handle_free (struct handle *h)
 
void handle_merge (struct handle *dst, const struct handle *src)
 
struct setset_alloc (const struct location *loc)
 
struct setset_get (struct set *set)
 
void set_free (struct set *set)
 
void set_add_hash (struct set *set, struct table *table)
 
struct setset_lookup (const struct table *table, const char *name)
 
struct setset_lookup_global (uint32_t family, const char *table, const char *name)
 
void set_print (const struct set *s)
 
void set_print_plain (const struct set *s)
 
struct rulerule_alloc (const struct location *loc, const struct handle *h)
 
void rule_free (struct rule *rule)
 
void rule_print (const struct rule *rule)
 
struct scopescope_init (struct scope *scope, const struct scope *parent)
 
void scope_release (const struct scope *scope)
 
void symbol_bind (struct scope *scope, const char *identifier, struct expr *expr)
 
struct symbolsymbol_lookup (const struct scope *scope, const char *identifier)
 
const char * chain_type_name_lookup (const char *name)
 
const char * chain_hookname_lookup (const char *name)
 
struct chainchain_alloc (const char *name)
 
void chain_free (struct chain *chain)
 
void chain_add_hash (struct chain *chain, struct table *table)
 
struct chainchain_lookup (const struct table *table, const struct handle *h)
 
const char * family2str (unsigned int family)
 
void chain_print_plain (const struct chain *chain)
 
struct tabletable_alloc (void)
 
void table_free (struct table *table)
 
void table_add_hash (struct table *table)
 
struct tabletable_lookup (const struct handle *h)
 
struct cmdcmd_alloc (enum cmd_ops op, enum cmd_obj obj, const struct handle *h, const struct location *loc, void *data)
 
struct exportexport_alloc (uint32_t format)
 
void export_free (struct export *e)
 
struct monitormonitor_alloc (uint32_t format, uint32_t type, const char *event)
 
void monitor_free (struct monitor *m)
 
void cmd_free (struct cmd *cmd)
 
int do_command (struct netlink_ctx *ctx, struct cmd *cmd)
 
struct error_recordrule_postprocess (struct rule *rule)
 

Function Documentation

void chain_add_hash ( struct chain chain,
struct table table 
)

References table::chains, and chain::list.

struct chain* chain_alloc ( const char *  name)

References handle::chain, chain::chain, chain::handle, NULL, chain::rules, chain::scope, scope::symbols, xstrdup(), and xzalloc().

Here is the call graph for this function:

void chain_free ( struct chain chain)

References chain::handle, handle_free(), rule::list, list_for_each_entry_safe, rule_free(), chain::rules, chain::scope, scope_release(), and xfree.

Referenced by cmd_free(), and table_free().

Here is the call graph for this function:

Here is the caller graph for this function:

const char* chain_hookname_lookup ( const char *  name)

References NULL.

struct chain* chain_lookup ( const struct table table,
const struct handle h 
)

References handle::chain, chain::chain, table::chains, chain::handle, chain::list, list_for_each_entry, and NULL.

Here is the call graph for this function:

void chain_print_plain ( const struct chain chain)
const char* chain_type_name_lookup ( const char *  name)

References NULL.

struct cmd* cmd_alloc ( enum cmd_ops  op,
enum cmd_obj  obj,
const struct handle h,
const struct location loc,
void *  data 
)

References cmd::data, data, cmd::handle, cmd::list, cmd::location, cmd::obj, cmd::op, and xzalloc().

Here is the call graph for this function:

struct export* export_alloc ( uint32_t  format)

References format(), export::format, and xmalloc().

Here is the call graph for this function:

void export_free ( struct export e)

References xfree.

Referenced by cmd_free().

Here is the caller graph for this function:

const char* family2str ( unsigned int  family)

References NFPROTO_ARP, NFPROTO_BRIDGE, NFPROTO_INET, NFPROTO_IPV4, and NFPROTO_IPV6.

Referenced by chain_print_plain(), and set_print_plain().

Here is the caller graph for this function:

void handle_free ( struct handle h)

References handle::chain, handle::comment, handle::set, handle::table, and xfree.

Referenced by chain_free(), cmd_free(), rule_free(), set_free(), and table_free().

Here is the caller graph for this function:

void handle_merge ( struct handle dst,
const struct handle src 
)

References handle::chain, handle::comment, handle::family, handle::handle, NULL, handle::position, handle::set, handle::table, and xstrdup().

Here is the call graph for this function:

struct monitor* monitor_alloc ( uint32_t  format,
uint32_t  type,
const char *  event 
)

References monitor::event, monitor::flags, format(), monitor::format, monitor::type, type, and xmalloc().

Here is the call graph for this function:

void monitor_free ( struct monitor m)

References xfree.

Referenced by cmd_free().

Here is the caller graph for this function:

struct rule* rule_alloc ( const struct location loc,
const struct handle h 
)

References rule::handle, rule::list, rule::location, NULL, rule::stmts, and xzalloc().

Referenced by netlink_delinearize_rule().

Here is the call graph for this function:

Here is the caller graph for this function:

void rule_free ( struct rule rule)

References rule::handle, handle_free(), stmt_list_free(), rule::stmts, and xfree.

Referenced by chain_free(), and cmd_free().

Here is the call graph for this function:

Here is the caller graph for this function:

struct error_record* rule_postprocess ( struct rule rule)

References NULL.

void rule_print ( const struct rule rule)

References handle::handle, rule::handle, handle_output, stmt::list, list_for_each_entry, stmt::ops, stmt_ops::print, and rule::stmts.

Here is the call graph for this function:

struct scope* scope_init ( struct scope scope,
const struct scope parent 
)

References scope::parent.

void scope_release ( const struct scope scope)

References symbol::expr, expr_free(), symbol::identifier, symbol::list, list_for_each_entry_safe, scope::symbols, and xfree.

Referenced by chain_free(), and table_free().

Here is the call graph for this function:

Here is the caller graph for this function:

void set_add_hash ( struct set set,
struct table table 
)

References set::list, and table::sets.

struct set* set_alloc ( const struct location loc)

References set::location, NULL, set::refcnt, and xzalloc().

Here is the call graph for this function:

void set_free ( struct set set)

References expr_free(), set::handle, handle_free(), set::init, NULL, set::refcnt, and xfree.

Referenced by cmd_free().

Here is the call graph for this function:

Here is the caller graph for this function:

struct set* set_get ( struct set set)

References set::refcnt.

Referenced by set_ref_expr_alloc().

Here is the caller graph for this function:

struct set* set_lookup ( const struct table table,
const char *  name 
)

References set::handle, set::list, list_for_each_entry, NULL, handle::set, and table::sets.

Referenced by set_lookup_global().

Here is the caller graph for this function:

struct set* set_lookup_global ( uint32_t  family,
const char *  table,
const char *  name 
)

References handle::family, NULL, set_lookup(), handle::table, and table_lookup().

Here is the call graph for this function:

void set_print ( const struct set s)
void set_print_plain ( const struct set s)

References handle::family, family2str(), set::handle, print_fmt_options::tab, and handle::table.

Here is the call graph for this function:

void symbol_bind ( struct scope scope,
const char *  identifier,
struct expr expr 
)

References symbol::expr, symbol::identifier, symbol::list, scope::symbols, xstrdup(), and xzalloc().

Here is the call graph for this function:

struct symbol* symbol_lookup ( const struct scope scope,
const char *  identifier 
)
void table_add_hash ( struct table table)

References table::list.

struct table* table_alloc ( void  )

References table::chains, table::scope, table::sets, scope::symbols, and xzalloc().

Here is the call graph for this function:

void table_free ( struct table table)

References chain::chain, chain_free(), table::chains, table::handle, handle_free(), chain::list, list_for_each_entry_safe, table::scope, scope_release(), and xfree.

Referenced by cmd_free().

Here is the call graph for this function:

Here is the caller graph for this function:

struct table* table_lookup ( const struct handle h)

References handle::family, table::handle, table::list, list_for_each_entry, NULL, and handle::table.

Referenced by netlink_delinearize_rule(), and set_lookup_global().

Here is the caller graph for this function: