]> rtime.felk.cvut.cz Git - lisovros/iproute2_canprio.git/commitdiff
Fix help text for ip link
authorStephen Hemminger <stephen.hemminger@vyatta.com>
Mon, 13 Oct 2008 14:17:08 +0000 (07:17 -0700)
committerStephen Hemminger <stephen.hemminger@vyatta.com>
Mon, 13 Oct 2008 14:17:08 +0000 (07:17 -0700)
This is a variant of Patrick McHardy patch for help text.
Add help for ip link add and ip link delete.
The help conditional on what the kernel supports.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
ip/iplink.c

index 1c6b0d472c69a0356649148c02665e3aa2694f94..fd23db1f3dce476e92f283202fd050ae460b7fe2 100644 (file)
 #endif
 
 static void usage(void) __attribute__((noreturn));
+static int iplink_have_newlink(void);
 
 void iplink_usage(void)
 {
-       fprintf(stderr, "Usage: ip link set DEVICE { up | down |\n");
-       fprintf(stderr, "                            arp { on | off } |\n");
-       fprintf(stderr, "                            dynamic { on | off } |\n");
-       fprintf(stderr, "                            multicast { on | off } |\n");
-       fprintf(stderr, "                            allmulticast { on | off } |\n");
-       fprintf(stderr, "                            promisc { on | off } |\n");
-       fprintf(stderr, "                            trailers { on | off } |\n");
-       fprintf(stderr, "                            txqueuelen PACKETS |\n");
-       fprintf(stderr, "                            name NEWNAME |\n");
-       fprintf(stderr, "                            address LLADDR | broadcast LLADDR |\n");
-       fprintf(stderr, "                            mtu MTU }\n");
-       fprintf(stderr, "                            netns PID }\n");
+       if (iplink_have_newlink()) {
+               fprintf(stderr, "Usage: ip link add link DEV [ name ] NAME\n");
+               fprintf(stderr, "                   [ txqueuelen PACKETS ]\n");
+               fprintf(stderr, "                   [ address LLADDR ]\n");
+               fprintf(stderr, "                   [ broadcast LLADDR ]\n");
+               fprintf(stderr, "                   [ mtu MTU ]\n");
+               fprintf(stderr, "                   type TYPE [ ARGS ]\n");
+               fprintf(stderr, "       ip link delete DEV type TYPE [ ARGS ]\n");
+               fprintf(stderr, "\n");
+               fprintf(stderr, "       ip link set DEVICE [ { up | down } ]\n");
+       } else
+               fprintf(stderr, "Usage: ip link set DEVICE [ { up | down } ]\n");
+
+       fprintf(stderr, "                         [ arp { on | off } ]\n");
+       fprintf(stderr, "                         [ dynamic { on | off } ]\n");
+       fprintf(stderr, "                         [ multicast { on | off } ]\n");
+       fprintf(stderr, "                         [ allmulticast { on | off } ]\n");
+       fprintf(stderr, "                         [ promisc { on | off } ]\n");
+       fprintf(stderr, "                         [ trailers { on | off } ]\n");
+       fprintf(stderr, "                         [ txqueuelen PACKETS ]\n");
+       fprintf(stderr, "                         [ name NEWNAME ]\n");
+       fprintf(stderr, "                         [ address LLADDR ]\n");
+       fprintf(stderr, "                         [ broadcast LLADDR ]\n");
+       fprintf(stderr, "                         [ mtu MTU ]\n");
+       fprintf(stderr, "                         [ netns PID ]\n");
        fprintf(stderr, "       ip link show [ DEVICE ]\n");
+
+       if (iplink_have_newlink()) {
+               fprintf(stderr, "\n");
+               fprintf(stderr, "TYPE := { vlan | veth | dummy | ifb | macvlan }\n");
+       }
        exit(-1);
 }