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 <netlink-local.h>
#include <netlink/netlink.h>
#include <netlink/utils.h>
#include <netlink/route/rtnl.h>
#include <netlink/route/rule.h>
#include <inttypes.h>
Include dependency graph for rule.c:

Macros

#define RULE_DIFF(ATTR, EXPR)   ATTR_DIFF(attrs, RULE_ATTR_##ATTR, a, b, EXPR)
 

Functions

Allocation/Freeing
struct rtnl_rulertnl_rule_alloc (void)
 
void rtnl_rule_put (struct rtnl_rule *rule)
 
Cache Management
int rtnl_rule_alloc_cache (struct nl_sock *sock, int family, struct nl_cache **result)
 Build a rule cache including all rules currently configured in the kernel. More...
 
Rule Addition
int rtnl_rule_build_add_request (struct rtnl_rule *tmpl, int flags, struct nl_msg **result)
 Build netlink request message to add a new rule. More...
 
int rtnl_rule_add (struct nl_sock *sk, struct rtnl_rule *tmpl, int flags)
 Add a new rule. More...
 
Rule Deletion
int rtnl_rule_build_delete_request (struct rtnl_rule *rule, int flags, struct nl_msg **result)
 Build a netlink request message to delete a rule. More...
 
int rtnl_rule_delete (struct nl_sock *sk, struct rtnl_rule *rule, int flags)
 Delete a rule. More...
 
Attribute Modification
void rtnl_rule_set_family (struct rtnl_rule *rule, int family)
 
int rtnl_rule_get_family (struct rtnl_rule *rule)
 
void rtnl_rule_set_prio (struct rtnl_rule *rule, int prio)
 
int rtnl_rule_get_prio (struct rtnl_rule *rule)
 
void rtnl_rule_set_mark (struct rtnl_rule *rule, uint64_t mark)
 
uint64_t rtnl_rule_get_mark (struct rtnl_rule *rule)
 
void rtnl_rule_set_table (struct rtnl_rule *rule, int table)
 
int rtnl_rule_get_table (struct rtnl_rule *rule)
 
void rtnl_rule_set_dsfield (struct rtnl_rule *rule, int dsfield)
 
int rtnl_rule_get_dsfield (struct rtnl_rule *rule)
 
void rtnl_rule_set_src_len (struct rtnl_rule *rule, int len)
 
int rtnl_rule_get_src_len (struct rtnl_rule *rule)
 
void rtnl_rule_set_dst_len (struct rtnl_rule *rule, int len)
 
int rtnl_rule_get_dst_len (struct rtnl_rule *rule)
 
int rtnl_rule_set_src (struct rtnl_rule *rule, struct nl_addr *src)
 
struct nl_addrrtnl_rule_get_src (struct rtnl_rule *rule)
 
int rtnl_rule_set_dst (struct rtnl_rule *rule, struct nl_addr *dst)
 
struct nl_addrrtnl_rule_get_dst (struct rtnl_rule *rule)
 
int rtnl_rule_set_iif (struct rtnl_rule *rule, const char *dev)
 
char * rtnl_rule_get_iif (struct rtnl_rule *rule)
 
void rtnl_rule_set_action (struct rtnl_rule *rule, int type)
 
int rtnl_rule_get_action (struct rtnl_rule *rule)
 
void rtnl_rule_set_realms (struct rtnl_rule *rule, uint32_t realms)
 
uint32_t rtnl_rule_get_realms (struct rtnl_rule *rule)
 

Macro Definition Documentation

#define RULE_DIFF (   ATTR,
  EXPR 
)    ATTR_DIFF(attrs, RULE_ATTR_##ATTR, a, b, EXPR)