Debian Codegraph @

examples/xdp_live_frame/xdp.c

raw symbols SCIP
1 //go:build ignore
2
3 // XDP program for demonstrating BPF_F_TEST_XDP_LIVE_FRAMES.
4 // When run in live frame mode, the provided packet data is sent directly
5 // to the network interface based on the XDP program's return value.
6
7 #include "bpf_endian.h"
8 #include "common.h"
9
10 char __license[] SEC("license") = "Dual MIT/GPL";
11
12 // xdp_prog_tx returns XDP_TX to transmit the packet back out the same interface.
13 // This is used with BPF_F_TEST_XDP_LIVE_FRAMES for packet generation.
14 SEC("xdp")
15 int xdp_prog_tx(struct xdp_md *ctx) {
16 return XDP_TX;
17 }
18
19 // xdp_prog_pass is attached to the interface to enable XDP_TX.
20 // XDP_TX requires an XDP program to be attached to the target interface.
21 SEC("xdp")
22 int xdp_prog_pass(struct xdp_md *ctx) {
23 return XDP_PASS;
24 }