From: Victor Julien Date: Mon, 9 Feb 2015 07:36:07 +0000 (+0100) Subject: reject: optimize and simplify run test X-Git-Tag: suricata-6.0.0-beta1~314 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1b042cf1086f544beea93e868813037ea0a35b80;p=thirdparty%2Fsuricata.git reject: optimize and simplify run test --- diff --git a/src/action-globals.h b/src/action-globals.h index aa46bd293d..fc9a3275f0 100644 --- a/src/action-globals.h +++ b/src/action-globals.h @@ -33,4 +33,6 @@ #define ACTION_REJECT_BOTH 0x10 #define ACTION_PASS 0x20 +#define ACTION_REJECT_ANY (ACTION_REJECT|ACTION_REJECT_DST|ACTION_REJECT_BOTH) + #endif /* __ACTION_GLOBALS_H__ */ diff --git a/src/respond-reject.c b/src/respond-reject.c index d32a197c55..8212396a9d 100644 --- a/src/respond-reject.c +++ b/src/respond-reject.c @@ -58,9 +58,7 @@ void TmModuleRespondRejectRegister (void) static TmEcode RespondRejectFunc(ThreadVars *tv, Packet *p, void *data) { /* ACTION_REJECT defaults to rejecting the SRC */ - if (!(PACKET_TEST_ACTION(p, ACTION_REJECT)) && - !(PACKET_TEST_ACTION(p, ACTION_REJECT_DST)) && - !(PACKET_TEST_ACTION(p, ACTION_REJECT_BOTH))) { + if (likely(PACKET_TEST_ACTION(p, ACTION_REJECT_ANY) == 0)) { return TM_ECODE_OK; }