Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/habibiefaried/xdp-ebpf-sample
Sample code of xdp ebpf using golang as user-space program. using C (obviously) as kernel-space
https://github.com/habibiefaried/xdp-ebpf-sample
Last synced: 12 days ago
JSON representation
Sample code of xdp ebpf using golang as user-space program. using C (obviously) as kernel-space
- Host: GitHub
- URL: https://github.com/habibiefaried/xdp-ebpf-sample
- Owner: habibiefaried
- License: mit
- Created: 2020-01-06T02:11:38.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-08-05T08:25:59.000Z (over 3 years ago)
- Last Synced: 2024-06-21T20:03:03.813Z (5 months ago)
- Language: Go
- Size: 31.3 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# xdp-ebpf-sample
Sample code of xdp ebpf using golang as user-space program. using C (obviously) as kernel-space# Installing bcc iovisor header with tools
```
$ sudo apt-get -y install bison build-essential cmake flex git libedit-dev libllvm6.0 llvm-6.0-dev libclang-6.0-dev python zlib1g-dev libelf-dev luajit luajit-5.1-dev gcc-multilib linux-tools-$(uname -r) linux-headers-$(uname -r) -y && git clone https://github.com/iovisor/bcc.git && mkdir bcc/build && cd bcc/build && cmake .. -DCMAKE_INSTALL_PREFIX=/usr && make && sudo make install
```# 1 click go installation
```
# curl https://dl.google.com/go/go1.16.6.linux-amd64.tar.gz -o go1.16.6.linux-amd64.tar.gz && tar -C /usr/local -xzf go1.16.6.linux-amd64.tar.gz && echo "export PATH=$PATH:/usr/local/go/bin" >> /root/.bashrc && source /root/.bashrc && go version && go get -u github.com/iovisor/gobpf/bcc && go get -u golang.org/x/net/context
```# Tracing of logging
I'm doing logging using `bpf_trace_printk()`.This is the command to see the logs
```
cat /sys/kernel/debug/tracing/trace_pipe
```
or
```
tc exec bpf dbg
```# Notes
* Use ubuntu 18.04 to follow this tutorial because it's fully tested on that version of OS until now
* Tested in Ubuntu 20.04.2 in ec2