bpf: print kern_version in the form of KERNEL_VERSION macro
* bpf.c (DEF_BPF_CMD_DECODER(BPF_PROG_LOAD)): Print union bpf_attr.kern_version in the form of KERNEL_VERSION macro call. * tests/bpf.c: Update expected output.
This commit is contained in:
parent
8c209d1ad1
commit
ffcd3a837f
5
bpf.c
5
bpf.c
@ -213,7 +213,10 @@ DEF_BPF_CMD_DECODER(BPF_PROG_LOAD)
|
||||
PRINT_FIELD_U(", ", attr, log_level);
|
||||
PRINT_FIELD_U(", ", attr, log_size);
|
||||
PRINT_FIELD_X(", ", attr, log_buf);
|
||||
PRINT_FIELD_U(", ", attr, kern_version);
|
||||
tprintf(", kern_version=KERNEL_VERSION(%u, %u, %u)",
|
||||
attr.kern_version >> 16,
|
||||
(attr.kern_version >> 8) & 0xFF,
|
||||
attr.kern_version & 0xFF);
|
||||
PRINT_FIELD_FLAGS(", ", attr, prog_flags, bpf_prog_flags, "BPF_F_???");
|
||||
decode_attr_extra_data(tcp, data, size, sizeof(attr));
|
||||
tprints("}");
|
||||
|
@ -376,7 +376,7 @@ print_BPF_PROG_LOAD_first(const unsigned long addr)
|
||||
|
||||
printf("prog_type=BPF_PROG_TYPE_SOCKET_FILTER, insn_cnt=0, insns=0"
|
||||
", license=NULL, log_level=0, log_size=0, log_buf=0"
|
||||
", kern_version=0, prog_flags=0");
|
||||
", kern_version=KERNEL_VERSION(0, 0, 0), prog_flags=0");
|
||||
}
|
||||
|
||||
static const struct bpf_insn insns[] = {
|
||||
@ -411,9 +411,10 @@ print_BPF_PROG_LOAD_attr(const unsigned long addr)
|
||||
{
|
||||
printf("prog_type=BPF_PROG_TYPE_SOCKET_FILTER, insn_cnt=%u, insns=%p"
|
||||
", license=\"GPL\", log_level=42, log_size=4096, log_buf=%p"
|
||||
", kern_version=%u, prog_flags=BPF_F_STRICT_ALIGNMENT",
|
||||
", kern_version=KERNEL_VERSION(51966, 240, 13)"
|
||||
", prog_flags=BPF_F_STRICT_ALIGNMENT",
|
||||
(unsigned int) ARRAY_SIZE(insns), insns,
|
||||
log_buf, 0xcafef00d);
|
||||
log_buf);
|
||||
}
|
||||
|
||||
# endif /* HAVE_UNION_BPF_ATTR_PROG_FLAGS */
|
||||
|
Loading…
x
Reference in New Issue
Block a user