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

Basic project structure + Build scripts #1

Merged
merged 3 commits into from
Mar 10, 2022
Merged

Basic project structure + Build scripts #1

merged 3 commits into from
Mar 10, 2022

Conversation

mariomac
Copy link

@mariomac mariomac commented Mar 7, 2022

This PR includes:

  • Basic project structure
  • Basic test+build scripts (Makefile and Dockerfile)
  • A proof-of-concept code that is going to serve as starting point for the actual agent. Don't care too much about it as it will be reworked completely but it was useful to "test" the build scripts for BPF code generation.

@mariomac
Copy link
Author

mariomac commented Mar 7, 2022

putting on hold, as I'd like to do a later investigation about wrapping https://github.com/libbpf/libbpf-bootstrap, which seems to work pretty well, in Go.

Copy link
Contributor

@jpinsonneau jpinsonneau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@OlivierCazade OlivierCazade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is great to see the first step here!

LGTM, my comments are more about the code and this is going to change since this is a POC

@@ -0,0 +1,19 @@
#!/usr/bin/env bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be we should move this script to another directory?
Here we are mixing c headers and bash scripts

__uint(max_entries, 1 << 24);
} flows SEC(".maps");

struct egress_t {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that this struct and the go struct RawStats have to be equivalent.

Anyway we could generate one from the other?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, I don't know any way (unless we create some kind of parser, which it would be a nice side project)

#!/usr/bin/env bash

# Version of libbpf to fetch headers from
LIBBPF_VERSION=0.7.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can we make sure we fetch the correct version? libbpf comes pre-installed, or do we install it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Libbpf is bundled with the Cilium library. We just need the headers for compiling the C code. I'll check if there is a way that we can fetch the Cilium's libbpf version. The destination machine does not need to install any extra library, as libbpf is only used to build the eBPF VM bytecode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants