]> granicus.if.org Git - strace/commitdiff
bpf_sock_filter: use print_xlat32
authorEugene Syromyatnikov <evgsyr@gmail.com>
Sat, 10 Mar 2018 05:16:17 +0000 (06:16 +0100)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 12 Apr 2018 23:00:28 +0000 (23:00 +0000)
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.

bpf_sock_filter.c

index 7f8e16a8024efd9ed4ca7a1a6908831f758f637f..599141e2f7f191b5e69dd839bdf2c1501e01b504 100644 (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;
                }
        }