From: Jiri Pirko Date: Sat, 26 Feb 2011 03:55:19 +0000 (-0800) Subject: iplink: implement setting of master devic X-Git-Tag: v2.6.39~13^2~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a1e191b90c35f5ef5d7dfba5ad8b5b7a7f57a421;p=thirdparty%2Fiproute2.git iplink: implement setting of master devic --- diff --git a/ip/iplink.c b/ip/iplink.c index 8160855ce..8c92bb1c1 100644 --- a/ip/iplink.c +++ b/ip/iplink.c @@ -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(); diff --git a/man/man8/ip.8 b/man/man8/ip.8 index 0a95b1b0d..c5248ef41 100644 --- a/man/man8/ip.8 +++ b/man/man8/ip.8 @@ -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,