Skip to content

Commit

Permalink
Handle non-null errors returned from xdp_multiprog__get_from_ifindex
Browse files Browse the repository at this point in the history
Signed-off-by: Donald Hunter <donald.hunter@gmail.com>
  • Loading branch information
donaldh committed Mar 3, 2023
1 parent 7c8f43e commit 1366836
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion common/common_user_bpf_xdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,11 @@ int do_unload(struct config *cfg)
DECLARE_LIBBPF_OPTS(bpf_object_open_opts, opts);

mp = xdp_multiprog__get_from_ifindex(cfg->ifindex);
if (!mp) {
if (libxdp_get_error(mp)) {
fprintf(stderr, "Unable to get xdp_dispatcher program: %s\n",
strerror(errno));
goto out;
} else if (!mp) {
fprintf(stderr, "No XDP program loaded on %s\n", cfg->ifname);
mp = NULL;
goto out;
Expand Down

0 comments on commit 1366836

Please sign in to comment.