Skip to content
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 logic #367

Merged
merged 11 commits into from
Oct 26, 2023
Merged

Split logic #367

merged 11 commits into from
Oct 26, 2023

Commits on Oct 26, 2023

  1. chore: split logic into multiple files

    This only moves code around, no functional changes.
    geyslan committed Oct 26, 2023
    Configuration menu
    Copy the full SHA
    c192943 View commit details
    Browse the repository at this point in the history
  2. chore(link): make BPF link legacy a private type

    It has no methods, and is only used embedded in the BPFLink type.
    geyslan committed Oct 26, 2023
    Configuration menu
    Copy the full SHA
    0c6a05f View commit details
    Browse the repository at this point in the history
  3. chore(go): rename C variables

    - Changed C function 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 'value' or
      pointers to 'value'.
    
    This also changed comparisons to "< 0" instead of "!= 0".
    geyslan committed Oct 26, 2023
    Configuration menu
    Copy the full SHA
    a4c5f50 View commit details
    Browse the repository at this point in the history
  4. chore: use cgo_* helpers for struct lifecycle

    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.
    
      - cgo_bpf_map_info_new()
      - cgo_bpf_map_info_size()
      - cgo_bpf_map_info_free()
    
      - cgo_bpf_tc_opts_new()
      - cgo_bpf_tc_opts_free()
    
      - cgo_bpf_tc_hook_new()
      - cgo_bpf_tc_hook_free()
    
    Based on the same aquasecurity#244 concerns, introduced bpf_map_info getters:
    
      - cgo_bpf_map_info_type()
      - cgo_bpf_map_info_id()
      - cgo_bpf_map_info_key_size()
      - cgo_bpf_map_info_value_size()
      - cgo_bpf_map_info_max_entries()
      - cgo_bpf_map_info_map_flags()
      - cgo_bpf_map_info_name()
      - cgo_bpf_map_info_ifindex()
      - cgo_bpf_map_info_btf_vmlinux_value_type_id()
      - cgo_bpf_map_info_netns_dev()
      - cgo_bpf_map_info_netns_ino()
      - cgo_bpf_map_info_btf_id()
      - cgo_bpf_map_info_btf_key_type_id()
      - cgo_bpf_map_info_btf_value_type_id()
      - cgo_bpf_map_info_map_extra()
    
      - cgo_bpf_tc_opts_prog_fd()
      - cgo_bpf_tc_opts_flags()
      - cgo_bpf_tc_opts_prog_id()
      - cgo_bpf_tc_opts_handle()
      - cgo_bpf_tc_opts_priority()
    
    Changed these functions to use cgo_* struct handlers:
    
      - NewModuleFromFileArgs()
      - GetMapInfoByFD()
      - TcHook.Destroy()
      - TcHook.Attach()
      - TcHook.Detach()
      - TcHook.Query()
    geyslan committed Oct 26, 2023
    Configuration menu
    Copy the full SHA
    913d1ea View commit details
    Browse the repository at this point in the history
  5. chore: add information to SetStrictMode()

    SetStrictMode is no-op as of libbpf v1.0.
    geyslan committed Oct 26, 2023
    Configuration menu
    Copy the full SHA
    1b882cf View commit details
    Browse the repository at this point in the history
  6. fix(link)!: Unpin link API

    The underlying bpf_link__unpin() does not receive a pointer to the
    pin path, only for the link itself.
    geyslan committed Oct 26, 2023
    Configuration menu
    Copy the full SHA
    3aeb45b View commit details
    Browse the repository at this point in the history
  7. chore: standardize defer use

    Applied the use of 'defer' for better resource management.
    geyslan committed Oct 26, 2023
    Configuration menu
    Copy the full SHA
    87088b6 View commit details
    Browse the repository at this point in the history
  8. chore(prog): remove inner name field

    The API must rely on the program name returned by the libbpf API.
    geyslan committed Oct 26, 2023
    Configuration menu
    Copy the full SHA
    77c521f View commit details
    Browse the repository at this point in the history
  9. chore: give breath to the code putting spaces

    This adds spaces to the code to make it more readable.
    
    This also puts RingBuffer.Stop() and PerfBuffer.Stop() happy path
    out of the branching logic.
    geyslan committed Oct 26, 2023
    Configuration menu
    Copy the full SHA
    0228f12 View commit details
    Browse the repository at this point in the history
  10. chore(prog): add TODO

    geyslan committed Oct 26, 2023
    Configuration menu
    Copy the full SHA
    62f0ccc View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    f1738f9 View commit details
    Browse the repository at this point in the history