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

Modules

 Nexthop
 

Functions

int rtnl_route_parse (struct nlmsghdr *nlh, struct rtnl_route **result)
 
int rtnl_route_build_msg (struct nl_msg *msg, struct rtnl_route *route)
 

Allocation/Freeing

struct rtnl_routertnl_route_alloc (void)
 
void rtnl_route_get (struct rtnl_route *route)
 
void rtnl_route_put (struct rtnl_route *route)
 

Attributes

void rtnl_route_set_table (struct rtnl_route *route, uint32_t table)
 
uint32_t rtnl_route_get_table (struct rtnl_route *route)
 
void rtnl_route_set_scope (struct rtnl_route *route, uint8_t scope)
 
uint8_t rtnl_route_get_scope (struct rtnl_route *route)
 
void rtnl_route_set_tos (struct rtnl_route *route, uint8_t tos)
 
uint8_t rtnl_route_get_tos (struct rtnl_route *route)
 
void rtnl_route_set_protocol (struct rtnl_route *route, uint8_t protocol)
 
uint8_t rtnl_route_get_protocol (struct rtnl_route *route)
 
void rtnl_route_set_priority (struct rtnl_route *route, uint32_t prio)
 
uint32_t rtnl_route_get_priority (struct rtnl_route *route)
 
int rtnl_route_set_family (struct rtnl_route *route, uint8_t family)
 
uint8_t rtnl_route_get_family (struct rtnl_route *route)
 
int rtnl_route_set_dst (struct rtnl_route *route, struct nl_addr *addr)
 
struct nl_addrrtnl_route_get_dst (struct rtnl_route *route)
 
int rtnl_route_set_src (struct rtnl_route *route, struct nl_addr *addr)
 
struct nl_addrrtnl_route_get_src (struct rtnl_route *route)
 
int rtnl_route_set_type (struct rtnl_route *route, uint8_t type)
 
uint8_t rtnl_route_get_type (struct rtnl_route *route)
 
void rtnl_route_set_flags (struct rtnl_route *route, uint32_t flags)
 
void rtnl_route_unset_flags (struct rtnl_route *route, uint32_t flags)
 
uint32_t rtnl_route_get_flags (struct rtnl_route *route)
 
int rtnl_route_set_metric (struct rtnl_route *route, int metric, uint32_t value)
 
int rtnl_route_unset_metric (struct rtnl_route *route, int metric)
 
int rtnl_route_get_metric (struct rtnl_route *route, int metric, uint32_t *value)
 
int rtnl_route_set_pref_src (struct rtnl_route *route, struct nl_addr *addr)
 
struct nl_addrrtnl_route_get_pref_src (struct rtnl_route *route)
 
void rtnl_route_set_iif (struct rtnl_route *route, int ifindex)
 
int rtnl_route_get_iif (struct rtnl_route *route)
 
void rtnl_route_add_nexthop (struct rtnl_route *route, struct rtnl_nexthop *nh)
 
void rtnl_route_remove_nexthop (struct rtnl_route *route, struct rtnl_nexthop *nh)
 
struct nl_list_headrtnl_route_get_nexthops (struct rtnl_route *route)
 
int rtnl_route_get_nnexthops (struct rtnl_route *route)
 
void rtnl_route_foreach_nexthop (struct rtnl_route *r, void(*cb)(struct rtnl_nexthop *, void *), void *arg)
 
struct rtnl_nexthoprtnl_route_nexthop_n (struct rtnl_route *r, int n)
 

Utilities

int rtnl_route_guess_scope (struct rtnl_route *route)
 Guess scope of a route object. More...
 

Detailed Description

Attributes
Name Default
-------------------------------------------------------------
tos 0
protocol RTPROT_STATIC
prio 0
family AF_UNSPEC
iif NULL

Function Documentation

void rtnl_route_add_nexthop ( struct rtnl_route route,
struct rtnl_nexthop nh 
)

References rtnl_route::rt_nexthops, rtnl_route::rt_nr_nh, and rtnl_nexthop::rtnh_list.

Referenced by nl_cli_route_parse_nexthop(), and rtnl_route_parse().

Here is the caller graph for this function:

struct rtnl_route* rtnl_route_alloc ( void  )

References nl_object_alloc(), and route_obj_ops.

Referenced by nl_cli_route_alloc(), and rtnl_route_parse().

Here is the call graph for this function:

Here is the caller graph for this function:

void rtnl_route_foreach_nexthop ( struct rtnl_route r,
void(*)(struct rtnl_nexthop *, void *)  cb,
void *  arg 
)
void rtnl_route_get ( struct rtnl_route route)

References nl_object_get().

Here is the call graph for this function:

struct nl_addr* rtnl_route_get_dst ( struct rtnl_route route)

References rtnl_route::rt_dst.

uint8_t rtnl_route_get_family ( struct rtnl_route route)

References rtnl_route::rt_family.

Referenced by nl_cli_route_parse_dst(), nl_cli_route_parse_nexthop(), nl_cli_route_parse_pref_src(), and nl_cli_route_parse_src().

Here is the caller graph for this function:

uint32_t rtnl_route_get_flags ( struct rtnl_route route)

References rtnl_route::rt_flags.

int rtnl_route_get_iif ( struct rtnl_route route)

References rtnl_route::rt_iif.

int rtnl_route_get_metric ( struct rtnl_route route,
int  metric,
uint32_t *  value 
)

References NLE_OBJ_NOTFOUND, NLE_RANGE, rtnl_route::rt_metrics, and rtnl_route::rt_metrics_mask.

Referenced by rtnl_route_build_msg().

Here is the caller graph for this function:

struct nl_list_head* rtnl_route_get_nexthops ( struct rtnl_route route)
int rtnl_route_get_nnexthops ( struct rtnl_route route)

References rtnl_route::rt_nr_nh.

Referenced by rtnl_route_build_msg().

Here is the caller graph for this function:

struct nl_addr* rtnl_route_get_pref_src ( struct rtnl_route route)
uint32_t rtnl_route_get_priority ( struct rtnl_route route)

References rtnl_route::rt_prio.

uint8_t rtnl_route_get_protocol ( struct rtnl_route route)
uint8_t rtnl_route_get_scope ( struct rtnl_route route)

References rtnl_route::rt_scope.

struct nl_addr* rtnl_route_get_src ( struct rtnl_route route)

References rtnl_route::rt_src.

uint32_t rtnl_route_get_table ( struct rtnl_route route)

References rtnl_route::rt_table.

uint8_t rtnl_route_get_tos ( struct rtnl_route route)

References rtnl_route::rt_tos.

uint8_t rtnl_route_get_type ( struct rtnl_route route)

References rtnl_route::rt_type.

int rtnl_route_guess_scope ( struct rtnl_route route)

Guess scope of a route object.

  • route Route object.

Guesses the scope of a route object, based on the following rules:

1 1) Local route -> local scope
2 2) At least one nexthop not directly connected -> universe scope
3 3) All others -> link scope
Returns
Scope value.

References nl_list_for_each_entry, rtnl_route::rt_nexthops, RT_SCOPE_HOST, RT_SCOPE_LINK, RT_SCOPE_UNIVERSE, rtnl_route::rt_type, RTN_LOCAL, rtnl_nexthop::rtnh_gateway, and rtnl_nexthop::rtnh_list.

Referenced by rtnl_route_build_msg().

Here is the caller graph for this function:

void rtnl_route_put ( struct rtnl_route route)

References nl_object_put().

Referenced by rtnl_route_parse().

Here is the call graph for this function:

Here is the caller graph for this function:

void rtnl_route_remove_nexthop ( struct rtnl_route route,
struct rtnl_nexthop nh 
)
int rtnl_route_set_dst ( struct rtnl_route route,
struct nl_addr addr 
)

References nl_addr::a_family, nl_addr_get(), nl_addr_put(), NLE_AF_MISMATCH, rtnl_route::rt_dst, and rtnl_route::rt_family.

Referenced by nl_cli_route_parse_dst(), and rtnl_route_parse().

Here is the call graph for this function:

Here is the caller graph for this function:

int rtnl_route_set_family ( struct rtnl_route route,
uint8_t  family 
)

References NLE_AF_NOSUPPORT, and rtnl_route::rt_family.

Referenced by nl_cli_route_parse_family().

Here is the caller graph for this function:

void rtnl_route_set_flags ( struct rtnl_route route,
uint32_t  flags 
)
void rtnl_route_set_iif ( struct rtnl_route route,
int  ifindex 
)

References rtnl_route::rt_iif.

Referenced by nl_cli_route_parse_iif(), and rtnl_route_parse().

Here is the caller graph for this function:

int rtnl_route_set_metric ( struct rtnl_route route,
int  metric,
uint32_t  value 
)

References NLE_RANGE, rtnl_route::rt_metrics, rtnl_route::rt_metrics_mask, rtnl_route::rt_nmetrics, and value.

Referenced by rtnl_route_parse().

Here is the caller graph for this function:

int rtnl_route_set_pref_src ( struct rtnl_route route,
struct nl_addr addr 
)

References nl_addr::a_family, nl_addr_get(), nl_addr_put(), NLE_AF_MISMATCH, rtnl_route::rt_family, and rtnl_route::rt_pref_src.

Referenced by nl_cli_route_parse_pref_src(), and rtnl_route_parse().

Here is the call graph for this function:

Here is the caller graph for this function:

void rtnl_route_set_priority ( struct rtnl_route route,
uint32_t  prio 
)

References rtnl_route::rt_prio.

Referenced by nl_cli_route_parse_prio(), and rtnl_route_parse().

Here is the caller graph for this function:

void rtnl_route_set_protocol ( struct rtnl_route route,
uint8_t  protocol 
)

References rtnl_route::rt_protocol.

Referenced by nl_cli_route_parse_protocol().

Here is the caller graph for this function:

void rtnl_route_set_scope ( struct rtnl_route route,
uint8_t  scope 
)

References rtnl_route::rt_scope.

Referenced by nl_cli_route_parse_scope().

Here is the caller graph for this function:

int rtnl_route_set_src ( struct rtnl_route route,
struct nl_addr addr 
)

References nl_addr::a_family, nl_addr_get(), nl_addr_put(), NLE_AF_MISMATCH, NLE_SRCRT_NOSUPPORT, rtnl_route::rt_family, and rtnl_route::rt_src.

Referenced by nl_cli_route_parse_src(), and rtnl_route_parse().

Here is the call graph for this function:

Here is the caller graph for this function:

void rtnl_route_set_table ( struct rtnl_route route,
uint32_t  table 
)

References rtnl_route::rt_table.

Referenced by nl_cli_route_parse_table().

Here is the caller graph for this function:

void rtnl_route_set_tos ( struct rtnl_route route,
uint8_t  tos 
)

References rtnl_route::rt_tos.

int rtnl_route_set_type ( struct rtnl_route route,
uint8_t  type 
)

References NLE_RANGE, rtnl_route::rt_type, RTN_MAX, and type.

Referenced by nl_cli_route_parse_type().

Here is the caller graph for this function:

void rtnl_route_unset_flags ( struct rtnl_route route,
uint32_t  flags 
)
int rtnl_route_unset_metric ( struct rtnl_route route,
int  metric 
)