|
|
7e752c |
From 5c940644dfc632f1270f39ee909e1abb877ff081 Mon Sep 17 00:00:00 2001
|
|
|
7e752c |
From: Andrea Claudi <aclaudi@redhat.com>
|
|
|
7e752c |
Date: Thu, 13 Jun 2019 14:37:57 +0200
|
|
|
7e752c |
Subject: [PATCH] bpf: add btf func and func_proto kind support
|
|
|
7e752c |
|
|
|
7e752c |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1716361
|
|
|
7e752c |
Upstream Status: iproute2.git commit 3da6d055d93fe
|
|
|
7e752c |
|
|
|
7e752c |
commit 3da6d055d93fefe40bf88a9bc37b4ce3433696ee
|
|
|
7e752c |
Author: Yonghong Song <yhs@fb.com>
|
|
|
7e752c |
Date: Thu Jan 24 16:41:07 2019 -0800
|
|
|
7e752c |
|
|
|
7e752c |
bpf: add btf func and func_proto kind support
|
|
|
7e752c |
|
|
|
7e752c |
The issue is discovered for bpf selftest test_skb_cgroup.sh.
|
|
|
7e752c |
Currently we have,
|
|
|
7e752c |
$ ./test_skb_cgroup_id.sh
|
|
|
7e752c |
Wait for testing link-local IP to become available ... OK
|
|
|
7e752c |
Object has unknown BTF type: 13!
|
|
|
7e752c |
[PASS]
|
|
|
7e752c |
|
|
|
7e752c |
In the above the BTF type 13 refers to BTF kind
|
|
|
7e752c |
BTF_KIND_FUNC_PROTO.
|
|
|
7e752c |
This patch added support of BTF_KIND_FUNC_PROTO and
|
|
|
7e752c |
BTF_KIND_FUNC during type parsing.
|
|
|
7e752c |
With this patch, I got
|
|
|
7e752c |
$ ./test_skb_cgroup_id.sh
|
|
|
7e752c |
Wait for testing link-local IP to become available ... OK
|
|
|
7e752c |
[PASS]
|
|
|
7e752c |
|
|
|
7e752c |
Signed-off-by: Yonghong Song <yhs@fb.com>
|
|
|
7e752c |
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
|
|
|
7e752c |
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
|
|
|
7e752c |
---
|
|
|
7e752c |
lib/bpf.c | 4 ++++
|
|
|
7e752c |
1 file changed, 4 insertions(+)
|
|
|
7e752c |
|
|
|
7e752c |
diff --git a/lib/bpf.c b/lib/bpf.c
|
|
|
7e752c |
index 5e85cfc0bdd5b..762f8857453ff 100644
|
|
|
7e752c |
--- a/lib/bpf.c
|
|
|
7e752c |
+++ b/lib/bpf.c
|
|
|
7e752c |
@@ -2193,12 +2193,16 @@ static int bpf_btf_prep_type_data(struct bpf_elf_ctx *ctx)
|
|
|
7e752c |
case BTF_KIND_ENUM:
|
|
|
7e752c |
type_cur += var_len * sizeof(struct btf_enum);
|
|
|
7e752c |
break;
|
|
|
7e752c |
+ case BTF_KIND_FUNC_PROTO:
|
|
|
7e752c |
+ type_cur += var_len * sizeof(struct btf_param);
|
|
|
7e752c |
+ break;
|
|
|
7e752c |
case BTF_KIND_TYPEDEF:
|
|
|
7e752c |
case BTF_KIND_PTR:
|
|
|
7e752c |
case BTF_KIND_FWD:
|
|
|
7e752c |
case BTF_KIND_VOLATILE:
|
|
|
7e752c |
case BTF_KIND_CONST:
|
|
|
7e752c |
case BTF_KIND_RESTRICT:
|
|
|
7e752c |
+ case BTF_KIND_FUNC:
|
|
|
7e752c |
break;
|
|
|
7e752c |
default:
|
|
|
7e752c |
fprintf(stderr, "Object has unknown BTF type: %u!\n", kind);
|
|
|
7e752c |
--
|
|
|
7e752c |
2.20.1
|
|
|
7e752c |
|