bpf_sock_filter: use print_xlat32

We can't simply use print_xlat here due to the way those SKF_*_OFF
constants are defined.

* bpf_sock_filter.c (print_sock_filter_k): Use print_xlat32 for printing
SKF_AD_OFF, SKF_NET_OFF, and SKF_LL_OFF named constants.
This commit is contained in:
Eugene Syromyatnikov 2018-03-10 06:16:17 +01:00 committed by Dmitry V. Levin
parent f21f7033f9
commit 2342efed27

View File

@ -39,17 +39,18 @@ print_sock_filter_k(const struct bpf_filter_block *const fp)
{
if (BPF_CLASS(fp->code) == BPF_LD && BPF_MODE(fp->code) == BPF_ABS) {
if (fp->k >= (unsigned int) SKF_AD_OFF) {
tprints("SKF_AD_OFF+");
print_xlat32(SKF_AD_OFF);
tprints("+");
printxval(skf_ad, fp->k - (unsigned int) SKF_AD_OFF,
"SKF_AD_???");
return true;
} else if (fp->k >= (unsigned int) SKF_NET_OFF) {
tprintf("%s+%u", "SKF_NET_OFF",
fp->k - (unsigned int) SKF_NET_OFF);
print_xlat32(SKF_NET_OFF);
tprintf("+%u", fp->k - (unsigned int) SKF_NET_OFF);
return true;
} else if (fp->k >= (unsigned int) SKF_LL_OFF) {
tprintf("%s+%u", "SKF_LL_OFF",
fp->k - (unsigned int) SKF_LL_OFF);
print_xlat32(SKF_LL_OFF);
tprintf("+%u", fp->k - (unsigned int) SKF_LL_OFF);
return true;
}
}