2021-04-25 08:56:48 +00:00
|
|
|
Compile:
|
|
|
|
|
|
|
|
```
|
2021-04-25 09:15:16 +00:00
|
|
|
clang -O2 -Wall -target bpf -c xdp_udp.c -o xdp_udp.o
|
2021-04-25 08:56:48 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
Load:
|
|
|
|
|
|
|
|
```
|
2021-04-25 09:15:16 +00:00
|
|
|
ip link set dev lo xdp obj xdp_udp.o sec xdp_udp
|
|
|
|
```
|
|
|
|
|
|
|
|
View:
|
|
|
|
|
|
|
|
```
|
|
|
|
ip link show dev lo
|
2021-04-25 08:56:48 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
Unload:
|
|
|
|
|
|
|
|
```
|
|
|
|
ip link set dev lo xdp off
|
|
|
|
```
|
2021-04-25 09:15:16 +00:00
|
|
|
|
|
|
|
Sources:
|
|
|
|
- https://github.com/xdp-project/xdp-tutorial
|
|
|
|
- https://github.com/xdp-project/xdp-tutorial/tree/master/basic01-xdp-pass
|