diff options
author | Maciej Żenczykowski <maze@google.com> | 2024-04-14 18:33:16 -0700 |
---|---|---|
committer | Maciej Żenczykowski <maze@google.com> | 2024-04-14 18:43:34 -0700 |
commit | b004229b02d58f2c889edc00dc61b1616b31bf25 (patch) | |
tree | 81f12e583cad90aa318d63c9466811d38b6d0ce4 | |
parent | c720b5a5457b43ab50e636fb9bdfefff3e296689 (diff) | |
download | apf-b004229b02d58f2c889edc00dc61b1616b31bf25.tar.gz |
v5: replace DROP_PACKET with just DROP
This is needlessly verbose - what else would we be dropping?
Generated via:
sed -r -i 's@DROP_PACKET@DROP@g' apf_interpreter_source.c
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I01c5151ce5282ed82bb67e7658499e8d930b945c
-rw-r--r-- | v5/apf_interpreter.c | 8 | ||||
-rw-r--r-- | v5/apf_interpreter_source.c | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/v5/apf_interpreter.c b/v5/apf_interpreter.c index 06af66d..d3104f4 100644 --- a/v5/apf_interpreter.c +++ b/v5/apf_interpreter.c @@ -582,7 +582,7 @@ extern void APF_TRACE_HOOK(u32 pc, const u32* regs, const u8* program, /* Return code indicating "packet" should accepted. */ #define PASS_PACKET 1 /* Return code indicating "packet" should be dropped. */ -#define DROP_PACKET 0 +#define DROP 0 /* Verify an internal condition and accept packet if it fails. */ #define ASSERT_RETURN(c) if (!(c)) return PASS_PACKET /* If "c" is of an unsigned type, generate a compile warning that gets promoted to an error. */ @@ -680,7 +680,7 @@ static int do_apf_run(apf_context* ctx) { do { APF_TRACE_HOOK(ctx->pc, ctx->R, ctx->program, ctx->program_len, ctx->packet, ctx->packet_len, ctx->mem.slot, ctx->ram_len); - if (ctx->pc == ctx->program_len + 1) return DROP_PACKET; + if (ctx->pc == ctx->program_len + 1) return DROP; if (ctx->pc >= ctx->program_len) return PASS_PACKET; const u8 bytecode = ctx->program[ctx->pc++]; @@ -713,7 +713,7 @@ static int do_apf_run(apf_context* ctx) { if (4 * imm > ctx->ram_len) return PASS_PACKET; counter[-(s32)imm]++; } - return reg_num ? DROP_PACKET : PASS_PACKET; + return reg_num ? DROP : PASS_PACKET; } case LDB_OPCODE: case LDH_OPCODE: @@ -942,7 +942,7 @@ static int do_apf_run(apf_context* ctx) { if (match_rst == error_program) return PASS_PACKET; if (match_rst == error_packet) { counter[-5]++; /* increment error dns packet counter */ - return (imm >= JDNSQMATCHSAFE_EXT_OPCODE) ? PASS_PACKET : DROP_PACKET; + return (imm >= JDNSQMATCHSAFE_EXT_OPCODE) ? PASS_PACKET : DROP; } while (ctx->pc + 1 < ctx->program_len && (ctx->program[ctx->pc] || ctx->program[ctx->pc + 1])) { diff --git a/v5/apf_interpreter_source.c b/v5/apf_interpreter_source.c index 9740a18..a946344 100644 --- a/v5/apf_interpreter_source.c +++ b/v5/apf_interpreter_source.c @@ -52,7 +52,7 @@ extern void APF_TRACE_HOOK(u32 pc, const u32* regs, const u8* program, // Return code indicating "packet" should accepted. #define PASS_PACKET 1 // Return code indicating "packet" should be dropped. -#define DROP_PACKET 0 +#define DROP 0 // Verify an internal condition and accept packet if it fails. #define ASSERT_RETURN(c) if (!(c)) return PASS_PACKET // If "c" is of an unsigned type, generate a compile warning that gets promoted to an error. @@ -150,7 +150,7 @@ static int do_apf_run(apf_context* ctx) { do { APF_TRACE_HOOK(ctx->pc, ctx->R, ctx->program, ctx->program_len, ctx->packet, ctx->packet_len, ctx->mem.slot, ctx->ram_len); - if (ctx->pc == ctx->program_len + 1) return DROP_PACKET; + if (ctx->pc == ctx->program_len + 1) return DROP; if (ctx->pc >= ctx->program_len) return PASS_PACKET; const u8 bytecode = ctx->program[ctx->pc++]; @@ -183,7 +183,7 @@ static int do_apf_run(apf_context* ctx) { if (4 * imm > ctx->ram_len) return PASS_PACKET; counter[-(s32)imm]++; } - return reg_num ? DROP_PACKET : PASS_PACKET; + return reg_num ? DROP : PASS_PACKET; } case LDB_OPCODE: case LDH_OPCODE: @@ -412,7 +412,7 @@ static int do_apf_run(apf_context* ctx) { if (match_rst == error_program) return PASS_PACKET; if (match_rst == error_packet) { counter[-5]++; // increment error dns packet counter - return (imm >= JDNSQMATCHSAFE_EXT_OPCODE) ? PASS_PACKET : DROP_PACKET; + return (imm >= JDNSQMATCHSAFE_EXT_OPCODE) ? PASS_PACKET : DROP; } while (ctx->pc + 1 < ctx->program_len && (ctx->program[ctx->pc] || ctx->program[ctx->pc + 1])) { |