]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
iplink: implement setting of master devic
authorJiri Pirko <jpirko@redhat.com>
Sat, 26 Feb 2011 03:55:19 +0000 (19:55 -0800)
committerStephen Hemminger <stephen.hemminger@vyatta.com>
Sat, 26 Feb 2011 03:55:19 +0000 (19:55 -0800)
ip/iplink.c
man/man8/ip.8

index 8160855cea23052652ef1231452e528a4d191fc8..8c92bb1c1ed6dc8351fe11e166602cd947c28861 100644 (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();
index 0a95b1b0d847489accf3dd52c8dc1a1932316edb..c5248ef41cf0a6f4c63d2044654c39f3d05289db 100644 (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,