Skip to content

Libbpf userspace function bpf_xdp_detach

0.7.0

Detach a BPF_PROG_TYPE_XDP program that was previously attached via bpf_xdp_attach.

Definition

int bpf_xdp_detach(int ifindex, __u32 flags, const struct bpf_xdp_attach_opts *opts);

Parameters

  • ifindex: index of the network interface to detach the program from
  • flags: flags to control the detachment behavior
  • opts: options to control the detachment, see struct bpf_xdp_attach_opts

Flags

  • XDP_FLAGS_REPLACE = (1U << 4) - If set, remove the currently attached program, throw an error if no program is attached.

Return

Zero on success, or a negative error code on failure.

struct bpf_xdp_attach_opts

struct bpf_xdp_attach_opts {
    size_t sz;
    int old_prog_fd;
    size_t :0;
};

Usage

Docs could be improved

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

Example

Docs could be improved

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