|
libnl 1.1.4
|
Modules | |
| Link Info API | |
Macros | |
| #define | RTNL_LINK_NOT_FOUND -1 |
| Special interface index stating the link was not found. | |
Link Flags Translations | |
| char * | rtnl_link_flags2str (int flags, char *buf, size_t len) |
| int | rtnl_link_str2flags (const char *name) |
Link Statistics Translations | |
| char * | rtnl_link_stat2str (int st, char *buf, size_t len) |
| int | rtnl_link_str2stat (const char *name) |
Link Operstate Translations | |
| char * | rtnl_link_operstate2str (int st, char *buf, size_t len) |
| int | rtnl_link_str2operstate (const char *name) |
Link Mode Translations | |
| char * | rtnl_link_mode2str (int st, char *buf, size_t len) |
| int | rtnl_link_str2mode (const char *name) |
Allocation/Freeing | |
| struct rtnl_link * | rtnl_link_alloc (void) |
| void | rtnl_link_put (struct rtnl_link *link) |
Cache Management | |
| struct nl_cache * | rtnl_link_alloc_cache (struct nl_handle *handle) |
| Allocate link cache and fill in all configured links. | |
| struct rtnl_link * | rtnl_link_get (struct nl_cache *cache, int ifindex) |
| Look up link by interface index in the provided cache. | |
| struct rtnl_link * | rtnl_link_get_by_name (struct nl_cache *cache, const char *name) |
| Look up link by link name in the provided cache. | |
Link Modifications | |
| struct nl_msg * | rtnl_link_build_change_request (struct rtnl_link *old, struct rtnl_link *tmpl, int flags) |
| Builds a netlink change request message to change link attributes. | |
| int | rtnl_link_change (struct nl_handle *handle, struct rtnl_link *old, struct rtnl_link *tmpl, int flags) |
| Change link attributes. | |
Name <-> Index Translations | |
| char * | rtnl_link_i2name (struct nl_cache *cache, int ifindex, char *dst, size_t len) |
| Translate an interface index to the corresponding link name. | |
| int | rtnl_link_name2i (struct nl_cache *cache, const char *name) |
| Translate a link name to the corresponding interface index. | |
Attributes | |
| void | rtnl_link_set_qdisc (struct rtnl_link *link, const char *qdisc) |
| char * | rtnl_link_get_qdisc (struct rtnl_link *link) |
| void | rtnl_link_set_name (struct rtnl_link *link, const char *name) |
| char * | rtnl_link_get_name (struct rtnl_link *link) |
| void | rtnl_link_set_addr (struct rtnl_link *link, struct nl_addr *addr) |
| struct nl_addr * | rtnl_link_get_addr (struct rtnl_link *link) |
| void | rtnl_link_set_broadcast (struct rtnl_link *link, struct nl_addr *brd) |
| struct nl_addr * | rtnl_link_get_broadcast (struct rtnl_link *link) |
| void | rtnl_link_set_flags (struct rtnl_link *link, unsigned int flags) |
| void | rtnl_link_unset_flags (struct rtnl_link *link, unsigned int flags) |
| unsigned int | rtnl_link_get_flags (struct rtnl_link *link) |
| void | rtnl_link_set_family (struct rtnl_link *link, int family) |
| int | rtnl_link_get_family (struct rtnl_link *link) |
| void | rtnl_link_set_arptype (struct rtnl_link *link, unsigned int arptype) |
| unsigned int | rtnl_link_get_arptype (struct rtnl_link *link) |
| void | rtnl_link_set_ifindex (struct rtnl_link *link, int ifindex) |
| int | rtnl_link_get_ifindex (struct rtnl_link *link) |
| void | rtnl_link_set_mtu (struct rtnl_link *link, unsigned int mtu) |
| unsigned int | rtnl_link_get_mtu (struct rtnl_link *link) |
| void | rtnl_link_set_txqlen (struct rtnl_link *link, unsigned int txqlen) |
| unsigned int | rtnl_link_get_txqlen (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) |
| 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) |
| int | rtnl_link_get_master (struct rtnl_link *link) |
| void | rtnl_link_set_operstate (struct rtnl_link *link, uint8_t operstate) |
| uint8_t | rtnl_link_get_operstate (struct rtnl_link *link) |
| void | rtnl_link_set_linkmode (struct rtnl_link *link, uint8_t linkmode) |
| uint8_t | rtnl_link_get_linkmode (struct rtnl_link *link) |
| uint64_t | rtnl_link_get_stat (struct rtnl_link *link, int id) |
| int | rtnl_link_set_info_type (struct rtnl_link *link, const char *type) |
| Specify the info type of a link. | |
| char * | rtnl_link_get_info_type (struct rtnl_link *link) |
| Return info type of a link. | |
| struct rtnl_link * rtnl_link_alloc | ( | void | ) |
Definition at line 841 of file link.c.
| void rtnl_link_put | ( | struct rtnl_link * | link | ) |
Definition at line 846 of file link.c.
| struct nl_cache * rtnl_link_alloc_cache | ( | struct nl_handle * | handle | ) |
| handle | Netlink handle. |
Allocates a new link cache, initializes it properly and updates it to include all links currently configured in the kernel.
Definition at line 869 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 | ||
| ) |
| cache | link cache |
| ifindex | link interface index |
The caller owns a reference on the returned object and must give the object back via rtnl_link_put().
Definition at line 895 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 | ||
| ) |
| cache | link cache |
| name | link name |
The caller owns a reference on the returned object and must give the object back via rtnl_link_put().
Definition at line 922 of file link.c.
References nl_object_get().
Referenced by rtnl_link_name2i().
| struct nl_msg * rtnl_link_build_change_request | ( | struct rtnl_link * | old, |
| struct rtnl_link * | tmpl, | ||
| int | flags | ||
| ) |
| old | link to be changed |
| tmpl | template with requested changes |
| 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.
Definition at line 965 of file link.c.
References nla_nest_end(), nla_nest_start(), NLA_PUT_ADDR, NLA_PUT_STRING, NLA_PUT_U32, NLA_PUT_U8, nlmsg_alloc_simple(), nlmsg_append(), and nlmsg_free().
Referenced by rtnl_link_change().
| int rtnl_link_change | ( | struct nl_handle * | handle, |
| struct rtnl_link * | old, | ||
| struct rtnl_link * | tmpl, | ||
| int | flags | ||
| ) |
| handle | netlink handle |
| old | link to be changed |
| tmpl | template with requested changes |
| flags | additional netlink message flags |
Builds a new netlink message by calling rtnl_link_build_change_request(), sends the request to the kernel and waits for the next ACK to be received, i.e. blocks until the request has been processed.
Definition at line 1048 of file link.c.
References nl_send_auto_complete(), nl_wait_for_ack(), nlmsg_free(), and rtnl_link_build_change_request().
| char * rtnl_link_i2name | ( | struct nl_cache * | cache, |
| int | ifindex, | ||
| char * | dst, | ||
| size_t | len | ||
| ) |
| cache | link cache |
| ifindex | link interface index |
| dst | destination buffer |
| len | length of destination buffer |
Translates the specified interface index to the corresponding link name and stores the name in the destination buffer.
Definition at line 1085 of file link.c.
References rtnl_link_get().
| int rtnl_link_name2i | ( | struct nl_cache * | cache, |
| const char * | name | ||
| ) |
| cache | link cache |
| name | link name |
Definition at line 1106 of file link.c.
References rtnl_link_get_by_name(), and RTNL_LINK_NOT_FOUND.
| 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 | ( | int | st, |
| char * | buf, | ||
| size_t | len | ||
| ) |
| int rtnl_link_str2operstate | ( | const char * | name | ) |
| char * rtnl_link_mode2str | ( | int | st, |
| char * | buf, | ||
| size_t | len | ||
| ) |
| int rtnl_link_str2mode | ( | const char * | name | ) |
| void rtnl_link_set_qdisc | ( | struct rtnl_link * | link, |
| const char * | qdisc | ||
| ) |
| char * rtnl_link_get_qdisc | ( | struct rtnl_link * | link | ) |
| void rtnl_link_set_name | ( | struct rtnl_link * | link, |
| const char * | name | ||
| ) |
| char * rtnl_link_get_name | ( | struct rtnl_link * | link | ) |
| void rtnl_link_set_addr | ( | struct rtnl_link * | link, |
| struct nl_addr * | addr | ||
| ) |
| struct nl_addr * rtnl_link_get_addr | ( | struct rtnl_link * | link | ) |
| void rtnl_link_set_broadcast | ( | struct rtnl_link * | link, |
| struct nl_addr * | brd | ||
| ) |
| struct nl_addr * rtnl_link_get_broadcast | ( | struct rtnl_link * | link | ) |
| void rtnl_link_set_flags | ( | struct rtnl_link * | link, |
| unsigned int | flags | ||
| ) |
| void rtnl_link_unset_flags | ( | struct rtnl_link * | link, |
| unsigned int | flags | ||
| ) |
| unsigned int rtnl_link_get_flags | ( | struct rtnl_link * | link | ) |
| void rtnl_link_set_family | ( | struct rtnl_link * | link, |
| int | family | ||
| ) |
| int rtnl_link_get_family | ( | struct rtnl_link * | link | ) |
| void rtnl_link_set_arptype | ( | struct rtnl_link * | link, |
| unsigned int | arptype | ||
| ) |
| unsigned int rtnl_link_get_arptype | ( | struct rtnl_link * | link | ) |
| void rtnl_link_set_ifindex | ( | struct rtnl_link * | link, |
| int | ifindex | ||
| ) |
| int rtnl_link_get_ifindex | ( | struct rtnl_link * | link | ) |
| void rtnl_link_set_mtu | ( | struct rtnl_link * | link, |
| unsigned int | mtu | ||
| ) |
| unsigned int rtnl_link_get_mtu | ( | struct rtnl_link * | link | ) |
| void rtnl_link_set_txqlen | ( | struct rtnl_link * | link, |
| unsigned int | txqlen | ||
| ) |
| unsigned int rtnl_link_get_txqlen | ( | 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 | ) |
| 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 | ||
| ) |
| int rtnl_link_get_master | ( | struct rtnl_link * | link | ) |
| void rtnl_link_set_operstate | ( | struct rtnl_link * | link, |
| uint8_t | operstate | ||
| ) |
| uint8_t rtnl_link_get_operstate | ( | struct rtnl_link * | link | ) |
| void rtnl_link_set_linkmode | ( | struct rtnl_link * | link, |
| uint8_t | linkmode | ||
| ) |
| uint8_t rtnl_link_get_linkmode | ( | struct rtnl_link * | link | ) |
| uint64_t rtnl_link_get_stat | ( | struct rtnl_link * | link, |
| int | id | ||
| ) |
| int rtnl_link_set_info_type | ( | struct rtnl_link * | link, |
| const char * | type | ||
| ) |
| link | link object |
| type | info type |
Looks up the info type and prepares the link to store info type specific attributes. If an info type has been assigned already it will be released with all changes lost.
Definition at line 1501 of file link.c.
References rtnl_link_info_ops::io_alloc.
| char * rtnl_link_get_info_type | ( | struct rtnl_link * | link | ) |