github.com/cilium/ebpf@v0.15.1-0.20240517100537-8079b37aa138/internal/prog.go (about)

     1  package internal
     2  
     3  // EmptyBPFContext is the smallest-possible BPF input context to be used for
     4  // invoking `Program.{Run,Benchmark,Test}`.
     5  //
     6  // Programs require a context input buffer of at least 15 bytes. Looking in
     7  // net/bpf/test_run.c, bpf_test_init() requires that the input is at least
     8  // ETH_HLEN (14) bytes. As of Linux commit fd18942 ("bpf: Don't redirect packets
     9  // with invalid pkt_len"), it also requires the skb to be non-empty after
    10  // removing the Layer 2 header.
    11  var EmptyBPFContext = make([]byte, 15)