Modules | |
Nexthop | |
Routing Table Identifier Translations | |
char * | rtnl_route_table2str (int table, char *buf, size_t size) |
Convert routing table identifier to character string. | |
int | rtnl_route_str2table (const char *name) |
Convert character string to routing table identifier. | |
Routing Protocol Translations | |
char * | rtnl_route_proto2str (int proto, char *buf, size_t size) |
Convert routing protocol identifier to character string. | |
int | rtnl_route_str2proto (const char *name) |
Convert character string to routing protocol identifier. | |
Routing Metrices Translations | |
char * | rtnl_route_metric2str (int metric, char *buf, size_t size) |
Convert routing metric identifier to character string. | |
int | rtnl_route_str2metric (const char *name) |
Convert character string to routing metric identifier. | |
Nexthop Flags Translations | |
char * | rtnl_route_nh_flags2str (int flags, char *buf, size_t len) |
Convert nexthop flags to a character string. | |
int | rtnl_route_nh_str2flags (const char *name) |
Convert a character string to a nexthop flag. | |
Route Object Allocation/Freeage | |
rtnl_route * | rtnl_route_alloc (void) |
Allocate a new route object. | |
void | rtnl_route_free (struct rtnl_route *route) |
Free route object. | |
Route Object Reference Counting | |
void | rtnl_route_get (struct rtnl_route *route) |
void | rtnl_route_put (struct rtnl_route *route) |
Route Cache Management | |
nl_cache * | rtnl_route_alloc_cache (struct nl_handle *handle) |
Build a route cache holding all routes currently configured in the kernel. | |
Route Addition | |
nl_msg * | rtnl_route_build_add_request (struct rtnl_route *tmpl, int flags) |
Build netlink request message to add a new route. | |
Attribute: Routing Table | |
void | rtnl_route_set_table (struct rtnl_route *route, int table) |
Set the table of a route to the specified value. | |
int | rtnl_route_get_table (struct rtnl_route *route) |
Get the table of a route. | |
Attribute: Scope | |
void | rtnl_route_set_scope (struct rtnl_route *route, int scope) |
Set the scope of a route to the specified value. | |
int | rtnl_route_get_scope (struct rtnl_route *route) |
Get the scope of a route. | |
Attribute: Type Of Service | |
void | rtnl_route_set_tos (struct rtnl_route *route, int tos) |
Set the TOS of a route to the specified value. | |
int | rtnl_route_get_tos (struct rtnl_route *route) |
Get the TOS of a route. | |
Attribute: Realm | |
void | rtnl_route_set_realms (struct rtnl_route *route, realm_t realms) |
Set the realms of a route to the specified value. | |
realm_t | rtnl_route_get_realms (struct rtnl_route *route) |
Get realms of route object. | |
Attribute: Routing Protocol | |
void | rtnl_route_set_protocol (struct rtnl_route *route, int proto) |
Set the protocol of a route to the specified value. | |
int | rtnl_route_get_protocol (struct rtnl_route *route) |
Get the protocol of a route. | |
Attribute: Priority/Metric | |
void | rtnl_route_set_prio (struct rtnl_route *route, int prio) |
Set the priority of a route to the specified value. | |
int | rtnl_route_get_prio (struct rtnl_route *route) |
Get the priority of a route. | |
Attribute: Address Family | |
void | rtnl_route_set_family (struct rtnl_route *route, int family) |
Set the address family of a route to the specified value. | |
int | rtnl_route_get_family (struct rtnl_route *route) |
Get the address family of a route. | |
Attribute: Destination Address | |
int | rtnl_route_set_dst (struct rtnl_route *route, struct nl_addr *addr) |
Set the destination address of a route to the specified address. | |
nl_addr * | rtnl_route_get_dst (struct rtnl_route *route) |
Get the destination address of a route. | |
void | rtnl_route_set_dst_len (struct rtnl_route *route, int prefix) |
Set the destination address prefix length of a route to the specified value. | |
int | rtnl_route_get_dst_len (struct rtnl_route *route) |
Get the destination address prefix length of a route. | |
Attribute: Source Address | |
int | rtnl_route_set_src (struct rtnl_route *route, struct nl_addr *addr) |
Set the source address of a route to the specified address. | |
nl_addr * | rtnl_route_get_src (struct rtnl_route *route) |
Get the source address of a route. | |
void | rtnl_route_set_src_len (struct rtnl_route *route, int prefix) |
Set the source address prefix length of a route to the specified value. | |
int | rtnl_route_get_src_len (struct rtnl_route *route) |
Get the source address prefix length of a route. | |
Attribute: Gateway Address | |
int | rtnl_route_set_gateway (struct rtnl_route *route, struct nl_addr *addr) |
Set the gateway address of a route to the specified address. | |
nl_addr * | rtnl_route_get_gateway (struct rtnl_route *route) |
Get the gateway address of a route. | |
Attribute: Type | |
void | rtnl_route_set_type (struct rtnl_route *route, int type) |
Set the type of a route to the specified value. | |
int | rtnl_route_get_type (struct rtnl_route *route) |
Get the type of a route. | |
Attribute: Flags | |
void | rtnl_route_set_flags (struct rtnl_route *route, unsigned int flags) |
Add flags to a route. | |
void | rtnl_route_unset_flags (struct rtnl_route *route, unsigned int flags) |
Remove flags from a route. | |
unsigned int | rtnl_route_get_flags (struct rtnl_route *route) |
Get flags of a route. | |
Attribute: Routing Metrics | |
int | rtnl_route_set_metric (struct rtnl_route *route, int metric, uint32_t value) |
Set a metric of a route to the specified value. | |
int | rtnl_route_unset_metric (struct rtnl_route *route, int metric) |
Unset a metric of a route. | |
unsigned int | rtnl_route_get_metric (struct rtnl_route *route, int metric) |
Get a metric for a route. | |
Attribute: Preferred Source Address | |
int | rtnl_route_set_pref_src (struct rtnl_route *route, struct nl_addr *addr) |
Set the preferred source address of a route to the specified address. | |
nl_addr * | rtnl_route_get_pref_src (struct rtnl_route *route) |
Get the preferred source address of a route. | |
Attribute: Outgoing Interface Index | |
void | rtnl_route_set_oif (struct rtnl_route *route, int ifindex) |
Set the outgoing interface of a route to the specified value. | |
int | rtnl_route_get_oif (struct rtnl_route *route) |
Get the outgoing interface index of a route. | |
Attribute: Incoming Interface | |
void | rtnl_route_set_iif (struct rtnl_route *route, const char *name) |
Set the incoming interface of a route to the specified value. | |
char * | rtnl_route_get_iif (struct rtnl_route *route) |
Get the incomming interface name of a route. | |
Attribute: Nexthop | |
void | rtnl_route_add_nexthop (struct rtnl_route *route, struct rtnl_nexthop *nh) |
void | rtnl_route_remove_nexthop (struct rtnl_nexthop *nh) |
nl_list_head * | rtnl_route_get_nexthops (struct rtnl_route *route) |
struct rtnl_route* rtnl_route_alloc | ( | void | ) |
Allocate a new route object.
Definition at line 712 of file route.c.
References nl_object_alloc_from_ops().
void rtnl_route_free | ( | struct rtnl_route * | route | ) |
Free route object.
route | Route object to be freed. |
Definition at line 724 of file route.c.
References nl_object_free().
struct nl_cache* rtnl_route_alloc_cache | ( | struct nl_handle * | handle | ) |
Build a route cache holding all routes currently configured in the kernel.
handle | netlink handle |
Definition at line 764 of file route.c.
References nl_cache_alloc_from_ops(), and nl_cache_update().
struct nl_msg* rtnl_route_build_add_request | ( | struct rtnl_route * | tmpl, | |
int | flags | |||
) |
Build netlink request message to add a new route.
tmpl | template with data of new route | |
flags | additional netlink message flags |
rtnl_route_set_*
functions.The following attributes must be set in the template:
Definition at line 849 of file route.c.
References NLM_F_CREATE.
void rtnl_route_set_table | ( | struct rtnl_route * | route, | |
int | table | |||
) |
int rtnl_route_get_table | ( | struct rtnl_route * | route | ) |
void rtnl_route_set_scope | ( | struct rtnl_route * | route, | |
int | scope | |||
) |
int rtnl_route_get_scope | ( | struct rtnl_route * | route | ) |
void rtnl_route_set_tos | ( | struct rtnl_route * | route, | |
int | tos | |||
) |
int rtnl_route_get_tos | ( | struct rtnl_route * | route | ) |
void rtnl_route_set_realms | ( | struct rtnl_route * | route, | |
realm_t | realms | |||
) |
realm_t rtnl_route_get_realms | ( | struct rtnl_route * | route | ) |
void rtnl_route_set_protocol | ( | struct rtnl_route * | route, | |
int | proto | |||
) |
int rtnl_route_get_protocol | ( | struct rtnl_route * | route | ) |
void rtnl_route_set_prio | ( | struct rtnl_route * | route, | |
int | prio | |||
) |
int rtnl_route_get_prio | ( | struct rtnl_route * | route | ) |
void rtnl_route_set_family | ( | struct rtnl_route * | route, | |
int | family | |||
) |
int rtnl_route_get_family | ( | struct rtnl_route * | route | ) |
int rtnl_route_set_dst | ( | struct rtnl_route * | route, | |
struct nl_addr * | addr | |||
) |
Set the destination address of a route to the specified address.
route | route to be changed | |
addr | new destination address |
If a address family has been specified already via either calling rtnl_route_set_family() or by setting one of the other addresses, the specified addr is automatically validated against this family and the assignment fails in case of a mismatch.
Definition at line 1087 of file route.c.
References nl_addr_get(), and nl_addr_put().
struct nl_addr* rtnl_route_get_dst | ( | struct rtnl_route * | route | ) |
void rtnl_route_set_dst_len | ( | struct rtnl_route * | route, | |
int | prefix | |||
) |
Set the destination address prefix length of a route to the specified value.
route | route to be changed | |
prefix | new destination address prefix |
int rtnl_route_get_dst_len | ( | struct rtnl_route * | route | ) |
int rtnl_route_set_src | ( | struct rtnl_route * | route, | |
struct nl_addr * | addr | |||
) |
Set the source address of a route to the specified address.
route | route to be changed | |
addr | new source address |
If a address family has been specified already via either calling rtnl_route_set_family() or by setting one of the other addresses, the specified addr is automatically validated against this family and the assignment fails in case of a mismatch.
Definition at line 1168 of file route.c.
References nl_addr_get(), and nl_addr_put().
struct nl_addr* rtnl_route_get_src | ( | struct rtnl_route * | route | ) |
void rtnl_route_set_src_len | ( | struct rtnl_route * | route, | |
int | prefix | |||
) |
int rtnl_route_get_src_len | ( | struct rtnl_route * | route | ) |
int rtnl_route_set_gateway | ( | struct rtnl_route * | route, | |
struct nl_addr * | addr | |||
) |
Set the gateway address of a route to the specified address.
route | route to be changed | |
addr | new gateway address |
If a address family has been specified already via either calling rtnl_route_set_family() or by setting one of the other addresses, the specified addr is automatically validated against this family and the assignment fails in case of a mismatch.
Definition at line 1247 of file route.c.
References nl_addr_get(), and nl_addr_put().
struct nl_addr* rtnl_route_get_gateway | ( | struct rtnl_route * | route | ) |
void rtnl_route_set_type | ( | struct rtnl_route * | route, | |
int | type | |||
) |
int rtnl_route_get_type | ( | struct rtnl_route * | route | ) |
void rtnl_route_set_flags | ( | struct rtnl_route * | route, | |
unsigned int | flags | |||
) |
void rtnl_route_unset_flags | ( | struct rtnl_route * | route, | |
unsigned int | flags | |||
) |
unsigned int 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 | |||
) |
unsigned int rtnl_route_get_metric | ( | struct rtnl_route * | route, | |
int | metric | |||
) |
int rtnl_route_set_pref_src | ( | struct rtnl_route * | route, | |
struct nl_addr * | addr | |||
) |
Set the preferred source address of a route to the specified address.
route | route to be changed | |
addr | new preferred source address |
If a address family has been specified already via either calling rtnl_route_set_family() or by setting one of the other addresses, the specified addr is automatically validated against this family and the assignment fails in case of a mismatch.
Definition at line 1428 of file route.c.
References nl_addr_get(), and nl_addr_put().
struct nl_addr* rtnl_route_get_pref_src | ( | struct rtnl_route * | route | ) |
void rtnl_route_set_oif | ( | struct rtnl_route * | route, | |
int | ifindex | |||
) |
int rtnl_route_get_oif | ( | struct rtnl_route * | route | ) |
Get the outgoing interface index of a route.
route | route handle |
Definition at line 1481 of file route.c.
References RTNL_LINK_NOT_FOUND.
void rtnl_route_set_iif | ( | struct rtnl_route * | route, | |
const char * | name | |||
) |
char* rtnl_route_get_iif | ( | struct rtnl_route * | route | ) |
char* rtnl_route_table2str | ( | int | table, | |
char * | buf, | |||
size_t | size | |||
) |
Convert routing table identifier to character string.
table | Routing table identifier. | |
buf | Destination buffer | |
size | Size of destination buffer. |
int rtnl_route_str2table | ( | const char * | name | ) |
Convert character string to routing table identifier.
name | Name of routing table. |
char* rtnl_route_proto2str | ( | int | proto, | |
char * | buf, | |||
size_t | size | |||
) |
Convert routing protocol identifier to character string.
proto | Routing protocol identifier. | |
buf | Destination buffer | |
size | Size of destination buffer. |
int rtnl_route_str2proto | ( | const char * | name | ) |
Convert character string to routing protocol identifier.
name | Name of routing protocol. |
char* rtnl_route_metric2str | ( | int | metric, | |
char * | buf, | |||
size_t | size | |||
) |
Convert routing metric identifier to character string.
metric | Routing metric identifier. | |
buf | Destination buffer | |
size | Size of destination buffer. |
int rtnl_route_str2metric | ( | const char * | name | ) |
Convert character string to routing metric identifier.
name | Name of routing metric. |
char* rtnl_route_nh_flags2str | ( | int | flags, | |
char * | buf, | |||
size_t | len | |||
) |
Convert nexthop flags to a character string.
flags | Nexthop flags. | |
buf | Destination buffer. | |
len | Length of destination buffer. |
int rtnl_route_nh_str2flags | ( | const char * | name | ) |