mirror of
https://github.com/eunomia-bpf/bpf-developer-tutorial.git
synced 2026-07-04 02:47:28 +08:00
Add more XDP related blogs (#135)
* add setup * update * fix code * move to dir * fix code * update the code * update code of 42 * update 21 * update * fix linter issues and add xdp in rust * update the docker file * fix CI * fix kernel code * update * update * add guidline
This commit is contained in:
14
src/42-xdp-loadbalancer/no-docker/xdp_pass.c
Normal file
14
src/42-xdp-loadbalancer/no-docker/xdp_pass.c
Normal file
@@ -0,0 +1,14 @@
|
||||
#include "vmlinux.h"
|
||||
#include <bpf/bpf_helpers.h>
|
||||
|
||||
SEC("xdp")
|
||||
int xdp_pass(struct xdp_md* ctx) {
|
||||
void* data = (void*)(long)ctx->data;
|
||||
void* data_end = (void*)(long)ctx->data_end;
|
||||
int pkt_sz = data_end - data;
|
||||
|
||||
bpf_printk("packet size is %d", pkt_sz);
|
||||
return XDP_PASS;
|
||||
}
|
||||
|
||||
char __license[] SEC("license") = "GPL";
|
||||
BIN
src/42-xdp-loadbalancer/no-docker/xdp_pass.o
Normal file
BIN
src/42-xdp-loadbalancer/no-docker/xdp_pass.o
Normal file
Binary file not shown.
Reference in New Issue
Block a user