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

Output iface name when --output-meta is set #259

Merged
merged 2 commits into from
Sep 28, 2023
Merged

Conversation

brb
Copy link
Member

@brb brb commented Sep 28, 2023

This commits makes --output-meta to output not only ifindex, but also
iface name.

To achieve that, we first build a netns_inode => ifindex => iface_name
cache. This is done by entering each /proc/$PID/ns/net, and then quering
ifaces. Then, when a pwru process receives an BPF event, it queries the
cache (netns inode and ifindex are set in the event).

Example:

... [curl]  nf_hook_slow netns=4026531840 mark=0x0 iface=3(wlan0)

@brb brb added the enhancement New feature or request label Sep 28, 2023
This is going to be used for listing links (ifaces).

NB: we cannot use Go's net.Interface due to [1].

[1]: cilium/cilium#15051

Signed-off-by: Martynas Pumputis <m@lambda.lt>
This commits makes --output-meta to output not only ifindex, but also
iface name.

To achieve that, we first build a netns_inode => ifindex => iface_name
cache. This is done by entering each /proc/$PID/ns/net, and then quering
ifaces. Then, when a pwru process receives an BPF event, it queries the
cache (netns inode and ifindex are set in the event).

Example:

    ... [curl]  nf_hook_slow netns=4026531840 mark=0x0 iface=3(wlan0)

Signed-off-by: Martynas Pumputis <m@lambda.lt>
Copy link
Member

@jschwinger233 jschwinger233 left a comment

Choose a reason for hiding this comment

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

Super!

@brb brb merged commit 93ca1a5 into main Sep 28, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants