Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

source-xf-xdp: update for deprecated function in libbpf #8619

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions configure.ac
Expand Up @@ -1369,6 +1369,10 @@
# Are all required libs installed, yes=HAVE_AF_XDP
AS_IF([test "x$enable_af_xdp" = "xyes"],
AC_DEFINE([HAVE_AF_XDP],[1],[AF_XDP support is available]))

# bpf_get_link_xpd_id has been removed in the most recent
# versions of libbpf.
AC_CHECK_FUNCS([bpf_xdp_query_id])
])

# DPDK support
Expand Down
7 changes: 7 additions & 0 deletions src/source-af-xdp.c
Expand Up @@ -493,10 +493,17 @@ static TmEcode AFXDPSocketCreation(AFXDPThreadVars *ptv)
}

/* Has the eBPF program successfully bound? */
#ifdef HAVE_BPF_XDP_QUERY_ID
if (bpf_xdp_query_id(ptv->ifindex, ptv->xsk.cfg.xdp_flags, &ptv->prog_id)) {
SCLogError("Failed to attach eBPF program to interface: %s", ptv->livedev->dev);
SCReturnInt(TM_ECODE_FAILED);
}
#else
if (bpf_get_link_xdp_id(ptv->ifindex, &ptv->prog_id, ptv->xsk.cfg.xdp_flags)) {
SCLogError("Failed to attach eBPF program to interface: %s", ptv->livedev->dev);
SCReturnInt(TM_ECODE_FAILED);
}
#endif

SCReturnInt(TM_ECODE_OK);
}
Expand Down