Skip to content

Commit

Permalink
Merge pull request #99 from dave-tucker/new-names
Browse files Browse the repository at this point in the history
  • Loading branch information
dave-tucker authored Jul 31, 2023
2 parents afdb453 + 1625999 commit 599ba4b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 23 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,10 @@ jobs:

- uses: Swatinem/rust-cache@v2

- name: Install bpf-linker
run: cargo install bpf-linker

- name: Install Cargo Generate
run: cargo install cargo-generate
- name: Install deps
uses: taiki-e/install-action@v2
with:
tool: bpf-linker,cargo-generate

- name: Run tests
run: ./test.sh ${{ github.workspace }} ${{ matrix.program }}
36 changes: 18 additions & 18 deletions {{project-name}}-ebpf/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use aya_bpf::{macros::kprobe, programs::ProbeContext};
use aya_log_ebpf::info;

#[kprobe(name = "{{crate_name}}")]
#[kprobe]
pub fn {{crate_name}}(ctx: ProbeContext) -> u32 {
match try_{{crate_name}}(ctx) {
Ok(ret) => ret,
Expand All @@ -21,7 +21,7 @@ fn try_{{crate_name}}(ctx: ProbeContext) -> Result<u32, u32> {
use aya_bpf::{macros::kretprobe, programs::ProbeContext};
use aya_log_ebpf::info;

#[kretprobe(name = "{{crate_name}}")]
#[kretprobe]
pub fn {{crate_name}}(ctx: ProbeContext) -> u32 {
match try_{{crate_name}}(ctx) {
Ok(ret) => ret,
Expand All @@ -40,7 +40,7 @@ use aya_bpf::{
};
use aya_log_ebpf::info;

#[fentry(name="{{crate_name}}")]
#[fentry(function="{{fn_name}}")]
pub fn {{crate_name}}(ctx: FEntryContext) -> u32 {
match try_{{crate_name}}(ctx) {
Ok(ret) => ret,
Expand All @@ -59,7 +59,7 @@ use aya_bpf::{
};
use aya_log_ebpf::info;

#[fexit(name="{{crate_name}}")]
#[fexit(function="{{fn_name}}")]
pub fn {{crate_name}}(ctx: FExitContext) -> u32 {
match try_{{crate_name}}(ctx) {
Ok(ret) => ret,
Expand All @@ -78,7 +78,7 @@ use aya_bpf::{
};
use aya_log_ebpf::info;

#[uprobe(name="{{crate_name}}")]
#[uprobe]
pub fn {{crate_name}}(ctx: ProbeContext) -> u32 {
match try_{{crate_name}}(ctx) {
Ok(ret) => ret,
Expand All @@ -97,7 +97,7 @@ use aya_bpf::{
};
use aya_log_ebpf::info;

#[uretprobe(name="{{crate_name}}")]
#[uretprobe]
pub fn {{crate_name}}(ctx: ProbeContext) -> u32 {
match try_{{crate_name}}(ctx) {
Ok(ret) => ret,
Expand All @@ -116,7 +116,7 @@ use aya_bpf::{
};
use aya_log_ebpf::info;

#[sock_ops(name="{{crate_name}}")]
#[sock_ops]
pub fn {{crate_name}}(ctx: SockOpsContext) -> u32 {
match try_{{crate_name}}(ctx) {
Ok(ret) => ret,
Expand All @@ -141,7 +141,7 @@ use {{crate_name}}_common::SockKey;
#[map(name="{{sock_map}}")]
static {{sock_map}}: SockHash<SockKey> = SockHash::<SockKey>::with_max_entries(1024, 0);

#[sk_msg(name="{{crate_name}}")]
#[sk_msg]
pub fn {{crate_name}}(ctx: SkMsgContext) -> u32 {
match try_{{crate_name}}(ctx) {
Ok(ret) => ret,
Expand All @@ -157,7 +157,7 @@ fn try_{{crate_name}}(ctx: SkMsgContext) -> Result<u32, u32> {
use aya_bpf::{bindings::xdp_action, macros::xdp, programs::XdpContext};
use aya_log_ebpf::info;

#[xdp(name = "{{crate_name}}")]
#[xdp]
pub fn {{crate_name}}(ctx: XdpContext) -> u32 {
match try_{{crate_name}}(ctx) {
Ok(ret) => ret,
Expand All @@ -173,7 +173,7 @@ fn try_{{crate_name}}(ctx: XdpContext) -> Result<u32, u32> {
use aya_bpf::{macros::classifier, programs::TcContext};
use aya_log_ebpf::info;

#[classifier(name = "{{crate_name}}")]
#[classifier]
pub fn {{crate_name}}(ctx: TcContext) -> i32 {
match try_{{crate_name}}(ctx) {
Ok(ret) => ret,
Expand All @@ -192,7 +192,7 @@ use aya_bpf::{
};
use aya_log_ebpf::info;

#[cgroup_skb(name="{{crate_name}}")]
#[cgroup_skb]
pub fn {{crate_name}}(ctx: SkBuffContext) -> i32 {
match try_{{crate_name}}(ctx) {
Ok(ret) => ret,
Expand All @@ -211,7 +211,7 @@ use aya_bpf::{
};
use aya_log_ebpf::info;

#[tracepoint(name = "{{crate_name}}")]
#[tracepoint]
pub fn {{crate_name}}(ctx: TracePointContext) -> u32 {
match try_{{crate_name}}(ctx) {
Ok(ret) => ret,
Expand All @@ -230,7 +230,7 @@ use aya_bpf::{
};
use aya_log_ebpf::info;

#[lsm(name = "{{lsm_hook}}")]
#[lsm(hook = "{{lsm_hook}}")]
pub fn {{lsm_hook}}(ctx: LsmContext) -> i32 {
match try_{{lsm_hook}}(ctx) {
Ok(ret) => ret,
Expand All @@ -249,7 +249,7 @@ use aya_bpf::{
};
use aya_log_ebpf::info;

#[btf_tracepoint(name = "{{tracepoint_name}}")]
#[btf_tracepoint(function="{{tracepoint_name}}")]
pub fn {{tracepoint_name}}(ctx: BtfTracePointContext) -> i32 {
match try_{{tracepoint_name}}(ctx) {
Ok(ret) => ret,
Expand All @@ -267,7 +267,7 @@ use aya_bpf::{
programs::SkBuffContext,
};

#[socket_filter(name = "{{crate_name}}")]
#[socket_filter]
pub fn {{crate_name}}(_ctx: SkBuffContext) -> i64 {
return 0
}
Expand All @@ -278,7 +278,7 @@ use aya_bpf::{
};
use aya_log_ebpf::info;

#[cgroup_sysctl(name = "{{crate_name}}")]
#[cgroup_sysctl]
pub fn {{crate_name}}(ctx: SysctlContext) -> i32 {
match try_{{crate_name}}(ctx) {
Ok(ret) => ret,
Expand All @@ -294,7 +294,7 @@ fn try_{{crate_name}}(ctx: SysctlContext) -> Result<i32, i32> {
use aya_bpf::{macros::cgroup_sockopt, programs::SockoptContext};
use aya_log_ebpf::info;

#[cgroup_sockopt({{sockopt_target}}, name = "{{crate_name}}")]
#[cgroup_sockopt({{sockopt_target}})]
pub fn {{crate_name}}(ctx: SockoptContext) -> i32 {
match try_{{crate_name}}(ctx) {
Ok(ret) => ret,
Expand All @@ -310,7 +310,7 @@ fn try_{{crate_name}}(ctx: SockoptContext) -> Result<i32, i32> {
use aya_bpf::{macros::raw_tracepoint, programs::RawTracePointContext};
use aya_log_ebpf::info;

#[raw_tracepoint(name = "{{crate_name}}")]
#[raw_tracepoint(tracepoint="{{tracepoint_name}}")]
pub fn {{crate_name}}(ctx: RawTracePointContext) -> i32 {
match try_{{crate_name}}(ctx) {
Ok(ret) => ret,
Expand Down

0 comments on commit 599ba4b

Please sign in to comment.