Skip to content

Commit

Permalink
libxdp: Make sure to set the the program autoload when loading a program
Browse files Browse the repository at this point in the history
When loading an xdp_program, we just load the underlying BPF object;
however, if that has previously had autoload disabled on the program we're
trying to load, the program won't actually be loaded. Since the load
corresponds to a particular program this is surprising behaviour, so make
sure we turn on program autoload for the program we're working with before
loading the BPF object.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
  • Loading branch information
tohojo committed Dec 9, 2022
1 parent af00429 commit 41703d2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/libxdp/libxdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1289,6 +1289,9 @@ static int xdp_program__load(struct xdp_program *prog)
if (!prog->bpf_obj)
return -EINVAL;

/* Make sure this program is loaded even if autoload was turned off */
bpf_program__set_autoload(prog->bpf_prog, true);

err = bpf_object__load(prog->bpf_obj);
if (err)
return err;
Expand Down

0 comments on commit 41703d2

Please sign in to comment.