libnl
3.2.3
|
Data Structures | |
struct | rtnl_link |
Link object. More... | |
Modules | |
Link Modules API | |
API for modules implementing specific link types/semantics. | |
Bonding | |
Dummy | |
VLAN | |
Virtual LAN link module. | |
Enumerations | |
enum | rtnl_link_stat_id_t { RTNL_LINK_RX_PACKETS, RTNL_LINK_TX_PACKETS, RTNL_LINK_RX_BYTES, RTNL_LINK_TX_BYTES, RTNL_LINK_RX_ERRORS, RTNL_LINK_TX_ERRORS, RTNL_LINK_RX_DROPPED, RTNL_LINK_TX_DROPPED, RTNL_LINK_RX_COMPRESSED, RTNL_LINK_TX_COMPRESSED, RTNL_LINK_RX_FIFO_ERR, RTNL_LINK_TX_FIFO_ERR, RTNL_LINK_RX_LEN_ERR, RTNL_LINK_RX_OVER_ERR, RTNL_LINK_RX_CRC_ERR, RTNL_LINK_RX_FRAME_ERR, RTNL_LINK_RX_MISSED_ERR, RTNL_LINK_TX_ABORT_ERR, RTNL_LINK_TX_CARRIER_ERR, RTNL_LINK_TX_HBEAT_ERR, RTNL_LINK_TX_WIN_ERR, RTNL_LINK_COLLISIONS, RTNL_LINK_MULTICAST, RTNL_LINK_IP6_INPKTS, RTNL_LINK_IP6_INHDRERRORS, RTNL_LINK_IP6_INTOOBIGERRORS, RTNL_LINK_IP6_INNOROUTES, RTNL_LINK_IP6_INADDRERRORS, RTNL_LINK_IP6_INUNKNOWNPROTOS, RTNL_LINK_IP6_INTRUNCATEDPKTS, RTNL_LINK_IP6_INDISCARDS, RTNL_LINK_IP6_INDELIVERS, RTNL_LINK_IP6_OUTFORWDATAGRAMS, RTNL_LINK_IP6_OUTPKTS, RTNL_LINK_IP6_OUTDISCARDS, RTNL_LINK_IP6_OUTNOROUTES, RTNL_LINK_IP6_REASMTIMEOUT, RTNL_LINK_IP6_REASMREQDS, RTNL_LINK_IP6_REASMOKS, RTNL_LINK_IP6_REASMFAILS, RTNL_LINK_IP6_FRAGOKS, RTNL_LINK_IP6_FRAGFAILS, RTNL_LINK_IP6_FRAGCREATES, RTNL_LINK_IP6_INMCASTPKTS, RTNL_LINK_IP6_OUTMCASTPKTS, RTNL_LINK_IP6_INBCASTPKTS, RTNL_LINK_IP6_OUTBCASTPKTS, RTNL_LINK_IP6_INOCTETS, RTNL_LINK_IP6_OUTOCTETS, RTNL_LINK_IP6_INMCASTOCTETS, RTNL_LINK_IP6_OUTMCASTOCTETS, RTNL_LINK_IP6_INBCASTOCTETS, RTNL_LINK_IP6_OUTBCASTOCTETS, RTNL_LINK_ICMP6_INMSGS, RTNL_LINK_ICMP6_INERRORS, RTNL_LINK_ICMP6_OUTMSGS, RTNL_LINK_ICMP6_OUTERRORS, __RTNL_LINK_STATS_MAX } |
Get / List | |
int | rtnl_link_alloc_cache (struct nl_sock *sk, int family, struct nl_cache **result) |
Allocate link cache and fill in all configured links. | |
struct rtnl_link * | rtnl_link_get (struct nl_cache *cache, int ifindex) |
Lookup link in cache by interface index. | |
struct rtnl_link * | rtnl_link_get_by_name (struct nl_cache *cache, const char *name) |
Lookup link in cache by link name. | |
int | rtnl_link_build_get_request (int ifindex, const char *name, struct nl_msg **result) |
Construct RTM_GETLINK netlink message. | |
int | rtnl_link_get_kernel (struct nl_sock *sk, int ifindex, const char *name, struct rtnl_link **result) |
Get a link object directly from kernel. | |
char * | rtnl_link_i2name (struct nl_cache *cache, int ifindex, char *dst, size_t len) |
Translate interface index to corresponding link name. | |
int | rtnl_link_name2i (struct nl_cache *cache, const char *name) |
Translate link name to corresponding interface index. | |
Add / Modify | |
int | rtnl_link_build_add_request (struct rtnl_link *link, int flags, struct nl_msg **result) |
Build a netlink message requesting the addition of new virtual link. | |
int | rtnl_link_add (struct nl_sock *sk, struct rtnl_link *link, int flags) |
Add virtual link. | |
int | rtnl_link_build_change_request (struct rtnl_link *orig, struct rtnl_link *changes, int flags, struct nl_msg **result) |
Build a netlink message requesting the modification of link. | |
int | rtnl_link_change (struct nl_sock *sk, struct rtnl_link *orig, struct rtnl_link *changes, int flags) |
Change link. | |
Delete | |
int | rtnl_link_build_delete_request (const struct rtnl_link *link, struct nl_msg **result) |
Build a netlink message requesting the deletion of a link. | |
int | rtnl_link_delete (struct nl_sock *sk, const struct rtnl_link *link) |
Delete link. | |
Link Object | |
struct rtnl_link * | rtnl_link_alloc (void) |
Allocate link object. | |
void | rtnl_link_put (struct rtnl_link *link) |
Return a link object reference. | |
void | rtnl_link_set_name (struct rtnl_link *link, const char *name) |
Set name of link object. | |
char * | rtnl_link_get_name (struct rtnl_link *link) |
Return name of link object. | |
void | rtnl_link_set_addr (struct rtnl_link *link, struct nl_addr *addr) |
Set link layer address of link object. | |
struct nl_addr * | rtnl_link_get_addr (struct rtnl_link *link) |
Return link layer address of link object. | |
void | rtnl_link_set_broadcast (struct rtnl_link *link, struct nl_addr *addr) |
Set link layer broadcast address of link object. | |
struct nl_addr * | rtnl_link_get_broadcast (struct rtnl_link *link) |
Return link layer broadcast address of link object. | |
void | rtnl_link_set_flags (struct rtnl_link *link, unsigned int flags) |
Set flags of link object. | |
void | rtnl_link_unset_flags (struct rtnl_link *link, unsigned int flags) |
Unset flags of link object. | |
unsigned int | rtnl_link_get_flags (struct rtnl_link *link) |
Return flags of link object. | |
void | rtnl_link_set_family (struct rtnl_link *link, int family) |
Set address family of link object. | |
int | rtnl_link_get_family (struct rtnl_link *link) |
Return address family of link object. | |
void | rtnl_link_set_arptype (struct rtnl_link *link, unsigned int arptype) |
Set hardware type of link object. | |
unsigned int | rtnl_link_get_arptype (struct rtnl_link *link) |
Get hardware type of link object. | |
void | rtnl_link_set_ifindex (struct rtnl_link *link, int ifindex) |
Set interface index of link object. | |
int | rtnl_link_get_ifindex (struct rtnl_link *link) |
Return interface index of link object. | |
void | rtnl_link_set_mtu (struct rtnl_link *link, unsigned int mtu) |
Set Maximum Transmission Unit of link object. | |
unsigned int | rtnl_link_get_mtu (struct rtnl_link *link) |
Return maximum transmission unit of link object. | |
void | rtnl_link_set_txqlen (struct rtnl_link *link, unsigned int txqlen) |
Set transmission queue length. | |
unsigned int | rtnl_link_get_txqlen (struct rtnl_link *link) |
Return transmission queue length. | |
void | rtnl_link_set_link (struct rtnl_link *link, int ifindex) |
int | rtnl_link_get_link (struct rtnl_link *link) |
void | rtnl_link_set_master (struct rtnl_link *link, int ifindex) |
Set master link of link object. | |
int | rtnl_link_get_master (struct rtnl_link *link) |
Return master link of link object. | |
void | rtnl_link_set_operstate (struct rtnl_link *link, uint8_t status) |
Set operational status of link object. | |
uint8_t | rtnl_link_get_operstate (struct rtnl_link *link) |
Return operational status of link object. | |
void | rtnl_link_set_linkmode (struct rtnl_link *link, uint8_t mode) |
Set link mode of link object. | |
uint8_t | rtnl_link_get_linkmode (struct rtnl_link *link) |
Return link mode of link object. | |
const char * | rtnl_link_get_ifalias (struct rtnl_link *link) |
Return alias name of link object (SNMP IfAlias) | |
void | rtnl_link_set_ifalias (struct rtnl_link *link, const char *alias) |
Set alias name of link object (SNMP IfAlias) | |
void | rtnl_link_set_qdisc (struct rtnl_link *link, const char *name) |
Set queueing discipline name of link object. | |
char * | rtnl_link_get_qdisc (struct rtnl_link *link) |
Return name of queueing discipline of link object. | |
int | rtnl_link_get_num_vf (struct rtnl_link *link, uint32_t *num_vf) |
Return number of PCI virtual functions of link object. | |
uint64_t | rtnl_link_get_stat (struct rtnl_link *link, rtnl_link_stat_id_t id) |
Return value of link statistics counter. | |
int | rtnl_link_set_stat (struct rtnl_link *link, rtnl_link_stat_id_t id, const uint64_t value) |
Set value of link statistics counter. | |
int | rtnl_link_set_type (struct rtnl_link *link, const char *type) |
Set type of link object. | |
char * | rtnl_link_get_type (struct rtnl_link *link) |
Return type of link. | |
Master/Slave | |
int | rtnl_link_enslave_ifindex (struct nl_sock *sock, int master, int slave) |
Enslave slave link to master link. | |
int | rtnl_link_enslave (struct nl_sock *sock, struct rtnl_link *master, struct rtnl_link *slave) |
Enslave slave link to master link. | |
int | rtnl_link_release_ifindex (struct nl_sock *sock, int slave) |
Release slave link from its master. | |
int | rtnl_link_release (struct nl_sock *sock, struct rtnl_link *slave) |
Release slave link from its master. | |
Utilities | |
char * | rtnl_link_flags2str (int flags, char *buf, size_t len) |
int | rtnl_link_str2flags (const char *name) |
char * | rtnl_link_stat2str (int st, char *buf, size_t len) |
int | rtnl_link_str2stat (const char *name) |
char * | rtnl_link_operstate2str (uint8_t st, char *buf, size_t len) |
int | rtnl_link_str2operstate (const char *name) |
char * | rtnl_link_mode2str (uint8_t st, char *buf, size_t len) |
int | rtnl_link_str2mode (const char *name) |
Deprecated Functions | |
int | rtnl_link_set_info_type (struct rtnl_link *link, const char *type) |
char * | rtnl_link_get_info_type (struct rtnl_link *link) |
void | rtnl_link_set_weight (struct rtnl_link *link, unsigned int weight) |
unsigned int | rtnl_link_get_weight (struct rtnl_link *link) |
enum rtnl_link_stat_id_t |
int rtnl_link_alloc_cache | ( | struct nl_sock * | sk, |
int | family, | ||
struct nl_cache ** | result | ||
) |
Allocate link cache and fill in all configured links.
sk | Netlink socket. |
family | Link address family or AF_UNSPEC |
result | Pointer to store resulting cache. |
Allocates and initializes a new link cache. A netlink message is sent to the kernel requesting a full dump of all configured links. The returned messages are parsed and filled into the cache. If the operation succeeds the resulting cache will a link object for each link configured in the kernel.
If family
is set to an address family other than AF_UNSPEC
the contents of the cache can be limited to a specific address family. Currently the following address families are supported:
Definition at line 843 of file link.c.
References nl_cache_alloc(), nl_cache_free(), and nl_cache_refill().
struct rtnl_link* rtnl_link_get | ( | struct nl_cache * | cache, |
int | ifindex | ||
) | [read] |
Lookup link in cache by interface index.
cache | Link cache |
ifindex | Interface index |
Searches through the provided cache looking for a link with matching interface index.
Definition at line 878 of file link.c.
References nl_object_get().
Referenced by rtnl_link_i2name().
struct rtnl_link* rtnl_link_get_by_name | ( | struct nl_cache * | cache, |
const char * | name | ||
) | [read] |
Lookup link in cache by link name.
cache | Link cache |
name | Name of link |
Searches through the provided cache looking for a link with matching link name
Definition at line 910 of file link.c.
References nl_object_get().
Referenced by rtnl_link_name2i().
int rtnl_link_build_get_request | ( | int | ifindex, |
const char * | name, | ||
struct nl_msg ** | result | ||
) |
Construct RTM_GETLINK netlink message.
ifindex | Interface index |
name | Name of link |
result | Pointer to store resulting netlink message |
The behaviour of this function is identical to rtnl_link_get_kernel() with the exception that it will not send the message but return it in the provided return pointer instead.
Definition at line 942 of file link.c.
References NLA_PUT_STRING, nlmsg_alloc_simple(), nlmsg_append(), and nlmsg_free().
Referenced by rtnl_link_get_kernel().
int rtnl_link_get_kernel | ( | struct nl_sock * | sk, |
int | ifindex, | ||
const char * | name, | ||
struct rtnl_link ** | result | ||
) |
Get a link object directly from kernel.
sk | Netlink socket |
ifindex | Interface index |
name | Name of link |
result | Pointer to store resulting link object |
This function builds a RTM_GETLINK
netlink message to request a specific link directly from the kernel. The returned answer is parsed into a struct rtnl_link object and returned via the result pointer or -NLE_OBJ_NOTFOUND is returned if no matching link was found.
Definition at line 991 of file link.c.
References nl_pickup(), nl_send_auto(), nl_wait_for_ack(), nlmsg_free(), and rtnl_link_build_get_request().
Referenced by rtnl_link_bond_enslave_ifindex(), and rtnl_link_enslave_ifindex().
char* rtnl_link_i2name | ( | struct nl_cache * | cache, |
int | ifindex, | ||
char * | dst, | ||
size_t | len | ||
) |
Translate interface index to corresponding link name.
cache | Link cache |
ifindex | Interface index |
dst | String to store name |
len | Length of destination string |
Translates the specified interface index to the corresponding link name and stores the name in the destination string.
Definition at line 1033 of file link.c.
References rtnl_link_get(), and rtnl_link_put().
int rtnl_link_name2i | ( | struct nl_cache * | cache, |
const char * | name | ||
) |
Translate link name to corresponding interface index.
cache | Link cache |
name | Name of link |
Definition at line 1056 of file link.c.
References rtnl_link_get_by_name(), and rtnl_link_put().
int rtnl_link_build_add_request | ( | struct rtnl_link * | link, |
int | flags, | ||
struct nl_msg ** | result | ||
) |
Build a netlink message requesting the addition of new virtual link.
link | new link to add |
flags | additional netlink message flags |
result | pointer to store resulting netlink message |
The behaviour of this function is identical to rtnl_link_add() with the exception that it will not send the message but return it in the provided return pointer instead.
Definition at line 1170 of file link.c.
Referenced by rtnl_link_add().
int rtnl_link_add | ( | struct nl_sock * | sk, |
struct rtnl_link * | link, | ||
int | flags | ||
) |
Add virtual link.
sk | netlink socket. |
link | new link to add |
flags | additional netlink message flags |
Builds a RTM_NEWLINK
netlink message requesting the addition of a new virtual link.
After sending, the function will wait for the ACK or an eventual error message to be received and will therefore block until the operation has been completed.
Definition at line 1199 of file link.c.
References nl_send_sync(), and rtnl_link_build_add_request().
Referenced by rtnl_link_bond_add().
int rtnl_link_build_change_request | ( | struct rtnl_link * | orig, |
struct rtnl_link * | changes, | ||
int | flags, | ||
struct nl_msg ** | result | ||
) |
Build a netlink message requesting the modification of link.
orig | original link to change |
changes | link containing the changes to be made |
flags | additional netlink message flags |
result | pointer to store resulting netlink message |
The behaviour of this function is identical to rtnl_link_change() with the exception that it will not send the message but return it in the provided return pointer instead.
Definition at line 1231 of file link.c.
Referenced by rtnl_link_change().
int rtnl_link_change | ( | struct nl_sock * | sk, |
struct rtnl_link * | orig, | ||
struct rtnl_link * | changes, | ||
int | flags | ||
) |
Change link.
sk | netlink socket. |
orig | original link to be changed |
changes | link containing the changes to be made |
flags | additional netlink message flags |
Builds a RTM_NEWLINK
netlink message requesting the change of a network link. If -EOPNOTSUPP is returned by the kernel, the message type will be changed to RTM_SETLINK
and the message is resent to work around older kernel versions.
The link to be changed is looked up based on the interface index supplied in the orig
link. Optionaly the link name is used but only if no interface index is provided, otherwise providing an link name will result in the link name being changed.
If no matching link exists, the function will return -NLE_OBJ_NOTFOUND.
After sending, the function will wait for the ACK or an eventual error message to be received and will therefore block until the operation has been completed.
Definition at line 1298 of file link.c.
References nlmsg_free(), and rtnl_link_build_change_request().
Referenced by rtnl_link_bond_enslave_ifindex(), and rtnl_link_enslave_ifindex().
int rtnl_link_build_delete_request | ( | const struct rtnl_link * | link, |
struct nl_msg ** | result | ||
) |
Build a netlink message requesting the deletion of a link.
link | Link to delete |
result | Pointer to store resulting netlink message |
The behaviour of this function is identical to rtnl_link_delete() with the exception that it will not send the message but return it in the provided return pointer instead.
Definition at line 1344 of file link.c.
References NLA_PUT_STRING, nlmsg_alloc_simple(), nlmsg_append(), and nlmsg_free().
Referenced by rtnl_link_delete().
int rtnl_link_delete | ( | struct nl_sock * | sk, |
const struct rtnl_link * | link | ||
) |
Delete link.
sk | Netlink socket |
link | Link to delete |
Builds a RTM_DELLINK
netlink message requesting the deletion of a network link which has been previously added to the kernel and sends the message to the kernel.
If no matching link exists, the function will return -NLE_OBJ_NOTFOUND.
After sending, the function will wait for the ACK or an eventual error message to be received and will therefore block until the operation has been completed.
Definition at line 1398 of file link.c.
References nl_send_sync(), and rtnl_link_build_delete_request().
struct rtnl_link* rtnl_link_alloc | ( | void | ) | [read] |
Allocate link object.
Definition at line 1422 of file link.c.
References nl_object_alloc().
Referenced by rtnl_link_bond_add(), rtnl_link_bond_enslave_ifindex(), and rtnl_link_enslave_ifindex().
void rtnl_link_put | ( | struct rtnl_link * | link | ) |
Return a link object reference.
obj | object to release reference from |
Definition at line 1432 of file link.c.
References nl_object_put().
Referenced by rtnl_link_bond_add(), rtnl_link_bond_enslave_ifindex(), rtnl_link_enslave_ifindex(), rtnl_link_i2name(), rtnl_link_name2i(), rtnl_tc_set_ifindex(), and rtnl_tc_set_link().
void rtnl_link_set_name | ( | struct rtnl_link * | link, |
const char * | name | ||
) |
Set name of link object.
link | Link object |
name | New name |
Definition at line 1451 of file link.c.
Referenced by rtnl_link_bond_add().
char* rtnl_link_get_name | ( | struct rtnl_link * | link | ) |
Return name of link object.
link | Link object |
Definition at line 1465 of file link.c.
Referenced by rtnl_link_bond_add().
void rtnl_link_set_addr | ( | struct rtnl_link * | link, |
struct nl_addr * | addr | ||
) |
Set link layer address of link object.
link | Link object |
addr | New link layer address |
The function increments the reference counter of the address object and overwrites any existing link layer address previously assigned.
struct nl_addr* rtnl_link_get_addr | ( | struct rtnl_link * | link | ) | [read] |
Return link layer address of link object.
link | Link object |
void rtnl_link_set_broadcast | ( | struct rtnl_link * | link, |
struct nl_addr * | addr | ||
) |
Set link layer broadcast address of link object.
link | Link object |
addr | New broadcast address |
The function increments the reference counter of the address object and overwrites any existing link layer broadcast address previously assigned.
struct nl_addr* rtnl_link_get_broadcast | ( | struct rtnl_link * | link | ) | [read] |
Return link layer broadcast address of link object.
link | Link object |
void rtnl_link_set_flags | ( | struct rtnl_link * | link, |
unsigned int | flags | ||
) |
Set flags of link object.
link | Link object |
flags | Flags |
void rtnl_link_unset_flags | ( | struct rtnl_link * | link, |
unsigned int | flags | ||
) |
Unset flags of link object.
link | Link object |
flags | Flags |
unsigned int rtnl_link_get_flags | ( | struct rtnl_link * | link | ) |
Return flags of link object.
link | Link object |
void rtnl_link_set_family | ( | struct rtnl_link * | link, |
int | family | ||
) |
Set address family of link object.
int rtnl_link_get_family | ( | struct rtnl_link * | link | ) |
Return address family of link object.
link | Link object |
AF_UNSPEC
if not specified. void rtnl_link_set_arptype | ( | struct rtnl_link * | link, |
unsigned int | arptype | ||
) |
Set hardware type of link object.
link | Link object |
arptype | New hardware type (ARPHRD_*) |
unsigned int rtnl_link_get_arptype | ( | struct rtnl_link * | link | ) |
Get hardware type of link object.
link | Link object |
(ARPHRD_ETHER *) or ARPHRD_VOID
void rtnl_link_set_ifindex | ( | struct rtnl_link * | link, |
int | ifindex | ||
) |
Set interface index of link object.
link | Link object |
ifindex | Interface index |
Definition at line 1649 of file link.c.
Referenced by rtnl_link_bond_enslave_ifindex(), and rtnl_link_enslave_ifindex().
int rtnl_link_get_ifindex | ( | struct rtnl_link * | link | ) |
Return interface index of link object.
link | Link object |
Definition at line 1664 of file link.c.
Referenced by rtnl_link_bond_enslave(), rtnl_link_bond_release(), rtnl_link_enslave(), and rtnl_link_release().
void rtnl_link_set_mtu | ( | struct rtnl_link * | link, |
unsigned int | mtu | ||
) |
Set Maximum Transmission Unit of link object.
link | Link object |
mtu | New MTU value in number of bytes |
unsigned int rtnl_link_get_mtu | ( | struct rtnl_link * | link | ) |
Return maximum transmission unit of link object.
link | Link object |
void rtnl_link_set_txqlen | ( | struct rtnl_link * | link, |
unsigned int | txqlen | ||
) |
Set transmission queue length.
link | Link object |
txqlen | New queue length |
The unit is dependant on the link type. The most common units is number of packets.
unsigned int rtnl_link_get_txqlen | ( | struct rtnl_link * | link | ) |
Return transmission queue length.
link | Link object |
The unit is dependant on the link type. The most common units is number of packets.
void rtnl_link_set_master | ( | struct rtnl_link * | link, |
int | ifindex | ||
) |
Set master link of link object.
link | Link object |
ifindex | Interface index of master link |
Definition at line 1745 of file link.c.
Referenced by rtnl_link_bond_enslave_ifindex(), and rtnl_link_enslave_ifindex().
int rtnl_link_get_master | ( | struct rtnl_link * | link | ) |
Return master link of link object.
link | Link object |
Definition at line 1758 of file link.c.
Referenced by rtnl_link_bond_enslave_ifindex(), and rtnl_link_enslave_ifindex().
void rtnl_link_set_operstate | ( | struct rtnl_link * | link, |
uint8_t | status | ||
) |
Set operational status of link object.
link | Link object |
status | New opertional status |
uint8_t rtnl_link_get_operstate | ( | struct rtnl_link * | link | ) |
Return operational status of link object.
link | Link object |
IF_OPER_UNKNOWN
void rtnl_link_set_linkmode | ( | struct rtnl_link * | link, |
uint8_t | mode | ||
) |
Set link mode of link object.
link | Link object |
mode | New link mode |
uint8_t rtnl_link_get_linkmode | ( | struct rtnl_link * | link | ) |
Return link mode of link object.
link | Link object |
IF_LINK_MODE_DEFAULT
const char* rtnl_link_get_ifalias | ( | struct rtnl_link * | link | ) |
Return alias name of link object (SNMP IfAlias)
link | Link object |
void rtnl_link_set_ifalias | ( | struct rtnl_link * | link, |
const char * | alias | ||
) |
Set alias name of link object (SNMP IfAlias)
link | Link object |
alias | Alias name or NULL to unset |
Sets the alias name of the link to the specified name. The alias name can be unset by specyfing NULL as the alias. The name will be strdup()ed, so no need to provide a persistent character string.
void rtnl_link_set_qdisc | ( | struct rtnl_link * | link, |
const char * | name | ||
) |
Set queueing discipline name of link object.
link | Link object |
name | Name of queueing discipline |
For more information on how to modify the qdisc of a link, see section Traffic Control (Routing Family Library).
char* rtnl_link_get_qdisc | ( | struct rtnl_link * | link | ) |
Return name of queueing discipline of link object.
link | Link object |
int rtnl_link_get_num_vf | ( | struct rtnl_link * | link, |
uint32_t * | num_vf | ||
) |
uint64_t rtnl_link_get_stat | ( | struct rtnl_link * | link, |
rtnl_link_stat_id_t | id | ||
) |
int rtnl_link_set_stat | ( | struct rtnl_link * | link, |
rtnl_link_stat_id_t | id, | ||
const uint64_t | value | ||
) |
int rtnl_link_set_type | ( | struct rtnl_link * | link, |
const char * | type | ||
) |
Set type of link object.
link | Link object |
type | Name of link type |
Looks up the link type module and prepares the link to store type specific attributes. If a type has been assigned already it will be released with all link type specific attributes lost.
Definition at line 1951 of file link.c.
References rtnl_link_info_ops::io_alloc, and rtnl_link_info_ops_lookup().
Referenced by rtnl_link_bond_add(), rtnl_link_bond_enslave_ifindex(), and rtnl_link_set_info_type().
char* rtnl_link_get_type | ( | struct rtnl_link * | link | ) |
Return type of link.
link | Link object |
Definition at line 1978 of file link.c.
Referenced by rtnl_link_get_info_type().
int rtnl_link_enslave_ifindex | ( | struct nl_sock * | sock, |
int | master, | ||
int | slave | ||
) |
Enslave slave link to master link.
sock | netlink socket |
master | ifindex of master link |
slave | ifindex of slave link |
This function is identical to rtnl_link_enslave() except that it takes interface indices instead of rtnl_link objects.
Definition at line 2003 of file link.c.
References rtnl_link_alloc(), rtnl_link_change(), rtnl_link_get_kernel(), rtnl_link_get_master(), rtnl_link_put(), rtnl_link_set_ifindex(), and rtnl_link_set_master().
Referenced by rtnl_link_enslave(), and rtnl_link_release_ifindex().
int rtnl_link_enslave | ( | struct nl_sock * | sock, |
struct rtnl_link * | master, | ||
struct rtnl_link * | slave | ||
) |
Enslave slave link to master link.
sock | netlink socket |
master | master link |
slave | slave link |
Constructs a RTM_NEWLINK or RTM_SETLINK message adding the slave to the master and sends the request via the specified netlink socket.
Definition at line 2058 of file link.c.
References rtnl_link_enslave_ifindex(), and rtnl_link_get_ifindex().
int rtnl_link_release_ifindex | ( | struct nl_sock * | sock, |
int | slave | ||
) |
Release slave link from its master.
sock | netlink socket |
slave | slave link |
This function is identical to rtnl_link_release() except that it takes an interface index instead of a rtnl_link object.
Definition at line 2077 of file link.c.
References rtnl_link_enslave_ifindex().
Referenced by rtnl_link_release().
int rtnl_link_release | ( | struct nl_sock * | sock, |
struct rtnl_link * | slave | ||
) |
Release slave link from its master.
sock | netlink socket |
slave | slave link |
Constructs a RTM_NEWLINK or RTM_SETLINK message releasing the slave from its master and sends the request via the specified netlink socket.
Definition at line 2101 of file link.c.
References rtnl_link_get_ifindex(), and rtnl_link_release_ifindex().
int rtnl_link_set_info_type | ( | struct rtnl_link * | link, |
const char * | type | ||
) |
Definition at line 2262 of file link.c.
References rtnl_link_set_type().
char* rtnl_link_get_info_type | ( | struct rtnl_link * | link | ) |
Definition at line 2270 of file link.c.
References rtnl_link_get_type().
void rtnl_link_set_weight | ( | struct rtnl_link * | link, |
unsigned int | weight | ||
) |
unsigned int rtnl_link_get_weight | ( | struct rtnl_link * | link | ) |