summaryrefslogtreecommitdiff
path: root/src/xdp/common/common_libbpf.c
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-02-15 19:05:47 +0100
committerGitHub <noreply@github.com>2023-02-15 19:05:47 +0100
commitc8a6b4cf2efec079af558997c0600c54be45215c (patch)
treeff25541d9dad6ffd304b1de5919eb308d35f090f /src/xdp/common/common_libbpf.c
parenta48940a943d237b0b2e8fcf8f9066c416d175e8d (diff)
parent819eab8708365ac5398f44c25178470358330c36 (diff)
downloadvyos-1x-c8a6b4cf2efec079af558997c0600c54be45215c.tar.gz
vyos-1x-c8a6b4cf2efec079af558997c0600c54be45215c.zip
Merge pull request #1817 from sarthurdev/bookworm
debian: T5003: Upgrade base system to Debian 12 "Bookworm"
Diffstat (limited to 'src/xdp/common/common_libbpf.c')
-rw-r--r--src/xdp/common/common_libbpf.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/xdp/common/common_libbpf.c b/src/xdp/common/common_libbpf.c
index 5788ecd9e..443ca4c66 100644
--- a/src/xdp/common/common_libbpf.c
+++ b/src/xdp/common/common_libbpf.c
@@ -24,10 +24,6 @@ static inline bool IS_ERR_OR_NULL(const void *ptr)
int bpf_prog_load_xattr_maps(const struct bpf_prog_load_attr_maps *attr,
struct bpf_object **pobj, int *prog_fd)
{
- struct bpf_object_open_attr open_attr = {
- .file = attr->file,
- .prog_type = attr->prog_type,
- };
struct bpf_program *prog, *first_prog = NULL;
enum bpf_attach_type expected_attach_type;
enum bpf_prog_type prog_type;
@@ -41,10 +37,13 @@ int bpf_prog_load_xattr_maps(const struct bpf_prog_load_attr_maps *attr,
if (!attr->file)
return -EINVAL;
+ obj = bpf_object__open_file(attr->file, NULL);
- obj = bpf_object__open_xattr(&open_attr);
- if (IS_ERR_OR_NULL(obj))
- return -ENOENT;
+ if (libbpf_get_error(obj))
+ return -EINVAL;
+
+ prog = bpf_object__next_program(obj, NULL);
+ bpf_program__set_type(prog, attr->prog_type);
bpf_object__for_each_program(prog, obj) {
/*
@@ -82,7 +81,7 @@ int bpf_prog_load_xattr_maps(const struct bpf_prog_load_attr_maps *attr,
bpf_map__for_each(map, obj) {
const char* mapname = bpf_map__name(map);
- if (!bpf_map__is_offload_neutral(map))
+ if (bpf_map__type(map) != BPF_MAP_TYPE_PERF_EVENT_ARRAY)
bpf_map__set_ifindex(map, attr->ifindex);
/* Was: map->map_ifindex = attr->ifindex; */