Skip to content

Commit 2dc7c1f

Browse files
Jakub Kicinskidavem330
authored andcommitted
tools: bpftool: use more common tag format
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 <[email protected]> Reviewed-by: Simon Horman <[email protected]> Acked-by: Daniel Borkmann <[email protected]> Acked-by: Alexei Starovoitov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 2af55f4 commit 2dc7c1f

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

tools/bpf/bpftool/Documentation/bpftool-prog.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ EXAMPLES
5555
**# bpftool prog show**
5656
::
5757

58-
10: xdp name some_prog tag 00:5a:3d:21:23:62:0c:8b
58+
10: xdp name some_prog tag 005a3d2123620c8b
5959
loaded_at Sep 29/20:11 uid 0
6060
xlated 528B jited 370B memlock 4096B map_ids 10
6161

tools/bpf/bpftool/main.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@
5353
#define NEXT_ARGP() ({ (*argc)--; (*argv)++; if (*argc < 0) usage(); })
5454
#define BAD_ARG() ({ err("what is '%s'?\n", *argv); -1; })
5555

56-
#define BPF_TAG_FMT "%02hhx:%02hhx:%02hhx:%02hhx:" \
57-
"%02hhx:%02hhx:%02hhx:%02hhx"
56+
#define BPF_TAG_FMT "%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
5857

5958
#define HELP_SPEC_PROGRAM \
6059
"PROG := { id PROG_ID | pinned FILE | tag PROG_TAG }"

tools/bpf/bpftool/prog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ static int show_prog(int fd)
224224
printf("name %s ", info.name);
225225

226226
printf("tag ");
227-
print_hex(info.tag, BPF_TAG_SIZE, ":");
227+
print_hex(info.tag, BPF_TAG_SIZE, "");
228228
printf("\n");
229229

230230
if (info.load_time) {

0 commit comments

Comments
 (0)