Commit ace9c961 authored by Stephen Hemminger's avatar Stephen Hemminger

Add support for IFALIAS

New 2.6.28 support for text description
parent 1e659af3
...@@ -281,6 +281,10 @@ int print_linkinfo(const struct sockaddr_nl *who, ...@@ -281,6 +281,10 @@ int print_linkinfo(const struct sockaddr_nl *who,
if (do_link && tb[IFLA_LINKINFO] && show_details) if (do_link && tb[IFLA_LINKINFO] && show_details)
print_linktype(fp, tb[IFLA_LINKINFO]); print_linktype(fp, tb[IFLA_LINKINFO]);
if (do_link && tb[IFLA_IFALIAS])
fprintf(fp,"\n alias %s",
(const char *) RTA_DATA(tb[IFLA_IFALIAS]));
if (do_link && tb[IFLA_STATS] && show_stats) { if (do_link && tb[IFLA_STATS] && show_stats) {
struct rtnl_link_stats slocal; struct rtnl_link_stats slocal;
struct rtnl_link_stats *s = RTA_DATA(tb[IFLA_STATS]); struct rtnl_link_stats *s = RTA_DATA(tb[IFLA_STATS]);
......
...@@ -67,6 +67,7 @@ void iplink_usage(void) ...@@ -67,6 +67,7 @@ void iplink_usage(void)
fprintf(stderr, " [ broadcast LLADDR ]\n"); fprintf(stderr, " [ broadcast LLADDR ]\n");
fprintf(stderr, " [ mtu MTU ]\n"); fprintf(stderr, " [ mtu MTU ]\n");
fprintf(stderr, " [ netns PID ]\n"); fprintf(stderr, " [ netns PID ]\n");
fprintf(stderr, " [ alias NAME ]\n");
fprintf(stderr, " ip link show [ DEVICE ]\n"); fprintf(stderr, " ip link show [ DEVICE ]\n");
if (iplink_have_newlink()) { if (iplink_have_newlink()) {
...@@ -289,6 +290,12 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req, ...@@ -289,6 +290,12 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
*type = *argv; *type = *argv;
argc--; argv++; argc--; argv++;
break; break;
} else if (matches(*argv, "alias") == 0) {
NEXT_ARG();
addattr_l(&req->n, sizeof(*req), IFLA_IFALIAS,
*argv, strlen(*argv));
argc--; argv++;
break;
} else { } else {
if (strcmp(*argv, "dev") == 0) { if (strcmp(*argv, "dev") == 0) {
NEXT_ARG(); NEXT_ARG();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment