Project

General

Profile

Actions

Bug #9513

open
SB OD

ebpf: xdp-cpu-redirect and peer config ignored when pinned maps are reused

Bug #9513: ebpf: xdp-cpu-redirect and peer config ignored when pinned maps are reused

Added by Suri Bot 2 days ago. Updated about 23 hours ago.

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

Description

Requested by: @Philippe Antoine

With xdp-filter-file, bypass: yes and pinned-maps: true, a restarted Suricata that finds the flow tables already pinned in /sys/fs/bpf returns early from EBPFLoadFile() (src/util-ebpf.c, "Loaded pinned maps, will use already loaded eBPF filter") with return value 1.

In ParseAFPConfig() (src/runmode-af-packet.c), case 1 only logs "loaded pinned maps from sysfs". All the setup in case 0 is skipped:

  • EBPFSetupXDP() (that part is covered by #6731)
  • EBPFBuildCPUSet(): the xdp-cpu-redirect configuration
  • EBPFSetPeerIface(): the IPS peer interface redirect

So changes to xdp-cpu-redirect or copy-iface between runs are silently ignored while the pinned maps exist. The values from the previous run stay in effect.

https://github.com/OISF/suricata/pull/16823 (XDP tunnel bypass, #7674) adds EBPFLoadTunnels() to the same path, so the tunnel configuration would be skipped the same way on restart.

The "Pinned maps usage" section of doc/userguide/capture-hardware/ebpf-xdp.rst does not mention this limitation.

Possible fixes (to be discussed):

  • apply the CPU set, peer and tunnel configuration in the pinned-maps path too (update the pinned maps), or
  • at least document the limitation, and maybe warn when the config differs from what's in the pinned maps.

Found in review: https://github.com/OISF/suricata/pull/16823#discussion_r4783202228


Related issues 2 (2 open — 0 closed)

Related to Suricata - Bug #6731: eBPF XDP program is not attached when pinned-maps is trueNewOISF DevActions
Related to Suricata - Feature #3310: ease suricata configuration with xdp TriagedCommunity TicketActions
Actions

Also available in: PDF Atom