netfilter
firewalling, NAT, and packet mangling for linux
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
FIB Lookup
Collaboration diagram for FIB Lookup:

Modules

 Request
 

Allocation/Freeing

struct flnl_resultflnl_result_alloc (void)
 
void flnl_result_put (struct flnl_result *res)
 

Cache Management

struct nl_cacheflnl_result_alloc_cache (void)
 Allocate lookup result cache. More...
 

Lookup

int flnl_lookup_build_request (struct flnl_request *req, int flags, struct nl_msg **result)
 Builds a netlink request message to do a lookup. More...
 
int flnl_lookup (struct nl_sock *sk, struct flnl_request *req, struct nl_cache *cache)
 Perform FIB Lookup. More...
 

Attribute Access

int flnl_result_get_table_id (struct flnl_result *res)
 
int flnl_result_get_prefixlen (struct flnl_result *res)
 
int flnl_result_get_nexthop_sel (struct flnl_result *res)
 
int flnl_result_get_type (struct flnl_result *res)
 
int flnl_result_get_scope (struct flnl_result *res)
 
int flnl_result_get_error (struct flnl_result *res)
 

Detailed Description

Function Documentation

int flnl_lookup ( struct nl_sock sk,
struct flnl_request req,
struct nl_cache cache 
)

Perform FIB Lookup.

  • sk Netlink socket.
  • req Lookup request object.
  • cache Cache for result.

Builds a netlink message to request a FIB lookup, waits for the reply and adds the result to the specified cache.

Returns
0 on success or a negative error code.

References flnl_lookup_build_request(), nl_cache_pickup(), nl_send_auto_complete(), and nlmsg_free().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

int flnl_lookup_build_request ( struct flnl_request req,
int  flags,
struct nl_msg **  result 
)

Builds a netlink request message to do a lookup.

  • req Requested match.
  • flags additional netlink message flags

Builds a new netlink message requesting a change of link attributes. The netlink message header isn't fully equipped with all relevant fields and must be sent out via nl_send_auto_complete() or supplemented as needed. old must point to a link currently configured in the kernel and tmpl must contain the attributes to be changed set via rtnl_link_set_* functions.

Returns
New netlink message
Note
Not all attributes can be changed, see Changeable Attributes for more details.

References flnl_request_get_addr(), flnl_request_get_fwmark(), flnl_request_get_scope(), flnl_request_get_table(), flnl_request_get_tos(), nl_addr_get_binary_addr(), NLE_MISSING_ATTR, NLE_MSGSIZE, NLE_NOMEM, NLMSG_ALIGNTO, nlmsg_alloc_simple(), nlmsg_append(), nlmsg_free(), RT_SCOPE_UNIVERSE, and RT_TABLE_UNSPEC.

Referenced by flnl_lookup().

Here is the call graph for this function:

Here is the caller graph for this function:

struct flnl_result* flnl_result_alloc ( void  )

References nl_object_alloc().

Here is the call graph for this function:

struct nl_cache* flnl_result_alloc_cache ( void  )

Allocate lookup result cache.

Allocates a new lookup result cache and initializes it properly.

Note
Free the memory after usage using nl_cache_destroy_and_free().
Returns
Newly allocated cache or NULL if an error occured.

References nl_cache_alloc().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

int flnl_result_get_error ( struct flnl_result res)

References flnl_result::fr_error.

int flnl_result_get_nexthop_sel ( struct flnl_result res)
int flnl_result_get_prefixlen ( struct flnl_result res)
int flnl_result_get_scope ( struct flnl_result res)

References flnl_result::fr_scope.

int flnl_result_get_table_id ( struct flnl_result res)
int flnl_result_get_type ( struct flnl_result res)

References flnl_result::fr_type.

void flnl_result_put ( struct flnl_result res)

References nl_object_put().

Here is the call graph for this function: