Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lorenzosaino/xdp-playground
Development environment for experimenting with XDP on a VM
https://github.com/lorenzosaino/xdp-playground
ebpf ubuntu vagrant xdp
Last synced: 18 days ago
JSON representation
Development environment for experimenting with XDP on a VM
- Host: GitHub
- URL: https://github.com/lorenzosaino/xdp-playground
- Owner: lorenzosaino
- License: bsd-3-clause
- Created: 2020-10-21T23:11:14.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-04-23T11:23:46.000Z (over 2 years ago)
- Last Synced: 2024-07-30T18:13:39.704Z (3 months ago)
- Topics: ebpf, ubuntu, vagrant, xdp
- Language: Shell
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# XDP playground
XDP playground is a development environment for experimenting with XDP on a Ubuntu 20.04 virtual machine.
It allows you to write XDP programs and test their correctness by writing test cases using Python.## Requirements
You need the following installed on your machine:
* [Vagrant](http://www.vagrantup.com)
* [Virtualbox](https://www.virtualbox.org/)## Setup
Before the first usage you need to set up your virtual running
vagrant up
This will create and start a VM with all that required packages installed.
Once it is ready you can SSH into the virtual machine running:vagrant ssh
When you are done, you can destroy the VM running
vagrant destroy
## Usage
Once you have everything set up, you can start experimenting. SSH into the VM with
vagrant ssh
and move to the `/vagrant` directory. It will include all files present in the root directory of this repository.
You can now start playing with [`xdp.c`](xdp.c) and [`test.py`](test.py).The Makefile includes targets that you may find useful.
You may compile the code in [`xdp.c`](xdp.c) to eBPF bytecode withmake compile
and run all tests included in [`test.py`](test.py) with
make test
If you need additional Python packages for your tests, add them to [`requirements.txt`](requirements.txt) and run
make deps
You may also run each of these targets in Vagrant from the host OS without SSH'ing into Vagrant by prepending the `vagrant-` prefix to the command, e.g.:
make vagrant-test
These commands SSH into the Vagrant VM, move to the `/vagrant` directory and execute the specified target.
## Useful resources
* [XDP paper](https://dl.acm.org/doi/10.1145/3281411.3281443)
* [Cilium BPF and XDP Reference Guide](https://docs.cilium.io/en/latest/bpf/#bpf-guide)
* [BPF features by Linux kernel version](https://github.com/iovisor/bcc/blob/master/docs/kernel-versions.md)
* [XDP tutorial](https://github.com/xdp-project/xdp-tutorial)
* [XDP Tools](https://github.com/xdp-project/xdp-tools)