20 #include <netlink/cli/utils.h> 21 #include <netlink/cli/link.h> 35 struct nl_cache *nl_cli_link_alloc_cache_family_flags(
struct nl_sock *sock,
39 struct nl_cache *cache;
51 struct nl_cache *nl_cli_link_alloc_cache_family(
struct nl_sock *sock,
int family)
53 return nl_cli_link_alloc_cache_family_flags(sock, family, 0);
56 struct nl_cache *nl_cli_link_alloc_cache(
struct nl_sock *sock)
58 return nl_cli_link_alloc_cache_family(sock, AF_UNSPEC);
61 struct nl_cache *nl_cli_link_alloc_cache_flags(
struct nl_sock *sock,
64 return nl_cli_link_alloc_cache_family_flags(sock, AF_UNSPEC, flags);
67 void nl_cli_link_parse_family(
struct rtnl_link *link,
char *arg)
71 if ((family = nl_str2af(arg)) < 0)
73 "Unable to translate address family \"%s\"", arg);
78 void nl_cli_link_parse_name(
struct rtnl_link *link,
char *arg)
83 void nl_cli_link_parse_mtu(
struct rtnl_link *link,
char *arg)
89 void nl_cli_link_parse_ifindex(
struct rtnl_link *link,
char *arg)
95 void nl_cli_link_parse_txqlen(
struct rtnl_link *link,
char *arg)
101 void nl_cli_link_parse_weight(
struct rtnl_link *link,
char *arg)
105 void nl_cli_link_parse_ifalias(
struct rtnl_link *link,
char *arg)
107 if (strlen(arg) > IFALIASZ)
109 "Link ifalias too big, must not exceed %u in length.",
void nl_cache_mngt_provide(struct nl_cache *cache)
Provide a cache for global use.
int rtnl_link_alloc_cache_flags(struct nl_sock *sk, int family, struct nl_cache **result, unsigned int flags)
Allocate link cache and fill in all configured links.
void rtnl_link_set_ifindex(struct rtnl_link *link, int ifindex)
Set interface index of link object.
struct rtnl_link * rtnl_link_alloc(void)
Allocate link object.
void rtnl_link_set_ifalias(struct rtnl_link *link, const char *alias)
Set alias name of link object (SNMP IfAlias)
void rtnl_link_set_family(struct rtnl_link *link, int family)
Set address family of link object.
void rtnl_link_set_name(struct rtnl_link *link, const char *name)
Set name of link object.
uint32_t nl_cli_parse_u32(const char *arg)
Parse a text based 32 bit unsigned integer argument.
void nl_cli_fatal(int err, const char *fmt,...)
Print error message and quit application.
void rtnl_link_set_mtu(struct rtnl_link *link, unsigned int mtu)
Set Maximum Transmission Unit of link object.
void rtnl_link_set_txqlen(struct rtnl_link *link, unsigned int txqlen)
Set transmission queue length.