]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
vti6/tunnel: Unify and simplify link type help functions
authorSerhey Popovych <serhe.popovych@gmail.com>
Thu, 18 Jan 2018 14:04:35 +0000 (16:04 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Fri, 19 Jan 2018 00:34:41 +0000 (16:34 -0800)
Both of these two changes are missing for link_vti6.c:

  commit 8b47135474cd ("ip: link: Unify link type help functions a bit")
  commit 561e650eff67 ("ip link: Shortify printing the usage of link type")

Replay them on link_vti6.c to bring link type help functions
inline with other tunneling code.

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
ip/link_vti6.c

index 6b61e3d3229b959c612e7036897626885f1c5e57..2a86d59222a68f6074aba8b0f65d97b709df771f 100644 (file)
 #include "ip_common.h"
 #include "tunnel.h"
 
+static void print_usage(FILE *f)
+{
+       fprintf(f,
+               "Usage: ... vti6 [ remote ADDR ]\n"
+               "                [ local ADDR ]\n"
+               "                [ [i|o]key KEY ]\n"
+               "                [ dev PHYS_DEV ]\n"
+               "                [ fwmark MARK ]\n"
+               "\n"
+               "Where: ADDR := { IPV6_ADDRESS }\n"
+               "       KEY  := { DOTTED_QUAD | NUMBER }\n"
+               "       MARK := { 0x0..0xffffffff }\n"
+       );
+}
 
 static void usage(void) __attribute__((noreturn));
 static void usage(void)
 {
-       fprintf(stderr, "Usage: ip link { add | set | change | replace | del } NAME\n");
-       fprintf(stderr, "          type { vti6 } [ remote ADDR ] [ local ADDR ]\n");
-       fprintf(stderr, "          [ [i|o]key KEY ]\n");
-       fprintf(stderr, "          [ dev PHYS_DEV ]\n");
-       fprintf(stderr, "          [ fwmark MARK ]\n");
-       fprintf(stderr, "\n");
-       fprintf(stderr, "Where: NAME := STRING\n");
-       fprintf(stderr, "       ADDR := { IPV6_ADDRESS }\n");
-       fprintf(stderr, "       KEY  := { DOTTED_QUAD | NUMBER }\n");
-       fprintf(stderr, "       MARK := { 0x0..0xffffffff }\n");
+       print_usage(stderr);
        exit(-1);
 }
 
@@ -224,9 +229,16 @@ static void vti6_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
        }
 }
 
+static void vti6_print_help(struct link_util *lu, int argc, char **argv,
+       FILE *f)
+{
+       print_usage(f);
+}
+
 struct link_util vti6_link_util = {
        .id = "vti6",
        .maxattr = IFLA_VTI_MAX,
        .parse_opt = vti6_parse_opt,
        .print_opt = vti6_print_opt,
+       .print_help = vti6_print_help,
 };