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

snapshot/socket: Refactor code #1895

Merged
merged 2 commits into from
Aug 28, 2023

Conversation

mauriciovasquezbernal
Copy link
Member

@mauriciovasquezbernal mauriciovasquezbernal commented Jul 27, 2023

  • Refactors the code in a way that RunCollector can be easily removed later on.
  • Use binary instead of string
  • Move all ebpf programs to same file

This aligns the eBPF code with experiments done in #1866.

@mauriciovasquezbernal mauriciovasquezbernal changed the title snapshot/socket: Cleanup and handle TODOs snapshot/socket: Refactor code Jul 28, 2023
@mauriciovasquezbernal mauriciovasquezbernal force-pushed the mauricio/cleanup-snapshot-socket branch 3 times, most recently from 3cba054 to e704a0d Compare August 4, 2023 20:40
Copy link
Member

@blanquicet blanquicet left a comment

Choose a reason for hiding this comment

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

A few non-blocking comments, but LGTM!

pkg/gadgets/snapshot/socket/tracer/bpf/socket.bpf.c Outdated Show resolved Hide resolved
pkg/gadgets/snapshot/socket/tracer/tracer.go Outdated Show resolved Hide resolved
This commit refactors the code in a way that RunCollector can be easily
removed later on.

Signed-off-by: Mauricio Vásquez <mauriciov@microsoft.com>
This commit reworks the snapshot socket gadget to use binary enconding
instead of strings.
It also reorganizes the code to have all eBPF programs in the same file.
This is a bit less efficient as programs that aren't used are loaded
into the kernel, but I hope to have support in the cilium/ebpf library
to handle this case.

Signed-off-by: Mauricio Vásquez <mauriciov@microsoft.com>
@mauriciovasquezbernal mauriciovasquezbernal merged commit 38f88f1 into main Aug 28, 2023
46 checks passed
@mauriciovasquezbernal mauriciovasquezbernal deleted the mauricio/cleanup-snapshot-socket branch August 28, 2023 16:46
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.

None yet

2 participants