Bug #9513
openebpf: xdp-cpu-redirect and peer config ignored when pinned maps are reused
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(): thexdp-cpu-redirectconfigurationEBPFSetPeerIface(): 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