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

New gadget: trace dns with uprobes #2795

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

New gadget: trace dns with uprobes #2795

wants to merge 1 commit into from

Conversation

alban
Copy link
Member

@alban alban commented May 2, 2024

New gadget: trace dns with uprobes

As an alternative to the trace dns gadget, this new gadget is using uprobe on getaddrinfo instead of socket filter.

How to use

export IG_EXPERIMENTAL=true
cd gadgets/trace_udns
sudo -E ig image build -t trace_udns --update-metadata .
sudo -E ig run trace_udns --verify-image=false

Example of output:

RUNTIME.CONTAINERNAME                     MNTNS_ID          PID                    TID           COMM             NAME                  OPERATION_STR        
mycontainer                               4026534326        2604799                2604799       wget             www.wikipedia.org.    getaddrinfo          

Testing done

Just the basic

Inspired from:

TODO:

  • Add the IPs from the DNS answers
  • Support other functions such as gethostbyname and gethostbyname2

Signed-off-by: Alban Crequy <albancrequy@linux.microsoft.com>
} lookups SEC(".maps");

SEC("uprobe/libc:getaddrinfo")
int BPF_KPROBE(getaddrinfo_e, const char *node, const char *service,
Copy link
Contributor

Choose a reason for hiding this comment

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

weak suggestion: you can also use BPF_UPROBE, and the two macros are exactly the same.

@alban
Copy link
Member Author

alban commented May 14, 2024

I continued my experiments in alban/trace-udns#1

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