Skip to content

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

Merged
brb merged 2 commits intomainfrom
pr/brb/pp-iface-names
Sep 28, 2023
Merged

Output iface name when --output-meta is set#259
brb merged 2 commits intomainfrom
pr/brb/pp-iface-names

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
@brb brb requested a review from jschwinger233 September 28, 2023 09:36
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>
@brb brb force-pushed the pr/brb/pp-iface-names branch from 2855bb1 to ce043e5 Compare September 28, 2023 09:37
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>
@brb brb force-pushed the pr/brb/pp-iface-names branch from ce043e5 to 066721f Compare September 28, 2023 09:46
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
@brb brb deleted the pr/brb/pp-iface-names branch May 22, 2025 09:11
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.

2 participants