Skip to content

Libbpf userspace function bpf_program__set_ifindex

0.0.1

Set the interface index for a BPF program.

Definition

void bpf_program__set_ifindex(struct bpf_program *prog, __u32 ifindex);

Parameters

  • prog: The BPF program.
  • ifindex: The interface index to set.

Usage

This method associates a BPF program with a network interface. This is only relevant for programs of type BPF_PROG_TYPE_XDP that are offloaded to hardware. Offloading to hardware loops in the hardware driver in the verification process, so the kernel needs to know the network device the program will be attached to at load time.

Example

Docs could be improved

This part of the docs is incomplete, contributions are very welcome