├── tc ├── tc-common │ ├── src │ │ └── lib.rs │ └── Cargo.toml ├── .cargo │ └── config.toml ├── tc-ebpf │ ├── rust-toolchain.toml │ ├── .cargo │ │ └── config.toml │ ├── .vscode │ │ └── settings.json │ ├── .vim │ │ └── coc-settings.json │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── Cargo.toml ├── .vim │ └── coc-settings.json ├── .vscode │ └── settings.json ├── xtask │ ├── Cargo.toml │ └── src │ │ ├── codegen.rs │ │ ├── main.rs │ │ └── build_ebpf.rs ├── .gitignore ├── tc │ └── Cargo.toml └── README.md ├── xdp ├── xdp-common │ ├── src │ │ └── lib.rs │ └── Cargo.toml ├── .cargo │ └── config.toml ├── xdp-ebpf │ ├── rust-toolchain.toml │ ├── .cargo │ │ └── config.toml │ ├── .vim │ │ └── coc-settings.json │ ├── .vscode │ │ └── settings.json │ └── Cargo.toml ├── .vscode │ └── settings.json ├── .vim │ └── coc-settings.json ├── xtask │ ├── Cargo.toml │ └── src │ │ ├── main.rs │ │ └── build_ebpf.rs ├── Cargo.toml ├── .gitignore ├── README.md └── xdp │ ├── Cargo.toml │ └── src │ └── main.rs ├── atomic ├── atomic-common │ ├── src │ │ └── lib.rs │ └── Cargo.toml ├── .cargo │ └── config.toml ├── atomic-ebpf │ ├── rust-toolchain.toml │ ├── .cargo │ │ └── config.toml │ ├── .vim │ │ └── coc-settings.json │ ├── .vscode │ │ └── settings.json │ └── Cargo.toml ├── Cargo.toml ├── .vim │ └── coc-settings.json ├── .vscode │ └── settings.json ├── xtask │ ├── Cargo.toml │ └── src │ │ ├── main.rs │ │ └── build_ebpf.rs ├── .gitignore ├── atomic │ ├── Cargo.toml │ └── src │ │ └── main.rs └── README.md ├── cgroup ├── cgroup-common │ ├── src │ │ └── lib.rs │ └── Cargo.toml ├── .cargo │ └── config.toml ├── cgroup-ebpf │ ├── rust-toolchain.toml │ ├── .cargo │ │ └── config.toml │ ├── .vscode │ │ └── settings.json │ ├── .vim │ │ └── coc-settings.json │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── .vim │ └── coc-settings.json ├── .vscode │ └── settings.json ├── Cargo.toml ├── xtask │ ├── Cargo.toml │ └── src │ │ ├── main.rs │ │ └── build_ebpf.rs ├── .gitignore ├── cgroup │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── README.md └── Dockerfile ├── clone ├── clone-common │ ├── src │ │ └── lib.rs │ └── Cargo.toml ├── .cargo │ └── config.toml ├── clone-ebpf │ ├── rust-toolchain.toml │ ├── .cargo │ │ └── config.toml │ ├── .vim │ │ └── coc-settings.json │ ├── .vscode │ │ └── settings.json │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── Cargo.toml ├── .vim │ └── coc-settings.json ├── .vscode │ └── settings.json ├── xtask │ ├── Cargo.toml │ └── src │ │ ├── main.rs │ │ └── build_ebpf.rs ├── .gitignore ├── README.md └── clone │ ├── Cargo.toml │ └── src │ └── main.rs ├── dpath ├── dpath-common │ ├── src │ │ └── lib.rs │ └── Cargo.toml ├── .cargo │ └── config.toml ├── dpath-ebpf │ ├── rust-toolchain.toml │ ├── .cargo │ │ └── config.toml │ ├── .vscode │ │ └── settings.json │ ├── .vim │ │ └── coc-settings.json │ └── Cargo.toml ├── .vim │ └── coc-settings.json ├── .vscode │ └── settings.json ├── Cargo.toml ├── xtask │ ├── Cargo.toml │ └── src │ │ ├── main.rs │ │ └── build_ebpf.rs ├── .gitignore ├── dpath │ ├── Cargo.toml │ └── src │ │ └── main.rs └── README.md ├── notokio ├── notokio-common │ ├── src │ │ └── lib.rs │ └── Cargo.toml ├── .cargo │ └── config.toml ├── notokio-ebpf │ ├── rust-toolchain.toml │ ├── .cargo │ │ └── config.toml │ ├── .vscode │ │ └── settings.json │ ├── .vim │ │ └── coc-settings.json │ ├── src │ │ └── main.rs │ └── Cargo.toml ├── Cargo.toml ├── .vim │ └── coc-settings.json ├── .vscode │ └── settings.json ├── xtask │ ├── Cargo.toml │ └── src │ │ ├── main.rs │ │ └── build_ebpf.rs ├── .gitignore ├── notokio │ ├── Cargo.toml │ └── src │ │ └── main.rs └── README.md ├── uprobe ├── uprobe-common │ ├── src │ │ └── lib.rs │ └── Cargo.toml ├── .cargo │ └── config.toml ├── uprobe-ebpf │ ├── rust-toolchain.toml │ ├── .cargo │ │ └── config.toml │ ├── .vim │ │ └── coc-settings.json │ ├── .vscode │ │ └── settings.json │ ├── src │ │ └── main.rs │ └── Cargo.toml ├── Cargo.toml ├── .vim │ └── coc-settings.json ├── .vscode │ └── settings.json ├── xtask │ ├── Cargo.toml │ └── src │ │ ├── main.rs │ │ └── build_ebpf.rs ├── .gitignore ├── uprobe │ └── Cargo.toml └── README.md ├── xdp-mac ├── xdp-mac-common │ ├── src │ │ └── lib.rs │ └── Cargo.toml ├── .cargo │ └── config.toml ├── xdp-mac-ebpf │ ├── rust-toolchain.toml │ ├── .cargo │ │ └── config.toml │ ├── .vscode │ │ └── settings.json │ ├── .vim │ │ └── coc-settings.json │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── .vim │ └── coc-settings.json ├── .vscode │ └── settings.json ├── xtask │ ├── Cargo.toml │ └── src │ │ ├── main.rs │ │ └── build_ebpf.rs ├── Cargo.toml ├── .gitignore ├── README.md └── xdp-mac │ ├── Cargo.toml │ └── src │ └── main.rs ├── tc-srcip ├── tc-srcip-common │ ├── src │ │ └── lib.rs │ └── Cargo.toml ├── .cargo │ └── config.toml ├── tc-srcip-ebpf │ ├── rust-toolchain.toml │ ├── .cargo │ │ └── config.toml │ ├── .vim │ │ └── coc-settings.json │ ├── .vscode │ │ └── settings.json │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── Cargo.toml ├── .vscode │ └── settings.json ├── .vim │ └── coc-settings.json ├── xtask │ ├── Cargo.toml │ └── src │ │ ├── codegen.rs │ │ ├── main.rs │ │ └── build_ebpf.rs ├── Dockerfile ├── .gitignore ├── tc-srcip │ └── Cargo.toml ├── README.md └── kubernetes.yaml ├── xdp-bytes ├── xdp-bytes-common │ ├── src │ │ └── lib.rs │ └── Cargo.toml ├── .cargo │ └── config.toml ├── xdp-bytes-ebpf │ ├── rust-toolchain.toml │ ├── .cargo │ │ └── config.toml │ ├── .vim │ │ └── coc-settings.json │ ├── .vscode │ │ └── settings.json │ └── Cargo.toml ├── Cargo.toml ├── .vim │ └── coc-settings.json ├── .vscode │ └── settings.json ├── xtask │ ├── Cargo.toml │ └── src │ │ ├── codegen.rs │ │ ├── main.rs │ │ └── build_ebpf.rs ├── .gitignore ├── xdp-bytes │ └── Cargo.toml └── README.md ├── bpf-loop ├── bpf-loop-common │ ├── src │ │ └── lib.rs │ └── Cargo.toml ├── .cargo │ └── config.toml ├── bpf-loop-ebpf │ ├── .helix │ │ └── config.toml │ ├── .vim │ │ └── coc-settings.json │ ├── .vscode │ │ └── settings.json │ ├── .cargo │ │ └── config.toml │ ├── rust-toolchain.toml │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── Cargo.toml ├── .vscode │ └── settings.json ├── .dir-locals.el ├── .vim │ └── coc-settings.json ├── xtask │ ├── Cargo.toml │ └── src │ │ ├── main.rs │ │ └── build.rs ├── .gitignore ├── bpf-loop │ └── Cargo.toml └── README.md ├── pub-progs ├── pub-progs-common │ ├── src │ │ └── lib.rs │ └── Cargo.toml ├── .cargo │ └── config.toml ├── Cargo.toml ├── pub-progs-ebpf │ ├── src │ │ ├── main.rs │ │ └── lib.rs │ ├── .cargo │ │ └── config.toml │ ├── .vim │ │ └── coc-settings.json │ ├── .vscode │ │ └── settings.json │ ├── rust-toolchain.toml │ └── Cargo.toml ├── .vim │ └── coc-settings.json ├── .vscode │ └── settings.json ├── xtask │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── .gitignore ├── pub-progs │ ├── Cargo.toml │ └── src │ │ └── main.rs └── README.md ├── xdp-mut-u8 ├── xdp-mut-u8-common │ ├── src │ │ └── lib.rs │ └── Cargo.toml ├── .cargo │ └── config.toml ├── xdp-mut-u8-ebpf │ ├── rust-toolchain.toml │ ├── .cargo │ │ └── config.toml │ ├── .vim │ │ └── coc-settings.json │ ├── .vscode │ │ └── settings.json │ └── Cargo.toml ├── Cargo.toml ├── .vim │ └── coc-settings.json ├── .vscode │ └── settings.json ├── xtask │ ├── Cargo.toml │ └── src │ │ ├── main.rs │ │ └── build_ebpf.rs ├── .gitignore ├── xdp-mut-u8 │ ├── Cargo.toml │ └── src │ │ └── main.rs └── README.md ├── xdp-verifier-err ├── xdp-verifier-err-common │ ├── src │ │ └── lib.rs │ └── Cargo.toml ├── .cargo │ └── config.toml ├── xdp-verifier-err-ebpf │ ├── rust-toolchain.toml │ ├── .cargo │ │ └── config.toml │ ├── .vim │ │ └── coc-settings.json │ ├── .vscode │ │ └── settings.json │ └── Cargo.toml ├── Cargo.toml ├── .vim │ └── coc-settings.json ├── .vscode │ └── settings.json ├── xtask │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── .gitignore ├── README.md └── xdp-verifier-err │ ├── Cargo.toml │ └── src │ └── main.rs ├── cshim ├── .cargo │ └── config.toml ├── .vim │ └── coc-settings.json ├── .vscode │ └── settings.json ├── cshim-ebpf │ ├── .cargo │ │ └── config.toml │ ├── .vim │ │ └── coc-settings.json │ ├── .vscode │ │ └── settings.json │ ├── rust-toolchain.toml │ ├── src │ │ ├── vmlinux_access.h │ │ ├── vmlinux_access.c │ │ └── main.rs │ ├── Cargo.toml │ └── build.rs ├── cshim-common │ ├── src │ │ └── lib.rs │ └── Cargo.toml ├── xtask │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── Cargo.toml ├── .gitignore ├── cshim │ └── Cargo.toml └── README.md ├── tc-bytes ├── .cargo │ └── config.toml ├── tc-bytes-ebpf │ ├── rust-toolchain.toml │ ├── .cargo │ │ └── config.toml │ ├── .vim │ │ └── coc-settings.json │ ├── .vscode │ │ └── settings.json │ └── Cargo.toml ├── Cargo.toml ├── .vscode │ └── settings.json ├── .vim │ └── coc-settings.json ├── xtask │ ├── Cargo.toml │ └── src │ │ ├── codegen.rs │ │ ├── main.rs │ │ └── build_ebpf.rs ├── tc-bytes-common │ └── Cargo.toml ├── .gitignore ├── README.md └── tc-bytes │ └── Cargo.toml ├── tc-perfbuf ├── .cargo │ └── config.toml ├── Cargo.toml ├── tc-perfbuf-ebpf │ ├── rust-toolchain.toml │ ├── .cargo │ │ └── config.toml │ ├── .vim │ │ └── coc-settings.json │ ├── .vscode │ │ └── settings.json │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── .vim │ └── coc-settings.json ├── .vscode │ └── settings.json ├── xtask │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── tc-perfbuf-common │ ├── Cargo.toml │ └── src │ │ └── lib.rs ├── .gitignore ├── README.md └── tc-perfbuf │ └── Cargo.toml ├── tc-ringbuf ├── .cargo │ └── config.toml ├── .vim │ └── coc-settings.json ├── .vscode │ └── settings.json ├── tc-ringbuf-ebpf │ ├── .cargo │ │ └── config.toml │ ├── .vim │ │ └── coc-settings.json │ ├── .vscode │ │ └── settings.json │ ├── rust-toolchain.toml │ └── Cargo.toml ├── xtask │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── Cargo.toml ├── tc-ringbuf-common │ ├── Cargo.toml │ └── src │ │ └── lib.rs ├── .gitignore ├── README.md └── tc-ringbuf │ └── Cargo.toml ├── tc-load-bytes ├── .cargo │ └── config.toml ├── Cargo.toml ├── .vscode │ └── settings.json ├── .vim │ └── coc-settings.json ├── tc-load-bytes-ebpf │ ├── .cargo │ │ └── config.toml │ ├── .vim │ │ └── coc-settings.json │ ├── .vscode │ │ └── settings.json │ ├── rust-toolchain.toml │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── xtask │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── tc-load-bytes-common │ ├── src │ │ └── lib.rs │ └── Cargo.toml ├── .gitignore ├── tc-load-bytes │ ├── Cargo.toml │ └── src │ │ └── main.rs └── README.md ├── xdp-perfbuf ├── .cargo │ └── config.toml ├── xdp-perfbuf-ebpf │ ├── rust-toolchain.toml │ ├── .cargo │ │ └── config.toml │ ├── .vim │ │ └── coc-settings.json │ ├── .vscode │ │ └── settings.json │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── Cargo.toml ├── .vim │ └── coc-settings.json ├── .vscode │ └── settings.json ├── xtask │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── xdp-perfbuf-common │ ├── Cargo.toml │ └── src │ │ └── lib.rs ├── .gitignore ├── README.md └── xdp-perfbuf │ └── Cargo.toml └── tc-perfbuf-simple ├── .cargo └── config.toml ├── tc-perfbuf-simple-ebpf ├── rust-toolchain.toml ├── .cargo │ └── config.toml ├── .vscode │ └── settings.json ├── .vim │ └── coc-settings.json ├── Cargo.toml └── src │ └── main.rs ├── Cargo.toml ├── .vim └── coc-settings.json ├── .vscode └── settings.json ├── xtask ├── Cargo.toml └── src │ └── main.rs ├── tc-perfbuf-simple-common ├── Cargo.toml └── src │ └── lib.rs ├── .gitignore ├── tc-perfbuf-simple └── Cargo.toml └── README.md /tc/tc-common/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] -------------------------------------------------------------------------------- /xdp/xdp-common/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] -------------------------------------------------------------------------------- /atomic/atomic-common/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] -------------------------------------------------------------------------------- /cgroup/cgroup-common/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] -------------------------------------------------------------------------------- /clone/clone-common/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] -------------------------------------------------------------------------------- /dpath/dpath-common/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] -------------------------------------------------------------------------------- /notokio/notokio-common/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] -------------------------------------------------------------------------------- /uprobe/uprobe-common/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] -------------------------------------------------------------------------------- /xdp-mac/xdp-mac-common/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] -------------------------------------------------------------------------------- /tc-srcip/tc-srcip-common/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] -------------------------------------------------------------------------------- /xdp-bytes/xdp-bytes-common/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] -------------------------------------------------------------------------------- /bpf-loop/bpf-loop-common/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | -------------------------------------------------------------------------------- /pub-progs/pub-progs-common/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | -------------------------------------------------------------------------------- /xdp-mut-u8/xdp-mut-u8-common/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] -------------------------------------------------------------------------------- /xdp-verifier-err/xdp-verifier-err-common/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] -------------------------------------------------------------------------------- /clone/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [alias] 2 | xtask = "run --package xtask --" -------------------------------------------------------------------------------- /cshim/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [alias] 2 | xtask = "run --package xtask --" -------------------------------------------------------------------------------- /dpath/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [alias] 2 | xtask = "run --package xtask --" -------------------------------------------------------------------------------- /tc/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [alias] 2 | xtask = "run --package xtask --" -------------------------------------------------------------------------------- /tc/tc-ebpf/rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel="nightly" 3 | -------------------------------------------------------------------------------- /xdp/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [alias] 2 | xtask = "run --package xtask --" -------------------------------------------------------------------------------- /atomic/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [alias] 2 | xtask = "run --package xtask --" -------------------------------------------------------------------------------- /cgroup/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [alias] 2 | xtask = "run --package xtask --" -------------------------------------------------------------------------------- /notokio/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [alias] 2 | xtask = "run --package xtask --" -------------------------------------------------------------------------------- /pub-progs/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [alias] 2 | xtask = "run --package xtask --" -------------------------------------------------------------------------------- /tc-bytes/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [alias] 2 | xtask = "run --package xtask --" -------------------------------------------------------------------------------- /tc-perfbuf/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [alias] 2 | xtask = "run --package xtask --" -------------------------------------------------------------------------------- /tc-ringbuf/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [alias] 2 | xtask = "run --package xtask --" -------------------------------------------------------------------------------- /tc-srcip/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [alias] 2 | xtask = "run --package xtask --" -------------------------------------------------------------------------------- /tc/Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = ["tc", "tc-common", "xtask"] 3 | -------------------------------------------------------------------------------- /uprobe/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [alias] 2 | xtask = "run --package xtask --" -------------------------------------------------------------------------------- /xdp-bytes/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [alias] 2 | xtask = "run --package xtask --" -------------------------------------------------------------------------------- /xdp-mac/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [alias] 2 | xtask = "run --package xtask --" -------------------------------------------------------------------------------- /xdp-mut-u8/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [alias] 2 | xtask = "run --package xtask --" -------------------------------------------------------------------------------- /xdp/xdp-ebpf/rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel="nightly" 3 | -------------------------------------------------------------------------------- /atomic/atomic-ebpf/rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel="stage1" 3 | -------------------------------------------------------------------------------- /bpf-loop/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [alias] 2 | xtask = "run --package xtask --" 3 | -------------------------------------------------------------------------------- /cgroup/cgroup-ebpf/rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel="nightly" 3 | -------------------------------------------------------------------------------- /clone/clone-ebpf/rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel="nightly" 3 | -------------------------------------------------------------------------------- /dpath/dpath-ebpf/rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel="nightly" 3 | -------------------------------------------------------------------------------- /notokio/notokio-ebpf/rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel="nightly" 3 | -------------------------------------------------------------------------------- /tc-load-bytes/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [alias] 2 | xtask = "run --package xtask --" -------------------------------------------------------------------------------- /uprobe/uprobe-ebpf/rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel="nightly" 3 | -------------------------------------------------------------------------------- /xdp-mac/xdp-mac-ebpf/rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel="nightly" 3 | -------------------------------------------------------------------------------- /xdp-perfbuf/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [alias] 2 | xtask = "run --package xtask --" -------------------------------------------------------------------------------- /bpf-loop/bpf-loop-ebpf/.helix/config.toml: -------------------------------------------------------------------------------- 1 | [editor] 2 | workspace-lsp-roots = [] 3 | -------------------------------------------------------------------------------- /clone/Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = ["clone", "clone-common", "xtask"] 3 | -------------------------------------------------------------------------------- /tc-bytes/tc-bytes-ebpf/rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel="nightly" 3 | -------------------------------------------------------------------------------- /tc-perfbuf-simple/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [alias] 2 | xtask = "run --package xtask --" -------------------------------------------------------------------------------- /tc-srcip/tc-srcip-ebpf/rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel="nightly" 3 | -------------------------------------------------------------------------------- /xdp-bytes/xdp-bytes-ebpf/rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel="nightly" 3 | -------------------------------------------------------------------------------- /xdp-verifier-err/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [alias] 2 | xtask = "run --package xtask --" -------------------------------------------------------------------------------- /atomic/Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = ["atomic", "atomic-common", "xtask"] 3 | -------------------------------------------------------------------------------- /notokio/Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = ["notokio", "notokio-common", "xtask"] 3 | -------------------------------------------------------------------------------- /uprobe/Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = ["uprobe", "uprobe-common", "xtask"] 3 | -------------------------------------------------------------------------------- /xdp-mut-u8/xdp-mut-u8-ebpf/rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel="nightly" 3 | -------------------------------------------------------------------------------- /pub-progs/Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = ["pub-progs", "pub-progs-common", "xtask"] 3 | -------------------------------------------------------------------------------- /tc-bytes/Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = ["tc-bytes", "tc-bytes-common", "xtask"] 3 | -------------------------------------------------------------------------------- /tc-srcip/Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = ["tc-srcip", "tc-srcip-common", "xtask"] 3 | -------------------------------------------------------------------------------- /xdp-bytes/Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = ["xdp-bytes", "xdp-bytes-common", "xtask"] 3 | -------------------------------------------------------------------------------- /tc-perfbuf/Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = ["tc-perfbuf", "tc-perfbuf-common", "xtask"] 3 | -------------------------------------------------------------------------------- /tc-perfbuf/tc-perfbuf-ebpf/rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel="nightly-2023-01-10" 3 | -------------------------------------------------------------------------------- /xdp-mut-u8/Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = ["xdp-mut-u8", "xdp-mut-u8-common", "xtask"] 3 | -------------------------------------------------------------------------------- /xdp-perfbuf/xdp-perfbuf-ebpf/rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel="nightly-2023-01-10" 3 | -------------------------------------------------------------------------------- /xdp-verifier-err/xdp-verifier-err-ebpf/rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel="nightly" 3 | -------------------------------------------------------------------------------- /xdp-perfbuf/Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = ["xdp-perfbuf", "xdp-perfbuf-common", "xtask"] 3 | -------------------------------------------------------------------------------- /tc-load-bytes/Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = ["tc-load-bytes", "tc-load-bytes-common", "xtask"] 3 | -------------------------------------------------------------------------------- /bpf-loop/Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | resolver = "2" 3 | members = ["xtask", "bpf-loop", "bpf-loop-common"] 4 | -------------------------------------------------------------------------------- /tc-perfbuf-simple/tc-perfbuf-simple-ebpf/rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel="nightly-2023-01-10" 3 | -------------------------------------------------------------------------------- /tc/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "tc-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /tc/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "tc-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /xdp/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "xdp-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /clone/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "clone-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /clone/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "clone-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /cshim/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "cshim-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /cshim/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "cshim-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /dpath/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "dpath-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /dpath/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "dpath-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /pub-progs/pub-progs-ebpf/src/main.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | #![no_main] 3 | 4 | pub use pub_progs::sched_process_fork; 5 | -------------------------------------------------------------------------------- /tc-perfbuf-simple/Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = ["tc-perfbuf-simple", "tc-perfbuf-simple-common", "xtask"] 3 | -------------------------------------------------------------------------------- /xdp-verifier-err/Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = ["xdp-verifier-err", "xdp-verifier-err-common", "xtask"] 3 | -------------------------------------------------------------------------------- /xdp/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "xdp-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /atomic/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "atomic-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /atomic/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "atomic-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /bpf-loop/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "bpf-loop-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /cgroup/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "cgroup-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /cgroup/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "cgroup-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /notokio/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "notokio-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /notokio/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "notokio-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /tc-bytes/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "tc-bytes-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /tc-srcip/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "tc-srcip-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /uprobe/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "uprobe-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /uprobe/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "uprobe-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /xdp-mac/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "xdp-mac-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /xdp-mac/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "xdp-mac-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /bpf-loop/.dir-locals.el: -------------------------------------------------------------------------------- 1 | ((lsp-mode . ((lsp-rust-analyzer-linked-projects . ["Cargo.toml", "bpf-loop-ebpf/Cargo.toml"])))) 2 | -------------------------------------------------------------------------------- /bpf-loop/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "bpf-loop-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /pub-progs/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "pub-progs-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /pub-progs/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "pub-progs-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /tc-bytes/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "tc-bytes-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /tc-perfbuf/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "tc-perfbuf-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /tc-perfbuf/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "tc-perfbuf-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /tc-ringbuf/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "tc-ringbuf-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /tc-ringbuf/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "tc-ringbuf-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /tc-srcip/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "tc-srcip-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /xdp-bytes/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "xdp-bytes-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /xdp-bytes/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "xdp-bytes-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /tc-load-bytes/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "tc-load-bytes-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /xdp-perfbuf/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "xdp-perfbuf-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /xdp-perfbuf/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "xdp-perfbuf-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /tc-load-bytes/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "tc-load-bytes-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /tc-perfbuf-simple/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "tc-perfbuf-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /tc-perfbuf-simple/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "tc-perfbuf-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /xdp-verifier-err/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "xdp-verifier-err-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /xdp-verifier-err/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": ["Cargo.toml", "xdp-verifier-err-ebpf/Cargo.toml"] 3 | } 4 | -------------------------------------------------------------------------------- /tc/tc-ebpf/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | target-dir = "../target" 3 | target = "bpfel-unknown-none" 4 | 5 | [unstable] 6 | build-std = ["core"] -------------------------------------------------------------------------------- /xdp-mut-u8/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": [ 3 | "Cargo.toml", 4 | "xdp-mut-u8-ebpf/Cargo.toml" 5 | ] 6 | } -------------------------------------------------------------------------------- /xdp-mut-u8/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": [ 3 | "Cargo.toml", 4 | "xdp-mut-u8-ebpf/Cargo.toml" 5 | ] 6 | } -------------------------------------------------------------------------------- /xdp/xdp-ebpf/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | target-dir = "../target" 3 | target = "bpfel-unknown-none" 4 | 5 | [unstable] 6 | build-std = ["core"] -------------------------------------------------------------------------------- /atomic/atomic-ebpf/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | target-dir = "../target" 3 | target = "bpfel-unknown-none" 4 | 5 | [unstable] 6 | build-std = ["core"] -------------------------------------------------------------------------------- /cgroup/cgroup-ebpf/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | target-dir = "../target" 3 | target = "bpfel-unknown-none" 4 | 5 | [unstable] 6 | build-std = ["core"] -------------------------------------------------------------------------------- /clone/clone-ebpf/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | target-dir = "../target" 3 | target = "bpfel-unknown-none" 4 | 5 | [unstable] 6 | build-std = ["core"] -------------------------------------------------------------------------------- /cshim/cshim-ebpf/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | target-dir = "../target" 3 | target = "bpfel-unknown-none" 4 | 5 | [unstable] 6 | build-std = ["core"] -------------------------------------------------------------------------------- /dpath/dpath-ebpf/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | target-dir = "../target" 3 | target = "bpfel-unknown-none" 4 | 5 | [unstable] 6 | build-std = ["core"] -------------------------------------------------------------------------------- /uprobe/uprobe-ebpf/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | target-dir = "../target" 3 | target = "bpfel-unknown-none" 4 | 5 | [unstable] 6 | build-std = ["core"] -------------------------------------------------------------------------------- /notokio/notokio-ebpf/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | target-dir = "../target" 3 | target = "bpfel-unknown-none" 4 | 5 | [unstable] 6 | build-std = ["core"] -------------------------------------------------------------------------------- /pub-progs/pub-progs-ebpf/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | target-dir = "../target" 3 | target = "bpfel-unknown-none" 4 | 5 | [unstable] 6 | build-std = ["core"] -------------------------------------------------------------------------------- /tc-bytes/tc-bytes-ebpf/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | target-dir = "../target" 3 | target = "bpfel-unknown-none" 4 | 5 | [unstable] 6 | build-std = ["core"] -------------------------------------------------------------------------------- /tc-srcip/tc-srcip-ebpf/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | target-dir = "../target" 3 | target = "bpfel-unknown-none" 4 | 5 | [unstable] 6 | build-std = ["core"] -------------------------------------------------------------------------------- /tc/tc-ebpf/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /xdp-bytes/xdp-bytes-ebpf/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | target-dir = "../target" 3 | target = "bpfel-unknown-none" 4 | 5 | [unstable] 6 | build-std = ["core"] -------------------------------------------------------------------------------- /xdp-mac/xdp-mac-ebpf/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | target-dir = "../target" 3 | target = "bpfel-unknown-none" 4 | 5 | [unstable] 6 | build-std = ["core"] -------------------------------------------------------------------------------- /cgroup/cgroup-ebpf/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false, 4 | } -------------------------------------------------------------------------------- /dpath/dpath-ebpf/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false, 4 | } -------------------------------------------------------------------------------- /tc-perfbuf/tc-perfbuf-ebpf/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | target-dir = "../target" 3 | target = "bpfel-unknown-none" 4 | 5 | [unstable] 6 | build-std = ["core"] -------------------------------------------------------------------------------- /tc-ringbuf/tc-ringbuf-ebpf/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | target-dir = "../target" 3 | target = "bpfel-unknown-none" 4 | 5 | [unstable] 6 | build-std = ["core"] -------------------------------------------------------------------------------- /tc/tc-ebpf/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /xdp-mut-u8/xdp-mut-u8-ebpf/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | target-dir = "../target" 3 | target = "bpfel-unknown-none" 4 | 5 | [unstable] 6 | build-std = ["core"] -------------------------------------------------------------------------------- /xdp-perfbuf/xdp-perfbuf-ebpf/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | target-dir = "../target" 3 | target = "bpfel-unknown-none" 4 | 5 | [unstable] 6 | build-std = ["core"] -------------------------------------------------------------------------------- /xdp/xdp-ebpf/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /xdp/xdp-ebpf/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /atomic/atomic-ebpf/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /atomic/atomic-ebpf/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /cgroup/cgroup-ebpf/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /clone/clone-ebpf/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /clone/clone-ebpf/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /cshim/cshim-ebpf/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /cshim/cshim-ebpf/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /dpath/dpath-ebpf/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /notokio/notokio-ebpf/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /tc-load-bytes/tc-load-bytes-ebpf/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | target-dir = "../target" 3 | target = "bpfel-unknown-none" 4 | 5 | [unstable] 6 | build-std = ["core"] -------------------------------------------------------------------------------- /uprobe/uprobe-ebpf/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /uprobe/uprobe-ebpf/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /xdp-mac/xdp-mac-ebpf/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /bpf-loop/bpf-loop-ebpf/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /bpf-loop/bpf-loop-ebpf/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /notokio/notokio-ebpf/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /pub-progs/pub-progs-ebpf/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /pub-progs/pub-progs-ebpf/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /tc-bytes/tc-bytes-ebpf/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /tc-bytes/tc-bytes-ebpf/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /tc-srcip/tc-srcip-ebpf/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /tc-srcip/tc-srcip-ebpf/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /xdp-bytes/xdp-bytes-ebpf/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /xdp-bytes/xdp-bytes-ebpf/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /xdp-mac/xdp-mac-ebpf/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /xdp-verifier-err/xdp-verifier-err-ebpf/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | target-dir = "../target" 3 | target = "bpfel-unknown-none" 4 | 5 | [unstable] 6 | build-std = ["core"] -------------------------------------------------------------------------------- /dpath/Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = ["dpath", "dpath-common", "xtask"] 3 | 4 | [patch.crates-io] 5 | aya = { git = "https://github.com/aya-rs/aya", branch = "main" } 6 | -------------------------------------------------------------------------------- /tc-perfbuf-simple/tc-perfbuf-simple-ebpf/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | target-dir = "../target" 3 | target = "bpfel-unknown-none" 4 | 5 | [unstable] 6 | build-std = ["core"] -------------------------------------------------------------------------------- /tc-perfbuf/tc-perfbuf-ebpf/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /tc-perfbuf/tc-perfbuf-ebpf/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /tc-ringbuf/tc-ringbuf-ebpf/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /tc-ringbuf/tc-ringbuf-ebpf/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /xdp-mut-u8/xdp-mut-u8-ebpf/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /xdp-mut-u8/xdp-mut-u8-ebpf/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /xdp-perfbuf/xdp-perfbuf-ebpf/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /xdp-perfbuf/xdp-perfbuf-ebpf/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /cgroup/Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = ["cgroup", "cgroup-common", "xtask"] 3 | 4 | [patch.crates-io] 5 | aya = { git = "https://github.com/aya-rs/aya", branch = "main" } 6 | -------------------------------------------------------------------------------- /cshim/cshim-common/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | 3 | use core::ffi::c_int; 4 | 5 | #[repr(C)] 6 | pub struct Event { 7 | pub pid: c_int, 8 | pub tgid: c_int, 9 | } 10 | -------------------------------------------------------------------------------- /tc-load-bytes/tc-load-bytes-ebpf/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /tc-load-bytes/tc-load-bytes-ebpf/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /tc-perfbuf-simple/tc-perfbuf-simple-ebpf/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /xdp-verifier-err/xdp-verifier-err-ebpf/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /xdp-verifier-err/xdp-verifier-err-ebpf/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /clone/xtask/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xtask" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | anyhow = "1" 8 | clap = { version = "3.1", features = ["derive"] } 9 | -------------------------------------------------------------------------------- /cshim/xtask/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xtask" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | anyhow = "1" 8 | clap = { version = "4.1", features = ["derive"] } 9 | -------------------------------------------------------------------------------- /dpath/xtask/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xtask" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | anyhow = "1" 8 | clap = { version = "3.1", features = ["derive"] } 9 | -------------------------------------------------------------------------------- /tc-perfbuf-simple/tc-perfbuf-simple-ebpf/.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.cargo.target": "bpfel-unknown-none", 3 | "rust-analyzer.checkOnSave.allTargets": false 4 | } 5 | -------------------------------------------------------------------------------- /xdp/xtask/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xtask" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | anyhow = "1" 8 | clap = { version = "3.1", features = ["derive"] } 9 | -------------------------------------------------------------------------------- /atomic/xtask/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xtask" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | anyhow = "1" 8 | clap = { version = "4.0", features = ["derive"] } 9 | -------------------------------------------------------------------------------- /bpf-loop/xtask/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xtask" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | anyhow = "1" 8 | clap = { version = "4.1", features = ["derive"] } 9 | -------------------------------------------------------------------------------- /cgroup/xtask/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xtask" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | anyhow = "1" 8 | clap = { version = "3.1", features = ["derive"] } 9 | -------------------------------------------------------------------------------- /notokio/xtask/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xtask" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | anyhow = "1" 8 | clap = { version = "3.1", features = ["derive"] } 9 | -------------------------------------------------------------------------------- /pub-progs/xtask/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xtask" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | anyhow = "1" 8 | clap = { version = "4.1", features = ["derive"] } 9 | -------------------------------------------------------------------------------- /tc-perfbuf/xtask/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xtask" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | anyhow = "1" 8 | clap = { version = "4.0", features = ["derive"] } 9 | -------------------------------------------------------------------------------- /tc-ringbuf/xtask/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xtask" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | anyhow = "1" 8 | clap = { version = "4.0", features = ["derive"] } 9 | -------------------------------------------------------------------------------- /uprobe/xtask/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xtask" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | anyhow = "1" 8 | clap = { version = "4.0", features = ["derive"] } 9 | -------------------------------------------------------------------------------- /xdp-mac/xtask/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xtask" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | anyhow = "1" 8 | clap = { version = "3.1", features = ["derive"] } 9 | -------------------------------------------------------------------------------- /xdp-mut-u8/xtask/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xtask" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | anyhow = "1" 8 | clap = { version = "3.1", features = ["derive"] } 9 | -------------------------------------------------------------------------------- /xdp/Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = ["xdp", "xdp-common", "xtask"] 3 | 4 | [patch.crates-io] 5 | aya = { git = "https://github.com/aya-rs/aya", branch = "main", features=["async_tokio"] } 6 | -------------------------------------------------------------------------------- /cshim/Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = ["cshim", "cshim-common", "xtask"] 3 | 4 | [patch.crates-io] 5 | aya = { git = "https://github.com/aya-rs/aya", branch = "main", features=["async_tokio"] } 6 | -------------------------------------------------------------------------------- /tc-load-bytes/xtask/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xtask" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | anyhow = "1" 8 | clap = { version = "4.1", features = ["derive"] } 9 | -------------------------------------------------------------------------------- /xdp-mac/Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = ["xdp-mac", "xdp-mac-common", "xtask"] 3 | 4 | [patch.crates-io] 5 | aya = { git = "https://github.com/vadorovsky/aya", branch = "aya-log-mac-addr" } 6 | -------------------------------------------------------------------------------- /xdp-perfbuf/xtask/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xtask" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | anyhow = "1" 8 | clap = { version = "4.0", features = ["derive"] } 9 | -------------------------------------------------------------------------------- /tc-perfbuf-simple/xtask/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xtask" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | anyhow = "1" 8 | clap = { version = "4.0", features = ["derive"] } 9 | -------------------------------------------------------------------------------- /xdp-verifier-err/xtask/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xtask" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | anyhow = "1" 8 | clap = { version = "3.1", features = ["derive"] } 9 | -------------------------------------------------------------------------------- /bpf-loop/bpf-loop-ebpf/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | target-dir = "../target" 3 | target = "bpfel-unknown-none" 4 | rustflags = "-C debuginfo=2 -C link-arg=--btf" 5 | 6 | [unstable] 7 | build-std = ["core"] 8 | -------------------------------------------------------------------------------- /tc-ringbuf/Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = ["tc-ringbuf", "tc-ringbuf-common", "xtask"] 3 | 4 | [patch.crates-io] 5 | aya = { git = "https://github.com/vadorovsky/aya", branch = "ringbuf-integration", features = ["async_tokio"] } 6 | -------------------------------------------------------------------------------- /tc-load-bytes/tc-load-bytes-common/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | 3 | pub const MAX_MTU: usize = 1500; 4 | 5 | #[derive(Debug, Copy, Clone)] 6 | #[repr(C)] 7 | pub struct PacketBuffer { 8 | // pub size: usize, 9 | pub buf: [u8; MAX_MTU], 10 | } 11 | -------------------------------------------------------------------------------- /tc/xtask/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xtask" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | anyhow = "1" 8 | aya-tool = { git = "https://github.com/aya-rs/aya", branch = "main" } 9 | clap = { version = "3.1", features = ["derive"] } 10 | -------------------------------------------------------------------------------- /tc-bytes/xtask/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xtask" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | anyhow = "1" 8 | aya-tool = { git = "https://github.com/aya-rs/aya", branch = "main" } 9 | clap = { version = "3.1", features = ["derive"] } 10 | -------------------------------------------------------------------------------- /tc-srcip/xtask/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xtask" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | anyhow = "1" 8 | aya-tool = { git = "https://github.com/aya-rs/aya", branch = "main" } 9 | clap = { version = "3.1", features = ["derive"] } 10 | -------------------------------------------------------------------------------- /xdp-bytes/xtask/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xtask" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | anyhow = "1" 8 | aya-tool = { git = "https://github.com/aya-rs/aya", branch = "main" } 9 | clap = { version = "3.1", features = ["derive"] } 10 | -------------------------------------------------------------------------------- /cshim/cshim-ebpf/rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel = "nightly" 3 | # The source code of rustc, provided by the rust-src component, is needed for 4 | # building eBPF programs. 5 | components = [ "rustc", "rust-std", "cargo", "rust-docs", "rustfmt", "clippy", "rust-src" ] 6 | -------------------------------------------------------------------------------- /tc/tc-common/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "tc-common" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [features] 7 | default = [] 8 | user = [ "aya" ] 9 | 10 | [dependencies] 11 | aya = { version = ">=0.11", optional=true } 12 | 13 | [lib] 14 | path = "src/lib.rs" 15 | -------------------------------------------------------------------------------- /xdp/xdp-common/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xdp-common" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [features] 7 | default = [] 8 | user = [ "aya" ] 9 | 10 | [dependencies] 11 | aya = { version = ">=0.11", optional=true } 12 | 13 | [lib] 14 | path = "src/lib.rs" 15 | -------------------------------------------------------------------------------- /clone/clone-common/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "clone-common" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [features] 7 | default = [] 8 | user = [ "aya" ] 9 | 10 | [dependencies] 11 | aya = { version = ">=0.11", optional=true } 12 | 13 | [lib] 14 | path = "src/lib.rs" 15 | -------------------------------------------------------------------------------- /cshim/cshim-common/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "cshim-common" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [features] 7 | default = [] 8 | user = ["aya"] 9 | 10 | [dependencies] 11 | aya = { version = ">=0.11", optional = true } 12 | 13 | [lib] 14 | path = "src/lib.rs" 15 | -------------------------------------------------------------------------------- /atomic/atomic-common/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "atomic-common" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [features] 7 | default = [] 8 | user = [ "aya" ] 9 | 10 | [dependencies] 11 | aya = { version = ">=0.11", optional=true } 12 | 13 | [lib] 14 | path = "src/lib.rs" 15 | -------------------------------------------------------------------------------- /bpf-loop/bpf-loop-common/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "bpf-loop-common" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [features] 7 | default = [] 8 | user = ["aya"] 9 | 10 | [dependencies] 11 | aya = { version = "0.12", optional = true } 12 | 13 | [lib] 14 | path = "src/lib.rs" 15 | -------------------------------------------------------------------------------- /pub-progs/pub-progs-ebpf/rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel="nightly-2023-01-10" 3 | # The source code of rustc, provided by the rust-src component, is needed for 4 | # building eBPF programs. 5 | components = [ "rustc", "rust-std", "cargo", "rust-docs", "rustfmt", "clippy", "rust-src" ] 6 | -------------------------------------------------------------------------------- /tc-ringbuf/tc-ringbuf-ebpf/rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel="nightly-2023-01-10" 3 | # The source code of rustc, provided by the rust-src component, is needed for 4 | # building eBPF programs. 5 | components = [ "rustc", "rust-std", "cargo", "rust-docs", "rustfmt", "clippy", "rust-src" ] 6 | -------------------------------------------------------------------------------- /uprobe/uprobe-common/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "uprobe-common" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [features] 7 | default = [] 8 | user = [ "aya" ] 9 | 10 | [dependencies] 11 | aya = { version = ">=0.11", optional=true } 12 | 13 | [lib] 14 | path = "src/lib.rs" 15 | -------------------------------------------------------------------------------- /pub-progs/pub-progs-common/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "pub-progs-common" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [features] 7 | default = [] 8 | user = ["aya"] 9 | 10 | [dependencies] 11 | aya = { version = ">=0.11", optional = true } 12 | 13 | [lib] 14 | path = "src/lib.rs" 15 | -------------------------------------------------------------------------------- /tc-bytes/tc-bytes-common/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "tc-bytes-common" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [features] 7 | default = [] 8 | user = [ "aya" ] 9 | 10 | [dependencies] 11 | aya = { version = ">=0.11", optional=true } 12 | 13 | [lib] 14 | path = "src/lib.rs" 15 | -------------------------------------------------------------------------------- /tc-srcip/tc-srcip-common/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "tc-srcip-common" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [features] 7 | default = [] 8 | user = [ "aya" ] 9 | 10 | [dependencies] 11 | aya = { version = ">=0.11", optional=true } 12 | 13 | [lib] 14 | path = "src/lib.rs" 15 | -------------------------------------------------------------------------------- /xdp-bytes/xdp-bytes-common/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xdp-bytes-common" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [features] 7 | default = [] 8 | user = [ "aya" ] 9 | 10 | [dependencies] 11 | aya = { version = ">=0.11", optional=true } 12 | 13 | [lib] 14 | path = "src/lib.rs" 15 | -------------------------------------------------------------------------------- /tc-load-bytes/tc-load-bytes-ebpf/rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel="nightly-2023-01-10" 3 | # The source code of rustc, provided by the rust-src component, is needed for 4 | # building eBPF programs. 5 | components = [ "rustc", "rust-std", "cargo", "rust-docs", "rustfmt", "clippy", "rust-src" ] 6 | -------------------------------------------------------------------------------- /tc-perfbuf/tc-perfbuf-common/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "tc-perfbuf-common" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [features] 7 | default = [] 8 | user = [ "aya" ] 9 | 10 | [dependencies] 11 | aya = { version = ">=0.11", optional=true } 12 | 13 | [lib] 14 | path = "src/lib.rs" 15 | -------------------------------------------------------------------------------- /xdp-mut-u8/xdp-mut-u8-common/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xdp-mut-u8-common" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [features] 7 | default = [] 8 | user = [ "aya" ] 9 | 10 | [dependencies] 11 | aya = { version = ">=0.11", optional=true } 12 | 13 | [lib] 14 | path = "src/lib.rs" 15 | -------------------------------------------------------------------------------- /xdp-perfbuf/xdp-perfbuf-common/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xdp-perfbuf-common" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [features] 7 | default = [] 8 | user = [ "aya" ] 9 | 10 | [dependencies] 11 | aya = { version = ">=0.11", optional=true } 12 | 13 | [lib] 14 | path = "src/lib.rs" 15 | -------------------------------------------------------------------------------- /tc-load-bytes/tc-load-bytes-common/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "tc-load-bytes-common" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [features] 7 | default = [] 8 | user = ["aya"] 9 | 10 | [dependencies] 11 | aya = { version = ">=0.11", optional = true } 12 | 13 | [lib] 14 | path = "src/lib.rs" 15 | -------------------------------------------------------------------------------- /tc-perfbuf/tc-perfbuf-common/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | 3 | #[derive(Debug, Copy, Clone)] 4 | #[repr(C)] 5 | pub struct PacketBuffer { 6 | pub size: usize, 7 | } 8 | 9 | #[cfg(feature = "user")] 10 | pub mod user { 11 | use super::*; 12 | 13 | unsafe impl aya::Pod for PacketBuffer {} 14 | } 15 | -------------------------------------------------------------------------------- /xdp-perfbuf/xdp-perfbuf-common/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | 3 | #[derive(Debug, Copy, Clone)] 4 | #[repr(C)] 5 | pub struct PacketBuffer { 6 | pub size: usize, 7 | } 8 | 9 | #[cfg(feature = "user")] 10 | pub mod user { 11 | use super::*; 12 | 13 | unsafe impl aya::Pod for PacketBuffer {} 14 | } 15 | -------------------------------------------------------------------------------- /dpath/dpath-common/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "dpath-common" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [features] 7 | default = [] 8 | user = [ "aya" ] 9 | 10 | [dependencies] 11 | aya = { git = "https://github.com/aya-rs/aya", branch = "main", optional=true } 12 | 13 | [lib] 14 | path = "src/lib.rs" -------------------------------------------------------------------------------- /cgroup/cgroup-common/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "cgroup-common" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [features] 7 | default = [] 8 | user = [ "aya" ] 9 | 10 | [dependencies] 11 | aya = { git = "https://github.com/aya-rs/aya", branch = "main", optional=true } 12 | 13 | [lib] 14 | path = "src/lib.rs" -------------------------------------------------------------------------------- /tc-perfbuf-simple/tc-perfbuf-simple-common/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "tc-perfbuf-simple-common" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [features] 7 | default = [] 8 | user = [ "aya" ] 9 | 10 | [dependencies] 11 | aya = { version = ">=0.11", optional=true } 12 | 13 | [lib] 14 | path = "src/lib.rs" 15 | -------------------------------------------------------------------------------- /tc-perfbuf-simple/tc-perfbuf-simple-common/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | 3 | #[derive(Debug, Copy, Clone)] 4 | #[repr(C)] 5 | pub struct PacketBuffer { 6 | pub size: usize, 7 | } 8 | 9 | #[cfg(feature = "user")] 10 | pub mod user { 11 | use super::*; 12 | 13 | unsafe impl aya::Pod for PacketBuffer {} 14 | } 15 | -------------------------------------------------------------------------------- /xdp-verifier-err/xdp-verifier-err-common/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xdp-verifier-err-common" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [features] 7 | default = [] 8 | user = [ "aya" ] 9 | 10 | [dependencies] 11 | aya = { version = ">=0.11", optional=true } 12 | 13 | [lib] 14 | path = "src/lib.rs" 15 | -------------------------------------------------------------------------------- /notokio/notokio-common/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "notokio-common" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [features] 7 | default = [] 8 | user = [ "aya" ] 9 | 10 | [dependencies] 11 | aya = { git = "https://github.com/vadorovsky/aya", branch = "aya-log-tokio", optional = true } 12 | 13 | [lib] 14 | path = "src/lib.rs" 15 | -------------------------------------------------------------------------------- /xdp-mac/xdp-mac-common/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xdp-mac-common" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [features] 7 | default = [] 8 | user = [ "aya" ] 9 | 10 | [dependencies] 11 | aya = { git = "https://github.com/vadorovsky/aya", branch = "aya-log-mac-addr", optional=true } 12 | 13 | [lib] 14 | path = "src/lib.rs" 15 | -------------------------------------------------------------------------------- /bpf-loop/bpf-loop-ebpf/rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel = "nightly" 3 | # The source code of rustc, provided by the rust-src component, is needed for 4 | # building eBPF programs. 5 | components = [ 6 | "cargo", 7 | "clippy", 8 | "rust-docs", 9 | "rust-src", 10 | "rust-std", 11 | "rustc", 12 | "rustfmt", 13 | ] 14 | -------------------------------------------------------------------------------- /tc-ringbuf/tc-ringbuf-common/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "tc-ringbuf-common" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [features] 7 | default = [] 8 | user = [ "aya" ] 9 | 10 | [dependencies] 11 | aya = { git = "https://github.com/vadorovsky/aya", branch = "ringbuf-integration", optional=true } 12 | 13 | [lib] 14 | path = "src/lib.rs" 15 | -------------------------------------------------------------------------------- /cshim/cshim-ebpf/src/vmlinux_access.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "types.h" 4 | #include 5 | #include 6 | 7 | struct task_struct { 8 | int pid; 9 | int tgid; 10 | } __attribute__((preserve_access_index)); 11 | 12 | int task_struct_pid(struct task_struct *task); 13 | int task_struct_tgid(struct task_struct *task); 14 | -------------------------------------------------------------------------------- /cshim/cshim-ebpf/src/vmlinux_access.c: -------------------------------------------------------------------------------- 1 | #include "vmlinux_access.h" 2 | 3 | int task_struct_pid(struct task_struct *task) 4 | { 5 | if (task == 0) { 6 | return -1; 7 | } 8 | return BPF_CORE_READ(task, pid); 9 | } 10 | 11 | int task_struct_tgid(struct task_struct *task) 12 | { 13 | if (task == 0) { 14 | return -1; 15 | } 16 | return BPF_CORE_READ(task, tgid); 17 | } 18 | -------------------------------------------------------------------------------- /tc-srcip/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rustlang/rust:nightly-bullseye-slim AS build 2 | 3 | COPY . /src 4 | WORKDIR /src 5 | RUN rustup component add rust-src 6 | RUN cargo install bpf-linker 7 | RUN cargo xtask build-ebpf --release \ 8 | && cargo build --release 9 | 10 | FROM debian:bullseye-slim 11 | 12 | COPY --from=build /src/target/release/tc-srcip /usr/bin/tc-srcip 13 | ENTRYPOINT [ "/usr/bin/tc-srcip" ] 14 | -------------------------------------------------------------------------------- /tc-ringbuf/tc-ringbuf-common/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | 3 | // Has to be aligned to 8 bytes. 4 | pub const MAX_MTU: usize = 1504; 5 | 6 | #[derive(Debug, Copy, Clone)] 7 | #[repr(C)] 8 | pub struct PacketBuffer { 9 | pub size: usize, 10 | pub buf: [u8; MAX_MTU], 11 | } 12 | 13 | #[cfg(feature = "user")] 14 | pub mod user { 15 | use super::*; 16 | 17 | unsafe impl aya::Pod for PacketBuffer {} 18 | } 19 | -------------------------------------------------------------------------------- /tc/.gitignore: -------------------------------------------------------------------------------- 1 | ### https://raw.github.com/github/gitignore/master/Rust.gitignore 2 | 3 | # Generated by Cargo 4 | # will have compiled files and executables 5 | debug/ 6 | target/ 7 | 8 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 9 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 10 | Cargo.lock 11 | 12 | # These are backup files generated by rustfmt 13 | **/*.rs.bk 14 | -------------------------------------------------------------------------------- /xdp/.gitignore: -------------------------------------------------------------------------------- 1 | ### https://raw.github.com/github/gitignore/master/Rust.gitignore 2 | 3 | # Generated by Cargo 4 | # will have compiled files and executables 5 | debug/ 6 | target/ 7 | 8 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 9 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 10 | Cargo.lock 11 | 12 | # These are backup files generated by rustfmt 13 | **/*.rs.bk 14 | -------------------------------------------------------------------------------- /atomic/.gitignore: -------------------------------------------------------------------------------- 1 | ### https://raw.github.com/github/gitignore/master/Rust.gitignore 2 | 3 | # Generated by Cargo 4 | # will have compiled files and executables 5 | debug/ 6 | target/ 7 | 8 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 9 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 10 | Cargo.lock 11 | 12 | # These are backup files generated by rustfmt 13 | **/*.rs.bk 14 | -------------------------------------------------------------------------------- /bpf-loop/.gitignore: -------------------------------------------------------------------------------- 1 | ### https://raw.github.com/github/gitignore/master/Rust.gitignore 2 | 3 | # Generated by Cargo 4 | # will have compiled files and executables 5 | debug/ 6 | target/ 7 | 8 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 9 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 10 | Cargo.lock 11 | 12 | # These are backup files generated by rustfmt 13 | **/*.rs.bk 14 | -------------------------------------------------------------------------------- /cgroup/.gitignore: -------------------------------------------------------------------------------- 1 | ### https://raw.github.com/github/gitignore/master/Rust.gitignore 2 | 3 | # Generated by Cargo 4 | # will have compiled files and executables 5 | debug/ 6 | target/ 7 | 8 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 9 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 10 | Cargo.lock 11 | 12 | # These are backup files generated by rustfmt 13 | **/*.rs.bk 14 | -------------------------------------------------------------------------------- /clone/.gitignore: -------------------------------------------------------------------------------- 1 | ### https://raw.github.com/github/gitignore/master/Rust.gitignore 2 | 3 | # Generated by Cargo 4 | # will have compiled files and executables 5 | debug/ 6 | target/ 7 | 8 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 9 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 10 | Cargo.lock 11 | 12 | # These are backup files generated by rustfmt 13 | **/*.rs.bk 14 | -------------------------------------------------------------------------------- /cshim/.gitignore: -------------------------------------------------------------------------------- 1 | ### https://raw.github.com/github/gitignore/master/Rust.gitignore 2 | 3 | # Generated by Cargo 4 | # will have compiled files and executables 5 | debug/ 6 | target/ 7 | 8 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 9 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 10 | Cargo.lock 11 | 12 | # These are backup files generated by rustfmt 13 | **/*.rs.bk 14 | -------------------------------------------------------------------------------- /dpath/.gitignore: -------------------------------------------------------------------------------- 1 | ### https://raw.github.com/github/gitignore/master/Rust.gitignore 2 | 3 | # Generated by Cargo 4 | # will have compiled files and executables 5 | debug/ 6 | target/ 7 | 8 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 9 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 10 | Cargo.lock 11 | 12 | # These are backup files generated by rustfmt 13 | **/*.rs.bk 14 | -------------------------------------------------------------------------------- /notokio/.gitignore: -------------------------------------------------------------------------------- 1 | ### https://raw.github.com/github/gitignore/master/Rust.gitignore 2 | 3 | # Generated by Cargo 4 | # will have compiled files and executables 5 | debug/ 6 | target/ 7 | 8 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 9 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 10 | Cargo.lock 11 | 12 | # These are backup files generated by rustfmt 13 | **/*.rs.bk 14 | -------------------------------------------------------------------------------- /tc-bytes/.gitignore: -------------------------------------------------------------------------------- 1 | ### https://raw.github.com/github/gitignore/master/Rust.gitignore 2 | 3 | # Generated by Cargo 4 | # will have compiled files and executables 5 | debug/ 6 | target/ 7 | 8 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 9 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 10 | Cargo.lock 11 | 12 | # These are backup files generated by rustfmt 13 | **/*.rs.bk 14 | -------------------------------------------------------------------------------- /tc-srcip/.gitignore: -------------------------------------------------------------------------------- 1 | ### https://raw.github.com/github/gitignore/master/Rust.gitignore 2 | 3 | # Generated by Cargo 4 | # will have compiled files and executables 5 | debug/ 6 | target/ 7 | 8 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 9 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 10 | Cargo.lock 11 | 12 | # These are backup files generated by rustfmt 13 | **/*.rs.bk 14 | -------------------------------------------------------------------------------- /uprobe/.gitignore: -------------------------------------------------------------------------------- 1 | ### https://raw.github.com/github/gitignore/master/Rust.gitignore 2 | 3 | # Generated by Cargo 4 | # will have compiled files and executables 5 | debug/ 6 | target/ 7 | 8 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 9 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 10 | Cargo.lock 11 | 12 | # These are backup files generated by rustfmt 13 | **/*.rs.bk 14 | -------------------------------------------------------------------------------- /xdp-mac/.gitignore: -------------------------------------------------------------------------------- 1 | ### https://raw.github.com/github/gitignore/master/Rust.gitignore 2 | 3 | # Generated by Cargo 4 | # will have compiled files and executables 5 | debug/ 6 | target/ 7 | 8 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 9 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 10 | Cargo.lock 11 | 12 | # These are backup files generated by rustfmt 13 | **/*.rs.bk 14 | -------------------------------------------------------------------------------- /pub-progs/.gitignore: -------------------------------------------------------------------------------- 1 | ### https://raw.github.com/github/gitignore/master/Rust.gitignore 2 | 3 | # Generated by Cargo 4 | # will have compiled files and executables 5 | debug/ 6 | target/ 7 | 8 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 9 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 10 | Cargo.lock 11 | 12 | # These are backup files generated by rustfmt 13 | **/*.rs.bk 14 | -------------------------------------------------------------------------------- /tc-load-bytes/.gitignore: -------------------------------------------------------------------------------- 1 | ### https://raw.github.com/github/gitignore/master/Rust.gitignore 2 | 3 | # Generated by Cargo 4 | # will have compiled files and executables 5 | debug/ 6 | target/ 7 | 8 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 9 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 10 | Cargo.lock 11 | 12 | # These are backup files generated by rustfmt 13 | **/*.rs.bk 14 | -------------------------------------------------------------------------------- /tc-perfbuf/.gitignore: -------------------------------------------------------------------------------- 1 | ### https://raw.github.com/github/gitignore/master/Rust.gitignore 2 | 3 | # Generated by Cargo 4 | # will have compiled files and executables 5 | debug/ 6 | target/ 7 | 8 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 9 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 10 | Cargo.lock 11 | 12 | # These are backup files generated by rustfmt 13 | **/*.rs.bk 14 | -------------------------------------------------------------------------------- /tc-ringbuf/.gitignore: -------------------------------------------------------------------------------- 1 | ### https://raw.github.com/github/gitignore/master/Rust.gitignore 2 | 3 | # Generated by Cargo 4 | # will have compiled files and executables 5 | debug/ 6 | target/ 7 | 8 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 9 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 10 | Cargo.lock 11 | 12 | # These are backup files generated by rustfmt 13 | **/*.rs.bk 14 | -------------------------------------------------------------------------------- /xdp-bytes/.gitignore: -------------------------------------------------------------------------------- 1 | ### https://raw.github.com/github/gitignore/master/Rust.gitignore 2 | 3 | # Generated by Cargo 4 | # will have compiled files and executables 5 | debug/ 6 | target/ 7 | 8 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 9 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 10 | Cargo.lock 11 | 12 | # These are backup files generated by rustfmt 13 | **/*.rs.bk 14 | -------------------------------------------------------------------------------- /xdp-mut-u8/.gitignore: -------------------------------------------------------------------------------- 1 | ### https://raw.github.com/github/gitignore/master/Rust.gitignore 2 | 3 | # Generated by Cargo 4 | # will have compiled files and executables 5 | debug/ 6 | target/ 7 | 8 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 9 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 10 | Cargo.lock 11 | 12 | # These are backup files generated by rustfmt 13 | **/*.rs.bk 14 | -------------------------------------------------------------------------------- /xdp-perfbuf/.gitignore: -------------------------------------------------------------------------------- 1 | ### https://raw.github.com/github/gitignore/master/Rust.gitignore 2 | 3 | # Generated by Cargo 4 | # will have compiled files and executables 5 | debug/ 6 | target/ 7 | 8 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 9 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 10 | Cargo.lock 11 | 12 | # These are backup files generated by rustfmt 13 | **/*.rs.bk 14 | -------------------------------------------------------------------------------- /tc-perfbuf-simple/.gitignore: -------------------------------------------------------------------------------- 1 | ### https://raw.github.com/github/gitignore/master/Rust.gitignore 2 | 3 | # Generated by Cargo 4 | # will have compiled files and executables 5 | debug/ 6 | target/ 7 | 8 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 9 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 10 | Cargo.lock 11 | 12 | # These are backup files generated by rustfmt 13 | **/*.rs.bk 14 | -------------------------------------------------------------------------------- /xdp-verifier-err/.gitignore: -------------------------------------------------------------------------------- 1 | ### https://raw.github.com/github/gitignore/master/Rust.gitignore 2 | 3 | # Generated by Cargo 4 | # will have compiled files and executables 5 | debug/ 6 | target/ 7 | 8 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 9 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 10 | Cargo.lock 11 | 12 | # These are backup files generated by rustfmt 13 | **/*.rs.bk 14 | -------------------------------------------------------------------------------- /bpf-loop/bpf-loop/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "bpf-loop" 3 | version = "0.1.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies] 8 | aya = "0.12" 9 | aya-log = "0.2" 10 | bpf-loop-common = { path = "../bpf-loop-common", features = ["user"] } 11 | anyhow = "1" 12 | env_logger = "0.10" 13 | libc = "0.2" 14 | log = "0.4" 15 | tokio = { version = "1.25", features = ["macros", "rt", "rt-multi-thread", "net", "signal"] } 16 | 17 | [[bin]] 18 | name = "bpf-loop" 19 | path = "src/main.rs" 20 | -------------------------------------------------------------------------------- /pub-progs/pub-progs/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "pub-progs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies] 8 | aya = { version = ">=0.11", features=["async_tokio"] } 9 | aya-log = "0.1" 10 | pub-progs-common = { path = "../pub-progs-common", features = ["user"] } 11 | anyhow = "1.0.68" 12 | env_logger = "0.10" 13 | log = "0.4" 14 | tokio = { version = "1.24", features = ["macros", "rt", "rt-multi-thread", "net", "signal"] } 15 | 16 | [[bin]] 17 | name = "pub-progs" 18 | path = "src/main.rs" 19 | -------------------------------------------------------------------------------- /tc/tc/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "tc" 3 | version = "0.1.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies] 8 | aya = { version = ">=0.11", features=["async_tokio"] } 9 | aya-log = "0.1" 10 | tc-common = { path = "../tc-common", features=["user"] } 11 | anyhow = "1.0.42" 12 | clap = { version = "3.1", features = ["derive"] } 13 | log = "0.4" 14 | simplelog = "0.12" 15 | tokio = { version = "1.18", features = ["macros", "rt", "rt-multi-thread", "net", "signal"] } 16 | 17 | [[bin]] 18 | name = "tc" 19 | path = "src/main.rs" 20 | -------------------------------------------------------------------------------- /atomic/atomic/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "atomic" 3 | version = "0.1.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies] 8 | aya = { version = ">=0.11", features=["async_tokio"] } 9 | aya-log = "0.1" 10 | atomic-common = { path = "../atomic-common", features=["user"] } 11 | anyhow = "1.0.42" 12 | clap = { version = "4.0", features = ["derive"] } 13 | env_logger = "0.10" 14 | log = "0.4" 15 | tokio = { version = "1.23", features = ["macros", "rt", "rt-multi-thread", "net", "signal"] } 16 | 17 | [[bin]] 18 | name = "atomic" 19 | path = "src/main.rs" 20 | -------------------------------------------------------------------------------- /dpath/dpath/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "dpath" 3 | version = "0.1.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies] 8 | aya = { git = "https://github.com/aya-rs/aya", branch = "main" } 9 | aya-log = "0.1" 10 | dpath-common = { path = "../dpath-common", features=["user"] } 11 | anyhow = "1.0.42" 12 | clap = { version = "3.1", features = ["derive"] } 13 | log = "0.4" 14 | simplelog = "0.12" 15 | tokio = { version = "1.18", features = ["macros", "rt", "rt-multi-thread", "net", "signal"] } 16 | 17 | [[bin]] 18 | name = "dpath" 19 | path = "src/main.rs" 20 | -------------------------------------------------------------------------------- /bpf-loop/README.md: -------------------------------------------------------------------------------- 1 | # bpf-loop 2 | 3 | ## Prerequisites 4 | 5 | 1. Install bpf-linker: `cargo install bpf-linker` 6 | 7 | ## Build eBPF 8 | 9 | ```bash 10 | cargo xtask build-ebpf 11 | ``` 12 | 13 | To perform a release build you can use the `--release` flag. 14 | You may also change the target architecture with the `--target` flag. 15 | 16 | ## Build Userspace 17 | 18 | ```bash 19 | cargo build 20 | ``` 21 | 22 | ## Build eBPF and Userspace 23 | 24 | ```bash 25 | cargo xtask build 26 | ``` 27 | 28 | ## Run 29 | 30 | ```bash 31 | RUST_LOG=info cargo xtask run 32 | ``` 33 | -------------------------------------------------------------------------------- /cgroup/cgroup/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "cgroup" 3 | version = "0.1.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies] 8 | aya = { git = "https://github.com/aya-rs/aya", branch = "main" } 9 | aya-log = "0.1" 10 | cgroup-common = { path = "../cgroup-common", features=["user"] } 11 | anyhow = "1.0.42" 12 | clap = { version = "3.1", features = ["derive"] } 13 | log = "0.4" 14 | simplelog = "0.12" 15 | tokio = { version = "1.18", features = ["macros", "rt", "rt-multi-thread", "net", "signal"] } 16 | 17 | [[bin]] 18 | name = "cgroup" 19 | path = "src/main.rs" 20 | -------------------------------------------------------------------------------- /notokio/notokio/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "notokio" 3 | version = "0.1.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies] 8 | aya = { git = "https://github.com/vadorovsky/aya", branch = "aya-log-tokio" } 9 | aya-log = { git = "https://github.com/vadorovsky/aya", branch = "aya-log-tokio" } 10 | ctrlc = "3.2" 11 | notokio-common = { path = "../notokio-common", features=["user"] } 12 | anyhow = "1.0.42" 13 | clap = { version = "3.1", features = ["derive"] } 14 | env_logger = "0.9" 15 | log = "0.4" 16 | 17 | [[bin]] 18 | name = "notokio" 19 | path = "src/main.rs" 20 | -------------------------------------------------------------------------------- /tc-srcip/tc-srcip/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "tc-srcip" 3 | version = "0.1.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies] 8 | aya = { version = ">=0.11", features=["async_tokio"] } 9 | aya-log = "0.1" 10 | tc-srcip-common = { path = "../tc-srcip-common", features=["user"] } 11 | anyhow = "1.0.42" 12 | clap = { version = "3.1", features = ["derive"] } 13 | log = "0.4" 14 | simplelog = "0.12" 15 | tokio = { version = "1.18", features = ["macros", "rt", "rt-multi-thread", "net", "signal"] } 16 | 17 | [[bin]] 18 | name = "tc-srcip" 19 | path = "src/main.rs" 20 | -------------------------------------------------------------------------------- /xdp-bytes/xdp-bytes/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xdp-bytes" 3 | version = "0.1.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies] 8 | aya = { version = ">=0.11", features=["async_tokio"] } 9 | aya-log = "0.1" 10 | xdp-bytes-common = { path = "../xdp-bytes-common", features=["user"] } 11 | anyhow = "1.0.42" 12 | clap = { version = "3.1", features = ["derive"] } 13 | log = "0.4" 14 | simplelog = "0.12" 15 | tokio = { version = "1.18", features = ["macros", "rt", "rt-multi-thread", "net", "signal"] } 16 | 17 | [[bin]] 18 | name = "xdp-bytes" 19 | path = "src/main.rs" 20 | -------------------------------------------------------------------------------- /tc-load-bytes/tc-load-bytes/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "tc-load-bytes" 3 | version = "0.1.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies] 8 | aya = { version = ">=0.11", features=["async_tokio"] } 9 | clap = { version = "4.1", features = ["derive"] } 10 | tc-load-bytes-common = { path = "../tc-load-bytes-common", features = ["user"] } 11 | anyhow = "1.0.68" 12 | env_logger = "0.10" 13 | log = "0.4" 14 | tokio = { version = "1.24", features = ["macros", "rt", "rt-multi-thread", "net", "signal"] } 15 | 16 | [[bin]] 17 | name = "tc-load-bytes" 18 | path = "src/main.rs" 19 | -------------------------------------------------------------------------------- /tc/README.md: -------------------------------------------------------------------------------- 1 | # tc 2 | 3 | ## Prerequisites 4 | 5 | 1. Install a rust stable toolchain: `rustup install stable` 6 | 1. Install a rust nightly toolchain: `rustup install nightly` 7 | 1. Install bpf-linker: `cargo install bpf-linker` 8 | 9 | ## Build eBPF 10 | 11 | ```bash 12 | cargo xtask build-ebpf 13 | ``` 14 | 15 | To perform a release build you can use the `--release` flag. 16 | You may also change the target architecture with the `--target` flag 17 | 18 | ## Build Userspace 19 | 20 | ```bash 21 | cargo build 22 | ``` 23 | 24 | ## Run 25 | 26 | ```bash 27 | cargo xtask run 28 | ``` 29 | -------------------------------------------------------------------------------- /xdp-mut-u8/xdp-mut-u8/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xdp-mut-u8" 3 | version = "0.1.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies] 8 | aya = { version = ">=0.11", features=["async_tokio"] } 9 | aya-log = "0.1" 10 | xdp-mut-u8-common = { path = "../xdp-mut-u8-common", features=["user"] } 11 | anyhow = "1.0.42" 12 | clap = { version = "3.1", features = ["derive"] } 13 | env_logger = "0.9" 14 | log = "0.4" 15 | tokio = { version = "1.18", features = ["macros", "rt", "rt-multi-thread", "net", "signal"] } 16 | 17 | [[bin]] 18 | name = "xdp-mut-u8" 19 | path = "src/main.rs" 20 | -------------------------------------------------------------------------------- /xdp/README.md: -------------------------------------------------------------------------------- 1 | # xdp 2 | 3 | ## Prerequisites 4 | 5 | 1. Install a rust stable toolchain: `rustup install stable` 6 | 1. Install a rust nightly toolchain: `rustup install nightly` 7 | 1. Install bpf-linker: `cargo install bpf-linker` 8 | 9 | ## Build eBPF 10 | 11 | ```bash 12 | cargo xtask build-ebpf 13 | ``` 14 | 15 | To perform a release build you can use the `--release` flag. 16 | You may also change the target architecture with the `--target` flag 17 | 18 | ## Build Userspace 19 | 20 | ```bash 21 | cargo build 22 | ``` 23 | 24 | ## Run 25 | 26 | ```bash 27 | cargo xtask run 28 | ``` 29 | -------------------------------------------------------------------------------- /cgroup/README.md: -------------------------------------------------------------------------------- 1 | # cgroup 2 | 3 | ## Prerequisites 4 | 5 | 1. Install a rust stable toolchain: `rustup install stable` 6 | 1. Install a rust nightly toolchain: `rustup install nightly` 7 | 1. Install bpf-linker: `cargo install bpf-linker` 8 | 9 | ## Build eBPF 10 | 11 | ```bash 12 | cargo xtask build-ebpf 13 | ``` 14 | 15 | To perform a release build you can use the `--release` flag. 16 | You may also change the target architecture with the `--target` flag 17 | 18 | ## Build Userspace 19 | 20 | ```bash 21 | cargo build 22 | ``` 23 | 24 | ## Run 25 | 26 | ```bash 27 | cargo xtask run 28 | ``` 29 | -------------------------------------------------------------------------------- /clone/README.md: -------------------------------------------------------------------------------- 1 | # clone 2 | 3 | ## Prerequisites 4 | 5 | 1. Install a rust stable toolchain: `rustup install stable` 6 | 1. Install a rust nightly toolchain: `rustup install nightly` 7 | 1. Install bpf-linker: `cargo install bpf-linker` 8 | 9 | ## Build eBPF 10 | 11 | ```bash 12 | cargo xtask build-ebpf 13 | ``` 14 | 15 | To perform a release build you can use the `--release` flag. 16 | You may also change the target architecture with the `--target` flag 17 | 18 | ## Build Userspace 19 | 20 | ```bash 21 | cargo build 22 | ``` 23 | 24 | ## Run 25 | 26 | ```bash 27 | cargo xtask run 28 | ``` 29 | -------------------------------------------------------------------------------- /dpath/README.md: -------------------------------------------------------------------------------- 1 | # dpath 2 | 3 | ## Prerequisites 4 | 5 | 1. Install a rust stable toolchain: `rustup install stable` 6 | 1. Install a rust nightly toolchain: `rustup install nightly` 7 | 1. Install bpf-linker: `cargo install bpf-linker` 8 | 9 | ## Build eBPF 10 | 11 | ```bash 12 | cargo xtask build-ebpf 13 | ``` 14 | 15 | To perform a release build you can use the `--release` flag. 16 | You may also change the target architecture with the `--target` flag 17 | 18 | ## Build Userspace 19 | 20 | ```bash 21 | cargo build 22 | ``` 23 | 24 | ## Run 25 | 26 | ```bash 27 | cargo xtask run 28 | ``` 29 | -------------------------------------------------------------------------------- /notokio/README.md: -------------------------------------------------------------------------------- 1 | # notokio 2 | 3 | ## Prerequisites 4 | 5 | 1. Install a rust stable toolchain: `rustup install stable` 6 | 1. Install a rust nightly toolchain: `rustup install nightly` 7 | 1. Install bpf-linker: `cargo install bpf-linker` 8 | 9 | ## Build eBPF 10 | 11 | ```bash 12 | cargo xtask build-ebpf 13 | ``` 14 | 15 | To perform a release build you can use the `--release` flag. 16 | You may also change the target architecture with the `--target` flag 17 | 18 | ## Build Userspace 19 | 20 | ```bash 21 | cargo build 22 | ``` 23 | 24 | ## Run 25 | 26 | ```bash 27 | cargo xtask run 28 | ``` 29 | -------------------------------------------------------------------------------- /xdp-mac/README.md: -------------------------------------------------------------------------------- 1 | # xdp-mac 2 | 3 | ## Prerequisites 4 | 5 | 1. Install a rust stable toolchain: `rustup install stable` 6 | 1. Install a rust nightly toolchain: `rustup install nightly` 7 | 1. Install bpf-linker: `cargo install bpf-linker` 8 | 9 | ## Build eBPF 10 | 11 | ```bash 12 | cargo xtask build-ebpf 13 | ``` 14 | 15 | To perform a release build you can use the `--release` flag. 16 | You may also change the target architecture with the `--target` flag 17 | 18 | ## Build Userspace 19 | 20 | ```bash 21 | cargo build 22 | ``` 23 | 24 | ## Run 25 | 26 | ```bash 27 | cargo xtask run 28 | ``` 29 | -------------------------------------------------------------------------------- /tc-bytes/README.md: -------------------------------------------------------------------------------- 1 | # tc-bytes 2 | 3 | ## Prerequisites 4 | 5 | 1. Install a rust stable toolchain: `rustup install stable` 6 | 1. Install a rust nightly toolchain: `rustup install nightly` 7 | 1. Install bpf-linker: `cargo install bpf-linker` 8 | 9 | ## Build eBPF 10 | 11 | ```bash 12 | cargo xtask build-ebpf 13 | ``` 14 | 15 | To perform a release build you can use the `--release` flag. 16 | You may also change the target architecture with the `--target` flag 17 | 18 | ## Build Userspace 19 | 20 | ```bash 21 | cargo build 22 | ``` 23 | 24 | ## Run 25 | 26 | ```bash 27 | cargo xtask run 28 | ``` 29 | -------------------------------------------------------------------------------- /tc-srcip/README.md: -------------------------------------------------------------------------------- 1 | # tc-srcip 2 | 3 | ## Prerequisites 4 | 5 | 1. Install a rust stable toolchain: `rustup install stable` 6 | 1. Install a rust nightly toolchain: `rustup install nightly` 7 | 1. Install bpf-linker: `cargo install bpf-linker` 8 | 9 | ## Build eBPF 10 | 11 | ```bash 12 | cargo xtask build-ebpf 13 | ``` 14 | 15 | To perform a release build you can use the `--release` flag. 16 | You may also change the target architecture with the `--target` flag 17 | 18 | ## Build Userspace 19 | 20 | ```bash 21 | cargo build 22 | ``` 23 | 24 | ## Run 25 | 26 | ```bash 27 | cargo xtask run 28 | ``` 29 | -------------------------------------------------------------------------------- /uprobe/uprobe/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "uprobe" 3 | version = "0.1.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies] 8 | aya = { version = ">=0.11", features=["async_tokio"] } 9 | aya-log = "0.1" 10 | uprobe-common = { path = "../uprobe-common", features=["user"] } 11 | anyhow = "1.0.42" 12 | clap = { version = "4.0", features = ["derive"] } 13 | env_logger = "0.10" 14 | libc = "0.2" 15 | log = "0.4" 16 | procfs = "0.14" 17 | tokio = { version = "1.23", features = ["macros", "rt", "rt-multi-thread", "net", "signal"] } 18 | 19 | [[bin]] 20 | name = "uprobe" 21 | path = "src/main.rs" 22 | -------------------------------------------------------------------------------- /xdp-bytes/README.md: -------------------------------------------------------------------------------- 1 | # xdp-bytes 2 | 3 | ## Prerequisites 4 | 5 | 1. Install a rust stable toolchain: `rustup install stable` 6 | 1. Install a rust nightly toolchain: `rustup install nightly` 7 | 1. Install bpf-linker: `cargo install bpf-linker` 8 | 9 | ## Build eBPF 10 | 11 | ```bash 12 | cargo xtask build-ebpf 13 | ``` 14 | 15 | To perform a release build you can use the `--release` flag. 16 | You may also change the target architecture with the `--target` flag 17 | 18 | ## Build Userspace 19 | 20 | ```bash 21 | cargo build 22 | ``` 23 | 24 | ## Run 25 | 26 | ```bash 27 | cargo xtask run 28 | ``` 29 | -------------------------------------------------------------------------------- /cshim/cshim/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "cshim" 3 | version = "0.1.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies] 8 | aya = { git = "https://github.com/aya-rs/aya", branch = "main", features=["async_tokio"] } 9 | aya-log = { git = "https://github.com/aya-rs/aya", branch = "main" } 10 | bytes = "1.5" 11 | cshim-common = { path = "../cshim-common", features = ["user"] } 12 | anyhow = "1" 13 | env_logger = "0.10" 14 | log = "0.4" 15 | tokio = { version = "1.25", features = ["macros", "rt", "rt-multi-thread", "net", "signal"] } 16 | 17 | [[bin]] 18 | name = "cshim" 19 | path = "src/main.rs" 20 | -------------------------------------------------------------------------------- /xdp-mut-u8/README.md: -------------------------------------------------------------------------------- 1 | # xdp-mut-u8 2 | 3 | ## Prerequisites 4 | 5 | 1. Install a rust stable toolchain: `rustup install stable` 6 | 1. Install a rust nightly toolchain: `rustup install nightly` 7 | 1. Install bpf-linker: `cargo install bpf-linker` 8 | 9 | ## Build eBPF 10 | 11 | ```bash 12 | cargo xtask build-ebpf 13 | ``` 14 | 15 | To perform a release build you can use the `--release` flag. 16 | You may also change the target architecture with the `--target` flag 17 | 18 | ## Build Userspace 19 | 20 | ```bash 21 | cargo build 22 | ``` 23 | 24 | ## Run 25 | 26 | ```bash 27 | cargo xtask run 28 | ``` 29 | -------------------------------------------------------------------------------- /atomic/README.md: -------------------------------------------------------------------------------- 1 | # atomic 2 | 3 | ## Prerequisites 4 | 5 | 1. Install a rust stable toolchain: `rustup install stable` 6 | 1. Install a rust nightly toolchain: `rustup install nightly` 7 | 1. Install bpf-linker: `cargo install bpf-linker` 8 | 9 | ## Build eBPF 10 | 11 | ```bash 12 | cargo xtask build-ebpf 13 | ``` 14 | 15 | To perform a release build you can use the `--release` flag. 16 | You may also change the target architecture with the `--target` flag 17 | 18 | ## Build Userspace 19 | 20 | ```bash 21 | cargo build 22 | ``` 23 | 24 | ## Run 25 | 26 | ```bash 27 | RUST_LOG=info cargo xtask run 28 | ``` 29 | -------------------------------------------------------------------------------- /clone/clone/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "clone" 3 | version = "0.1.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies] 8 | aya = { git = "https://github.com/aya-rs/aya", features=["async_tokio"] } 9 | aya-log = { git = "https://github.com/aya-rs/aya" } 10 | clone-common = { path = "../clone-common", features=["user"] } 11 | anyhow = "1.0.42" 12 | clap = { version = "3.1", features = ["derive"] } 13 | log = "0.4" 14 | simplelog = "0.12" 15 | tokio = { version = "1.18", features = ["macros", "rt", "rt-multi-thread", "net", "signal"] } 16 | 17 | [[bin]] 18 | name = "clone" 19 | path = "src/main.rs" 20 | -------------------------------------------------------------------------------- /uprobe/README.md: -------------------------------------------------------------------------------- 1 | # uprobe 2 | 3 | ## Prerequisites 4 | 5 | 1. Install a rust stable toolchain: `rustup install stable` 6 | 1. Install a rust nightly toolchain: `rustup install nightly` 7 | 1. Install bpf-linker: `cargo install bpf-linker` 8 | 9 | ## Build eBPF 10 | 11 | ```bash 12 | cargo xtask build-ebpf 13 | ``` 14 | 15 | To perform a release build you can use the `--release` flag. 16 | You may also change the target architecture with the `--target` flag 17 | 18 | ## Build Userspace 19 | 20 | ```bash 21 | cargo build 22 | ``` 23 | 24 | ## Run 25 | 26 | ```bash 27 | RUST_LOG=info cargo xtask run 28 | ``` 29 | -------------------------------------------------------------------------------- /pub-progs/README.md: -------------------------------------------------------------------------------- 1 | # pub-progs 2 | 3 | ## Prerequisites 4 | 5 | 1. Install a rust stable toolchain: `rustup install stable` 6 | 1. Install a rust nightly toolchain: `rustup install nightly` 7 | 1. Install bpf-linker: `cargo install bpf-linker` 8 | 9 | ## Build eBPF 10 | 11 | ```bash 12 | cargo xtask build-ebpf 13 | ``` 14 | 15 | To perform a release build you can use the `--release` flag. 16 | You may also change the target architecture with the `--target` flag 17 | 18 | ## Build Userspace 19 | 20 | ```bash 21 | cargo build 22 | ``` 23 | 24 | ## Run 25 | 26 | ```bash 27 | RUST_LOG=info cargo xtask run 28 | ``` 29 | -------------------------------------------------------------------------------- /tc-perfbuf/README.md: -------------------------------------------------------------------------------- 1 | # tc-perfbuf 2 | 3 | ## Prerequisites 4 | 5 | 1. Install a rust stable toolchain: `rustup install stable` 6 | 1. Install a rust nightly toolchain: `rustup install nightly` 7 | 1. Install bpf-linker: `cargo install bpf-linker` 8 | 9 | ## Build eBPF 10 | 11 | ```bash 12 | cargo xtask build-ebpf 13 | ``` 14 | 15 | To perform a release build you can use the `--release` flag. 16 | You may also change the target architecture with the `--target` flag 17 | 18 | ## Build Userspace 19 | 20 | ```bash 21 | cargo build 22 | ``` 23 | 24 | ## Run 25 | 26 | ```bash 27 | RUST_LOG=info cargo xtask run 28 | ``` 29 | -------------------------------------------------------------------------------- /tc-perfbuf/tc-perfbuf/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "tc-perfbuf" 3 | version = "0.1.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies] 8 | aya = { version = ">=0.11", features=["async_tokio"] } 9 | tc-perfbuf-common = { path = "../tc-perfbuf-common", features=["user"] } 10 | anyhow = "1.0.42" 11 | clap = { version = "4.0", features = ["derive"] } 12 | env_logger = "0.10" 13 | log = "0.4" 14 | tokio = { version = "1.23", features = ["macros", "rt", "rt-multi-thread", "net", "signal"] } 15 | bytes = "1.3" 16 | network-types = "0.0.4" 17 | 18 | [[bin]] 19 | name = "tc-perfbuf" 20 | path = "src/main.rs" 21 | -------------------------------------------------------------------------------- /tc-ringbuf/README.md: -------------------------------------------------------------------------------- 1 | # tc-ringbuf 2 | 3 | ## Prerequisites 4 | 5 | 1. Install a rust stable toolchain: `rustup install stable` 6 | 1. Install a rust nightly toolchain: `rustup install nightly` 7 | 1. Install bpf-linker: `cargo install bpf-linker` 8 | 9 | ## Build eBPF 10 | 11 | ```bash 12 | cargo xtask build-ebpf 13 | ``` 14 | 15 | To perform a release build you can use the `--release` flag. 16 | You may also change the target architecture with the `--target` flag 17 | 18 | ## Build Userspace 19 | 20 | ```bash 21 | cargo build 22 | ``` 23 | 24 | ## Run 25 | 26 | ```bash 27 | RUST_LOG=info cargo xtask run 28 | ``` 29 | -------------------------------------------------------------------------------- /xdp-verifier-err/README.md: -------------------------------------------------------------------------------- 1 | # xdp-verifier-err 2 | 3 | ## Prerequisites 4 | 5 | 1. Install a rust stable toolchain: `rustup install stable` 6 | 1. Install a rust nightly toolchain: `rustup install nightly` 7 | 1. Install bpf-linker: `cargo install bpf-linker` 8 | 9 | ## Build eBPF 10 | 11 | ```bash 12 | cargo xtask build-ebpf 13 | ``` 14 | 15 | To perform a release build you can use the `--release` flag. 16 | You may also change the target architecture with the `--target` flag 17 | 18 | ## Build Userspace 19 | 20 | ```bash 21 | cargo build 22 | ``` 23 | 24 | ## Run 25 | 26 | ```bash 27 | cargo xtask run 28 | ``` 29 | -------------------------------------------------------------------------------- /tc-perfbuf-simple/tc-perfbuf-simple/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "tc-perfbuf-simple" 3 | version = "0.1.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies] 8 | aya = { version = ">=0.11", features=["async_tokio"] } 9 | tc-perfbuf-simple-common = { path = "../tc-perfbuf-simple-common", features=["user"] } 10 | anyhow = "1.0.42" 11 | clap = { version = "4.0", features = ["derive"] } 12 | env_logger = "0.10" 13 | log = "0.4" 14 | tokio = { version = "1.23", features = ["macros", "rt", "rt-multi-thread", "net", "signal"] } 15 | bytes = "1.3" 16 | 17 | [[bin]] 18 | name = "tc-perfbuf" 19 | path = "src/main.rs" 20 | -------------------------------------------------------------------------------- /xdp-perfbuf/README.md: -------------------------------------------------------------------------------- 1 | # xdp-perfbuf 2 | 3 | ## Prerequisites 4 | 5 | 1. Install a rust stable toolchain: `rustup install stable` 6 | 1. Install a rust nightly toolchain: `rustup install nightly` 7 | 1. Install bpf-linker: `cargo install bpf-linker` 8 | 9 | ## Build eBPF 10 | 11 | ```bash 12 | cargo xtask build-ebpf 13 | ``` 14 | 15 | To perform a release build you can use the `--release` flag. 16 | You may also change the target architecture with the `--target` flag 17 | 18 | ## Build Userspace 19 | 20 | ```bash 21 | cargo build 22 | ``` 23 | 24 | ## Run 25 | 26 | ```bash 27 | RUST_LOG=info cargo xtask run 28 | ``` 29 | -------------------------------------------------------------------------------- /xdp-verifier-err/xdp-verifier-err/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xdp-verifier-err" 3 | version = "0.1.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies] 8 | aya = { version = ">=0.11", features=["async_tokio"] } 9 | aya-log = "0.1" 10 | xdp-verifier-err-common = { path = "../xdp-verifier-err-common", features=["user"] } 11 | anyhow = "1.0.42" 12 | clap = { version = "3.1", features = ["derive"] } 13 | env_logger = "0.9" 14 | log = "0.4" 15 | tokio = { version = "1.18", features = ["macros", "rt", "rt-multi-thread", "net", "signal"] } 16 | 17 | [[bin]] 18 | name = "xdp-verifier-err" 19 | path = "src/main.rs" 20 | -------------------------------------------------------------------------------- /tc-load-bytes/README.md: -------------------------------------------------------------------------------- 1 | # tc-load-bytes 2 | 3 | ## Prerequisites 4 | 5 | 1. Install a rust stable toolchain: `rustup install stable` 6 | 1. Install a rust nightly toolchain: `rustup install nightly` 7 | 1. Install bpf-linker: `cargo install bpf-linker` 8 | 9 | ## Build eBPF 10 | 11 | ```bash 12 | cargo xtask build-ebpf 13 | ``` 14 | 15 | To perform a release build you can use the `--release` flag. 16 | You may also change the target architecture with the `--target` flag 17 | 18 | ## Build Userspace 19 | 20 | ```bash 21 | cargo build 22 | ``` 23 | 24 | ## Run 25 | 26 | ```bash 27 | RUST_LOG=info cargo xtask run 28 | ``` 29 | -------------------------------------------------------------------------------- /tc-perfbuf-simple/README.md: -------------------------------------------------------------------------------- 1 | # tc-perfbuf 2 | 3 | ## Prerequisites 4 | 5 | 1. Install a rust stable toolchain: `rustup install stable` 6 | 1. Install a rust nightly toolchain: `rustup install nightly` 7 | 1. Install bpf-linker: `cargo install bpf-linker` 8 | 9 | ## Build eBPF 10 | 11 | ```bash 12 | cargo xtask build-ebpf 13 | ``` 14 | 15 | To perform a release build you can use the `--release` flag. 16 | You may also change the target architecture with the `--target` flag 17 | 18 | ## Build Userspace 19 | 20 | ```bash 21 | cargo build 22 | ``` 23 | 24 | ## Run 25 | 26 | ```bash 27 | RUST_LOG=info cargo xtask run 28 | ``` 29 | -------------------------------------------------------------------------------- /tc-srcip/xtask/src/codegen.rs: -------------------------------------------------------------------------------- 1 | use aya_gen::generate::InputFile; 2 | use std::{fs::File, io::Write, path::PathBuf}; 3 | 4 | pub fn generate() -> Result<(), anyhow::Error> { 5 | let dir = PathBuf::from("tc-srcip-ebpf/src"); 6 | let names: Vec<&str> = vec!["ethhdr", "iphdr"]; 7 | let bindings = aya_gen::generate( 8 | InputFile::Btf(PathBuf::from("/sys/kernel/btf/vmlinux")), 9 | &names, 10 | &[], 11 | )?; 12 | // Write the bindings to the $OUT_DIR/bindings.rs file. 13 | let mut out = File::create(dir.join("bindings.rs"))?; 14 | write!(out, "{}", bindings)?; 15 | Ok(()) 16 | } 17 | -------------------------------------------------------------------------------- /tc/xtask/src/codegen.rs: -------------------------------------------------------------------------------- 1 | use aya_tool::generate::InputFile; 2 | use std::{fs::File, io::Write, path::PathBuf}; 3 | 4 | pub fn generate() -> Result<(), anyhow::Error> { 5 | let dir = PathBuf::from("tc-ebpf/src"); 6 | let names: Vec<&str> = vec!["ethhdr", "iphdr", "ipv6hdr"]; 7 | let bindings = aya_tool::generate( 8 | InputFile::Btf(PathBuf::from("/sys/kernel/btf/vmlinux")), 9 | &names, 10 | &[], 11 | )?; 12 | // Write the bindings to the $OUT_DIR/bindings.rs file. 13 | let mut out = File::create(dir.join("bindings.rs"))?; 14 | write!(out, "{}", bindings)?; 15 | Ok(()) 16 | } 17 | -------------------------------------------------------------------------------- /tc-bytes/tc-bytes/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "tc-bytes" 3 | version = "0.1.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies] 8 | aya = { version = ">=0.11", features=["async_tokio"] } 9 | aya-log = { git = "https://github.com/aya-rs/aya-log", branch = "main" } 10 | tc-bytes-common = { path = "../tc-bytes-common", features=["user"] } 11 | anyhow = "1.0.42" 12 | clap = { version = "3.1", features = ["derive"] } 13 | log = "0.4" 14 | simplelog = "0.12" 15 | tokio = { version = "1.18", features = ["macros", "rt", "rt-multi-thread", "net", "signal"] } 16 | 17 | [[bin]] 18 | name = "tc-bytes" 19 | path = "src/main.rs" 20 | -------------------------------------------------------------------------------- /xdp/xdp/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xdp" 3 | version = "0.1.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies] 8 | aya = { git = "https://github.com/aya-rs/aya", branch = "main", features=["async_tokio"] } 9 | aya-log = { git = "https://github.com/aya-rs/aya", branch = "main" } 10 | xdp-common = { path = "../xdp-common", features=["user"] } 11 | anyhow = "1.0.42" 12 | clap = { version = "3.1", features = ["derive"] } 13 | env_logger = "0.9" 14 | log = "0.4" 15 | tokio = { version = "1.18", features = ["macros", "rt", "rt-multi-thread", "net", "signal"] } 16 | 17 | [[bin]] 18 | name = "xdp" 19 | path = "src/main.rs" 20 | -------------------------------------------------------------------------------- /notokio/notokio-ebpf/src/main.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | #![no_main] 3 | 4 | use aya_bpf::{ 5 | macros::lsm, 6 | programs::LsmContext, 7 | }; 8 | use aya_log_ebpf::info; 9 | 10 | #[lsm(name="task_alloc")] 11 | pub fn task_alloc(ctx: LsmContext) -> i32 { 12 | match try_task_alloc(ctx) { 13 | Ok(ret) => ret, 14 | Err(ret) => ret, 15 | } 16 | } 17 | 18 | fn try_task_alloc(ctx: LsmContext) -> Result { 19 | info!(&ctx, "lsm hook task_alloc called"); 20 | Ok(0) 21 | } 22 | 23 | #[panic_handler] 24 | fn panic(_info: &core::panic::PanicInfo) -> ! { 25 | unsafe { core::hint::unreachable_unchecked() } 26 | } 27 | -------------------------------------------------------------------------------- /xdp-perfbuf/xdp-perfbuf/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xdp-perfbuf" 3 | version = "0.1.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies] 8 | aya = { version = ">=0.11", features=["async_tokio"] } 9 | aya-log = "0.1" 10 | xdp-perfbuf-common = { path = "../xdp-perfbuf-common", features=["user"] } 11 | anyhow = "1.0.42" 12 | clap = { version = "4.0", features = ["derive"] } 13 | env_logger = "0.10" 14 | log = "0.4" 15 | tokio = { version = "1.23", features = ["macros", "rt", "rt-multi-thread", "net", "signal"] } 16 | bytes = "1.3" 17 | network-types = "0.0.4" 18 | 19 | [[bin]] 20 | name = "xdp-perfbuf" 21 | path = "src/main.rs" 22 | -------------------------------------------------------------------------------- /tc-bytes/xtask/src/codegen.rs: -------------------------------------------------------------------------------- 1 | use aya_gen::generate::InputFile; 2 | use std::{fs::File, io::Write, path::PathBuf}; 3 | 4 | pub fn generate() -> Result<(), anyhow::Error> { 5 | let dir = PathBuf::from("tc-bytes-ebpf/src"); 6 | let names: Vec<&str> = vec!["ethhdr", "iphdr", "ipv6hdr", "tcphdr"]; 7 | let bindings = aya_gen::generate( 8 | InputFile::Btf(PathBuf::from("/sys/kernel/btf/vmlinux")), 9 | &names, 10 | &[], 11 | )?; 12 | // Write the bindings to the $OUT_DIR/bindings.rs file. 13 | let mut out = File::create(dir.join("bindings.rs"))?; 14 | write!(out, "{}", bindings)?; 15 | Ok(()) 16 | } 17 | -------------------------------------------------------------------------------- /uprobe/uprobe-ebpf/src/main.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | #![no_main] 3 | 4 | use aya_bpf::{macros::uprobe, programs::ProbeContext}; 5 | use aya_log_ebpf::info; 6 | 7 | #[uprobe(name = "uprobe")] 8 | pub fn uprobe(ctx: ProbeContext) -> u32 { 9 | match try_uprobe(ctx) { 10 | Ok(ret) => ret, 11 | Err(ret) => ret, 12 | } 13 | } 14 | 15 | fn try_uprobe(ctx: ProbeContext) -> Result { 16 | let val: u32 = ctx.arg(0).ok_or(0u32)?; 17 | info!(&ctx, "wao: {}", val); 18 | Ok(0) 19 | } 20 | 21 | #[panic_handler] 22 | fn panic(_info: &core::panic::PanicInfo) -> ! { 23 | unsafe { core::hint::unreachable_unchecked() } 24 | } 25 | -------------------------------------------------------------------------------- /xdp-bytes/xtask/src/codegen.rs: -------------------------------------------------------------------------------- 1 | use aya_gen::generate::InputFile; 2 | use std::{fs::File, io::Write, path::PathBuf}; 3 | 4 | pub fn generate() -> Result<(), anyhow::Error> { 5 | let dir = PathBuf::from("xdp-bytes-ebpf/src"); 6 | let names: Vec<&str> = vec!["ethhdr", "iphdr", "ipv6hdr", "tcphdr"]; 7 | let bindings = aya_gen::generate( 8 | InputFile::Btf(PathBuf::from("/sys/kernel/btf/vmlinux")), 9 | &names, 10 | &[], 11 | )?; 12 | // Write the bindings to the $OUT_DIR/bindings.rs file. 13 | let mut out = File::create(dir.join("bindings.rs"))?; 14 | write!(out, "{}", bindings)?; 15 | Ok(()) 16 | } 17 | -------------------------------------------------------------------------------- /bpf-loop/bpf-loop-ebpf/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "bpf-loop-ebpf" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | aya-ebpf = "0.1.0" 8 | aya-log-ebpf = "0.1.0" 9 | bpf-loop-common = { path = "../bpf-loop-common" } 10 | 11 | [[bin]] 12 | name = "bpf-loop" 13 | path = "src/main.rs" 14 | 15 | [profile.dev] 16 | opt-level = 3 17 | debug = false 18 | debug-assertions = false 19 | overflow-checks = false 20 | lto = true 21 | panic = "abort" 22 | incremental = false 23 | codegen-units = 1 24 | rpath = false 25 | 26 | [profile.release] 27 | lto = true 28 | panic = "abort" 29 | codegen-units = 1 30 | 31 | [workspace] 32 | members = [] 33 | -------------------------------------------------------------------------------- /cshim/README.md: -------------------------------------------------------------------------------- 1 | # cshim 2 | 3 | ## Prerequisites 4 | 5 | 1. Install a rust stable toolchain: `rustup install stable` 6 | 1. Install a rust nightly toolchain with the rust-src component: `rustup toolchain install nightly --component rust-src` 7 | 1. Install bpf-linker: `cargo install bpf-linker` 8 | 9 | ## Build eBPF 10 | 11 | ```bash 12 | cargo xtask build-ebpf 13 | ``` 14 | 15 | To perform a release build you can use the `--release` flag. 16 | You may also change the target architecture with the `--target` flag. 17 | 18 | ## Build Userspace 19 | 20 | ```bash 21 | cargo build 22 | ``` 23 | 24 | ## Run 25 | 26 | ```bash 27 | RUST_LOG=info cargo xtask run 28 | ``` 29 | -------------------------------------------------------------------------------- /pub-progs/pub-progs-ebpf/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | 3 | use aya_bpf::{macros::tracepoint, programs::TracePointContext}; 4 | use aya_log_ebpf::info; 5 | 6 | #[tracepoint(name = "sched_process_fork")] 7 | pub fn sched_process_fork(ctx: TracePointContext) -> u32 { 8 | match try_pub_progs(ctx) { 9 | Ok(ret) => ret, 10 | Err(ret) => ret, 11 | } 12 | } 13 | 14 | fn try_pub_progs(ctx: TracePointContext) -> Result { 15 | info!(&ctx, "tracepoint sched_process_fork called"); 16 | Ok(0) 17 | } 18 | 19 | #[panic_handler] 20 | fn panic(_info: &core::panic::PanicInfo) -> ! { 21 | unsafe { core::hint::unreachable_unchecked() } 22 | } 23 | -------------------------------------------------------------------------------- /tc-perfbuf/tc-perfbuf-ebpf/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "tc-perfbuf-ebpf" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | aya-bpf = { git = "https://github.com/aya-rs/aya", branch = "main" } 8 | tc-perfbuf-common = { path = "../tc-perfbuf-common" } 9 | 10 | [[bin]] 11 | name = "tc-perfbuf" 12 | path = "src/main.rs" 13 | 14 | [profile.dev] 15 | opt-level = 3 16 | debug = false 17 | debug-assertions = false 18 | overflow-checks = false 19 | lto = true 20 | panic = "abort" 21 | incremental = false 22 | codegen-units = 1 23 | rpath = false 24 | 25 | [profile.release] 26 | lto = true 27 | panic = "abort" 28 | codegen-units = 1 29 | 30 | [workspace] 31 | members = [] 32 | -------------------------------------------------------------------------------- /xdp-mac/xdp-mac/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xdp-mac" 3 | version = "0.1.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies] 8 | aya = { git = "https://github.com/vadorovsky/aya", branch = "aya-log-mac-addr", features=["async_tokio"] } 9 | aya-log = { git = "https://github.com/vadorovsky/aya", branch = "aya-log-mac-addr" } 10 | xdp-mac-common = { path = "../xdp-mac-common", features=["user"] } 11 | anyhow = "1.0.42" 12 | clap = { version = "3.1", features = ["derive"] } 13 | env_logger = "0.9" 14 | log = "0.4" 15 | tokio = { version = "1.18", features = ["macros", "rt", "rt-multi-thread", "net", "signal"] } 16 | 17 | [[bin]] 18 | name = "xdp-mac" 19 | path = "src/main.rs" 20 | -------------------------------------------------------------------------------- /tc-load-bytes/tc-load-bytes-ebpf/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "tc-load-bytes-ebpf" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | aya-bpf = { git = "https://github.com/aya-rs/aya", branch = "main" } 8 | tc-load-bytes-common = { path = "../tc-load-bytes-common" } 9 | 10 | [[bin]] 11 | name = "tc-load-bytes" 12 | path = "src/main.rs" 13 | 14 | [profile.dev] 15 | opt-level = 3 16 | debug = false 17 | debug-assertions = false 18 | overflow-checks = false 19 | lto = true 20 | panic = "abort" 21 | incremental = false 22 | codegen-units = 1 23 | rpath = false 24 | 25 | [profile.release] 26 | lto = true 27 | panic = "abort" 28 | codegen-units = 1 29 | 30 | [workspace] 31 | members = [] 32 | -------------------------------------------------------------------------------- /cshim/xtask/src/main.rs: -------------------------------------------------------------------------------- 1 | mod build_ebpf; 2 | mod run; 3 | 4 | use std::process::exit; 5 | 6 | use clap::Parser; 7 | 8 | #[derive(Debug, Parser)] 9 | pub struct Options { 10 | #[clap(subcommand)] 11 | command: Command, 12 | } 13 | 14 | #[derive(Debug, Parser)] 15 | enum Command { 16 | BuildEbpf(build_ebpf::Options), 17 | Run(run::Options), 18 | } 19 | 20 | fn main() { 21 | let opts = Options::parse(); 22 | 23 | use Command::*; 24 | let ret = match opts.command { 25 | BuildEbpf(opts) => build_ebpf::build_ebpf(opts), 26 | Run(opts) => run::run(opts), 27 | }; 28 | 29 | if let Err(e) = ret { 30 | eprintln!("{e:#}"); 31 | exit(1); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /xdp/xtask/src/main.rs: -------------------------------------------------------------------------------- 1 | mod build_ebpf; 2 | mod run; 3 | 4 | use std::process::exit; 5 | 6 | use clap::Parser; 7 | 8 | #[derive(Debug, Parser)] 9 | pub struct Options { 10 | #[clap(subcommand)] 11 | command: Command, 12 | } 13 | 14 | #[derive(Debug, Parser)] 15 | enum Command { 16 | BuildEbpf(build_ebpf::Options), 17 | Run(run::Options), 18 | } 19 | 20 | fn main() { 21 | let opts = Options::parse(); 22 | 23 | use Command::*; 24 | let ret = match opts.command { 25 | BuildEbpf(opts) => build_ebpf::build_ebpf(opts), 26 | Run(opts) => run::run(opts), 27 | }; 28 | 29 | if let Err(e) = ret { 30 | eprintln!("{:#}", e); 31 | exit(1); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /atomic/xtask/src/main.rs: -------------------------------------------------------------------------------- 1 | mod build_ebpf; 2 | mod run; 3 | 4 | use std::process::exit; 5 | 6 | use clap::Parser; 7 | 8 | #[derive(Debug, Parser)] 9 | pub struct Options { 10 | #[clap(subcommand)] 11 | command: Command, 12 | } 13 | 14 | #[derive(Debug, Parser)] 15 | enum Command { 16 | BuildEbpf(build_ebpf::Options), 17 | Run(run::Options), 18 | } 19 | 20 | fn main() { 21 | let opts = Options::parse(); 22 | 23 | use Command::*; 24 | let ret = match opts.command { 25 | BuildEbpf(opts) => build_ebpf::build_ebpf(opts), 26 | Run(opts) => run::run(opts), 27 | }; 28 | 29 | if let Err(e) = ret { 30 | eprintln!("{e:#}"); 31 | exit(1); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /cgroup/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rustlang/rust:nightly-bullseye as builder 2 | 3 | RUN apt-get update \ 4 | && apt-get install -y \ 5 | musl-dev 6 | RUN rustup component add rust-src \ 7 | && rustup target add x86_64-unknown-linux-musl \ 8 | && cargo install bpf-linker 9 | COPY . /src 10 | WORKDIR /src 11 | RUN --mount=type=cache,target=/.root/cargo/registry \ 12 | --mount=type=cache,target=/src/target \ 13 | cargo xtask build-ebpf --release \ 14 | && cargo build --release --target=x86_64-unknown-linux-musl \ 15 | && cp target/x86_64-unknown-linux-musl/release/cgroup /cgroup 16 | 17 | FROM alpine:3.15 18 | 19 | COPY --from=builder /cgroup /usr/sbin/cgroup 20 | ENTRYPOINT [ "/usr/sbin/cgroup" ] 21 | -------------------------------------------------------------------------------- /cgroup/xtask/src/main.rs: -------------------------------------------------------------------------------- 1 | mod build_ebpf; 2 | mod run; 3 | 4 | use std::process::exit; 5 | 6 | use clap::Parser; 7 | 8 | #[derive(Debug, Parser)] 9 | pub struct Options { 10 | #[clap(subcommand)] 11 | command: Command, 12 | } 13 | 14 | #[derive(Debug, Parser)] 15 | enum Command { 16 | BuildEbpf(build_ebpf::Options), 17 | Run(run::Options), 18 | } 19 | 20 | fn main() { 21 | let opts = Options::parse(); 22 | 23 | use Command::*; 24 | let ret = match opts.command { 25 | BuildEbpf(opts) => build_ebpf::build_ebpf(opts), 26 | Run(opts) => run::run(opts), 27 | }; 28 | 29 | if let Err(e) = ret { 30 | eprintln!("{:#}", e); 31 | exit(1); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /clone/xtask/src/main.rs: -------------------------------------------------------------------------------- 1 | mod build_ebpf; 2 | mod run; 3 | 4 | use std::process::exit; 5 | 6 | use clap::Parser; 7 | 8 | #[derive(Debug, Parser)] 9 | pub struct Options { 10 | #[clap(subcommand)] 11 | command: Command, 12 | } 13 | 14 | #[derive(Debug, Parser)] 15 | enum Command { 16 | BuildEbpf(build_ebpf::Options), 17 | Run(run::Options), 18 | } 19 | 20 | fn main() { 21 | let opts = Options::parse(); 22 | 23 | use Command::*; 24 | let ret = match opts.command { 25 | BuildEbpf(opts) => build_ebpf::build_ebpf(opts), 26 | Run(opts) => run::run(opts), 27 | }; 28 | 29 | if let Err(e) = ret { 30 | eprintln!("{:#}", e); 31 | exit(1); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /dpath/xtask/src/main.rs: -------------------------------------------------------------------------------- 1 | mod build_ebpf; 2 | mod run; 3 | 4 | use std::process::exit; 5 | 6 | use clap::Parser; 7 | 8 | #[derive(Debug, Parser)] 9 | pub struct Options { 10 | #[clap(subcommand)] 11 | command: Command, 12 | } 13 | 14 | #[derive(Debug, Parser)] 15 | enum Command { 16 | BuildEbpf(build_ebpf::Options), 17 | Run(run::Options), 18 | } 19 | 20 | fn main() { 21 | let opts = Options::parse(); 22 | 23 | use Command::*; 24 | let ret = match opts.command { 25 | BuildEbpf(opts) => build_ebpf::build_ebpf(opts), 26 | Run(opts) => run::run(opts), 27 | }; 28 | 29 | if let Err(e) = ret { 30 | eprintln!("{:#}", e); 31 | exit(1); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /notokio/xtask/src/main.rs: -------------------------------------------------------------------------------- 1 | mod build_ebpf; 2 | mod run; 3 | 4 | use std::process::exit; 5 | 6 | use clap::Parser; 7 | 8 | #[derive(Debug, Parser)] 9 | pub struct Options { 10 | #[clap(subcommand)] 11 | command: Command, 12 | } 13 | 14 | #[derive(Debug, Parser)] 15 | enum Command { 16 | BuildEbpf(build_ebpf::Options), 17 | Run(run::Options), 18 | } 19 | 20 | fn main() { 21 | let opts = Options::parse(); 22 | 23 | use Command::*; 24 | let ret = match opts.command { 25 | BuildEbpf(opts) => build_ebpf::build_ebpf(opts), 26 | Run(opts) => run::run(opts), 27 | }; 28 | 29 | if let Err(e) = ret { 30 | eprintln!("{:#}", e); 31 | exit(1); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /pub-progs/xtask/src/main.rs: -------------------------------------------------------------------------------- 1 | mod build_ebpf; 2 | mod run; 3 | 4 | use std::process::exit; 5 | 6 | use clap::Parser; 7 | 8 | #[derive(Debug, Parser)] 9 | pub struct Options { 10 | #[clap(subcommand)] 11 | command: Command, 12 | } 13 | 14 | #[derive(Debug, Parser)] 15 | enum Command { 16 | BuildEbpf(build_ebpf::Options), 17 | Run(run::Options), 18 | } 19 | 20 | fn main() { 21 | let opts = Options::parse(); 22 | 23 | use Command::*; 24 | let ret = match opts.command { 25 | BuildEbpf(opts) => build_ebpf::build_ebpf(opts), 26 | Run(opts) => run::run(opts), 27 | }; 28 | 29 | if let Err(e) = ret { 30 | eprintln!("{e:#}"); 31 | exit(1); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tc-perfbuf/xtask/src/main.rs: -------------------------------------------------------------------------------- 1 | mod build_ebpf; 2 | mod run; 3 | 4 | use std::process::exit; 5 | 6 | use clap::Parser; 7 | 8 | #[derive(Debug, Parser)] 9 | pub struct Options { 10 | #[clap(subcommand)] 11 | command: Command, 12 | } 13 | 14 | #[derive(Debug, Parser)] 15 | enum Command { 16 | BuildEbpf(build_ebpf::Options), 17 | Run(run::Options), 18 | } 19 | 20 | fn main() { 21 | let opts = Options::parse(); 22 | 23 | use Command::*; 24 | let ret = match opts.command { 25 | BuildEbpf(opts) => build_ebpf::build_ebpf(opts), 26 | Run(opts) => run::run(opts), 27 | }; 28 | 29 | if let Err(e) = ret { 30 | eprintln!("{e:#}"); 31 | exit(1); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tc-ringbuf/tc-ringbuf/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "tc-ringbuf" 3 | version = "0.1.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [dependencies] 8 | aya = { git = "https://github.com/vadorovsky/aya", branch = "ringbuf-integration", features=["async_tokio"] } 9 | aya-log = { git = "https://github.com/vadorovsky/aya", branch = "ringbuf-integration" } 10 | tc-ringbuf-common = { path = "../tc-ringbuf-common", features=["user"] } 11 | anyhow = "1.0.42" 12 | clap = { version = "4.0", features = ["derive"] } 13 | env_logger = "0.10" 14 | log = "0.4" 15 | tokio = { version = "1.23", features = ["macros", "rt", "rt-multi-thread", "net", "signal"] } 16 | 17 | [[bin]] 18 | name = "tc-ringbuf" 19 | path = "src/main.rs" 20 | -------------------------------------------------------------------------------- /tc-ringbuf/xtask/src/main.rs: -------------------------------------------------------------------------------- 1 | mod build_ebpf; 2 | mod run; 3 | 4 | use std::process::exit; 5 | 6 | use clap::Parser; 7 | 8 | #[derive(Debug, Parser)] 9 | pub struct Options { 10 | #[clap(subcommand)] 11 | command: Command, 12 | } 13 | 14 | #[derive(Debug, Parser)] 15 | enum Command { 16 | BuildEbpf(build_ebpf::Options), 17 | Run(run::Options), 18 | } 19 | 20 | fn main() { 21 | let opts = Options::parse(); 22 | 23 | use Command::*; 24 | let ret = match opts.command { 25 | BuildEbpf(opts) => build_ebpf::build_ebpf(opts), 26 | Run(opts) => run::run(opts), 27 | }; 28 | 29 | if let Err(e) = ret { 30 | eprintln!("{e:#}"); 31 | exit(1); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /uprobe/xtask/src/main.rs: -------------------------------------------------------------------------------- 1 | mod build_ebpf; 2 | mod run; 3 | 4 | use std::process::exit; 5 | 6 | use clap::Parser; 7 | 8 | #[derive(Debug, Parser)] 9 | pub struct Options { 10 | #[clap(subcommand)] 11 | command: Command, 12 | } 13 | 14 | #[derive(Debug, Parser)] 15 | enum Command { 16 | BuildEbpf(build_ebpf::Options), 17 | Run(run::Options), 18 | } 19 | 20 | fn main() { 21 | let opts = Options::parse(); 22 | 23 | use Command::*; 24 | let ret = match opts.command { 25 | BuildEbpf(opts) => build_ebpf::build_ebpf(opts), 26 | Run(opts) => run::run(opts), 27 | }; 28 | 29 | if let Err(e) = ret { 30 | eprintln!("{:#}", e); 31 | exit(1); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /xdp-mac/xtask/src/main.rs: -------------------------------------------------------------------------------- 1 | mod build_ebpf; 2 | mod run; 3 | 4 | use std::process::exit; 5 | 6 | use clap::Parser; 7 | 8 | #[derive(Debug, Parser)] 9 | pub struct Options { 10 | #[clap(subcommand)] 11 | command: Command, 12 | } 13 | 14 | #[derive(Debug, Parser)] 15 | enum Command { 16 | BuildEbpf(build_ebpf::Options), 17 | Run(run::Options), 18 | } 19 | 20 | fn main() { 21 | let opts = Options::parse(); 22 | 23 | use Command::*; 24 | let ret = match opts.command { 25 | BuildEbpf(opts) => build_ebpf::build_ebpf(opts), 26 | Run(opts) => run::run(opts), 27 | }; 28 | 29 | if let Err(e) = ret { 30 | eprintln!("{:#}", e); 31 | exit(1); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /cshim/cshim-ebpf/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "cshim-ebpf" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | aya-bpf = { git = "https://github.com/aya-rs/aya", branch = "main" } 8 | cshim-common = { path = "../cshim-common" } 9 | 10 | [build-dependencies] 11 | anyhow = "1" 12 | 13 | [[bin]] 14 | name = "cshim" 15 | path = "src/main.rs" 16 | 17 | [profile.dev] 18 | opt-level = 3 19 | debug = 2 20 | debug-assertions = false 21 | overflow-checks = false 22 | lto = true 23 | panic = "abort" 24 | incremental = false 25 | codegen-units = 1 26 | rpath = false 27 | 28 | [profile.release] 29 | lto = true 30 | debug = 2 31 | panic = "abort" 32 | codegen-units = 1 33 | 34 | [workspace] 35 | members = [] 36 | -------------------------------------------------------------------------------- /tc-load-bytes/xtask/src/main.rs: -------------------------------------------------------------------------------- 1 | mod build_ebpf; 2 | mod run; 3 | 4 | use std::process::exit; 5 | 6 | use clap::Parser; 7 | 8 | #[derive(Debug, Parser)] 9 | pub struct Options { 10 | #[clap(subcommand)] 11 | command: Command, 12 | } 13 | 14 | #[derive(Debug, Parser)] 15 | enum Command { 16 | BuildEbpf(build_ebpf::Options), 17 | Run(run::Options), 18 | } 19 | 20 | fn main() { 21 | let opts = Options::parse(); 22 | 23 | use Command::*; 24 | let ret = match opts.command { 25 | BuildEbpf(opts) => build_ebpf::build_ebpf(opts), 26 | Run(opts) => run::run(opts), 27 | }; 28 | 29 | if let Err(e) = ret { 30 | eprintln!("{e:#}"); 31 | exit(1); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tc-perfbuf-simple/tc-perfbuf-simple-ebpf/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "tc-perfbuf-simple-ebpf" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | aya-bpf = { git = "https://github.com/aya-rs/aya", branch = "main" } 8 | tc-perfbuf-simple-common = { path = "../tc-perfbuf-simple-common" } 9 | 10 | [[bin]] 11 | name = "tc-perfbuf" 12 | path = "src/main.rs" 13 | 14 | [profile.dev] 15 | opt-level = 3 16 | debug = false 17 | debug-assertions = false 18 | overflow-checks = false 19 | lto = true 20 | panic = "abort" 21 | incremental = false 22 | codegen-units = 1 23 | rpath = false 24 | 25 | [profile.release] 26 | lto = true 27 | panic = "abort" 28 | codegen-units = 1 29 | 30 | [workspace] 31 | members = [] 32 | -------------------------------------------------------------------------------- /xdp-mut-u8/xtask/src/main.rs: -------------------------------------------------------------------------------- 1 | mod build_ebpf; 2 | mod run; 3 | 4 | use std::process::exit; 5 | 6 | use clap::Parser; 7 | 8 | #[derive(Debug, Parser)] 9 | pub struct Options { 10 | #[clap(subcommand)] 11 | command: Command, 12 | } 13 | 14 | #[derive(Debug, Parser)] 15 | enum Command { 16 | BuildEbpf(build_ebpf::Options), 17 | Run(run::Options), 18 | } 19 | 20 | fn main() { 21 | let opts = Options::parse(); 22 | 23 | use Command::*; 24 | let ret = match opts.command { 25 | BuildEbpf(opts) => build_ebpf::build_ebpf(opts), 26 | Run(opts) => run::run(opts), 27 | }; 28 | 29 | if let Err(e) = ret { 30 | eprintln!("{:#}", e); 31 | exit(1); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /xdp-perfbuf/xtask/src/main.rs: -------------------------------------------------------------------------------- 1 | mod build_ebpf; 2 | mod run; 3 | 4 | use std::process::exit; 5 | 6 | use clap::Parser; 7 | 8 | #[derive(Debug, Parser)] 9 | pub struct Options { 10 | #[clap(subcommand)] 11 | command: Command, 12 | } 13 | 14 | #[derive(Debug, Parser)] 15 | enum Command { 16 | BuildEbpf(build_ebpf::Options), 17 | Run(run::Options), 18 | } 19 | 20 | fn main() { 21 | let opts = Options::parse(); 22 | 23 | use Command::*; 24 | let ret = match opts.command { 25 | BuildEbpf(opts) => build_ebpf::build_ebpf(opts), 26 | Run(opts) => run::run(opts), 27 | }; 28 | 29 | if let Err(e) = ret { 30 | eprintln!("{e:#}"); 31 | exit(1); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tc-perfbuf-simple/xtask/src/main.rs: -------------------------------------------------------------------------------- 1 | mod build_ebpf; 2 | mod run; 3 | 4 | use std::process::exit; 5 | 6 | use clap::Parser; 7 | 8 | #[derive(Debug, Parser)] 9 | pub struct Options { 10 | #[clap(subcommand)] 11 | command: Command, 12 | } 13 | 14 | #[derive(Debug, Parser)] 15 | enum Command { 16 | BuildEbpf(build_ebpf::Options), 17 | Run(run::Options), 18 | } 19 | 20 | fn main() { 21 | let opts = Options::parse(); 22 | 23 | use Command::*; 24 | let ret = match opts.command { 25 | BuildEbpf(opts) => build_ebpf::build_ebpf(opts), 26 | Run(opts) => run::run(opts), 27 | }; 28 | 29 | if let Err(e) = ret { 30 | eprintln!("{e:#}"); 31 | exit(1); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /xdp-verifier-err/xtask/src/main.rs: -------------------------------------------------------------------------------- 1 | mod build_ebpf; 2 | mod run; 3 | 4 | use std::process::exit; 5 | 6 | use clap::Parser; 7 | 8 | #[derive(Debug, Parser)] 9 | pub struct Options { 10 | #[clap(subcommand)] 11 | command: Command, 12 | } 13 | 14 | #[derive(Debug, Parser)] 15 | enum Command { 16 | BuildEbpf(build_ebpf::Options), 17 | Run(run::Options), 18 | } 19 | 20 | fn main() { 21 | let opts = Options::parse(); 22 | 23 | use Command::*; 24 | let ret = match opts.command { 25 | BuildEbpf(opts) => build_ebpf::build_ebpf(opts), 26 | Run(opts) => run::run(opts), 27 | }; 28 | 29 | if let Err(e) = ret { 30 | eprintln!("{:#}", e); 31 | exit(1); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /clone/clone-ebpf/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "clone-ebpf" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | aya-bpf = { git = "https://github.com/aya-rs/aya", branch = "main" } 8 | aya-log-ebpf = { git = "https://github.com/aya-rs/aya", branch = "main" } 9 | clone-common = { path = "../clone-common" } 10 | 11 | [[bin]] 12 | name = "clone" 13 | path = "src/main.rs" 14 | 15 | [profile.dev] 16 | opt-level = 3 17 | debug = false 18 | debug-assertions = false 19 | overflow-checks = false 20 | lto = true 21 | panic = "abort" 22 | incremental = false 23 | codegen-units = 1 24 | rpath = false 25 | 26 | [profile.release] 27 | lto = true 28 | panic = "abort" 29 | codegen-units = 1 30 | 31 | [workspace] 32 | members = [] 33 | -------------------------------------------------------------------------------- /atomic/atomic-ebpf/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "atomic-ebpf" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | aya-bpf = { git = "https://github.com/aya-rs/aya", branch = "main" } 8 | aya-log-ebpf = { git = "https://github.com/aya-rs/aya", branch = "main" } 9 | atomic-common = { path = "../atomic-common" } 10 | 11 | [[bin]] 12 | name = "atomic" 13 | path = "src/main.rs" 14 | 15 | [profile.dev] 16 | opt-level = 3 17 | debug = false 18 | debug-assertions = false 19 | overflow-checks = false 20 | lto = true 21 | panic = "abort" 22 | incremental = false 23 | codegen-units = 1 24 | rpath = false 25 | 26 | [profile.release] 27 | lto = true 28 | panic = "abort" 29 | codegen-units = 1 30 | 31 | [workspace] 32 | members = [] 33 | -------------------------------------------------------------------------------- /dpath/dpath-ebpf/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "dpath-ebpf" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | aya-bpf = { git = "https://github.com/aya-rs/aya", branch = "main" } 8 | aya-log-ebpf = { git = "https://github.com/aya-rs/aya-log", branch = "main" } 9 | dpath-common = { path = "../dpath-common" } 10 | 11 | [[bin]] 12 | name = "dpath" 13 | path = "src/main.rs" 14 | 15 | [profile.dev] 16 | opt-level = 3 17 | debug = false 18 | debug-assertions = false 19 | overflow-checks = false 20 | lto = true 21 | panic = "abort" 22 | incremental = false 23 | codegen-units = 1 24 | rpath = false 25 | 26 | [profile.release] 27 | lto = true 28 | panic = "abort" 29 | codegen-units = 1 30 | 31 | [workspace] 32 | members = [] 33 | -------------------------------------------------------------------------------- /tc/tc-ebpf/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "tc-ebpf" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | aya-bpf = { git = "https://github.com/aya-rs/aya", branch = "main" } 8 | aya-log-ebpf = { git = "https://github.com/aya-rs/aya", branch = "main" } 9 | memoffset = "0.6" 10 | tc-common = { path = "../tc-common" } 11 | 12 | [[bin]] 13 | name = "tc" 14 | path = "src/main.rs" 15 | 16 | [profile.dev] 17 | opt-level = 3 18 | debug = false 19 | debug-assertions = false 20 | overflow-checks = false 21 | lto = true 22 | panic = "abort" 23 | incremental = false 24 | codegen-units = 1 25 | rpath = false 26 | 27 | [profile.release] 28 | lto = true 29 | panic = "abort" 30 | codegen-units = 1 31 | 32 | [workspace] 33 | members = [] 34 | -------------------------------------------------------------------------------- /uprobe/uprobe-ebpf/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "uprobe-ebpf" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | aya-bpf = { git = "https://github.com/aya-rs/aya", branch = "main" } 8 | aya-log-ebpf = { git = "https://github.com/aya-rs/aya", branch = "main" } 9 | uprobe-common = { path = "../uprobe-common" } 10 | 11 | [[bin]] 12 | name = "uprobe" 13 | path = "src/main.rs" 14 | 15 | [profile.dev] 16 | opt-level = 3 17 | debug = false 18 | debug-assertions = false 19 | overflow-checks = false 20 | lto = true 21 | panic = "abort" 22 | incremental = false 23 | codegen-units = 1 24 | rpath = false 25 | 26 | [profile.release] 27 | lto = true 28 | panic = "abort" 29 | codegen-units = 1 30 | 31 | [workspace] 32 | members = [] 33 | -------------------------------------------------------------------------------- /cgroup/cgroup-ebpf/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "cgroup-ebpf" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | aya-bpf = { git = "https://github.com/aya-rs/aya", branch = "main" } 8 | aya-log-ebpf = { git = "https://github.com/aya-rs/aya-log", branch = "main" } 9 | cgroup-common = { path = "../cgroup-common" } 10 | 11 | [[bin]] 12 | name = "cgroup" 13 | path = "src/main.rs" 14 | 15 | [profile.dev] 16 | opt-level = 3 17 | debug = false 18 | debug-assertions = false 19 | overflow-checks = false 20 | lto = true 21 | panic = "abort" 22 | incremental = false 23 | codegen-units = 1 24 | rpath = false 25 | 26 | [profile.release] 27 | lto = true 28 | panic = "abort" 29 | codegen-units = 1 30 | 31 | [workspace] 32 | members = [] 33 | -------------------------------------------------------------------------------- /xdp-perfbuf/xdp-perfbuf-ebpf/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xdp-perfbuf-ebpf" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | aya-bpf = { git = "https://github.com/aya-rs/aya", branch = "main" } 8 | aya-log-ebpf = { git = "https://github.com/aya-rs/aya", branch = "main" } 9 | xdp-perfbuf-common = { path = "../xdp-perfbuf-common" } 10 | 11 | [[bin]] 12 | name = "xdp-perfbuf" 13 | path = "src/main.rs" 14 | 15 | [profile.dev] 16 | opt-level = 3 17 | debug = false 18 | debug-assertions = false 19 | overflow-checks = false 20 | lto = true 21 | panic = "abort" 22 | incremental = false 23 | codegen-units = 1 24 | rpath = false 25 | 26 | [profile.release] 27 | lto = true 28 | panic = "abort" 29 | codegen-units = 1 30 | 31 | [workspace] 32 | members = [] 33 | -------------------------------------------------------------------------------- /notokio/notokio-ebpf/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "notokio-ebpf" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | aya-bpf = { git = "https://github.com/vadorovsky/aya", branch = "aya-log-tokio" } 8 | aya-log-ebpf = { git = "https://github.com/vadorovsky/aya", branch = "aya-log-tokio" } 9 | notokio-common = { path = "../notokio-common" } 10 | 11 | [[bin]] 12 | name = "notokio" 13 | path = "src/main.rs" 14 | 15 | [profile.dev] 16 | opt-level = 3 17 | debug = false 18 | debug-assertions = false 19 | overflow-checks = false 20 | lto = true 21 | panic = "abort" 22 | incremental = false 23 | codegen-units = 1 24 | rpath = false 25 | 26 | [profile.release] 27 | lto = true 28 | panic = "abort" 29 | codegen-units = 1 30 | 31 | [workspace] 32 | members = [] 33 | -------------------------------------------------------------------------------- /tc-bytes/tc-bytes-ebpf/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "tc-bytes-ebpf" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | aya-bpf = { git = "https://github.com/aya-rs/aya", branch = "main" } 8 | aya-log-ebpf = { git = "https://github.com/aya-rs/aya-log", branch = "main" } 9 | memoffset = "0.6" 10 | tc-bytes-common = { path = "../tc-bytes-common" } 11 | 12 | [[bin]] 13 | name = "tc-bytes" 14 | path = "src/main.rs" 15 | 16 | [profile.dev] 17 | opt-level = 3 18 | debug = false 19 | debug-assertions = false 20 | overflow-checks = false 21 | lto = true 22 | panic = "abort" 23 | incremental = false 24 | codegen-units = 1 25 | rpath = false 26 | 27 | [profile.release] 28 | lto = true 29 | panic = "abort" 30 | codegen-units = 1 31 | 32 | [workspace] 33 | members = [] 34 | -------------------------------------------------------------------------------- /tc-srcip/tc-srcip-ebpf/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "tc-srcip-ebpf" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | aya-bpf = { git = "https://github.com/aya-rs/aya", branch = "main" } 8 | aya-log-ebpf = { git = "https://github.com/aya-rs/aya-log", branch = "main" } 9 | memoffset = "0.6" 10 | tc-srcip-common = { path = "../tc-srcip-common" } 11 | 12 | [[bin]] 13 | name = "tc-srcip" 14 | path = "src/main.rs" 15 | 16 | [profile.dev] 17 | opt-level = 3 18 | debug = false 19 | debug-assertions = false 20 | overflow-checks = false 21 | lto = true 22 | panic = "abort" 23 | incremental = false 24 | codegen-units = 1 25 | rpath = false 26 | 27 | [profile.release] 28 | lto = true 29 | panic = "abort" 30 | codegen-units = 1 31 | 32 | [workspace] 33 | members = [] 34 | -------------------------------------------------------------------------------- /tc/xtask/src/main.rs: -------------------------------------------------------------------------------- 1 | mod build_ebpf; 2 | mod codegen; 3 | mod run; 4 | 5 | use std::process::exit; 6 | 7 | use clap::Parser; 8 | 9 | #[derive(Debug, Parser)] 10 | pub struct Options { 11 | #[clap(subcommand)] 12 | command: Command, 13 | } 14 | 15 | #[derive(Debug, Parser)] 16 | enum Command { 17 | BuildEbpf(build_ebpf::Options), 18 | Run(run::Options), 19 | Codegen, 20 | } 21 | 22 | fn main() { 23 | let opts = Options::parse(); 24 | 25 | use Command::*; 26 | let ret = match opts.command { 27 | BuildEbpf(opts) => build_ebpf::build_ebpf(opts), 28 | Run(opts) => run::run(opts), 29 | Codegen => codegen::generate(), 30 | }; 31 | 32 | if let Err(e) = ret { 33 | eprintln!("{:#}", e); 34 | exit(1); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tc-bytes/xtask/src/main.rs: -------------------------------------------------------------------------------- 1 | mod build_ebpf; 2 | mod codegen; 3 | mod run; 4 | 5 | use std::process::exit; 6 | 7 | use clap::Parser; 8 | 9 | #[derive(Debug, Parser)] 10 | pub struct Options { 11 | #[clap(subcommand)] 12 | command: Command, 13 | } 14 | 15 | #[derive(Debug, Parser)] 16 | enum Command { 17 | BuildEbpf(build_ebpf::Options), 18 | Run(run::Options), 19 | Codegen, 20 | } 21 | 22 | fn main() { 23 | let opts = Options::parse(); 24 | 25 | use Command::*; 26 | let ret = match opts.command { 27 | BuildEbpf(opts) => build_ebpf::build_ebpf(opts), 28 | Run(opts) => run::run(opts), 29 | Codegen => codegen::generate(), 30 | }; 31 | 32 | if let Err(e) = ret { 33 | eprintln!("{:#}", e); 34 | exit(1); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tc-srcip/xtask/src/main.rs: -------------------------------------------------------------------------------- 1 | mod build_ebpf; 2 | mod codegen; 3 | mod run; 4 | 5 | use std::process::exit; 6 | 7 | use clap::Parser; 8 | 9 | #[derive(Debug, Parser)] 10 | pub struct Options { 11 | #[clap(subcommand)] 12 | command: Command, 13 | } 14 | 15 | #[derive(Debug, Parser)] 16 | enum Command { 17 | BuildEbpf(build_ebpf::Options), 18 | Run(run::Options), 19 | Codegen, 20 | } 21 | 22 | fn main() { 23 | let opts = Options::parse(); 24 | 25 | use Command::*; 26 | let ret = match opts.command { 27 | BuildEbpf(opts) => build_ebpf::build_ebpf(opts), 28 | Run(opts) => run::run(opts), 29 | Codegen => codegen::generate(), 30 | }; 31 | 32 | if let Err(e) = ret { 33 | eprintln!("{:#}", e); 34 | exit(1); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /xdp-bytes/xtask/src/main.rs: -------------------------------------------------------------------------------- 1 | mod build_ebpf; 2 | mod codegen; 3 | mod run; 4 | 5 | use std::process::exit; 6 | 7 | use clap::Parser; 8 | 9 | #[derive(Debug, Parser)] 10 | pub struct Options { 11 | #[clap(subcommand)] 12 | command: Command, 13 | } 14 | 15 | #[derive(Debug, Parser)] 16 | enum Command { 17 | BuildEbpf(build_ebpf::Options), 18 | Run(run::Options), 19 | Codegen, 20 | } 21 | 22 | fn main() { 23 | let opts = Options::parse(); 24 | 25 | use Command::*; 26 | let ret = match opts.command { 27 | BuildEbpf(opts) => build_ebpf::build_ebpf(opts), 28 | Run(opts) => run::run(opts), 29 | Codegen => codegen::generate(), 30 | }; 31 | 32 | if let Err(e) = ret { 33 | eprintln!("{:#}", e); 34 | exit(1); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tc-ringbuf/tc-ringbuf-ebpf/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "tc-ringbuf-ebpf" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | aya-bpf = { git = "https://github.com/vadorovsky/aya", branch = "ringbuf-integration" } 8 | aya-log-ebpf = { git = "https://github.com/vadorovsky/aya", branch = "ringbuf-integration" } 9 | tc-ringbuf-common = { path = "../tc-ringbuf-common" } 10 | 11 | [[bin]] 12 | name = "tc-ringbuf" 13 | path = "src/main.rs" 14 | 15 | [profile.dev] 16 | opt-level = 3 17 | debug = false 18 | debug-assertions = false 19 | overflow-checks = false 20 | lto = true 21 | panic = "abort" 22 | incremental = false 23 | codegen-units = 1 24 | rpath = false 25 | 26 | [profile.release] 27 | lto = true 28 | panic = "abort" 29 | codegen-units = 1 30 | 31 | [workspace] 32 | members = [] 33 | -------------------------------------------------------------------------------- /bpf-loop/xtask/src/main.rs: -------------------------------------------------------------------------------- 1 | mod build_ebpf; 2 | mod build; 3 | mod run; 4 | 5 | use std::process::exit; 6 | 7 | use clap::Parser; 8 | 9 | #[derive(Debug, Parser)] 10 | pub struct Options { 11 | #[clap(subcommand)] 12 | command: Command, 13 | } 14 | 15 | #[derive(Debug, Parser)] 16 | enum Command { 17 | BuildEbpf(build_ebpf::Options), 18 | Build(build::Options), 19 | Run(run::Options), 20 | } 21 | 22 | fn main() { 23 | let opts = Options::parse(); 24 | 25 | use Command::*; 26 | let ret = match opts.command { 27 | BuildEbpf(opts) => build_ebpf::build_ebpf(opts), 28 | Run(opts) => run::run(opts), 29 | Build(opts) => build::build(opts), 30 | }; 31 | 32 | if let Err(e) = ret { 33 | eprintln!("{e:#}"); 34 | exit(1); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /xdp-mut-u8/xdp-mut-u8-ebpf/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xdp-mut-u8-ebpf" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | aya-bpf = { git = "https://github.com/vadorovsky/aya", branch = "xdp-tc-mut-u8" } 8 | aya-log-ebpf = { git = "https://github.com/vadorovsky/aya", branch = "xdp-tc-mut-u8" } 9 | xdp-mut-u8-common = { path = "../xdp-mut-u8-common" } 10 | network-types = "0.0.1" 11 | 12 | [[bin]] 13 | name = "xdp-mut-u8" 14 | path = "src/main.rs" 15 | 16 | [profile.dev] 17 | opt-level = 3 18 | debug = false 19 | debug-assertions = false 20 | overflow-checks = false 21 | lto = true 22 | panic = "abort" 23 | incremental = false 24 | codegen-units = 1 25 | rpath = false 26 | 27 | [profile.release] 28 | lto = true 29 | panic = "abort" 30 | codegen-units = 1 31 | 32 | [workspace] 33 | members = [] 34 | -------------------------------------------------------------------------------- /xdp/xdp-ebpf/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xdp-ebpf" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | aya-bpf = { git = "https://github.com/aya-rs/aya", branch = "main" } 8 | aya-log-ebpf = { git = "https://github.com/aya-rs/aya", branch = "main" } 9 | xdp-common = { path = "../xdp-common" } 10 | network-types = { git = "https://github.com/vadorovsky/network-types", branch = "main" } 11 | 12 | [[bin]] 13 | name = "xdp" 14 | path = "src/main.rs" 15 | 16 | [profile.dev] 17 | opt-level = 3 18 | debug = false 19 | debug-assertions = false 20 | overflow-checks = false 21 | lto = true 22 | panic = "abort" 23 | incremental = false 24 | codegen-units = 1 25 | rpath = false 26 | 27 | [profile.release] 28 | lto = true 29 | panic = "abort" 30 | codegen-units = 1 31 | 32 | [workspace] 33 | members = [] 34 | -------------------------------------------------------------------------------- /xdp-verifier-err/xdp-verifier-err-ebpf/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xdp-verifier-err-ebpf" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | aya-bpf = { git = "https://github.com/aya-rs/aya", branch = "main" } 8 | aya-log-ebpf = { git = "https://github.com/aya-rs/aya", branch = "main" } 9 | xdp-verifier-err-common = { path = "../xdp-verifier-err-common" } 10 | network-types = "0.0.1" 11 | 12 | [[bin]] 13 | name = "xdp-verifier-err" 14 | path = "src/main.rs" 15 | 16 | [profile.dev] 17 | opt-level = 3 18 | debug = false 19 | debug-assertions = false 20 | overflow-checks = false 21 | lto = true 22 | panic = "abort" 23 | incremental = false 24 | codegen-units = 1 25 | rpath = false 26 | 27 | [profile.release] 28 | lto = true 29 | panic = "abort" 30 | codegen-units = 1 31 | 32 | [workspace] 33 | members = [] 34 | -------------------------------------------------------------------------------- /bpf-loop/bpf-loop-ebpf/src/main.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | #![no_main] 3 | 4 | use core::ptr; 5 | 6 | use aya_ebpf::{helpers::bpf_loop, macros::tracepoint, programs::TracePointContext}; 7 | use aya_log_ebpf::info; 8 | 9 | extern "C" fn callback(ctx: *mut core::ffi::c_void, index: u32) -> i32 { 10 | 0 11 | } 12 | 13 | #[tracepoint] 14 | pub fn probe_bpf_loop(ctx: TracePointContext) -> u32 { 15 | match try_probe_bpf_loop(ctx) { 16 | Ok(ret) => ret, 17 | Err(ret) => ret, 18 | } 19 | } 20 | 21 | fn try_probe_bpf_loop(ctx: TracePointContext) -> Result { 22 | unsafe { 23 | bpf_loop(5, callback as *mut _, ptr::null_mut(), 0); 24 | } 25 | 26 | Ok(0) 27 | } 28 | 29 | #[panic_handler] 30 | fn panic(_info: &core::panic::PanicInfo) -> ! { 31 | unsafe { core::hint::unreachable_unchecked() } 32 | } 33 | -------------------------------------------------------------------------------- /clone/clone-ebpf/src/main.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | #![no_main] 3 | 4 | use aya_bpf::{macros::fentry, programs::FEntryContext, BpfContext}; 5 | use aya_log_ebpf::info; 6 | 7 | #[fentry] 8 | pub fn kernel_clone(ctx: FEntryContext) -> u32 { 9 | match unsafe { try_kernel_clone(ctx) } { 10 | Ok(ret) => ret, 11 | Err(ret) => ret, 12 | } 13 | } 14 | 15 | unsafe fn try_kernel_clone(ctx: FEntryContext) -> Result { 16 | let pid = ctx.pid(); 17 | 18 | let command = ctx.command().map_err(|e| e as u32)?; 19 | let command = core::str::from_utf8_unchecked(&command[..]); 20 | 21 | info!(&ctx, "new process: pid: {}, command: {}", pid, command); 22 | 23 | Ok(0) 24 | } 25 | 26 | #[panic_handler] 27 | fn panic(_info: &core::panic::PanicInfo) -> ! { 28 | unsafe { core::hint::unreachable_unchecked() } 29 | } 30 | -------------------------------------------------------------------------------- /xdp-mac/xdp-mac-ebpf/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xdp-mac-ebpf" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | aya-bpf = { git = "https://github.com/vadorovsky/aya", branch = "aya-log-mac-addr" } 8 | aya-log-ebpf = { git = "https://github.com/vadorovsky/aya", branch = "aya-log-mac-addr" } 9 | xdp-mac-common = { path = "../xdp-mac-common" } 10 | network-types = { git = "https://github.com/vadorovsky/network-types", branch = "main" } 11 | 12 | [[bin]] 13 | name = "xdp-mac" 14 | path = "src/main.rs" 15 | 16 | [profile.dev] 17 | opt-level = 3 18 | debug = false 19 | debug-assertions = false 20 | overflow-checks = false 21 | lto = true 22 | panic = "abort" 23 | incremental = false 24 | codegen-units = 1 25 | rpath = false 26 | 27 | [profile.release] 28 | lto = true 29 | panic = "abort" 30 | codegen-units = 1 31 | 32 | [workspace] 33 | members = [] 34 | -------------------------------------------------------------------------------- /tc-perfbuf/tc-perfbuf-ebpf/src/main.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | #![no_main] 3 | 4 | use aya_bpf::{ 5 | macros::{classifier, map}, 6 | maps::PerfEventArray, 7 | programs::TcContext, 8 | }; 9 | 10 | use tc_perfbuf_common::PacketBuffer; 11 | 12 | #[map] 13 | pub static DATA: PerfEventArray = PerfEventArray::new(0); 14 | 15 | #[classifier(name = "tc_perfbuf")] 16 | pub fn tc_perfbuf(ctx: TcContext) -> i32 { 17 | match try_tc_perfbuf(ctx) { 18 | Ok(ret) => ret, 19 | Err(ret) => ret, 20 | } 21 | } 22 | 23 | fn try_tc_perfbuf(ctx: TcContext) -> Result { 24 | DATA.output( 25 | &ctx, 26 | &PacketBuffer { 27 | size: ctx.len() as usize, 28 | }, 29 | ctx.len(), 30 | ); 31 | Ok(0) 32 | } 33 | 34 | #[panic_handler] 35 | fn panic(_info: &core::panic::PanicInfo) -> ! { 36 | unsafe { core::hint::unreachable_unchecked() } 37 | } 38 | -------------------------------------------------------------------------------- /xdp-bytes/xdp-bytes-ebpf/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xdp-bytes-ebpf" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | aya-bpf = { git = "https://github.com/vadorovsky/aya", branch = "xdp-load-bytes" } 8 | aya-log-ebpf = { git = "https://github.com/aya-rs/aya-log", branch = "main" } 9 | memoffset = "0.6" 10 | xdp-bytes-common = { path = "../xdp-bytes-common" } 11 | 12 | [patch.'https://github.com/aya-rs/aya'] 13 | aya-bpf = { git = "https://github.com/vadorovsky/aya", branch = "xdp-load-bytes" } 14 | 15 | [[bin]] 16 | name = "xdp-bytes" 17 | path = "src/main.rs" 18 | 19 | [profile.dev] 20 | opt-level = 3 21 | debug = false 22 | debug-assertions = false 23 | overflow-checks = false 24 | lto = true 25 | panic = "abort" 26 | incremental = false 27 | codegen-units = 1 28 | rpath = false 29 | 30 | [profile.release] 31 | lto = true 32 | panic = "abort" 33 | codegen-units = 1 34 | 35 | [workspace] 36 | members = [] 37 | -------------------------------------------------------------------------------- /tc-perfbuf-simple/tc-perfbuf-simple-ebpf/src/main.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | #![no_main] 3 | 4 | use aya_bpf::{ 5 | macros::{classifier, map}, 6 | maps::PerfEventArray, 7 | programs::TcContext, 8 | }; 9 | 10 | use tc_perfbuf_simple_common::PacketBuffer; 11 | 12 | #[map] 13 | pub static DATA: PerfEventArray = PerfEventArray::new(0); 14 | 15 | #[classifier(name = "tc_perfbuf")] 16 | pub fn tc_perfbuf(ctx: TcContext) -> i32 { 17 | match try_tc_perfbuf(ctx) { 18 | Ok(ret) => ret, 19 | Err(ret) => ret, 20 | } 21 | } 22 | 23 | fn try_tc_perfbuf(ctx: TcContext) -> Result { 24 | DATA.output( 25 | &ctx, 26 | &PacketBuffer { 27 | size: ctx.len() as usize, 28 | }, 29 | ctx.len(), 30 | ); 31 | Ok(0) 32 | } 33 | 34 | #[panic_handler] 35 | fn panic(_info: &core::panic::PanicInfo) -> ! { 36 | unsafe { core::hint::unreachable_unchecked() } 37 | } 38 | -------------------------------------------------------------------------------- /xdp-perfbuf/xdp-perfbuf-ebpf/src/main.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | #![no_main] 3 | 4 | use aya_bpf::{ 5 | bindings::xdp_action, 6 | macros::{map, xdp}, 7 | maps::PerfEventArray, 8 | programs::XdpContext, 9 | }; 10 | 11 | use xdp_perfbuf_common::PacketBuffer; 12 | 13 | #[map] 14 | pub static DATA: PerfEventArray = PerfEventArray::new(0); 15 | 16 | #[xdp(name = "xdp_perfbuf")] 17 | pub fn xdp_perfbuf(ctx: XdpContext) -> u32 { 18 | match try_xdp_perfbuf(ctx) { 19 | Ok(ret) => ret, 20 | Err(_) => xdp_action::XDP_ABORTED, 21 | } 22 | } 23 | 24 | fn try_xdp_perfbuf(ctx: XdpContext) -> Result { 25 | let len = ctx.data_end() - ctx.data(); 26 | DATA.output(&ctx, &PacketBuffer { size: len }, len as u32); 27 | 28 | Ok(xdp_action::XDP_PASS) 29 | } 30 | 31 | #[panic_handler] 32 | fn panic(_info: &core::panic::PanicInfo) -> ! { 33 | unsafe { core::hint::unreachable_unchecked() } 34 | } 35 | -------------------------------------------------------------------------------- /pub-progs/pub-progs-ebpf/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "pub-progs-ebpf" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | aya-bpf = { git = "https://github.com/vadorovsky/aya", branch = "bpf-macros-visibility" } 8 | aya-log-ebpf = { git = "https://github.com/vadorovsky/aya", branch = "bpf-macros-visibility" } 9 | pub-progs-common = { path = "../pub-progs-common" } 10 | 11 | [patch."https://github.com/aya-rs/aya"] 12 | aya-bpf = { git = "https://github.com/vadorovsky/aya", branch = "bpf-macros-visibility" } 13 | 14 | [lib] 15 | name = "pub_progs" 16 | path = "src/lib.rs" 17 | 18 | [[bin]] 19 | name = "pub-progs" 20 | path = "src/main.rs" 21 | 22 | [profile.dev] 23 | opt-level = 3 24 | debug = false 25 | debug-assertions = false 26 | overflow-checks = false 27 | lto = true 28 | panic = "abort" 29 | incremental = false 30 | codegen-units = 1 31 | rpath = false 32 | 33 | [profile.release] 34 | lto = true 35 | panic = "abort" 36 | codegen-units = 1 37 | 38 | [workspace] 39 | members = [] 40 | -------------------------------------------------------------------------------- /tc-srcip/kubernetes.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: DaemonSet 3 | metadata: 4 | name: tc-srcip 5 | namespace: kube-system 6 | labels: 7 | k8s-app: tc-srcip 8 | spec: 9 | selector: 10 | matchLabels: 11 | name: tc-srcip 12 | updateStrategy: 13 | type: RollingUpdate 14 | template: 15 | metadata: 16 | labels: 17 | name: tc-srcip 18 | spec: 19 | hostPID: true 20 | hostNetwork: true 21 | dnsPolicy: ClusterFirstWithHostNet 22 | volumes: 23 | - name: bpffs 24 | hostPath: 25 | path: /sys/fs/bpf 26 | type: Directory 27 | containers: 28 | - name: tc-srcip 29 | image: docker.io/vadorovsky/tc-srcip:latest 30 | imagePullPolicy: Always 31 | securityContext: 32 | privileged: true 33 | volumeMounts: 34 | - mountPath: /sys/fs/bpf 35 | name: bpffs 36 | imagePullSecrets: 37 | - name: regcred 38 | tolerations: 39 | - operator: Exists 40 | -------------------------------------------------------------------------------- /cshim/cshim-ebpf/build.rs: -------------------------------------------------------------------------------- 1 | use std::process::Command; 2 | 3 | use anyhow::{bail, Result}; 4 | 5 | fn main() -> Result<()> { 6 | let out_dir = std::env::var("OUT_DIR").unwrap(); 7 | 8 | let status = Command::new("clang") 9 | .arg("-I") 10 | .arg("src/") 11 | .arg("-O2") 12 | .arg("-emit-llvm") 13 | .arg("-target") 14 | .arg("bpf") 15 | .arg("-c") 16 | .arg("-gdwarf-4") 17 | .arg("src/vmlinux_access.c") 18 | .arg("-o") 19 | .arg(format!("{out_dir}/vmlinux_access.o")) 20 | .status() 21 | .expect("Failed to compile the C-shim"); 22 | if !status.success() { 23 | bail!("Failed to compile eBPF program"); 24 | } 25 | 26 | println!("cargo:rustc-link-search=native={out_dir}"); 27 | println!("cargo:rustc-link-lib=link-arg={out_dir}/vmlinux_access.o"); 28 | println!("cargo:rerun-if-changed=src/vmlinux_access.c"); 29 | println!("cargo:rerun-if-changed=src/vmlinux_access.h"); 30 | println!("cargo:rerun-if-changed=src/vmlinux.h"); 31 | 32 | Ok(()) 33 | } 34 | -------------------------------------------------------------------------------- /tc-load-bytes/tc-load-bytes-ebpf/src/main.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | #![no_main] 3 | 4 | use aya_bpf::{ 5 | bindings::TC_ACT_PIPE, 6 | macros::{classifier, map}, 7 | maps::PerCpuArray, 8 | programs::TcContext, 9 | }; 10 | 11 | use tc_load_bytes_common::{PacketBuffer, MAX_MTU}; 12 | 13 | #[map] 14 | static BUF: PerCpuArray = PerCpuArray::with_max_entries(1, 0); 15 | 16 | #[classifier(name = "tc_load_bytes")] 17 | pub fn tc_load_bytes(ctx: TcContext) -> i32 { 18 | match try_tc_load_bytes(ctx) { 19 | Ok(ret) => ret, 20 | Err(ret) => ret, 21 | } 22 | } 23 | 24 | fn try_tc_load_bytes(ctx: TcContext) -> Result { 25 | let buf = unsafe { 26 | let ptr = BUF.get_ptr_mut(0).ok_or(0)?; 27 | &mut *ptr 28 | }; 29 | if ctx.data() + MAX_MTU > ctx.data_end() { 30 | return Err(TC_ACT_PIPE); 31 | } 32 | ctx.load_bytes(0, &mut buf.buf[..MAX_MTU]) 33 | .map_err(|_| TC_ACT_PIPE)?; 34 | 35 | Ok(TC_ACT_PIPE) 36 | } 37 | 38 | #[panic_handler] 39 | fn panic(_info: &core::panic::PanicInfo) -> ! { 40 | unsafe { core::hint::unreachable_unchecked() } 41 | } 42 | -------------------------------------------------------------------------------- /xdp-mac/xdp-mac-ebpf/src/main.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | #![no_main] 3 | 4 | use core::mem; 5 | 6 | use aya_bpf::{bindings::xdp_action, macros::xdp, programs::XdpContext}; 7 | use aya_log_ebpf::info; 8 | use network_types::ethernet::EthHdr; 9 | 10 | #[xdp(name = "xdp_mac")] 11 | pub fn xdp_mac(ctx: XdpContext) -> u32 { 12 | match try_xdp_mac(ctx) { 13 | Ok(ret) => ret, 14 | Err(_) => xdp_action::XDP_ABORTED, 15 | } 16 | } 17 | 18 | fn try_xdp_mac(ctx: XdpContext) -> Result { 19 | let ethhdr: *const EthHdr = unsafe { ptr_at(&ctx, 0) }?; 20 | let mac = unsafe { *ethhdr }.h_dest; 21 | info!(&ctx, "mac: {:mac}, {:MAC}", mac, mac); 22 | Ok(xdp_action::XDP_PASS) 23 | } 24 | 25 | #[inline(always)] 26 | unsafe fn ptr_at(ctx: &XdpContext, offset: usize) -> Result<*const T, ()> { 27 | let start = ctx.data(); 28 | let end = ctx.data_end(); 29 | let len = mem::size_of::(); 30 | 31 | if start + offset + len > end { 32 | return Err(()); 33 | } 34 | 35 | Ok((start + offset) as *const T) 36 | } 37 | 38 | #[panic_handler] 39 | fn panic(_info: &core::panic::PanicInfo) -> ! { 40 | unsafe { core::hint::unreachable_unchecked() } 41 | } 42 | -------------------------------------------------------------------------------- /bpf-loop/xtask/src/build.rs: -------------------------------------------------------------------------------- 1 | use std::process::Command; 2 | 3 | use anyhow::Context as _; 4 | use clap::Parser; 5 | 6 | use crate::build_ebpf::{build_ebpf, Architecture, Options as BuildOptions}; 7 | 8 | #[derive(Debug, Parser)] 9 | pub struct Options { 10 | /// Set the endianness of the BPF target 11 | #[clap(default_value = "bpfel-unknown-none", long)] 12 | pub bpf_target: Architecture, 13 | /// Build and run the release target 14 | #[clap(long)] 15 | pub release: bool, 16 | } 17 | 18 | /// Build the project 19 | fn build_project(opts: &Options) -> Result<(), anyhow::Error> { 20 | let mut args = vec!["build"]; 21 | if opts.release { 22 | args.push("--release") 23 | } 24 | let status = Command::new("cargo") 25 | .args(&args) 26 | .status() 27 | .expect("failed to build userspace"); 28 | assert!(status.success()); 29 | Ok(()) 30 | } 31 | 32 | /// Build our ebpf program and the project 33 | pub fn build(opts: Options) -> Result<(), anyhow::Error> { 34 | // build our ebpf program followed by our application 35 | build_ebpf(BuildOptions { 36 | target: opts.bpf_target, 37 | release: opts.release, 38 | }) 39 | .context("Error while building eBPF program")?; 40 | build_project(&opts).context("Error while building userspace application")?; 41 | Ok(()) 42 | } -------------------------------------------------------------------------------- /cshim/cshim-ebpf/src/main.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | #![no_main] 3 | 4 | use aya_bpf::{ 5 | cty::c_int, 6 | macros::{lsm, map}, 7 | maps::PerfEventArray, 8 | programs::LsmContext, 9 | }; 10 | 11 | use cshim_common::Event; 12 | 13 | #[allow(non_upper_case_globals)] 14 | #[allow(non_snake_case)] 15 | #[allow(non_camel_case_types)] 16 | #[allow(dead_code)] 17 | mod vmlinux; 18 | 19 | use vmlinux::task_struct; 20 | 21 | #[map] 22 | pub static EVENTS: PerfEventArray = PerfEventArray::with_max_entries(1024, 0); 23 | 24 | #[allow(improper_ctypes)] 25 | extern "C" { 26 | fn task_struct_pid(task: *const task_struct) -> c_int; 27 | fn task_struct_tgid(task: *const task_struct) -> c_int; 28 | } 29 | 30 | #[lsm(hook = "task_alloc")] 31 | pub fn task_alloc(ctx: LsmContext) -> i32 { 32 | match try_task_alloc(ctx) { 33 | Ok(ret) => ret, 34 | Err(ret) => ret, 35 | } 36 | } 37 | 38 | fn try_task_alloc(ctx: LsmContext) -> Result { 39 | let task: *const task_struct = unsafe { ctx.arg(0) }; 40 | let pid = unsafe { task_struct_pid(task) }; 41 | let tgid = unsafe { task_struct_tgid(task) }; 42 | 43 | EVENTS.output(&ctx, &Event { pid, tgid }, 0); 44 | 45 | Ok(0) 46 | } 47 | 48 | #[panic_handler] 49 | fn panic(_info: &core::panic::PanicInfo) -> ! { 50 | unsafe { core::hint::unreachable_unchecked() } 51 | } 52 | -------------------------------------------------------------------------------- /tc-srcip/tc-srcip-ebpf/src/main.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | #![no_main] 3 | 4 | use core::mem; 5 | 6 | use aya_bpf::{bindings::TC_ACT_PIPE, macros::classifier, programs::SkBuffContext}; 7 | use aya_log_ebpf::info; 8 | use memoffset::offset_of; 9 | 10 | #[allow(non_upper_case_globals)] 11 | #[allow(non_snake_case)] 12 | #[allow(non_camel_case_types)] 13 | #[allow(dead_code)] 14 | mod bindings; 15 | use bindings::{ethhdr, iphdr}; 16 | 17 | const ETH_P_IP: u16 = 0x0800; 18 | 19 | const ETH_HDR_LEN: usize = mem::size_of::(); 20 | const IP_HDR_LEN: usize = mem::size_of::(); 21 | 22 | #[classifier(name = "tc_srcip")] 23 | pub fn tc_srcip(ctx: SkBuffContext) -> i32 { 24 | match unsafe { try_tc_srcip(ctx) } { 25 | Ok(ret) => ret, 26 | Err(_) => TC_ACT_PIPE, 27 | } 28 | } 29 | 30 | unsafe fn try_tc_srcip(ctx: SkBuffContext) -> Result { 31 | let h_proto = u16::from_be( 32 | ctx.load(offset_of!(ethhdr, h_proto)) 33 | .map_err(|_| TC_ACT_PIPE)?, 34 | ); 35 | 36 | if h_proto != ETH_P_IP { 37 | return Ok(TC_ACT_PIPE); 38 | } 39 | 40 | let saddr = u32::from_be(ctx.load(ETH_HDR_LEN + offset_of!(iphdr, saddr))?); 41 | 42 | info!(&ctx, "source address: {}", saddr); 43 | 44 | Ok(0) 45 | } 46 | 47 | #[panic_handler] 48 | fn panic(_info: &core::panic::PanicInfo) -> ! { 49 | unsafe { core::hint::unreachable_unchecked() } 50 | } 51 | -------------------------------------------------------------------------------- /pub-progs/pub-progs/src/main.rs: -------------------------------------------------------------------------------- 1 | use aya::programs::TracePoint; 2 | use aya::{include_bytes_aligned, Bpf}; 3 | use aya_log::BpfLogger; 4 | use log::{info, warn}; 5 | use tokio::signal; 6 | 7 | #[tokio::main] 8 | async fn main() -> Result<(), anyhow::Error> { 9 | env_logger::init(); 10 | 11 | // This will include your eBPF object file as raw bytes at compile-time and load it at 12 | // runtime. This approach is recommended for most real-world use cases. If you would 13 | // like to specify the eBPF program at runtime rather than at compile-time, you can 14 | // reach for `Bpf::load_file` instead. 15 | #[cfg(debug_assertions)] 16 | let mut bpf = Bpf::load(include_bytes_aligned!( 17 | "../../target/bpfel-unknown-none/debug/pub-progs" 18 | ))?; 19 | #[cfg(not(debug_assertions))] 20 | let mut bpf = Bpf::load(include_bytes_aligned!( 21 | "../../target/bpfel-unknown-none/release/pub-progs" 22 | ))?; 23 | if let Err(e) = BpfLogger::init(&mut bpf) { 24 | // This can happen if you remove all log statements from your eBPF program. 25 | warn!("failed to initialize eBPF logger: {}", e); 26 | } 27 | let program: &mut TracePoint = bpf.program_mut("sched_process_fork").unwrap().try_into()?; 28 | program.load()?; 29 | program.attach("sched", "sched_process_fork")?; 30 | 31 | info!("Waiting for Ctrl-C..."); 32 | signal::ctrl_c().await?; 33 | info!("Exiting..."); 34 | 35 | Ok(()) 36 | } 37 | -------------------------------------------------------------------------------- /atomic/atomic/src/main.rs: -------------------------------------------------------------------------------- 1 | use aya::{include_bytes_aligned, Bpf}; 2 | use aya::programs::TracePoint; 3 | use aya_log::BpfLogger; 4 | use clap::Parser; 5 | use log::{info, warn}; 6 | use tokio::signal; 7 | 8 | 9 | 10 | #[tokio::main] 11 | async fn main() -> Result<(), anyhow::Error> { 12 | 13 | 14 | env_logger::init(); 15 | 16 | // This will include your eBPF object file as raw bytes at compile-time and load it at 17 | // runtime. This approach is recommended for most real-world use cases. If you would 18 | // like to specify the eBPF program at runtime rather than at compile-time, you can 19 | // reach for `Bpf::load_file` instead. 20 | #[cfg(debug_assertions)] 21 | let mut bpf = Bpf::load(include_bytes_aligned!( 22 | "../../target/bpfel-unknown-none/debug/atomic" 23 | ))?; 24 | #[cfg(not(debug_assertions))] 25 | let mut bpf = Bpf::load(include_bytes_aligned!( 26 | "../../target/bpfel-unknown-none/release/atomic" 27 | ))?; 28 | if let Err(e) = BpfLogger::init(&mut bpf) { 29 | // This can happen if you remove all log statements from your eBPF program. 30 | warn!("failed to initialize eBPF logger: {}", e); 31 | } 32 | let program: &mut TracePoint = bpf.program_mut("atomic").unwrap().try_into()?; 33 | program.load()?; 34 | program.attach("sched", "sched_process_exec")?; 35 | 36 | info!("Waiting for Ctrl-C..."); 37 | signal::ctrl_c().await?; 38 | info!("Exiting..."); 39 | 40 | Ok(()) 41 | } 42 | -------------------------------------------------------------------------------- /cgroup/cgroup-ebpf/src/main.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | #![no_main] 3 | 4 | use aya_bpf::{ 5 | cty::c_char, 6 | helpers::bpf_probe_read_kernel_str, 7 | macros::{btf_tracepoint, map}, 8 | maps::PerCpuArray, 9 | programs::BtfTracePointContext, 10 | }; 11 | use aya_log_ebpf::info; 12 | 13 | const LOG_BUF_CAPACITY: usize = 64; 14 | 15 | #[repr(C)] 16 | pub struct Buf { 17 | pub buf: [u8; LOG_BUF_CAPACITY], 18 | } 19 | 20 | #[map] 21 | pub static BUF: PerCpuArray = PerCpuArray::with_max_entries(1, 0); 22 | 23 | #[btf_tracepoint(name = "cgroup_mkdir")] 24 | pub fn cgroup_mkdir(ctx: BtfTracePointContext) -> i32 { 25 | match { try_cgroup_mkdir(ctx) } { 26 | Ok(ret) => ret, 27 | Err(ret) => ret, 28 | } 29 | } 30 | 31 | fn try_cgroup_mkdir(ctx: BtfTracePointContext) -> Result { 32 | let path = unsafe { 33 | let path: *const c_char = ctx.arg(1); 34 | let buf = BUF.get_mut(0).ok_or(0)?; 35 | let len = 36 | bpf_probe_read_kernel_str(path as *const u8, &mut buf.buf).map_err(|e| e as i32)?; 37 | core::str::from_utf8_unchecked(&buf.buf[..len]) 38 | }; 39 | 40 | info!(&ctx, "tracepoint cgroup_mkdir called: {}", path); 41 | 42 | if path.starts_with("/sys/fs/cgroup") { 43 | info!(&ctx, "cgroup"); 44 | } 45 | if path.starts_with("/system.slice/docker") { 46 | info!(&ctx, "docker cgroup"); 47 | } 48 | 49 | Ok(0) 50 | } 51 | 52 | #[panic_handler] 53 | fn panic(_info: &core::panic::PanicInfo) -> ! { 54 | unsafe { core::hint::unreachable_unchecked() } 55 | } 56 | -------------------------------------------------------------------------------- /xdp/xdp/src/main.rs: -------------------------------------------------------------------------------- 1 | use aya::{include_bytes_aligned, Bpf}; 2 | use anyhow::Context; 3 | use aya::programs::{Xdp, XdpFlags}; 4 | use aya_log::BpfLogger; 5 | use clap::Parser; 6 | use log::info; 7 | use tokio::signal; 8 | 9 | #[derive(Debug, Parser)] 10 | struct Opt { 11 | #[clap(short, long, default_value = "eth0")] 12 | iface: String, 13 | } 14 | 15 | #[tokio::main] 16 | async fn main() -> Result<(), anyhow::Error> { 17 | let opt = Opt::parse(); 18 | 19 | env_logger::init(); 20 | 21 | // This will include your eBPF object file as raw bytes at compile-time and load it at 22 | // runtime. This approach is recommended for most real-world use cases. If you would 23 | // like to specify the eBPF program at runtime rather than at compile-time, you can 24 | // reach for `Bpf::load_file` instead. 25 | #[cfg(debug_assertions)] 26 | let mut bpf = Bpf::load(include_bytes_aligned!( 27 | "../../target/bpfel-unknown-none/debug/xdp" 28 | ))?; 29 | #[cfg(not(debug_assertions))] 30 | let mut bpf = Bpf::load(include_bytes_aligned!( 31 | "../../target/bpfel-unknown-none/release/xdp" 32 | ))?; 33 | BpfLogger::init(&mut bpf)?; 34 | let program: &mut Xdp = bpf.program_mut("log").unwrap().try_into()?; 35 | program.load()?; 36 | program.attach(&opt.iface, XdpFlags::default()) 37 | .context("failed to attach the XDP program with default flags - try changing XdpFlags::default() to XdpFlags::SKB_MODE")?; 38 | 39 | info!("Waiting for Ctrl-C..."); 40 | signal::ctrl_c().await?; 41 | info!("Exiting..."); 42 | 43 | Ok(()) 44 | } 45 | -------------------------------------------------------------------------------- /tc-load-bytes/tc-load-bytes/src/main.rs: -------------------------------------------------------------------------------- 1 | use aya::programs::{tc, SchedClassifier, TcAttachType}; 2 | use aya::{include_bytes_aligned, Bpf}; 3 | use clap::Parser; 4 | use log::info; 5 | use tokio::signal; 6 | 7 | #[derive(Debug, Parser)] 8 | struct Opt { 9 | #[clap(short, long, default_value = "eth0")] 10 | iface: String, 11 | } 12 | 13 | #[tokio::main] 14 | async fn main() -> Result<(), anyhow::Error> { 15 | let opt = Opt::parse(); 16 | 17 | env_logger::init(); 18 | 19 | // This will include your eBPF object file as raw bytes at compile-time and load it at 20 | // runtime. This approach is recommended for most real-world use cases. If you would 21 | // like to specify the eBPF program at runtime rather than at compile-time, you can 22 | // reach for `Bpf::load_file` instead. 23 | #[cfg(debug_assertions)] 24 | let mut bpf = Bpf::load(include_bytes_aligned!( 25 | "../../target/bpfel-unknown-none/debug/tc-load-bytes" 26 | ))?; 27 | #[cfg(not(debug_assertions))] 28 | let mut bpf = Bpf::load(include_bytes_aligned!( 29 | "../../target/bpfel-unknown-none/release/tc-load-bytes" 30 | ))?; 31 | // error adding clsact to the interface if it is already added is harmless 32 | // the full cleanup can be done with 'sudo tc qdisc del dev eth0 clsact'. 33 | let _ = tc::qdisc_add_clsact(&opt.iface); 34 | let program: &mut SchedClassifier = bpf.program_mut("tc_load_bytes").unwrap().try_into()?; 35 | program.load()?; 36 | program.attach(&opt.iface, TcAttachType::Ingress)?; 37 | 38 | info!("Waiting for Ctrl-C..."); 39 | signal::ctrl_c().await?; 40 | info!("Exiting..."); 41 | 42 | Ok(()) 43 | } 44 | -------------------------------------------------------------------------------- /dpath/dpath/src/main.rs: -------------------------------------------------------------------------------- 1 | use aya::{include_bytes_aligned, Bpf}; 2 | use aya::{programs::Lsm, Btf}; 3 | use aya_log::BpfLogger; 4 | use clap::Parser; 5 | use log::info; 6 | use simplelog::{ColorChoice, ConfigBuilder, LevelFilter, TermLogger, TerminalMode}; 7 | use tokio::signal; 8 | 9 | #[derive(Debug, Parser)] 10 | struct Opt { 11 | 12 | } 13 | 14 | #[tokio::main] 15 | async fn main() -> Result<(), anyhow::Error> { 16 | let opt = Opt::parse(); 17 | 18 | TermLogger::init( 19 | LevelFilter::Debug, 20 | ConfigBuilder::new() 21 | .set_target_level(LevelFilter::Error) 22 | .set_location_level(LevelFilter::Error) 23 | .build(), 24 | TerminalMode::Mixed, 25 | ColorChoice::Auto, 26 | )?; 27 | 28 | // This will include your eBPF object file as raw bytes at compile-time and load it at 29 | // runtime. This approach is recommended for most real-world use cases. If you would 30 | // like to specify the eBPF program at runtime rather than at compile-time, you can 31 | // reach for `Bpf::load_file` instead. 32 | #[cfg(debug_assertions)] 33 | let mut bpf = Bpf::load(include_bytes_aligned!( 34 | "../../target/bpfel-unknown-none/debug/dpath" 35 | ))?; 36 | #[cfg(not(debug_assertions))] 37 | let mut bpf = Bpf::load(include_bytes_aligned!( 38 | "../../target/bpfel-unknown-none/release/dpath" 39 | ))?; 40 | BpfLogger::init(&mut bpf)?; 41 | let btf = Btf::from_sys_fs()?; 42 | let program: &mut Lsm = bpf.program_mut("file_open").unwrap().try_into()?; 43 | program.load("file_open", &btf)?; 44 | program.attach()?; 45 | 46 | info!("Waiting for Ctrl-C..."); 47 | signal::ctrl_c().await?; 48 | info!("Exiting..."); 49 | 50 | Ok(()) 51 | } 52 | -------------------------------------------------------------------------------- /clone/clone/src/main.rs: -------------------------------------------------------------------------------- 1 | use aya::{include_bytes_aligned, Bpf}; 2 | use aya::{programs::FEntry, Btf}; 3 | use aya_log::BpfLogger; 4 | use clap::Parser; 5 | use log::info; 6 | use simplelog::{ColorChoice, ConfigBuilder, LevelFilter, TermLogger, TerminalMode}; 7 | use tokio::signal; 8 | 9 | #[derive(Debug, Parser)] 10 | struct Opt { 11 | 12 | } 13 | 14 | #[tokio::main] 15 | async fn main() -> Result<(), anyhow::Error> { 16 | let opt = Opt::parse(); 17 | 18 | TermLogger::init( 19 | LevelFilter::Debug, 20 | ConfigBuilder::new() 21 | .set_target_level(LevelFilter::Error) 22 | .set_location_level(LevelFilter::Error) 23 | .build(), 24 | TerminalMode::Mixed, 25 | ColorChoice::Auto, 26 | )?; 27 | 28 | // This will include your eBPF object file as raw bytes at compile-time and load it at 29 | // runtime. This approach is recommended for most real-world use cases. If you would 30 | // like to specify the eBPF program at runtime rather than at compile-time, you can 31 | // reach for `Bpf::load_file` instead. 32 | #[cfg(debug_assertions)] 33 | let mut bpf = Bpf::load(include_bytes_aligned!( 34 | "../../target/bpfel-unknown-none/debug/clone" 35 | ))?; 36 | #[cfg(not(debug_assertions))] 37 | let mut bpf = Bpf::load(include_bytes_aligned!( 38 | "../../target/bpfel-unknown-none/release/clone" 39 | ))?; 40 | BpfLogger::init(&mut bpf)?; 41 | let btf = Btf::from_sys_fs()?; 42 | let program: &mut FEntry = bpf.program_mut("kernel_clone").unwrap().try_into()?; 43 | program.load("kernel_clone", &btf)?; 44 | program.attach()?; 45 | 46 | info!("Waiting for Ctrl-C..."); 47 | signal::ctrl_c().await?; 48 | info!("Exiting..."); 49 | 50 | Ok(()) 51 | } 52 | -------------------------------------------------------------------------------- /cgroup/cgroup/src/main.rs: -------------------------------------------------------------------------------- 1 | use aya::{include_bytes_aligned, Bpf}; 2 | use aya::{programs::BtfTracePoint, Btf}; 3 | use aya_log::BpfLogger; 4 | use clap::Parser; 5 | use log::info; 6 | use simplelog::{ColorChoice, ConfigBuilder, LevelFilter, TermLogger, TerminalMode}; 7 | use tokio::signal; 8 | 9 | #[derive(Debug, Parser)] 10 | struct Opt { 11 | 12 | } 13 | 14 | #[tokio::main] 15 | async fn main() -> Result<(), anyhow::Error> { 16 | let opt = Opt::parse(); 17 | 18 | TermLogger::init( 19 | LevelFilter::Debug, 20 | ConfigBuilder::new() 21 | .set_target_level(LevelFilter::Error) 22 | .set_location_level(LevelFilter::Error) 23 | .build(), 24 | TerminalMode::Mixed, 25 | ColorChoice::Auto, 26 | )?; 27 | 28 | // This will include your eBPF object file as raw bytes at compile-time and load it at 29 | // runtime. This approach is recommended for most real-world use cases. If you would 30 | // like to specify the eBPF program at runtime rather than at compile-time, you can 31 | // reach for `Bpf::load_file` instead. 32 | #[cfg(debug_assertions)] 33 | let mut bpf = Bpf::load(include_bytes_aligned!( 34 | "../../target/bpfel-unknown-none/debug/cgroup" 35 | ))?; 36 | #[cfg(not(debug_assertions))] 37 | let mut bpf = Bpf::load(include_bytes_aligned!( 38 | "../../target/bpfel-unknown-none/release/cgroup" 39 | ))?; 40 | BpfLogger::init(&mut bpf)?; 41 | let btf = Btf::from_sys_fs()?; 42 | let program: &mut BtfTracePoint = bpf.program_mut("cgroup_mkdir").unwrap().try_into()?; 43 | program.load("cgroup_mkdir", &btf)?; 44 | program.attach()?; 45 | 46 | info!("Waiting for Ctrl-C..."); 47 | signal::ctrl_c().await?; 48 | info!("Exiting..."); 49 | 50 | Ok(()) 51 | } 52 | -------------------------------------------------------------------------------- /notokio/notokio/src/main.rs: -------------------------------------------------------------------------------- 1 | use std::sync::mpsc::channel; 2 | 3 | use aya::{include_bytes_aligned, Bpf}; 4 | use aya::{programs::Lsm, Btf}; 5 | use aya_log::BpfLogger; 6 | use clap::Parser; 7 | use log::{info, warn}; 8 | 9 | #[derive(Debug, Parser)] 10 | struct Opt { 11 | 12 | } 13 | 14 | fn main() -> Result<(), anyhow::Error> { 15 | let opt = Opt::parse(); 16 | 17 | env_logger::init(); 18 | 19 | // This will include your eBPF object file as raw bytes at compile-time and load it at 20 | // runtime. This approach is recommended for most real-world use cases. If you would 21 | // like to specify the eBPF program at runtime rather than at compile-time, you can 22 | // reach for `Bpf::load_file` instead. 23 | #[cfg(debug_assertions)] 24 | let mut bpf = Bpf::load(include_bytes_aligned!( 25 | "../../target/bpfel-unknown-none/debug/notokio" 26 | ))?; 27 | #[cfg(not(debug_assertions))] 28 | let mut bpf = Bpf::load(include_bytes_aligned!( 29 | "../../target/bpfel-unknown-none/release/notokio" 30 | ))?; 31 | if let Err(e) = BpfLogger::init(&mut bpf) { 32 | // This can happen if you remove all log statements from your eBPF program. 33 | warn!("failed to initialize eBPF logger: {}", e); 34 | } 35 | let btf = Btf::from_sys_fs()?; 36 | let program: &mut Lsm = bpf.program_mut("task_alloc").unwrap().try_into()?; 37 | program.load("task_alloc", &btf)?; 38 | program.attach()?; 39 | 40 | let (tx, rx) = channel(); 41 | ctrlc::set_handler(move || tx.send(()).expect("Could not send signal on channel.")) 42 | .expect("Error setting Ctrl-C handler"); 43 | info!("Waiting for Ctrl-C..."); 44 | rx.recv().expect("Could not receive from channel."); 45 | info!("Exiting..."); 46 | 47 | Ok(()) 48 | } 49 | -------------------------------------------------------------------------------- /xdp-mac/xdp-mac/src/main.rs: -------------------------------------------------------------------------------- 1 | use aya::{include_bytes_aligned, Bpf}; 2 | use anyhow::Context; 3 | use aya::programs::{Xdp, XdpFlags}; 4 | use aya_log::BpfLogger; 5 | use clap::Parser; 6 | use log::{info, warn}; 7 | use tokio::signal; 8 | 9 | #[derive(Debug, Parser)] 10 | struct Opt { 11 | #[clap(short, long, default_value = "eth0")] 12 | iface: String, 13 | } 14 | 15 | #[tokio::main] 16 | async fn main() -> Result<(), anyhow::Error> { 17 | let opt = Opt::parse(); 18 | 19 | env_logger::init(); 20 | 21 | // This will include your eBPF object file as raw bytes at compile-time and load it at 22 | // runtime. This approach is recommended for most real-world use cases. If you would 23 | // like to specify the eBPF program at runtime rather than at compile-time, you can 24 | // reach for `Bpf::load_file` instead. 25 | #[cfg(debug_assertions)] 26 | let mut bpf = Bpf::load(include_bytes_aligned!( 27 | "../../target/bpfel-unknown-none/debug/xdp-mac" 28 | ))?; 29 | #[cfg(not(debug_assertions))] 30 | let mut bpf = Bpf::load(include_bytes_aligned!( 31 | "../../target/bpfel-unknown-none/release/xdp-mac" 32 | ))?; 33 | if let Err(e) = BpfLogger::init(&mut bpf) { 34 | // This can happen if you remove all log statements from your eBPF program. 35 | warn!("failed to initialize eBPF logger: {}", e); 36 | } 37 | let program: &mut Xdp = bpf.program_mut("xdp_mac").unwrap().try_into()?; 38 | program.load()?; 39 | program.attach(&opt.iface, XdpFlags::default()) 40 | .context("failed to attach the XDP program with default flags - try changing XdpFlags::default() to XdpFlags::SKB_MODE")?; 41 | 42 | info!("Waiting for Ctrl-C..."); 43 | signal::ctrl_c().await?; 44 | info!("Exiting..."); 45 | 46 | Ok(()) 47 | } 48 | -------------------------------------------------------------------------------- /xdp-mut-u8/xdp-mut-u8/src/main.rs: -------------------------------------------------------------------------------- 1 | use aya::{include_bytes_aligned, Bpf}; 2 | use anyhow::Context; 3 | use aya::programs::{Xdp, XdpFlags}; 4 | use aya_log::BpfLogger; 5 | use clap::Parser; 6 | use log::{info, warn}; 7 | use tokio::signal; 8 | 9 | #[derive(Debug, Parser)] 10 | struct Opt { 11 | #[clap(short, long, default_value = "eth0")] 12 | iface: String, 13 | } 14 | 15 | #[tokio::main] 16 | async fn main() -> Result<(), anyhow::Error> { 17 | let opt = Opt::parse(); 18 | 19 | env_logger::init(); 20 | 21 | // This will include your eBPF object file as raw bytes at compile-time and load it at 22 | // runtime. This approach is recommended for most real-world use cases. If you would 23 | // like to specify the eBPF program at runtime rather than at compile-time, you can 24 | // reach for `Bpf::load_file` instead. 25 | #[cfg(debug_assertions)] 26 | let mut bpf = Bpf::load(include_bytes_aligned!( 27 | "../../target/bpfel-unknown-none/debug/xdp-mut-u8" 28 | ))?; 29 | #[cfg(not(debug_assertions))] 30 | let mut bpf = Bpf::load(include_bytes_aligned!( 31 | "../../target/bpfel-unknown-none/release/xdp-mut-u8" 32 | ))?; 33 | if let Err(e) = BpfLogger::init(&mut bpf) { 34 | // This can happen if you remove all log statements from your eBPF program. 35 | warn!("failed to initialize eBPF logger: {}", e); 36 | } 37 | let program: &mut Xdp = bpf.program_mut("xdp_verifier_err").unwrap().try_into()?; 38 | program.load()?; 39 | program.attach(&opt.iface, XdpFlags::default()) 40 | .context("failed to attach the XDP program with default flags - try changing XdpFlags::default() to XdpFlags::SKB_MODE")?; 41 | 42 | info!("Waiting for Ctrl-C..."); 43 | signal::ctrl_c().await?; 44 | info!("Exiting..."); 45 | 46 | Ok(()) 47 | } 48 | -------------------------------------------------------------------------------- /xdp-verifier-err/xdp-verifier-err/src/main.rs: -------------------------------------------------------------------------------- 1 | use aya::{include_bytes_aligned, Bpf}; 2 | use anyhow::Context; 3 | use aya::programs::{Xdp, XdpFlags}; 4 | use aya_log::BpfLogger; 5 | use clap::Parser; 6 | use log::{info, warn}; 7 | use tokio::signal; 8 | 9 | #[derive(Debug, Parser)] 10 | struct Opt { 11 | #[clap(short, long, default_value = "eth0")] 12 | iface: String, 13 | } 14 | 15 | #[tokio::main] 16 | async fn main() -> Result<(), anyhow::Error> { 17 | let opt = Opt::parse(); 18 | 19 | env_logger::init(); 20 | 21 | // This will include your eBPF object file as raw bytes at compile-time and load it at 22 | // runtime. This approach is recommended for most real-world use cases. If you would 23 | // like to specify the eBPF program at runtime rather than at compile-time, you can 24 | // reach for `Bpf::load_file` instead. 25 | #[cfg(debug_assertions)] 26 | let mut bpf = Bpf::load(include_bytes_aligned!( 27 | "../../target/bpfel-unknown-none/debug/xdp-verifier-err" 28 | ))?; 29 | #[cfg(not(debug_assertions))] 30 | let mut bpf = Bpf::load(include_bytes_aligned!( 31 | "../../target/bpfel-unknown-none/release/xdp-verifier-err" 32 | ))?; 33 | if let Err(e) = BpfLogger::init(&mut bpf) { 34 | // This can happen if you remove all log statements from your eBPF program. 35 | warn!("failed to initialize eBPF logger: {}", e); 36 | } 37 | let program: &mut Xdp = bpf.program_mut("xdp_verifier_err").unwrap().try_into()?; 38 | program.load()?; 39 | program.attach(&opt.iface, XdpFlags::default()) 40 | .context("failed to attach the XDP program with default flags - try changing XdpFlags::default() to XdpFlags::SKB_MODE")?; 41 | 42 | info!("Waiting for Ctrl-C..."); 43 | signal::ctrl_c().await?; 44 | info!("Exiting..."); 45 | 46 | Ok(()) 47 | } 48 | -------------------------------------------------------------------------------- /tc/tc-ebpf/src/main.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | #![no_main] 3 | 4 | use core::mem; 5 | 6 | use aya_bpf::{bindings::TC_ACT_OK, macros::classifier, programs::TcContext}; 7 | use aya_log_ebpf::info; 8 | use memoffset::offset_of; 9 | 10 | #[allow(non_upper_case_globals)] 11 | #[allow(non_snake_case)] 12 | #[allow(non_camel_case_types)] 13 | #[allow(dead_code)] 14 | mod bindings; 15 | 16 | use bindings::{ethhdr, iphdr, ipv6hdr}; 17 | 18 | #[classifier] 19 | pub fn tc(ctx: TcContext) -> i32 { 20 | match unsafe { try_tc(ctx) } { 21 | Ok(ret) => ret, 22 | Err(ret) => ret, 23 | } 24 | } 25 | 26 | unsafe fn try_tc(ctx: TcContext) -> Result { 27 | info!(&ctx, "received a packet"); 28 | 29 | let h_proto = u16::from_be( 30 | ctx.load(offset_of!(ethhdr, h_proto)) 31 | .map_err(|_| TC_ACT_OK)?, 32 | ); 33 | 34 | match h_proto { 35 | ETH_P_IP => { 36 | let source = u32::from_be( 37 | ctx.load(ETH_HDR_LEN + offset_of!(iphdr, saddr)) 38 | .map_err(|_| TC_ACT_OK)?, 39 | ); 40 | info!( 41 | &ctx, 42 | "source IPv4: {:i}, {:x}, {:X}", source, source, source 43 | ); 44 | } 45 | ETH_P_IPV6 => { 46 | let source = ctx 47 | .load::<[u8; 16]>(ETH_HDR_LEN + offset_of!(ipv6hdr, saddr)) 48 | .map_err(|_| TC_ACT_OK)?; 49 | info!(&ctx, "source IPv6: {:i}", source); 50 | } 51 | _ => return Ok(TC_ACT_OK), 52 | } 53 | 54 | Ok(TC_ACT_OK) 55 | } 56 | 57 | const ETH_P_IP: u16 = 0x0800; 58 | const ETH_P_IPV6: u16 = 0x86DD; 59 | const ETH_HDR_LEN: usize = mem::size_of::(); 60 | 61 | #[panic_handler] 62 | fn panic(_info: &core::panic::PanicInfo) -> ! { 63 | unsafe { core::hint::unreachable_unchecked() } 64 | } 65 | -------------------------------------------------------------------------------- /atomic/xtask/src/build_ebpf.rs: -------------------------------------------------------------------------------- 1 | use std::{path::PathBuf, process::Command}; 2 | 3 | use clap::Parser; 4 | 5 | #[derive(Debug, Copy, Clone)] 6 | pub enum Architecture { 7 | BpfEl, 8 | BpfEb, 9 | } 10 | 11 | impl std::str::FromStr for Architecture { 12 | type Err = String; 13 | 14 | fn from_str(s: &str) -> Result { 15 | Ok(match s { 16 | "bpfel-unknown-none" => Architecture::BpfEl, 17 | "bpfeb-unknown-none" => Architecture::BpfEb, 18 | _ => return Err("invalid target".to_owned()), 19 | }) 20 | } 21 | } 22 | 23 | impl std::fmt::Display for Architecture { 24 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 25 | f.write_str(match self { 26 | Architecture::BpfEl => "bpfel-unknown-none", 27 | Architecture::BpfEb => "bpfeb-unknown-none", 28 | }) 29 | } 30 | } 31 | 32 | #[derive(Debug, Parser)] 33 | pub struct Options { 34 | /// Set the endianness of the BPF target 35 | #[clap(default_value = "bpfel-unknown-none", long)] 36 | pub target: Architecture, 37 | /// Build the release target 38 | #[clap(long)] 39 | pub release: bool, 40 | } 41 | 42 | pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> { 43 | let dir = PathBuf::from("atomic-ebpf"); 44 | let target = format!("--target={}", opts.target); 45 | let mut args = vec![ 46 | "+stage1", 47 | "build", 48 | "--verbose", 49 | target.as_str(), 50 | "-Z", 51 | "build-std=core", 52 | ]; 53 | if opts.release { 54 | args.push("--release") 55 | } 56 | let status = Command::new("cargo") 57 | .current_dir(dir) 58 | .args(&args) 59 | .status() 60 | .expect("failed to build bpf program"); 61 | assert!(status.success()); 62 | Ok(()) 63 | } 64 | -------------------------------------------------------------------------------- /tc/xtask/src/build_ebpf.rs: -------------------------------------------------------------------------------- 1 | use std::path::PathBuf; 2 | use std::process::Command; 3 | 4 | use clap::Parser; 5 | 6 | #[derive(Debug, Copy, Clone)] 7 | pub enum Architecture { 8 | BpfEl, 9 | BpfEb, 10 | } 11 | 12 | impl std::str::FromStr for Architecture { 13 | type Err = String; 14 | 15 | fn from_str(s: &str) -> Result { 16 | Ok(match s { 17 | "bpfel-unknown-none" => Architecture::BpfEl, 18 | "bpfeb-unknown-none" => Architecture::BpfEb, 19 | _ => return Err("invalid target".to_owned()), 20 | }) 21 | } 22 | } 23 | 24 | impl std::fmt::Display for Architecture { 25 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 26 | f.write_str(match self { 27 | Architecture::BpfEl => "bpfel-unknown-none", 28 | Architecture::BpfEb => "bpfeb-unknown-none", 29 | }) 30 | } 31 | } 32 | 33 | #[derive(Debug, Parser)] 34 | pub struct Options { 35 | /// Set the endianness of the BPF target 36 | #[clap(default_value = "bpfel-unknown-none", long)] 37 | pub target: Architecture, 38 | /// Build the release target 39 | #[clap(long)] 40 | pub release: bool, 41 | } 42 | 43 | pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> { 44 | let dir = PathBuf::from("tc-ebpf"); 45 | let target = format!("--target={}", opts.target); 46 | let mut args = vec![ 47 | "+nightly", 48 | "build", 49 | "--verbose", 50 | target.as_str(), 51 | "-Z", 52 | "build-std=core", 53 | ]; 54 | if opts.release { 55 | args.push("--release") 56 | } 57 | let status = Command::new("cargo") 58 | .current_dir(&dir) 59 | .args(&args) 60 | .status() 61 | .expect("failed to build bpf program"); 62 | assert!(status.success()); 63 | Ok(()) 64 | } 65 | -------------------------------------------------------------------------------- /xdp/xtask/src/build_ebpf.rs: -------------------------------------------------------------------------------- 1 | use std::path::PathBuf; 2 | use std::process::Command; 3 | 4 | use clap::Parser; 5 | 6 | #[derive(Debug, Copy, Clone)] 7 | pub enum Architecture { 8 | BpfEl, 9 | BpfEb, 10 | } 11 | 12 | impl std::str::FromStr for Architecture { 13 | type Err = String; 14 | 15 | fn from_str(s: &str) -> Result { 16 | Ok(match s { 17 | "bpfel-unknown-none" => Architecture::BpfEl, 18 | "bpfeb-unknown-none" => Architecture::BpfEb, 19 | _ => return Err("invalid target".to_owned()), 20 | }) 21 | } 22 | } 23 | 24 | impl std::fmt::Display for Architecture { 25 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 26 | f.write_str(match self { 27 | Architecture::BpfEl => "bpfel-unknown-none", 28 | Architecture::BpfEb => "bpfeb-unknown-none", 29 | }) 30 | } 31 | } 32 | 33 | #[derive(Debug, Parser)] 34 | pub struct Options { 35 | /// Set the endianness of the BPF target 36 | #[clap(default_value = "bpfel-unknown-none", long)] 37 | pub target: Architecture, 38 | /// Build the release target 39 | #[clap(long)] 40 | pub release: bool, 41 | } 42 | 43 | pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> { 44 | let dir = PathBuf::from("xdp-ebpf"); 45 | let target = format!("--target={}", opts.target); 46 | let mut args = vec![ 47 | "+nightly", 48 | "build", 49 | "--verbose", 50 | target.as_str(), 51 | "-Z", 52 | "build-std=core", 53 | ]; 54 | if opts.release { 55 | args.push("--release") 56 | } 57 | let status = Command::new("cargo") 58 | .current_dir(&dir) 59 | .args(&args) 60 | .status() 61 | .expect("failed to build bpf program"); 62 | assert!(status.success()); 63 | Ok(()) 64 | } 65 | -------------------------------------------------------------------------------- /cgroup/xtask/src/build_ebpf.rs: -------------------------------------------------------------------------------- 1 | use std::path::PathBuf; 2 | use std::process::Command; 3 | 4 | use clap::Parser; 5 | 6 | #[derive(Debug, Copy, Clone)] 7 | pub enum Architecture { 8 | BpfEl, 9 | BpfEb, 10 | } 11 | 12 | impl std::str::FromStr for Architecture { 13 | type Err = String; 14 | 15 | fn from_str(s: &str) -> Result { 16 | Ok(match s { 17 | "bpfel-unknown-none" => Architecture::BpfEl, 18 | "bpfeb-unknown-none" => Architecture::BpfEb, 19 | _ => return Err("invalid target".to_owned()), 20 | }) 21 | } 22 | } 23 | 24 | impl std::fmt::Display for Architecture { 25 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 26 | f.write_str(match self { 27 | Architecture::BpfEl => "bpfel-unknown-none", 28 | Architecture::BpfEb => "bpfeb-unknown-none", 29 | }) 30 | } 31 | } 32 | 33 | #[derive(Debug, Parser)] 34 | pub struct Options { 35 | /// Set the endianness of the BPF target 36 | #[clap(default_value = "bpfel-unknown-none", long)] 37 | pub target: Architecture, 38 | /// Build the release target 39 | #[clap(long)] 40 | pub release: bool, 41 | } 42 | 43 | pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> { 44 | let dir = PathBuf::from("cgroup-ebpf"); 45 | let target = format!("--target={}", opts.target); 46 | let mut args = vec![ 47 | "+nightly", 48 | "build", 49 | "--verbose", 50 | target.as_str(), 51 | "-Z", 52 | "build-std=core", 53 | ]; 54 | if opts.release { 55 | args.push("--release") 56 | } 57 | let status = Command::new("cargo") 58 | .current_dir(&dir) 59 | .args(&args) 60 | .status() 61 | .expect("failed to build bpf program"); 62 | assert!(status.success()); 63 | Ok(()) 64 | } 65 | -------------------------------------------------------------------------------- /clone/xtask/src/build_ebpf.rs: -------------------------------------------------------------------------------- 1 | use std::path::PathBuf; 2 | use std::process::Command; 3 | 4 | use clap::Parser; 5 | 6 | #[derive(Debug, Copy, Clone)] 7 | pub enum Architecture { 8 | BpfEl, 9 | BpfEb, 10 | } 11 | 12 | impl std::str::FromStr for Architecture { 13 | type Err = String; 14 | 15 | fn from_str(s: &str) -> Result { 16 | Ok(match s { 17 | "bpfel-unknown-none" => Architecture::BpfEl, 18 | "bpfeb-unknown-none" => Architecture::BpfEb, 19 | _ => return Err("invalid target".to_owned()), 20 | }) 21 | } 22 | } 23 | 24 | impl std::fmt::Display for Architecture { 25 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 26 | f.write_str(match self { 27 | Architecture::BpfEl => "bpfel-unknown-none", 28 | Architecture::BpfEb => "bpfeb-unknown-none", 29 | }) 30 | } 31 | } 32 | 33 | #[derive(Debug, Parser)] 34 | pub struct Options { 35 | /// Set the endianness of the BPF target 36 | #[clap(default_value = "bpfel-unknown-none", long)] 37 | pub target: Architecture, 38 | /// Build the release target 39 | #[clap(long)] 40 | pub release: bool, 41 | } 42 | 43 | pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> { 44 | let dir = PathBuf::from("clone-ebpf"); 45 | let target = format!("--target={}", opts.target); 46 | let mut args = vec![ 47 | "+nightly", 48 | "build", 49 | "--verbose", 50 | target.as_str(), 51 | "-Z", 52 | "build-std=core", 53 | ]; 54 | if opts.release { 55 | args.push("--release") 56 | } 57 | let status = Command::new("cargo") 58 | .current_dir(&dir) 59 | .args(&args) 60 | .status() 61 | .expect("failed to build bpf program"); 62 | assert!(status.success()); 63 | Ok(()) 64 | } 65 | -------------------------------------------------------------------------------- /dpath/xtask/src/build_ebpf.rs: -------------------------------------------------------------------------------- 1 | use std::path::PathBuf; 2 | use std::process::Command; 3 | 4 | use clap::Parser; 5 | 6 | #[derive(Debug, Copy, Clone)] 7 | pub enum Architecture { 8 | BpfEl, 9 | BpfEb, 10 | } 11 | 12 | impl std::str::FromStr for Architecture { 13 | type Err = String; 14 | 15 | fn from_str(s: &str) -> Result { 16 | Ok(match s { 17 | "bpfel-unknown-none" => Architecture::BpfEl, 18 | "bpfeb-unknown-none" => Architecture::BpfEb, 19 | _ => return Err("invalid target".to_owned()), 20 | }) 21 | } 22 | } 23 | 24 | impl std::fmt::Display for Architecture { 25 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 26 | f.write_str(match self { 27 | Architecture::BpfEl => "bpfel-unknown-none", 28 | Architecture::BpfEb => "bpfeb-unknown-none", 29 | }) 30 | } 31 | } 32 | 33 | #[derive(Debug, Parser)] 34 | pub struct Options { 35 | /// Set the endianness of the BPF target 36 | #[clap(default_value = "bpfel-unknown-none", long)] 37 | pub target: Architecture, 38 | /// Build the release target 39 | #[clap(long)] 40 | pub release: bool, 41 | } 42 | 43 | pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> { 44 | let dir = PathBuf::from("dpath-ebpf"); 45 | let target = format!("--target={}", opts.target); 46 | let mut args = vec![ 47 | "+nightly", 48 | "build", 49 | "--verbose", 50 | target.as_str(), 51 | "-Z", 52 | "build-std=core", 53 | ]; 54 | if opts.release { 55 | args.push("--release") 56 | } 57 | let status = Command::new("cargo") 58 | .current_dir(&dir) 59 | .args(&args) 60 | .status() 61 | .expect("failed to build bpf program"); 62 | assert!(status.success()); 63 | Ok(()) 64 | } 65 | -------------------------------------------------------------------------------- /uprobe/xtask/src/build_ebpf.rs: -------------------------------------------------------------------------------- 1 | use std::path::PathBuf; 2 | use std::process::Command; 3 | 4 | use clap::Parser; 5 | 6 | #[derive(Debug, Copy, Clone)] 7 | pub enum Architecture { 8 | BpfEl, 9 | BpfEb, 10 | } 11 | 12 | impl std::str::FromStr for Architecture { 13 | type Err = String; 14 | 15 | fn from_str(s: &str) -> Result { 16 | Ok(match s { 17 | "bpfel-unknown-none" => Architecture::BpfEl, 18 | "bpfeb-unknown-none" => Architecture::BpfEb, 19 | _ => return Err("invalid target".to_owned()), 20 | }) 21 | } 22 | } 23 | 24 | impl std::fmt::Display for Architecture { 25 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 26 | f.write_str(match self { 27 | Architecture::BpfEl => "bpfel-unknown-none", 28 | Architecture::BpfEb => "bpfeb-unknown-none", 29 | }) 30 | } 31 | } 32 | 33 | #[derive(Debug, Parser)] 34 | pub struct Options { 35 | /// Set the endianness of the BPF target 36 | #[clap(default_value = "bpfel-unknown-none", long)] 37 | pub target: Architecture, 38 | /// Build the release target 39 | #[clap(long)] 40 | pub release: bool, 41 | } 42 | 43 | pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> { 44 | let dir = PathBuf::from("uprobe-ebpf"); 45 | let target = format!("--target={}", opts.target); 46 | let mut args = vec![ 47 | "+nightly", 48 | "build", 49 | "--verbose", 50 | target.as_str(), 51 | "-Z", 52 | "build-std=core", 53 | ]; 54 | if opts.release { 55 | args.push("--release") 56 | } 57 | let status = Command::new("cargo") 58 | .current_dir(&dir) 59 | .args(&args) 60 | .status() 61 | .expect("failed to build bpf program"); 62 | assert!(status.success()); 63 | Ok(()) 64 | } 65 | -------------------------------------------------------------------------------- /notokio/xtask/src/build_ebpf.rs: -------------------------------------------------------------------------------- 1 | use std::path::PathBuf; 2 | use std::process::Command; 3 | 4 | use clap::Parser; 5 | 6 | #[derive(Debug, Copy, Clone)] 7 | pub enum Architecture { 8 | BpfEl, 9 | BpfEb, 10 | } 11 | 12 | impl std::str::FromStr for Architecture { 13 | type Err = String; 14 | 15 | fn from_str(s: &str) -> Result { 16 | Ok(match s { 17 | "bpfel-unknown-none" => Architecture::BpfEl, 18 | "bpfeb-unknown-none" => Architecture::BpfEb, 19 | _ => return Err("invalid target".to_owned()), 20 | }) 21 | } 22 | } 23 | 24 | impl std::fmt::Display for Architecture { 25 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 26 | f.write_str(match self { 27 | Architecture::BpfEl => "bpfel-unknown-none", 28 | Architecture::BpfEb => "bpfeb-unknown-none", 29 | }) 30 | } 31 | } 32 | 33 | #[derive(Debug, Parser)] 34 | pub struct Options { 35 | /// Set the endianness of the BPF target 36 | #[clap(default_value = "bpfel-unknown-none", long)] 37 | pub target: Architecture, 38 | /// Build the release target 39 | #[clap(long)] 40 | pub release: bool, 41 | } 42 | 43 | pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> { 44 | let dir = PathBuf::from("notokio-ebpf"); 45 | let target = format!("--target={}", opts.target); 46 | let mut args = vec![ 47 | "+nightly", 48 | "build", 49 | "--verbose", 50 | target.as_str(), 51 | "-Z", 52 | "build-std=core", 53 | ]; 54 | if opts.release { 55 | args.push("--release") 56 | } 57 | let status = Command::new("cargo") 58 | .current_dir(&dir) 59 | .args(&args) 60 | .status() 61 | .expect("failed to build bpf program"); 62 | assert!(status.success()); 63 | Ok(()) 64 | } 65 | -------------------------------------------------------------------------------- /tc-bytes/xtask/src/build_ebpf.rs: -------------------------------------------------------------------------------- 1 | use std::path::PathBuf; 2 | use std::process::Command; 3 | 4 | use clap::Parser; 5 | 6 | #[derive(Debug, Copy, Clone)] 7 | pub enum Architecture { 8 | BpfEl, 9 | BpfEb, 10 | } 11 | 12 | impl std::str::FromStr for Architecture { 13 | type Err = String; 14 | 15 | fn from_str(s: &str) -> Result { 16 | Ok(match s { 17 | "bpfel-unknown-none" => Architecture::BpfEl, 18 | "bpfeb-unknown-none" => Architecture::BpfEb, 19 | _ => return Err("invalid target".to_owned()), 20 | }) 21 | } 22 | } 23 | 24 | impl std::fmt::Display for Architecture { 25 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 26 | f.write_str(match self { 27 | Architecture::BpfEl => "bpfel-unknown-none", 28 | Architecture::BpfEb => "bpfeb-unknown-none", 29 | }) 30 | } 31 | } 32 | 33 | #[derive(Debug, Parser)] 34 | pub struct Options { 35 | /// Set the endianness of the BPF target 36 | #[clap(default_value = "bpfel-unknown-none", long)] 37 | pub target: Architecture, 38 | /// Build the release target 39 | #[clap(long)] 40 | pub release: bool, 41 | } 42 | 43 | pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> { 44 | let dir = PathBuf::from("tc-bytes-ebpf"); 45 | let target = format!("--target={}", opts.target); 46 | let mut args = vec![ 47 | "+nightly", 48 | "build", 49 | "--verbose", 50 | target.as_str(), 51 | "-Z", 52 | "build-std=core", 53 | ]; 54 | if opts.release { 55 | args.push("--release") 56 | } 57 | let status = Command::new("cargo") 58 | .current_dir(&dir) 59 | .args(&args) 60 | .status() 61 | .expect("failed to build bpf program"); 62 | assert!(status.success()); 63 | Ok(()) 64 | } 65 | -------------------------------------------------------------------------------- /tc-srcip/xtask/src/build_ebpf.rs: -------------------------------------------------------------------------------- 1 | use std::path::PathBuf; 2 | use std::process::Command; 3 | 4 | use clap::Parser; 5 | 6 | #[derive(Debug, Copy, Clone)] 7 | pub enum Architecture { 8 | BpfEl, 9 | BpfEb, 10 | } 11 | 12 | impl std::str::FromStr for Architecture { 13 | type Err = String; 14 | 15 | fn from_str(s: &str) -> Result { 16 | Ok(match s { 17 | "bpfel-unknown-none" => Architecture::BpfEl, 18 | "bpfeb-unknown-none" => Architecture::BpfEb, 19 | _ => return Err("invalid target".to_owned()), 20 | }) 21 | } 22 | } 23 | 24 | impl std::fmt::Display for Architecture { 25 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 26 | f.write_str(match self { 27 | Architecture::BpfEl => "bpfel-unknown-none", 28 | Architecture::BpfEb => "bpfeb-unknown-none", 29 | }) 30 | } 31 | } 32 | 33 | #[derive(Debug, Parser)] 34 | pub struct Options { 35 | /// Set the endianness of the BPF target 36 | #[clap(default_value = "bpfel-unknown-none", long)] 37 | pub target: Architecture, 38 | /// Build the release target 39 | #[clap(long)] 40 | pub release: bool, 41 | } 42 | 43 | pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> { 44 | let dir = PathBuf::from("tc-srcip-ebpf"); 45 | let target = format!("--target={}", opts.target); 46 | let mut args = vec![ 47 | "+nightly", 48 | "build", 49 | "--verbose", 50 | target.as_str(), 51 | "-Z", 52 | "build-std=core", 53 | ]; 54 | if opts.release { 55 | args.push("--release") 56 | } 57 | let status = Command::new("cargo") 58 | .current_dir(&dir) 59 | .args(&args) 60 | .status() 61 | .expect("failed to build bpf program"); 62 | assert!(status.success()); 63 | Ok(()) 64 | } 65 | -------------------------------------------------------------------------------- /xdp-mac/xtask/src/build_ebpf.rs: -------------------------------------------------------------------------------- 1 | use std::path::PathBuf; 2 | use std::process::Command; 3 | 4 | use clap::Parser; 5 | 6 | #[derive(Debug, Copy, Clone)] 7 | pub enum Architecture { 8 | BpfEl, 9 | BpfEb, 10 | } 11 | 12 | impl std::str::FromStr for Architecture { 13 | type Err = String; 14 | 15 | fn from_str(s: &str) -> Result { 16 | Ok(match s { 17 | "bpfel-unknown-none" => Architecture::BpfEl, 18 | "bpfeb-unknown-none" => Architecture::BpfEb, 19 | _ => return Err("invalid target".to_owned()), 20 | }) 21 | } 22 | } 23 | 24 | impl std::fmt::Display for Architecture { 25 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 26 | f.write_str(match self { 27 | Architecture::BpfEl => "bpfel-unknown-none", 28 | Architecture::BpfEb => "bpfeb-unknown-none", 29 | }) 30 | } 31 | } 32 | 33 | #[derive(Debug, Parser)] 34 | pub struct Options { 35 | /// Set the endianness of the BPF target 36 | #[clap(default_value = "bpfel-unknown-none", long)] 37 | pub target: Architecture, 38 | /// Build the release target 39 | #[clap(long)] 40 | pub release: bool, 41 | } 42 | 43 | pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> { 44 | let dir = PathBuf::from("xdp-mac-ebpf"); 45 | let target = format!("--target={}", opts.target); 46 | let mut args = vec![ 47 | "+nightly", 48 | "build", 49 | "--verbose", 50 | target.as_str(), 51 | "-Z", 52 | "build-std=core", 53 | ]; 54 | if opts.release { 55 | args.push("--release") 56 | } 57 | let status = Command::new("cargo") 58 | .current_dir(&dir) 59 | .args(&args) 60 | .status() 61 | .expect("failed to build bpf program"); 62 | assert!(status.success()); 63 | Ok(()) 64 | } 65 | -------------------------------------------------------------------------------- /xdp-bytes/xtask/src/build_ebpf.rs: -------------------------------------------------------------------------------- 1 | use std::path::PathBuf; 2 | use std::process::Command; 3 | 4 | use clap::Parser; 5 | 6 | #[derive(Debug, Copy, Clone)] 7 | pub enum Architecture { 8 | BpfEl, 9 | BpfEb, 10 | } 11 | 12 | impl std::str::FromStr for Architecture { 13 | type Err = String; 14 | 15 | fn from_str(s: &str) -> Result { 16 | Ok(match s { 17 | "bpfel-unknown-none" => Architecture::BpfEl, 18 | "bpfeb-unknown-none" => Architecture::BpfEb, 19 | _ => return Err("invalid target".to_owned()), 20 | }) 21 | } 22 | } 23 | 24 | impl std::fmt::Display for Architecture { 25 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 26 | f.write_str(match self { 27 | Architecture::BpfEl => "bpfel-unknown-none", 28 | Architecture::BpfEb => "bpfeb-unknown-none", 29 | }) 30 | } 31 | } 32 | 33 | #[derive(Debug, Parser)] 34 | pub struct Options { 35 | /// Set the endianness of the BPF target 36 | #[clap(default_value = "bpfel-unknown-none", long)] 37 | pub target: Architecture, 38 | /// Build the release target 39 | #[clap(long)] 40 | pub release: bool, 41 | } 42 | 43 | pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> { 44 | let dir = PathBuf::from("xdp-bytes-ebpf"); 45 | let target = format!("--target={}", opts.target); 46 | let mut args = vec![ 47 | "+nightly", 48 | "build", 49 | "--verbose", 50 | target.as_str(), 51 | "-Z", 52 | "build-std=core", 53 | ]; 54 | if opts.release { 55 | args.push("--release") 56 | } 57 | let status = Command::new("cargo") 58 | .current_dir(&dir) 59 | .args(&args) 60 | .status() 61 | .expect("failed to build bpf program"); 62 | assert!(status.success()); 63 | Ok(()) 64 | } 65 | -------------------------------------------------------------------------------- /xdp-mut-u8/xtask/src/build_ebpf.rs: -------------------------------------------------------------------------------- 1 | use std::path::PathBuf; 2 | use std::process::Command; 3 | 4 | use clap::Parser; 5 | 6 | #[derive(Debug, Copy, Clone)] 7 | pub enum Architecture { 8 | BpfEl, 9 | BpfEb, 10 | } 11 | 12 | impl std::str::FromStr for Architecture { 13 | type Err = String; 14 | 15 | fn from_str(s: &str) -> Result { 16 | Ok(match s { 17 | "bpfel-unknown-none" => Architecture::BpfEl, 18 | "bpfeb-unknown-none" => Architecture::BpfEb, 19 | _ => return Err("invalid target".to_owned()), 20 | }) 21 | } 22 | } 23 | 24 | impl std::fmt::Display for Architecture { 25 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 26 | f.write_str(match self { 27 | Architecture::BpfEl => "bpfel-unknown-none", 28 | Architecture::BpfEb => "bpfeb-unknown-none", 29 | }) 30 | } 31 | } 32 | 33 | #[derive(Debug, Parser)] 34 | pub struct Options { 35 | /// Set the endianness of the BPF target 36 | #[clap(default_value = "bpfel-unknown-none", long)] 37 | pub target: Architecture, 38 | /// Build the release target 39 | #[clap(long)] 40 | pub release: bool, 41 | } 42 | 43 | pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> { 44 | let dir = PathBuf::from("xdp-mut-u8-ebpf"); 45 | let target = format!("--target={}", opts.target); 46 | let mut args = vec![ 47 | "+nightly", 48 | "build", 49 | "--verbose", 50 | target.as_str(), 51 | "-Z", 52 | "build-std=core", 53 | ]; 54 | if opts.release { 55 | args.push("--release") 56 | } 57 | let status = Command::new("cargo") 58 | .current_dir(&dir) 59 | .args(&args) 60 | .status() 61 | .expect("failed to build bpf program"); 62 | assert!(status.success()); 63 | Ok(()) 64 | } 65 | --------------------------------------------------------------------------------