-
Notifications
You must be signed in to change notification settings - Fork 94
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
Split BPFMap API into managed and unmanaged #356
Merged
Merged
Commits on Aug 8, 2023
-
Configuration menu - View commit details
-
Copy full SHA for d45e8f6 - Browse repository at this point
Copy the full SHA d45e8f6View commit details
Commits on Aug 9, 2023
-
Configuration menu - View commit details
-
Copy full SHA for c9b7e75 - Browse repository at this point
Copy the full SHA c9b7e75View commit details -
chore(c): move C definitions to 'libbpfgo.c'
Leaving 'libbpfgo.h' only with declarations to avoid multiple declaration errors when importing 'libbpfgo.h' from different Go files.
Configuration menu - View commit details
-
Copy full SHA for f58df61 - Browse repository at this point
Copy the full SHA f58df61View commit details
Commits on Aug 17, 2023
-
chore(c): prefix helpers with 'cgo_'
Prefix all C helpers used in Go with 'cgo_', renaming two cases where the functions does not reflect the libbpf API: set_print_fn -> cgo_libbpf_set_print_fn get_internal_map_init_value -> cgo_bpf_map__initial_value
Configuration menu - View commit details
-
Copy full SHA for 8b1190a - Browse repository at this point
Copy the full SHA 8b1190aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7b73fc0 - Browse repository at this point
Copy the full SHA 7b73fc0View commit details -
chore(map): logic refactoring and standardization
Introduced struct helpers to manage the C struct lifecycle on the C side, which avoids problems with structs which may contain bitfields. See aquasecurity#244. These are replacements for 'BPFMapBatchOpts' and 'bpfMapBatchOptsToC()'. - cgo_bpf_map_batch_opts_new - cgo_bpf_map_batch_opts_free These are replacements for 'bpfMapCreateOptsToC()' - cgo_bpf_map_create_opts_new - cgo_bpf_map_create_opts_free Restructured libbpf BPF map logic into separate files: - 'map-common.go' contains generic BPF map types, constants, and helpers like 'GetMapInfoByFD()'. - 'map-low.go' includes 'BPFMapLow' and respective logic and helpers like 'CreateMap()'. - 'map-iterator.go' contains related types and logic. In the 'BPFMap' struct: - Removed fields like 'fd' and 'name' since they must be retrieved directly from 'libbpf'. - Added 'bpfMapLow' instance for access to low-level methods. - Deprecated 'BPFMap.GetMaxEntries' in favor of using 'MaxEntries'. - Exposed 'InitialValue' and 'SetInitialValue' as public wrappers. - Introduced MapFlags(), IfIndex() and MapExtra() methods. Introduced 'misc.go' as a place for miscellaneous generic helpers. Bug Fixes: - Fixed cases where 'BPFMap.ValueSize()', possibly 0, was being passed directly to 'make()' - detected on the map of maps effort aquasecurity#343. Further Refactoring and Standardization on the map related logic and on lines touched by other changes: - Removed check for 'BPFMap.Name()' against nil, as 'C.GoString(C.NULL)' returns "". - Changed error returns to 'retC' in functions that return error values to avoid confusion with possible use of errno. - Changed returns to 'valueC' in functions that return values or pointers to values. - Suffixed variable names that are C types with 'C'. - Applied the use of 'defer' for better resource management.
Configuration menu - View commit details
-
Copy full SHA for fe71839 - Browse repository at this point
Copy the full SHA fe71839View commit details -
feat(map): introduce ReuseFD() to reuse a map fd
The `ReuseFD` function links the current BPFMap instance to a provided map file descriptor. This enables the reuse of a map that was initiated by another process. Initial effort: aquasecurity#346 Co-authored-by: Francisco Javier Honduvilla Coto <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 9cb8ba9 - Browse repository at this point
Copy the full SHA 9cb8ba9View commit details
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.