Commit 750a405a authored by Stephen Hemminger's avatar Stephen Hemminger

Fix help text for ip link

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: default avatarStephen Hemminger <shemminger@vyatta.com>
parent 3ef0c859
...@@ -38,22 +38,41 @@ ...@@ -38,22 +38,41 @@
#endif #endif
static void usage(void) __attribute__((noreturn)); static void usage(void) __attribute__((noreturn));
static int iplink_have_newlink(void);
void iplink_usage(void) void iplink_usage(void)
{ {
fprintf(stderr, "Usage: ip link set DEVICE { up | down |\n"); if (iplink_have_newlink()) {
fprintf(stderr, " arp { on | off } |\n"); fprintf(stderr, "Usage: ip link add link DEV [ name ] NAME\n");
fprintf(stderr, " dynamic { on | off } |\n"); fprintf(stderr, " [ txqueuelen PACKETS ]\n");
fprintf(stderr, " multicast { on | off } |\n"); fprintf(stderr, " [ address LLADDR ]\n");
fprintf(stderr, " allmulticast { on | off } |\n"); fprintf(stderr, " [ broadcast LLADDR ]\n");
fprintf(stderr, " promisc { on | off } |\n"); fprintf(stderr, " [ mtu MTU ]\n");
fprintf(stderr, " trailers { on | off } |\n"); fprintf(stderr, " type TYPE [ ARGS ]\n");
fprintf(stderr, " txqueuelen PACKETS |\n"); fprintf(stderr, " ip link delete DEV type TYPE [ ARGS ]\n");
fprintf(stderr, " name NEWNAME |\n"); fprintf(stderr, "\n");
fprintf(stderr, " address LLADDR | broadcast LLADDR |\n"); fprintf(stderr, " ip link set DEVICE [ { up | down } ]\n");
fprintf(stderr, " mtu MTU }\n"); } else
fprintf(stderr, " netns PID }\n"); 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"); 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); exit(-1);
} }
......
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