Add support for program loading flags - breaking change version #3763
+315
−25
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves: #3576
As requested by @shankarseal this is a breaking change (to keep the change simple) as the ebpf_extension_data_t wasn't following the correct contract for structures exposed to extensions.
Description
This pull request introduces several enhancements and new features to the eBPF program management system, primarily focusing on adding support for program flags and improving the handling of extension data. Below are the most significant changes grouped by theme:
Enhancements to Program Flags:
libbpf.h
andlibbpf_program.cpp
, allowing for better control over program behavior. [1] [2]ebpf_program_t
structure to include aflags
field inapi_internal.h
andebpf_program.c
, and added corresponding getter and setter functions. [1] [2] [3]ebpf_program_set_flags
function inebpf_api.cpp
to set flags on a program during initialization. [1] [2]EBPF_OPERATION_PROGRAM_SET_FLAGS
to handle setting flags via IOCTL inebpf_protocol.h
andebpf_core.c
. [1] [2]Enhancements to Extension Data:
ebpf_extension_data_t
struct to includedata_size
andprog_attach_flags
fields inebpf_extension.h
and updated related documentation. [1] [2]ebpf_link.c
to handle the new fields inebpf_extension_data_t
, ensuring proper initialization and usage during link creation and attachment. [1] [2] [3] [4] [5]ebpf_windows.h
to define new constants for version and size ofebpf_extension_data_t
.API and Export Updates:
bpf_program__flags
andbpf_program__set_flags
toebpfapi/Source.def
to expose the new flag functionalities. [1] [2]Testing and Documentation:
helpers.h
in end-to-end tests to includeebpf_windows.h
and added methods to access client data in the_single_instance_hook
class. [1] [2] [3]These changes collectively enhance the flexibility and control over eBPF programs by introducing a robust mechanism for handling program-specific flags and improving the management of extension data.
Testing
CI/CD
Documentation
Yes.
Installation
No.