iplink: implement setting of master devic

This commit is contained in:
Jiri Pirko 2011-02-25 19:55:19 -08:00 committed by Stephen Hemminger
parent f323f2a32c
commit a1e191b90c
2 changed files with 30 additions and 1 deletions

View File

@ -71,6 +71,8 @@ void iplink_usage(void)
fprintf(stderr, " [ vf NUM [ mac LLADDR ]\n");
fprintf(stderr, " [ vlan VLANID [ qos VLAN-QOS ] ]\n");
fprintf(stderr, " [ rate TXRATE ] ] \n");
fprintf(stderr, " [ master DEVICE ]\n");
fprintf(stderr, " [ nomaster ]\n");
fprintf(stderr, " ip link show [ DEVICE | group GROUP ]\n");
if (iplink_have_newlink()) {
@ -362,6 +364,20 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
if (len < 0)
return -1;
addattr_nest_end(&req->n, vflist);
#ifdef IFLA_MASTER
} else if (matches(*argv, "master") == 0) {
int ifindex;
NEXT_ARG();
ifindex = ll_name_to_index(*argv);
if (!ifindex)
invarg("Device does not exist\n", *argv);
addattr_l(&req->n, sizeof(*req), IFLA_MASTER,
&ifindex, 4);
} else if (matches(*argv, "nomaster") == 0) {
int ifindex = 0;
addattr_l(&req->n, sizeof(*req), IFLA_MASTER,
&ifindex, 4);
#endif
#ifdef IFF_DYNAMIC
} else if (matches(*argv, "dynamic") == 0) {
NEXT_ARG();

View File

@ -97,7 +97,12 @@ ip \- show / manipulate routing, devices, policy routing and tunnels
.B qos
.IR VLAN-QOS " ] ] ["
.B rate
.IR TXRATE " ]"
.IR TXRATE " ] |"
.br
.B master
.IR DEVICE
.br
.B nomaster
.ti -8
.B ip link show
@ -1055,6 +1060,14 @@ Setting this parameter to 0 disables rate limiting. The
parameter must be specified.
.in -8
.TP
.BI master " DEVICE"
set master device of the device (enslave device).
.TP
.BI nomaster
unset master device of the device (release device).
.PP
.B Warning:
If multiple parameter changes are requested,