19 #include <netlink/cli/utils.h> 20 #include <netlink/cli/link.h> 34 struct nl_cache *nl_cli_link_alloc_cache_family_flags(
struct nl_sock *sock,
38 struct nl_cache *cache;
50 struct nl_cache *nl_cli_link_alloc_cache_family(
struct nl_sock *sock,
int family)
52 return nl_cli_link_alloc_cache_family_flags(sock, family, 0);
55 struct nl_cache *nl_cli_link_alloc_cache(
struct nl_sock *sock)
57 return nl_cli_link_alloc_cache_family(sock, AF_UNSPEC);
60 struct nl_cache *nl_cli_link_alloc_cache_flags(
struct nl_sock *sock,
63 return nl_cli_link_alloc_cache_family_flags(sock, AF_UNSPEC, flags);
66 void nl_cli_link_parse_family(
struct rtnl_link *link,
char *arg)
70 if ((family = nl_str2af(arg)) < 0)
72 "Unable to translate address family \"%s\"", arg);
77 void nl_cli_link_parse_name(
struct rtnl_link *link,
char *arg)
82 void nl_cli_link_parse_mtu(
struct rtnl_link *link,
char *arg)
88 void nl_cli_link_parse_ifindex(
struct rtnl_link *link,
char *arg)
94 void nl_cli_link_parse_txqlen(
struct rtnl_link *link,
char *arg)
100 void nl_cli_link_parse_weight(
struct rtnl_link *link,
char *arg)
104 void nl_cli_link_parse_ifalias(
struct rtnl_link *link,
char *arg)
106 if (strlen(arg) > IFALIASZ)
108 "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.