prog.go 519 B

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