Commit ff7c2084 authored by Jiri Pirko's avatar Jiri Pirko Committed by Stephen Hemminger

iproute2: allow to ipv6 set address generation mode

Signed-off-by: default avatarJiri Pirko <jiri@resnulli.us>
parent 945eaebd
......@@ -81,6 +81,7 @@ void iplink_usage(void)
fprintf(stderr, " [ state { auto | enable | disable} ] ]\n");
fprintf(stderr, " [ master DEVICE ]\n");
fprintf(stderr, " [ nomaster ]\n");
fprintf(stderr, " [ addrgenmode { eui64 | none } ]\n");
fprintf(stderr, " ip link show [ DEVICE | group GROUP ] [up]\n");
if (iplink_have_newlink()) {
......@@ -161,6 +162,15 @@ static int get_link_mode(const char *mode)
return -1;
}
static int get_addr_gen_mode(const char *mode)
{
if (strcasecmp(mode, "eui64") == 0)
return IN6_ADDR_GEN_MODE_EUI64;
if (strcasecmp(mode, "none") == 0)
return IN6_ADDR_GEN_MODE_NONE;
return -1;
}
#if IPLINK_IOCTL_COMPAT
static int have_rtnl_newlink = -1;
......@@ -561,6 +571,18 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
invarg("Invalid \"numrxqueues\" value\n", *argv);
addattr_l(&req->n, sizeof(*req), IFLA_NUM_RX_QUEUES,
&numrxqueues, 4);
} else if (matches(*argv, "addrgenmode") == 0) {
struct rtattr *afs, *afs6;
int mode;
NEXT_ARG();
mode = get_addr_gen_mode(*argv);
if (mode < 0)
invarg("Invalid address generation mode\n", *argv);
afs = addattr_nest(&req->n, sizeof(*req), IFLA_AF_SPEC);
afs6 = addattr_nest(&req->n, sizeof(*req), AF_INET6);
addattr8(&req->n, sizeof(*req), IFLA_INET6_ADDR_GEN_MODE, mode);
addattr_nest_end(&req->n, afs6);
addattr_nest_end(&req->n, afs);
} else {
if (strcmp(*argv, "dev") == 0) {
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