https://github.com/asphaltt/xdpsnoop
xdpsnoop is a tool to trace XDP installation on NIC drivers.
https://github.com/asphaltt/xdpsnoop
Last synced: about 1 year ago
JSON representation
xdpsnoop is a tool to trace XDP installation on NIC drivers.
- Host: GitHub
- URL: https://github.com/asphaltt/xdpsnoop
- Owner: Asphaltt
- License: apache-2.0
- Created: 2024-03-03T15:03:02.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-06T15:41:53.000Z (over 2 years ago)
- Last Synced: 2024-04-17T23:59:06.005Z (over 2 years ago)
- Language: C
- Size: 745 KB
- Stars: 6
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# xdpsnoop: A tool to trace XDP installation on NIC drivers
`xdpsnoop` is an eBPF-based tool to trace XDP program installation and removal on NIC drivers. It is useful when something bad happens to the XDP program installation, and some error message will be printed if provided.
## Prerequisites
Linux kernel version 5.2 or later with:
- `CONFIG_BPF=y`
- `CONFIG_BPF_SYSCALL=y`
- `CONFIG_DEBUG_INFO_BTF=y`
- `CONFIG_KPROBES=y`
- `CONFIG_FUNCTION_TRACER=y`
## Usage
```sh
sudo ./xdpsnoop
2024/03/03 15:00:33 Listening for events...
2024/03/03 15:00:36 Installed XDP to ifindex=2 ifname=ens33 bpf_prog_id=438 bpf_prog_name=dummy
2024/03/03 15:00:37 Removed XDP from ifindex=2 ifname=ens33
```
## Build
With Go and clang installed, you can build `xdpsnoop` by running:
```sh
git clone https://github.com/Asphaltt/xdpsnoop.git
cd xdpsnoop
go generate
go build
```
## Credits
Thanks for [pwru](github.com/cilium/pwru) to retrieve BTF info from all kernel modules.
## License
`xdpsnoop` is licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for the full license text.
Its bpf source code is licensed under the GNU General Public License v2.0. See [LICENSE.GPL-2.0](./bpf/LICENSE.GPL-2.0) for the full license text.