New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Libbpf API compatibility #350
Conversation
5c0645a
to
1c44da5
Compare
Libbpf is incorporated as a submodule just for the header file. As discussed in issue #84, we cannot currently use the implementation since it is very Linux and GCC specific. This PR also fixes a bug where the user-mode API was calling CloseHandle directly instead of Platform::CloseHandle which is needed to make tests work with the mock platform. Addresses #84 Some code will be cleaner once issue #81 is done Signed-off-by: Dave Thaler <dthaler@microsoft.com>
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
// TODO(issue #223): read this mapping from the registry | ||
switch (type) { | ||
case BPF_PROG_TYPE_XDP: | ||
return &EBPF_PROGRAM_TYPE_XDP; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EBPF_PROGRAM_TYPE_XDP definition which is present in ebpf_api.h is temporary till Issue #223 is fixed. Once these definitions are removed, how will bpf_prog_type
enums be mapped to the program type guids?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By reading the mapping from the registry, as line 17 says
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
@@ -166,6 +166,8 @@ TEST_CASE("libbpf map", "[libbpf]") | |||
REQUIRE(bpf_map__prev(map, object) == nullptr); | |||
REQUIRE(bpf_map__prev(nullptr, object) == map); | |||
|
|||
const char* name = bpf_map__name(map); | |||
REQUIRE(name == nullptr); // droppacket.o has no map name. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just mentioning: PR for issue #81 will populate map names also from ELF file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that will be great. That PR will need to update this line since the test will fail until this line is updated to match.
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
Libbpf is incorporated as a submodule just for the header file.
As discussed in issue #84, we cannot currently use the implementation since it is very Linux and GCC specific.
This PR also fixes a bug where the user-mode API was calling
CloseHandle()
directly instead ofPlatform::CloseHandle()
which is needed to make tests work with the mock platform.Fixes #84 (future changes should be done under API-specific issues)
Some code will be cleaner once issue #81 is done
Signed-off-by: Dave Thaler dthaler@microsoft.com