diff options
author | Thomas Graf <tgraf@suug.ch> | 2010-11-11 12:57:10 (GMT) |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2010-11-11 12:57:10 (GMT) |
commit | 8970c5cde659d76dc10cda00bb6823b6f34d9c30 (patch) | |
tree | 79b64bc28d25c16bfc1235d8efbebabdb4a24209 /src/lib | |
parent | 59880cb01e0609f64bf004f8226541646b652cec (diff) | |
download | libnl-8970c5cde659d76dc10cda00bb6823b6f34d9c30.zip libnl-8970c5cde659d76dc10cda00bb6823b6f34d9c30.tar.gz libnl-8970c5cde659d76dc10cda00bb6823b6f34d9c30.tar.bz2 |
link: Support IFLA_IFALIAS attribute
- parse IFLA_IFALIAS if available
- provides API to access/change ifalias
rtnl_link_get_ifalias(link)
rtnl_link_set_ifalias(link, alias)
- extends nl-link-set to test functionality
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/link.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/lib/link.c b/src/lib/link.c index c192569..88cea55 100644 --- a/src/lib/link.c +++ b/src/lib/link.c @@ -6,7 +6,7 @@ * License as published by the Free Software Foundation version 2.1 * of the License. * - * Copyright (c) 2008-2009 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2008-2010 Thomas Graf <tgraf@suug.ch> */ /** @@ -18,6 +18,7 @@ #include <netlink/cli/utils.h> #include <netlink/cli/link.h> +#include <linux/if.h> struct rtnl_link *nl_cli_link_alloc(void) { @@ -70,4 +71,14 @@ void nl_cli_link_parse_weight(struct rtnl_link *link, char *arg) rtnl_link_set_weight(link, weight); } +void nl_cli_link_parse_ifalias(struct rtnl_link *link, char *arg) +{ + if (strlen(arg) > IFALIASZ) + nl_cli_fatal(ERANGE, + "Link ifalias too big, must not exceed %u in length.", + IFALIASZ); + + rtnl_link_set_ifalias(link, arg); +} + /** @} */ |