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

MapType probe API #321

Merged
merged 3 commits into from
Jul 19, 2021
Merged

MapType probe API #321

merged 3 commits into from
Jul 19, 2021

Commits on Jul 16, 2021

  1. features: add HaveMapType API

    With this commit we add a new subpackage `features`. `features`
    provides an API for calling processes to probe the kernel for available
    BPF features. The first public API function added with this commit is
    `HaveMapType(mt ebpf.MapType) error`, which allows to probe for
    available BPF map types. The results of an API call are stored in an
    internal cache, resulting in a probe being run at most once even if
    called repeatedly.
    
    Signed-off-by: Robin Gögge <r.goegge@outlook.com>
    rgo3 committed Jul 16, 2021
    Configuration menu
    Copy the full SHA
    85394de View commit details
    Browse the repository at this point in the history

Commits on Jul 19, 2021

  1. features/map: handle syscall errors using switch statement

    - Removed naked error comparison to ErrNotSupported (although valid)
    - Converted error handling logic to switch statement so only a single case may fire.
      Before, it was possible to hit multiple cases if the error from BPFMapCreate
      contained multiple wrapped errors.
    - Skipped wrapping of EPERM to avoid ending up with 'unexpected error during feature probe:
      operation not permitted'. Permission errors are not unexpected.
    
    Signed-off-by: Timo Beckers <timo@isovalent.com>
    ti-mo committed Jul 19, 2021
    Configuration menu
    Copy the full SHA
    9bd52a6 View commit details
    Browse the repository at this point in the history
  2. features/map: unexport MapCache struct

    Signed-off-by: Timo Beckers <timo@isovalent.com>
    ti-mo committed Jul 19, 2021
    Configuration menu
    Copy the full SHA
    8c014a4 View commit details
    Browse the repository at this point in the history