summaryrefslogtreecommitdiff
path: root/v5/apf_interpreter_source.c
diff options
context:
space:
mode:
Diffstat (limited to 'v5/apf_interpreter_source.c')
-rw-r--r--v5/apf_interpreter_source.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/v5/apf_interpreter_source.c b/v5/apf_interpreter_source.c
index 9ab27bf..4db7aa6 100644
--- a/v5/apf_interpreter_source.c
+++ b/v5/apf_interpreter_source.c
@@ -538,9 +538,9 @@ static int do_apf_run(apf_context* ctx) {
return EXCEPTION;
}
-int apf_run(void* ctx, u32* const program, const u32 program_len,
- const u32 ram_len, const u8* const packet,
- const u32 packet_len, const u32 filter_age_16384ths) {
+static int apf_runner(void* ctx, u32* const program, const u32 program_len,
+ const u32 ram_len, const u8* const packet,
+ const u32 packet_len, const u32 filter_age_16384ths) {
// Due to direct 32-bit read/write access to counters at end of ram
// APFv6 interpreter requires program & ram_len to be 4 byte aligned.
if (3 & (uintptr_t)program) return EXCEPTION;
@@ -551,10 +551,6 @@ int apf_run(void* ctx, u32* const program, const u32 program_len,
// We also don't want garbage like program_len == 0xFFFFFFFF
if ((program_len | ram_len) >> 31) return EXCEPTION;
- // Any valid ethernet packet should be at least ETH_HLEN long...
- if (!packet) return EXCEPTION;
- if (packet_len < ETH_HLEN) return EXCEPTION;
-
{
apf_context apf_ctx = { 0 };
int ret;
@@ -592,3 +588,13 @@ int apf_run(void* ctx, u32* const program, const u32 program_len,
return ret;
}
}
+
+int apf_run(void* ctx, u32* const program, const u32 program_len,
+ const u32 ram_len, const u8* const packet,
+ const u32 packet_len, const u32 filter_age_16384ths) {
+ // Any valid ethernet packet should be at least ETH_HLEN long...
+ if (!packet) return EXCEPTION;
+ if (packet_len < ETH_HLEN) return EXCEPTION;
+
+ return apf_runner(ctx, program, program_len, ram_len, packet, packet_len, filter_age_16384ths);
+}