Modules | |
Link Info API | |
Allocation/Freeing | |
struct rtnl_link * | rtnl_link_alloc (void) |
void | rtnl_link_put (struct rtnl_link *link) |
Cache Management | |
int | rtnl_link_alloc_cache (struct nl_sock *sk, struct nl_cache **result) |
Allocate link cache and fill in all configured links. More... | |
struct rtnl_link * | rtnl_link_get (struct nl_cache *cache, int ifindex) |
Look up link by interface index in the provided cache. More... | |
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. More... | |
Link Modifications | |
int | rtnl_link_build_change_request (struct rtnl_link *old, struct rtnl_link *tmpl, int flags, struct nl_msg **result) |
Builds a netlink change request message to change link attributes. More... | |
int | rtnl_link_change (struct nl_sock *sk, struct rtnl_link *old, struct rtnl_link *tmpl, int flags) |
Change link attributes. More... | |
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. More... | |
int | rtnl_link_name2i (struct nl_cache *cache, const char *name) |
Translate a link name to the corresponding interface index. More... | |
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) |
References nl_object_alloc().
Referenced by nl_cli_link_alloc().
Allocate link cache and fill in all configured links.
Allocates a new link cache, initializes it properly and updates it to include all links currently configured in the kernel.
References nl_cache_alloc_and_fill().
int rtnl_link_build_change_request | ( | struct rtnl_link * | old, |
struct rtnl_link * | tmpl, | ||
int | flags, | ||
struct nl_msg ** | result | ||
) |
Builds a netlink change request message to change link attributes.
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.
References ifinfomsg::ifi_family, ifinfomsg::ifi_flags, IFLA_IFNAME, IFLA_INFO_KIND, info, rtnl_link_info_ops::io_name, rtnl_link_info_ops::io_put_attrs, rtnl_link::l_addr, rtnl_link::l_bcast, rtnl_link::l_family, rtnl_link::l_flag_mask, rtnl_link::l_flags, rtnl_link::l_index, rtnl_link::l_info_ops, rtnl_link::l_linkmode, rtnl_link::l_mtu, rtnl_link::l_name, rtnl_link::l_operstate, rtnl_link::l_txqlen, rtnl_link::l_weight, nla_nest_end(), nla_nest_start(), NLA_PUT_ADDR, NLA_PUT_STRING, NLA_PUT_U32, NLA_PUT_U8, NLE_MSGSIZE, NLE_NOMEM, NLMSG_ALIGNTO, nlmsg_alloc_simple(), nlmsg_append(), nlmsg_free(), and RTM_SETLINK.
Referenced by rtnl_link_change().
int rtnl_link_change | ( | struct nl_sock * | sk, |
struct rtnl_link * | old, | ||
struct rtnl_link * | tmpl, | ||
int | flags | ||
) |
Change link attributes.
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.
References nl_send_auto_complete(), nlmsg_free(), and rtnl_link_build_change_request().
char* rtnl_link_flags2str | ( | int | flags, |
char * | buf, | ||
size_t | len | ||
) |
Look up link by interface index in the provided cache.
The caller owns a reference on the returned object and must give the object back via rtnl_link_put().
References nl_cache::c_items, nl_cache::c_ops, rtnl_link::l_index, nl_list_for_each_entry, nl_object_get(), and NULL.
Referenced by rtnl_link_i2name().
References rtnl_link::l_addr, and NULL.
References rtnl_link::l_arptype.
References rtnl_link::l_bcast, and NULL.
Look up link by link name in the provided cache.
The caller owns a reference on the returned object and must give the object back via rtnl_link_put().
References nl_cache::c_items, nl_cache::c_ops, rtnl_link::l_name, nl_list_for_each_entry, nl_object_get(), and NULL.
Referenced by rtnl_link_name2i().
References rtnl_link::l_family.
References rtnl_link::l_flags.
References rtnl_link::l_index.
Return info type of a link.
References rtnl_link_info_ops::io_name, rtnl_link::l_info_ops, and NULL.
References rtnl_link::l_link.
References IF_LINK_MODE_DEFAULT, and rtnl_link::l_linkmode.
References rtnl_link::l_master.
References rtnl_link::l_mtu.
References rtnl_link::l_name, and NULL.
References IF_OPER_UNKNOWN, and rtnl_link::l_operstate.
References rtnl_link::l_qdisc, and NULL.
References id, rtnl_link::l_stats, and RTNL_LINK_STATS_MAX.
References rtnl_link::l_txqlen.
References rtnl_link::l_weight.
Translate an interface index to the corresponding link name.
Translates the specified interface index to the corresponding link name and stores the name in the destination buffer.
References rtnl_link::l_name, NULL, rtnl_link_get(), and rtnl_link_put().
Referenced by main().
char* rtnl_link_mode2str | ( | int | st, |
char * | buf, | ||
size_t | len | ||
) |
Translate a link name to the corresponding interface index.
References rtnl_link::l_index, rtnl_link_get_by_name(), and rtnl_link_put().
Referenced by main(), nl_cli_addr_parse_dev(), nl_cli_neigh_parse_dev(), nl_cli_qdisc_parse_dev(), nl_cli_route_parse_iif(), nl_cli_route_parse_nexthop(), and parse_dev().
char* rtnl_link_operstate2str | ( | int | st, |
char * | buf, | ||
size_t | len | ||
) |
References nl_object_put().
Referenced by rtnl_link_i2name(), and rtnl_link_name2i().
References rtnl_link::l_addr.
References rtnl_link::l_arptype.
References rtnl_link::l_bcast.
References rtnl_link::l_family.
Referenced by nl_cli_link_parse_family().
References flags, rtnl_link::l_flag_mask, and rtnl_link::l_flags.
References rtnl_link::l_index.
Referenced by nl_cli_link_parse_ifindex().
Specify the info type of a link.
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.
References rtnl_link_info_ops::io_alloc, rtnl_link::l_info_ops, NLE_OPNOTSUPP, NULL, and rtnl_link_info_ops_lookup().
References rtnl_link::l_link.
References rtnl_link::l_linkmode.
References rtnl_link::l_master.
References rtnl_link::l_mtu.
Referenced by nl_cli_link_parse_mtu().
References rtnl_link::l_name.
Referenced by nl_cli_link_parse_name().
References rtnl_link::l_operstate.
References rtnl_link::l_qdisc.
References rtnl_link::l_txqlen.
Referenced by nl_cli_link_parse_txqlen().
References rtnl_link::l_weight.
Referenced by nl_cli_link_parse_weight().
char* rtnl_link_stat2str | ( | int | st, |
char * | buf, | ||
size_t | len | ||
) |
int rtnl_link_str2flags | ( | const char * | name | ) |
int rtnl_link_str2mode | ( | const char * | name | ) |
int rtnl_link_str2operstate | ( | const char * | name | ) |
int rtnl_link_str2stat | ( | const char * | name | ) |
References flags, rtnl_link::l_flag_mask, and rtnl_link::l_flags.