Add options and functionality for running with other XDP programs via xdp-loader. (#86)
This commit is contained in:
@@ -57,4 +57,13 @@
|
|||||||
|
|
||||||
// If enabled, uses a newer bpf_loop() function when choosing a source port for a new connection.
|
// 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.
|
// 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
|
||||||
@@ -113,6 +113,10 @@ int attach_xdp(struct xdp_program *prog, char** mode, int ifidx, int detach, int
|
|||||||
{
|
{
|
||||||
int err;
|
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;
|
u32 attach_mode = XDP_MODE_NATIVE;
|
||||||
|
|
||||||
*mode = "DRV/native";
|
*mode = "DRV/native";
|
||||||
|
|||||||
Reference in New Issue
Block a user