diff --git a/bpf/aya-bpf/src/maps/perf/perf_event_array.rs b/bpf/aya-bpf/src/maps/perf/perf_event_array.rs index c881a885..cb0e9383 100644 --- a/bpf/aya-bpf/src/maps/perf/perf_event_array.rs +++ b/bpf/aya-bpf/src/maps/perf/perf_event_array.rs @@ -66,4 +66,12 @@ impl PerfEventArray { ); } } + + pub fn skb_output(&self, ctx: &C, skb_len: u32, data: &T) { + self.output_at_index(ctx, BPF_F_CURRENT_CPU as u32, data, skb_len) + } + + pub fn xdp_output(&self, ctx: &C, xdp_len: u32, data: &T) { + self.output_at_index(ctx, BPF_F_CURRENT_CPU as u32, data, xdp_len) + } } diff --git a/bpf/aya-bpf/src/maps/perf/perf_event_byte_array.rs b/bpf/aya-bpf/src/maps/perf/perf_event_byte_array.rs index 46c3613f..00b57039 100644 --- a/bpf/aya-bpf/src/maps/perf/perf_event_byte_array.rs +++ b/bpf/aya-bpf/src/maps/perf/perf_event_byte_array.rs @@ -63,4 +63,12 @@ impl PerfEventByteArray { ); } } + + pub fn skb_output(&self, ctx: &C, skb_len: u32, data: &[u8]) { + self.output_at_index(ctx, BPF_F_CURRENT_CPU as u32, data, skb_len) + } + + pub fn xdp_output(&self, ctx: &C, xdp_len: u32, data: &[u8]) { + self.output_at_index(ctx, BPF_F_CURRENT_CPU as u32, data, xdp_len) + } }