Add options and functionality for running with other XDP programs via xdp-loader. (#86)
Some checks failed
Build / build (push) Failing after 2m14s
Run / run (push) Failing after 2m0s

This commit is contained in:
Christian Deacon
2025-12-28 15:56:35 -05:00
committed by GitHub
parent 278ff71c59
commit 496bdd0473
2 changed files with 14 additions and 1 deletions

View File

@@ -57,4 +57,13 @@
// If enabled, uses a newer bpf_loop() function when choosing a source port for a new connection.
// This allows for a much higher source port range. However, it requires a more recent kernel.
#define USE_NEW_LOOP
#define USE_NEW_LOOP
// Whether to enable chaining multiple XDP programs with this tool (1 = enable. 0 = disable).
#define XDP_MULTIPROG_ENABLED 1
// The XDP program's run priority (used for running multiple XDP programs together).
#define XDP_MULTIPROG_PRIORITY 10
// The action that indicates it should go onto the next program (default XDP_PASS).
#define XDP_MULTIPROG_ACTION XDP_PASS

View File

@@ -113,6 +113,10 @@ int attach_xdp(struct xdp_program *prog, char** mode, int ifidx, int detach, int
{
int err;
// Before attaching, set chaining options.
xdp_program__set_run_prio(prog, XDP_MULTIPROG_PRIORITY);
xdp_program__set_chain_call_enabled(prog, XDP_MULTIPROG_ACTION, XDP_MULTIPROG_ENABLED);
u32 attach_mode = XDP_MODE_NATIVE;
*mode = "DRV/native";