mirror of
https://github.com/h3xduck/TripleCross.git
synced 2025-12-21 09:13:07 +08:00
Setup development environment with libbpf
This commit is contained in:
1
external/libbpf-bootstrap/examples/rust/xdp/src/bpf/vmlinux.h
vendored
Symbolic link
1
external/libbpf-bootstrap/examples/rust/xdp/src/bpf/vmlinux.h
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../../../vmlinux/vmlinux.h
|
||||
15
external/libbpf-bootstrap/examples/rust/xdp/src/bpf/xdppass.bpf.c
vendored
Normal file
15
external/libbpf-bootstrap/examples/rust/xdp/src/bpf/xdppass.bpf.c
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
#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: %d", pkt_sz);
|
||||
return XDP_PASS;
|
||||
}
|
||||
|
||||
char __license[] SEC("license") = "GPL";
|
||||
Reference in New Issue
Block a user