Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dorkamotorka/ebpf-unittest
Demo Repository for eBPF XDP Unit Test
https://github.com/dorkamotorka/ebpf-unittest
Last synced: about 1 month ago
JSON representation
Demo Repository for eBPF XDP Unit Test
- Host: GitHub
- URL: https://github.com/dorkamotorka/ebpf-unittest
- Owner: dorkamotorka
- License: gpl-3.0
- Created: 2024-10-22T16:19:09.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-10-24T19:46:21.000Z (3 months ago)
- Last Synced: 2024-10-26T06:30:45.303Z (3 months ago)
- Language: C
- Size: 722 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# eBPF Unit Test
Demo Repository for eBPF XDP Unit Test
- Compile using:
```
clang -O2 -target bpf -c allow_ssh.c -o allow_ssh.o
```- Generate a Skeleton file:
```
bpftool gen skeleton allow_ssh.o > allow_ssh.skel.h
```
**Note**: An eBPF skeleton is an auto-generated file that simplifies the process of loading, attaching, and interacting with eBPF programs by providing structs and wrappers user-space application can utilize.- Compile the tests:
```
gcc -o test test.c -lbpf
```
**Note**: `-lbpf` links the program to the libbpf library, which is a user-space library that provides APIs to interact with eBPF programs.- Run it:
```
sudo ./test
```