tools: bpftool: use more common tag format
authorJakub Kicinski <jakub.kicinski@netronome.com>
Mon, 16 Oct 2017 17:12:54 +0000 (10:12 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 18 Oct 2017 12:19:39 +0000 (13:19 +0100)
Program tag is usually displayed as string of bytes without
any separators (e.g. as "aa5520b1090cfeb6" vs MAC addr-like
format bpftool uses currently: "aa:55:20:b1:09:0c:fe:b6").
Make bptfool use the more common format both for displaying
the tag and selecting the program by tag.

This was pointed out in review but I misunderstood the comment.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/bpf/bpftool/Documentation/bpftool-prog.rst
tools/bpf/bpftool/main.h
tools/bpf/bpftool/prog.c

index 04d12f768f06af098515b18dc8daec5485970008..3968f0bd37dbeb495158ebf25457c256369f13fa 100644 (file)
@@ -55,7 +55,7 @@ EXAMPLES
 **# bpftool prog show**
 ::
 
-  10: xdp  name some_prog  tag 00:5a:3d:21:23:62:0c:8b
+  10: xdp  name some_prog  tag 005a3d2123620c8b
        loaded_at Sep 29/20:11  uid 0
        xlated 528B  jited 370B  memlock 4096B  map_ids 10
 
index 8e809b2bb3111614289935fe350d891b2706d1f2..844e4ef6db56f6cace484b1342e7561a5b0a8dc4 100644 (file)
@@ -53,8 +53,7 @@
 #define NEXT_ARGP()    ({ (*argc)--; (*argv)++; if (*argc < 0) usage(); })
 #define BAD_ARG()      ({ err("what is '%s'?\n", *argv); -1; })
 
-#define BPF_TAG_FMT    "%02hhx:%02hhx:%02hhx:%02hhx:"  \
-                       "%02hhx:%02hhx:%02hhx:%02hhx"
+#define BPF_TAG_FMT    "%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
 
 #define HELP_SPEC_PROGRAM                                              \
        "PROG := { id PROG_ID | pinned FILE | tag PROG_TAG }"
index 9e2681c837179659ebe11783e2ed598f2c0ab667..d60f5307b6e21e98e0bc81220fd8154c9158c23d 100644 (file)
@@ -224,7 +224,7 @@ static int show_prog(int fd)
                printf("name %s  ", info.name);
 
        printf("tag ");
-       print_hex(info.tag, BPF_TAG_SIZE, ":");
+       print_hex(info.tag, BPF_TAG_SIZE, "");
        printf("\n");
 
        if (info.load_time) {