Project

General

Profile

Actions

Bug #5855

closed

af-xdp: may fail to build on Linux systems with kernel older than 5.11

Added by Pavel Ledyankin about 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Affected Versions:
Effort:
Difficulty:
Label:

Description

Good day!

Trying to build Suricata with AF_XDP support, but got this error:

@ CC source-af-xdp.o
source-af-xdp.c: In function 'ConfigureBusyPolling':
source-af-xdp.c:402:36: error: 'SO_PREFER_BUSY_POLL' undeclared (first use in this function); did you mean 'SO_BUSY_POLL'?
402 | if (setsockopt(fd, SOL_SOCKET, SO_PREFER_BUSY_POLL, (void *)&sock_opt, sizeof(sock_opt)) < 0) { | ^~~~~~~~~~~~~~~~~ | SO_BUSY_POLL
source-af-xdp.c:402:36: note: each undeclared identifier is reported only once for each function it appears in
source-af-xdp.c:412:36: error: 'SO_BUSY_POLL_BUDGET' undeclared (first use in this function); did you mean 'SO_BUSY_POLL'?
412 | if (setsockopt(fd, SOL_SOCKET, SO_BUSY_POLL_BUDGET, (void *)&sock_opt, sizeof(sock_opt)) < 0) { | ^~~~~~~~~~~~~~~~~ | SO_BUSY_POLL
source-af-xdp.c: In function 'AFXDPSocketCreation':
source-af-xdp.c:490:9: error: implicit declaration of function 'bpf_get_link_xdp_id' [-Werror=implicit-function-declaration]
490 | if (bpf_get_link_xdp_id(ptv->ifindex, &ptv->prog_id, ptv->xsk.cfg.xdp_flags)) { | ^~~~~~~~~~~~~~~~~@

Suricata Configuration:
AF_PACKET support: yes
AF_XDP support: yes
DPDK support: yes
eBPF support: no
XDP support: no
PF_RING support: no
NFQueue support: no
NFLOG support: no
IPFW support: no
Netmap support: no
DAG enabled: no
Napatech enabled: no
WinDivert enabled: no

Environment:

root@suricata-7:/opt/suricata# uname -a
Linux suricata-7 5.10.0-21-amd64 #1 SMP Debian 5.10.162-1 (2023-01-21) x86_64 GNU/Linux

root@suricata-7:/opt/suricata# cat /etc/debian_version
11.6

root@suricata-7:/opt/suricata# dpkg -l | grep libxdp-dev
ii libxdp-dev:amd64 1.2.9-1~bpo11+1 amd64 library and utilities for use with XDP - development files

Actions #1

Updated by Jason Ish about 1 year ago

It looks like Linux kernel 5.11 is required to build with AF-XDP.

The XDP source has a runtime check for kernel version of at 5.11 before allowing one to enable busy polling. However, this code uses some defines that may only be available if running 5.11 so it fails to compile.

The fix might be as simple as some `#ifdef`s looking for these defines. If thats not enough then we'll need some ./configure tests.

Actions #2

Updated by Jason Ish about 1 year ago

  • Subject changed from Can't build suricata with AF_XDP support to xf-xdp: mail fail to build on Linux systems with kernel older than 5.11
  • Status changed from New to Assigned
  • Assignee changed from OISF Dev to Jason Ish
  • Target version changed from TBD to 7.0.0-rc2
Actions #3

Updated by Victor Julien about 1 year ago

  • Subject changed from xf-xdp: mail fail to build on Linux systems with kernel older than 5.11 to af-xdp: may fail to build on Linux systems with kernel older than 5.11
Actions #4

Updated by Jason Ish about 1 year ago

  • Status changed from Assigned to In Review
Actions #5

Updated by Jason Ish about 1 year ago

  • Status changed from In Review to Closed

Merged.

Actions

Also available in: Atom PDF