From: Victor Julien Date: Sat, 16 Nov 2019 18:20:31 +0000 (+0100) Subject: decode: convert 'action' macros to inline funcs X-Git-Tag: suricata-7.0.0-beta1~1502 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4c7eb64411c9b7141a4d8e339982d657eb028bfc;p=thirdparty%2Fsuricata.git decode: convert 'action' macros to inline funcs Make sure most common branch is handled first to assist branch prediction. Macros still play a small role to please our 'action' cocci check. --- diff --git a/src/alert-prelude.c b/src/alert-prelude.c index 3c73b3866a..1e74bf69cd 100644 --- a/src/alert-prelude.c +++ b/src/alert-prelude.c @@ -230,10 +230,8 @@ static int EventToImpact(const PacketAlert *pa, const Packet *p, idmef_alert_t * idmef_impact_set_severity(impact, severity); - if (PACKET_TEST_ACTION(p, ACTION_DROP) || - PACKET_TEST_ACTION(p, ACTION_REJECT) || - PACKET_TEST_ACTION(p, ACTION_REJECT_DST) || - PACKET_TEST_ACTION(p, ACTION_REJECT_BOTH) ) { + if (PacketTestAction(p, ACTION_DROP) || PacketTestAction(p, ACTION_REJECT) || + PacketTestAction(p, ACTION_REJECT_DST) || PacketTestAction(p, ACTION_REJECT_BOTH)) { idmef_action_t *action; ret = idmef_action_new(&action); diff --git a/src/decode.c b/src/decode.c index 1c55efd2b7..c91b747c51 100644 --- a/src/decode.c +++ b/src/decode.c @@ -744,9 +744,9 @@ const char *PktSrcToString(enum PktSrcEnum pkt_src) void CaptureStatsUpdate(ThreadVars *tv, CaptureStats *s, const Packet *p) { - if (unlikely(PACKET_TEST_ACTION(p, (ACTION_REJECT|ACTION_REJECT_DST|ACTION_REJECT_BOTH)))) { + if (unlikely(PacketTestAction(p, (ACTION_REJECT | ACTION_REJECT_DST | ACTION_REJECT_BOTH)))) { StatsIncr(tv, s->counter_ips_rejected); - } else if (unlikely(PACKET_TEST_ACTION(p, ACTION_DROP))) { + } else if (unlikely(PacketTestAction(p, ACTION_DROP))) { StatsIncr(tv, s->counter_ips_blocked); } else if (unlikely(p->flags & PKT_STREAM_MODIFIED)) { StatsIncr(tv, s->counter_ips_replaced); diff --git a/src/decode.h b/src/decode.h index f5b410349c..503beec687 100644 --- a/src/decode.h +++ b/src/decode.h @@ -864,11 +864,16 @@ void CaptureStatsSetup(ThreadVars *tv, CaptureStats *s); * handle the case of a root packet * for tunnels */ -#define PACKET_SET_ACTION(p, a) do { \ - ((p)->root ? \ - ((p)->root->action = a) : \ - ((p)->action = a)); \ -} while (0) +#define PACKET_SET_ACTION(p, a) (p)->action = (a) + +static inline void PacketSetAction(Packet *p, const uint8_t a) +{ + if (likely(p->root == NULL)) { + PACKET_SET_ACTION(p, a); + } else { + PACKET_SET_ACTION(p->root, a); + } +} #define PACKET_ALERT(p) PACKET_SET_ACTION(p, ACTION_ALERT) @@ -884,16 +889,26 @@ void CaptureStatsSetup(ThreadVars *tv, CaptureStats *s); #define PACKET_PASS(p) PACKET_SET_ACTION(p, ACTION_PASS) -#define PACKET_TEST_ACTION(p, a) \ - ((p)->root ? \ - ((p)->root->action & a) : \ - ((p)->action & a)) +#define PACKET_TEST_ACTION(p, a) (p)->action &(a) + +static inline uint8_t PacketTestAction(const Packet *p, const uint8_t a) +{ + if (likely(p->root == NULL)) { + return PACKET_TEST_ACTION(p, a); + } else { + return PACKET_TEST_ACTION(p->root, a); + } +} -#define PACKET_UPDATE_ACTION(p, a) do { \ - ((p)->root ? \ - ((p)->root->action |= a) : \ - ((p)->action |= a)); \ -} while (0) +#define PACKET_UPDATE_ACTION(p, a) (p)->action |= (a) +static inline void PacketUpdateAction(Packet *p, const uint8_t a) +{ + if (likely(p->root == NULL)) { + PACKET_UPDATE_ACTION(p, a); + } else { + PACKET_UPDATE_ACTION(p->root, a); + } +} #define TUNNEL_INCR_PKT_RTV_NOLOCK(p) do { \ ((p)->root ? (p)->root->tunnel_rtv_cnt++ : (p)->tunnel_rtv_cnt++); \ diff --git a/src/detect-detection-filter.c b/src/detect-detection-filter.c index b4f57d1c4a..593d645711 100644 --- a/src/detect-detection-filter.c +++ b/src/detect-detection-filter.c @@ -574,17 +574,17 @@ static int DetectDetectionFilterTestSig3(void) SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts = PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; TimeSetIncrementTime(200); @@ -592,22 +592,22 @@ static int DetectDetectionFilterTestSig3(void) SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; if (alerts == 3 && drops == 3) diff --git a/src/detect-engine-alert.c b/src/detect-engine-alert.c index 90713facc5..f2f4ce7ca7 100644 --- a/src/detect-engine-alert.c +++ b/src/detect-engine-alert.c @@ -285,7 +285,7 @@ void PacketAlertFinalize(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx /* set actions on packet */ DetectSignatureApplyActions(p, p->alerts.alerts[i].s, p->alerts.alerts[i].flags); - if (PACKET_TEST_ACTION(p, ACTION_PASS)) { + if (PacketTestAction(p, ACTION_PASS)) { /* Ok, reset the alert cnt to end in the previous of pass * so we ignore the rest with less prio */ p->alerts.cnt = i; @@ -293,11 +293,10 @@ void PacketAlertFinalize(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx /* if the signature wants to drop, check if the * PACKET_ALERT_FLAG_DROP_FLOW flag is set. */ - } else if ((PACKET_TEST_ACTION(p, ACTION_DROP)) && - ((p->alerts.alerts[i].flags & PACKET_ALERT_FLAG_DROP_FLOW) || - (s->flags & SIG_FLAG_APPLAYER)) - && p->flow != NULL) - { + } else if ((PacketTestAction(p, ACTION_DROP)) && + ((p->alerts.alerts[i].flags & PACKET_ALERT_FLAG_DROP_FLOW) || + (s->flags & SIG_FLAG_APPLAYER)) && + p->flow != NULL) { /* This will apply only on IPS mode (check StreamTcpPacket) */ p->flow->flags |= FLOW_ACTION_DROP; // XXX API? } diff --git a/src/detect-iprep.c b/src/detect-iprep.c index a359638437..f69bf41b89 100644 --- a/src/detect-iprep.c +++ b/src/detect-iprep.c @@ -483,7 +483,7 @@ static int DetectIPRepTest01(void) SigMatchSignatures(&th_v, de_ctx, det_ctx, p); FAIL_IF(p->alerts.cnt != 1); - FAIL_IF(PACKET_TEST_ACTION(p, ACTION_DROP)); + FAIL_IF(PacketTestAction(p, ACTION_DROP)); UTHFreePacket(p); @@ -535,7 +535,7 @@ static int DetectIPRepTest02(void) p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); FAIL_IF(p->alerts.cnt != 1); - FAIL_IF(PACKET_TEST_ACTION(p, ACTION_DROP)); + FAIL_IF(PacketTestAction(p, ACTION_DROP)); UTHFreePacket(p); @@ -587,7 +587,7 @@ static int DetectIPRepTest03(void) p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); FAIL_IF(p->alerts.cnt != 1); - FAIL_IF(PACKET_TEST_ACTION(p, ACTION_DROP)); + FAIL_IF(PacketTestAction(p, ACTION_DROP)); UTHFreePacket(p); @@ -640,7 +640,7 @@ static int DetectIPRepTest04(void) p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); FAIL_IF(p->alerts.cnt != 1); - FAIL_IF(PACKET_TEST_ACTION(p, ACTION_DROP)); + FAIL_IF(PacketTestAction(p, ACTION_DROP)); UTHFreePacket(p); @@ -692,7 +692,7 @@ static int DetectIPRepTest05(void) p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); FAIL_IF(p->alerts.cnt != 0); - FAIL_IF(PACKET_TEST_ACTION(p, ACTION_DROP)); + FAIL_IF(PacketTestAction(p, ACTION_DROP)); UTHFreePacket(p); @@ -744,7 +744,7 @@ static int DetectIPRepTest06(void) p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); FAIL_IF(p->alerts.cnt != 1); - FAIL_IF(PACKET_TEST_ACTION(p, ACTION_DROP)); + FAIL_IF(PacketTestAction(p, ACTION_DROP)); UTHFreePacket(p); @@ -796,7 +796,7 @@ static int DetectIPRepTest07(void) p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); FAIL_IF(p->alerts.cnt != 1); - FAIL_IF(PACKET_TEST_ACTION(p, ACTION_DROP)); + FAIL_IF(PacketTestAction(p, ACTION_DROP)); UTHFreePacket(p); @@ -849,7 +849,7 @@ static int DetectIPRepTest08(void) p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); FAIL_IF(p->alerts.cnt != 0); - FAIL_IF(PACKET_TEST_ACTION(p, ACTION_DROP)); + FAIL_IF(PacketTestAction(p, ACTION_DROP)); UTHFreePacket(p); @@ -902,7 +902,7 @@ static int DetectIPRepTest09(void) p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); FAIL_IF(p->alerts.cnt != 1); - FAIL_IF(PACKET_TEST_ACTION(p, ACTION_DROP)); + FAIL_IF(PacketTestAction(p, ACTION_DROP)); UTHFreePacket(p); diff --git a/src/detect-threshold.c b/src/detect-threshold.c index baf8aea550..41a0ecb71f 100644 --- a/src/detect-threshold.c +++ b/src/detect-threshold.c @@ -1045,17 +1045,17 @@ static int DetectThresholdTestSig7(void) TimeGet(&p->ts); SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts = PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; TimeSetIncrementTime(200); @@ -1063,17 +1063,17 @@ static int DetectThresholdTestSig7(void) SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; if (alerts == 1 && drops == 6) @@ -1139,17 +1139,17 @@ static int DetectThresholdTestSig8(void) TimeGet(&p->ts); SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts = PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; TimeSetIncrementTime(200); @@ -1157,17 +1157,17 @@ static int DetectThresholdTestSig8(void) SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; if (alerts == 2 && drops == 6) @@ -1233,17 +1233,17 @@ static int DetectThresholdTestSig9(void) TimeGet(&p->ts); SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts = PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; TimeSetIncrementTime(200); @@ -1251,17 +1251,17 @@ static int DetectThresholdTestSig9(void) SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; if (alerts == 2 && drops == 2) @@ -1327,17 +1327,17 @@ static int DetectThresholdTestSig10(void) TimeGet(&p->ts); SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts = PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; TimeSetIncrementTime(200); @@ -1345,17 +1345,17 @@ static int DetectThresholdTestSig10(void) SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; if (alerts == 1 && drops == 1) @@ -1421,17 +1421,17 @@ static int DetectThresholdTestSig11(void) TimeGet(&p->ts); SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts = PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; TimeSetIncrementTime(200); @@ -1439,17 +1439,17 @@ static int DetectThresholdTestSig11(void) SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; if (alerts == 1 && drops == 4) @@ -1515,17 +1515,17 @@ static int DetectThresholdTestSig12(void) TimeGet(&p->ts); SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts = PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; TimeSetIncrementTime(200); @@ -1533,17 +1533,17 @@ static int DetectThresholdTestSig12(void) SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); alerts += PacketAlertCheck(p, 10); - drops += ((PACKET_TEST_ACTION(p, ACTION_DROP))?1:0); + drops += ((PacketTestAction(p, ACTION_DROP)) ? 1 : 0); p->action = 0; if (alerts == 1 && drops == 2) diff --git a/src/detect.c b/src/detect.c index ae5a76c174..ebd4a37971 100644 --- a/src/detect.c +++ b/src/detect.c @@ -1540,7 +1540,7 @@ next: void DetectSignatureApplyActions(Packet *p, const Signature *s, const uint8_t alert_flags) { - PACKET_UPDATE_ACTION(p, s->action); + PacketUpdateAction(p, s->action); if (s->action & ACTION_DROP) { if (p->alerts.drop.action == 0) { @@ -1601,9 +1601,7 @@ static void DetectNoFlow(ThreadVars *tv, Packet *p) { /* No need to perform any detection on this packet, if the the given flag is set.*/ - if ((p->flags & PKT_NOPACKET_INSPECTION) || - (PACKET_TEST_ACTION(p, ACTION_DROP))) - { + if ((p->flags & PKT_NOPACKET_INSPECTION) || (PacketTestAction(p, ACTION_DROP))) { return; } diff --git a/src/output-json-alert.c b/src/output-json-alert.c index ebb3e911e3..0ebe6fe0c1 100644 --- a/src/output-json-alert.c +++ b/src/output-json-alert.c @@ -344,8 +344,8 @@ void AlertJsonHeader(void *ctx, const Packet *p, const PacketAlert *pa, const char *action = "allowed"; /* use packet action if rate_filter modified the action */ if (unlikely(pa->flags & PACKET_ALERT_RATE_FILTER_MODIFIED)) { - if (PACKET_TEST_ACTION(p, (ACTION_DROP|ACTION_REJECT| - ACTION_REJECT_DST|ACTION_REJECT_BOTH))) { + if (PacketTestAction( + p, (ACTION_DROP | ACTION_REJECT | ACTION_REJECT_DST | ACTION_REJECT_BOTH))) { action = "blocked"; } } else { diff --git a/src/output-json-drop.c b/src/output-json-drop.c index e13da04236..83e16be828 100644 --- a/src/output-json-drop.c +++ b/src/output-json-drop.c @@ -351,7 +351,7 @@ static int JsonDropLogCondition(ThreadVars *tv, const Packet *p) ret = TRUE; return ret; - } else if (PACKET_TEST_ACTION(p, ACTION_DROP)) { + } else if (PacketTestAction(p, ACTION_DROP)) { return TRUE; } diff --git a/src/respond-reject.c b/src/respond-reject.c index b9a1740676..8b19e277db 100644 --- a/src/respond-reject.c +++ b/src/respond-reject.c @@ -64,7 +64,7 @@ static TmEcode RespondRejectThreadDeinit(ThreadVars *tv, void *data) static TmEcode RespondRejectFunc(ThreadVars *tv, Packet *p, void *data) { /* ACTION_REJECT defaults to rejecting the SRC */ - if (likely(PACKET_TEST_ACTION(p, ACTION_REJECT_ANY) == 0)) { + if (likely(PacketTestAction(p, ACTION_REJECT_ANY) == 0)) { return TM_ECODE_OK; } @@ -92,13 +92,13 @@ static TmEcode RespondRejectFunc(ThreadVars *tv, Packet *p, void *data) int RejectSendIPv4TCP(ThreadVars *tv, Packet *p, void *data) { SCEnter(); - if (PACKET_TEST_ACTION(p, ACTION_REJECT)) { + if (PacketTestAction(p, ACTION_REJECT)) { int r = RejectSendLibnet11IPv4TCP(tv, p, data, REJECT_DIR_SRC); SCReturnInt(r); - } else if (PACKET_TEST_ACTION(p, ACTION_REJECT_DST)) { + } else if (PacketTestAction(p, ACTION_REJECT_DST)) { int r = RejectSendLibnet11IPv4TCP(tv, p, data, REJECT_DIR_DST); SCReturnInt(r); - } else if(PACKET_TEST_ACTION(p, ACTION_REJECT_BOTH)) { + } else if (PacketTestAction(p, ACTION_REJECT_BOTH)) { int r = RejectSendLibnet11IPv4TCP(tv, p, data, REJECT_DIR_SRC); r |= RejectSendLibnet11IPv4TCP(tv, p, data, REJECT_DIR_DST); SCReturnInt(r); @@ -109,13 +109,13 @@ int RejectSendIPv4TCP(ThreadVars *tv, Packet *p, void *data) int RejectSendIPv4ICMP(ThreadVars *tv, Packet *p, void *data) { SCEnter(); - if (PACKET_TEST_ACTION(p, ACTION_REJECT)) { + if (PacketTestAction(p, ACTION_REJECT)) { int r = RejectSendLibnet11IPv4ICMP(tv, p, data, REJECT_DIR_SRC); SCReturnInt(r); - } else if (PACKET_TEST_ACTION(p, ACTION_REJECT_DST)) { + } else if (PacketTestAction(p, ACTION_REJECT_DST)) { int r = RejectSendLibnet11IPv4ICMP(tv, p, data, REJECT_DIR_DST); SCReturnInt(r); - } else if(PACKET_TEST_ACTION(p, ACTION_REJECT_BOTH)) { + } else if (PacketTestAction(p, ACTION_REJECT_BOTH)) { int r = RejectSendLibnet11IPv4ICMP(tv, p, data, REJECT_DIR_SRC); r |= RejectSendLibnet11IPv4ICMP(tv, p, data, REJECT_DIR_DST); SCReturnInt(r); @@ -126,13 +126,13 @@ int RejectSendIPv4ICMP(ThreadVars *tv, Packet *p, void *data) int RejectSendIPv6TCP(ThreadVars *tv, Packet *p, void *data) { SCEnter(); - if (PACKET_TEST_ACTION(p, ACTION_REJECT)) { + if (PacketTestAction(p, ACTION_REJECT)) { int r = RejectSendLibnet11IPv6TCP(tv, p, data, REJECT_DIR_SRC); SCReturnInt(r); - } else if (PACKET_TEST_ACTION(p, ACTION_REJECT_DST)) { + } else if (PacketTestAction(p, ACTION_REJECT_DST)) { int r = RejectSendLibnet11IPv6TCP(tv, p, data, REJECT_DIR_DST); SCReturnInt(r); - } else if(PACKET_TEST_ACTION(p, ACTION_REJECT_BOTH)) { + } else if (PacketTestAction(p, ACTION_REJECT_BOTH)) { int r = RejectSendLibnet11IPv6TCP(tv, p, data, REJECT_DIR_SRC); r |= RejectSendLibnet11IPv6TCP(tv, p, data, REJECT_DIR_DST); SCReturnInt(r); @@ -143,13 +143,13 @@ int RejectSendIPv6TCP(ThreadVars *tv, Packet *p, void *data) int RejectSendIPv6ICMP(ThreadVars *tv, Packet *p, void *data) { SCEnter(); - if (PACKET_TEST_ACTION(p, ACTION_REJECT)) { + if (PacketTestAction(p, ACTION_REJECT)) { int r = RejectSendLibnet11IPv6ICMP(tv, p, data, REJECT_DIR_SRC); SCReturnInt(r); - } else if (PACKET_TEST_ACTION(p, ACTION_REJECT_DST)) { + } else if (PacketTestAction(p, ACTION_REJECT_DST)) { int r = RejectSendLibnet11IPv6ICMP(tv, p, data, REJECT_DIR_DST); SCReturnInt(r); - } else if(PACKET_TEST_ACTION(p, ACTION_REJECT_BOTH)) { + } else if (PacketTestAction(p, ACTION_REJECT_BOTH)) { int r = RejectSendLibnet11IPv6ICMP(tv, p, data, REJECT_DIR_SRC); r |= RejectSendLibnet11IPv6ICMP(tv, p, data, REJECT_DIR_DST); SCReturnInt(r); diff --git a/src/source-af-packet.c b/src/source-af-packet.c index fdf7647d42..cc78ddf87a 100644 --- a/src/source-af-packet.c +++ b/src/source-af-packet.c @@ -726,7 +726,7 @@ static TmEcode AFPWritePacket(Packet *p, int version) uint16_t vlan_tci = 0; if (p->afp_v.copy_mode == AFP_COPY_MODE_IPS) { - if (PACKET_TEST_ACTION(p, ACTION_DROP)) { + if (PacketTestAction(p, ACTION_DROP)) { return TM_ECODE_OK; } } diff --git a/src/source-ipfw.c b/src/source-ipfw.c index 0d39cf9092..2aaacd283d 100644 --- a/src/source-ipfw.c +++ b/src/source-ipfw.c @@ -533,7 +533,7 @@ TmEcode IPFWSetVerdict(ThreadVars *tv, IPFWThreadVars *ptv, Packet *p) IPFWpoll.events = POLLWRNORM; #endif - if (PACKET_TEST_ACTION(p, ACTION_DROP)) { + if (PacketTestAction(p, ACTION_DROP)) { verdict = IPFW_DROP; } else { verdict = IPFW_ACCEPT; diff --git a/src/source-napatech.c b/src/source-napatech.c index a18616e512..2a0c4c5d5a 100644 --- a/src/source-napatech.c +++ b/src/source-napatech.c @@ -581,7 +581,7 @@ static int ProgramFlow(Packet *p, int is_inline) flow_match.gfi = 1; /* Generate FlowInfo records */ flow_match.tau = 1; /* tcp automatic unlearn */ - if (PACKET_TEST_ACTION(p, ACTION_DROP)) { + if (PacketTestAction(p, ACTION_DROP)) { flow_match.keySetId = NAPATECH_FLOWTYPE_DROP; } else { if (is_inline) { @@ -680,7 +680,7 @@ static void NapatechReleasePacket(struct Packet_ *p) * before releasing the Napatech buffer back to NTService. */ #ifdef NAPATECH_ENABLE_BYPASS - if (is_inline && PACKET_TEST_ACTION(p, ACTION_DROP)) { + if (is_inline && PacketTestAction(p, ACTION_DROP)) { p->ntpv.dyn3->wireLength = 0; } diff --git a/src/source-netmap.c b/src/source-netmap.c index c7f67c10da..136e9cb420 100644 --- a/src/source-netmap.c +++ b/src/source-netmap.c @@ -515,7 +515,7 @@ error: static TmEcode NetmapWritePacket(NetmapThreadVars *ntv, Packet *p) { if (ntv->copy_mode == NETMAP_COPY_MODE_IPS) { - if (PACKET_TEST_ACTION(p, ACTION_DROP)) { + if (PacketTestAction(p, ACTION_DROP)) { return TM_ECODE_OK; } } diff --git a/src/source-nfq.c b/src/source-nfq.c index d35b1d8b6c..97adea8904 100644 --- a/src/source-nfq.c +++ b/src/source-nfq.c @@ -475,7 +475,7 @@ static int NFQSetupPkt (Packet *p, struct nfq_q_handle *qh, void *data) static void NFQReleasePacket(Packet *p) { if (unlikely(!p->nfq_v.verdicted)) { - PACKET_UPDATE_ACTION(p, ACTION_DROP); + PacketUpdateAction(p, ACTION_DROP); NFQSetVerdict(p); } PacketFreeOrRelease(p); @@ -1036,7 +1036,7 @@ static inline uint32_t GetVerdict(const Packet *p) { uint32_t verdict = NF_ACCEPT; - if (PACKET_TEST_ACTION(p, ACTION_DROP)) { + if (PacketTestAction(p, ACTION_DROP)) { verdict = NF_DROP; } else { switch (nfq_config.mode) { @@ -1058,7 +1058,7 @@ static inline uint32_t GetVerdict(const Packet *p) #ifdef COUNTERS static inline void UpdateCounters(NFQQueueVars *t, const Packet *p) { - if (PACKET_TEST_ACTION(p, ACTION_DROP)) { + if (PacketTestAction(p, ACTION_DROP)) { t->dropped++; } else { if (p->flags & PKT_STREAM_MODIFIED) { diff --git a/src/source-windivert.c b/src/source-windivert.c index 3701310d72..edd0d7753b 100644 --- a/src/source-windivert.c +++ b/src/source-windivert.c @@ -789,7 +789,7 @@ static TmEcode WinDivertVerdictHelper(ThreadVars *tv, Packet *p) /* DROP simply means we do nothing; the WinDivert driver does the rest. */ - if (PACKET_TEST_ACTION(p, ACTION_DROP)) { + if (PacketTestAction(p, ACTION_DROP)) { #ifdef COUNTERS SCMutexLock(&wd_qv->counters_mutex); wd_qv->dropped++; diff --git a/src/tests/detect.c b/src/tests/detect.c index 7013a7dce0..b568fcf350 100644 --- a/src/tests/detect.c +++ b/src/tests/detect.c @@ -4805,7 +4805,7 @@ static int SigTestDropFlow03(void) goto end; } - if ( !(PACKET_TEST_ACTION(p2, ACTION_DROP))) { + if (!(PacketTestAction(p2, ACTION_DROP))) { printf("A \"drop\" action should be set from the flow to the packet: "); goto end; } @@ -4943,7 +4943,7 @@ static int SigTestDropFlow04(void) goto end; } - if (!(PACKET_TEST_ACTION(p1, ACTION_DROP))) { + if (!(PacketTestAction(p1, ACTION_DROP))) { printf("A \"drop\" action was set from the flow to the packet " "which is right, but setting the flag shouldn't disable " "inspection on the packet in IDS mode"); @@ -4988,7 +4988,7 @@ static int SigTestDropFlow04(void) goto end; } - if (!(PACKET_TEST_ACTION(p2, ACTION_DROP))) { + if (!(PacketTestAction(p2, ACTION_DROP))) { printf("A \"drop\" action was set from the flow to the packet " "which is right, but setting the flag shouldn't disable " "inspection on the packet in IDS mode"); diff --git a/src/util-threshold-config.c b/src/util-threshold-config.c index 9280016996..e81d14a569 100644 --- a/src/util-threshold-config.c +++ b/src/util-threshold-config.c @@ -1636,15 +1636,15 @@ static int SCThresholdConfTest09(void) p->alerts.cnt = 0; p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); - FAIL_IF(p->alerts.cnt != 1 || PACKET_TEST_ACTION(p, ACTION_DROP)); + FAIL_IF(p->alerts.cnt != 1 || PacketTestAction(p, ACTION_DROP)); p->alerts.cnt = 0; p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); - FAIL_IF(p->alerts.cnt != 1 || PACKET_TEST_ACTION(p, ACTION_DROP)); + FAIL_IF(p->alerts.cnt != 1 || PacketTestAction(p, ACTION_DROP)); p->alerts.cnt = 0; p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); - FAIL_IF(p->alerts.cnt != 1 || PACKET_TEST_ACTION(p, ACTION_DROP)); + FAIL_IF(p->alerts.cnt != 1 || PacketTestAction(p, ACTION_DROP)); TimeSetIncrementTime(2); TimeGet(&p->ts); @@ -1652,7 +1652,7 @@ static int SCThresholdConfTest09(void) p->alerts.cnt = 0; p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); - FAIL_IF(p->alerts.cnt != 1 || !(PACKET_TEST_ACTION(p, ACTION_DROP))); + FAIL_IF(p->alerts.cnt != 1 || !(PacketTestAction(p, ACTION_DROP))); TimeSetIncrementTime(3); TimeGet(&p->ts); @@ -1660,7 +1660,7 @@ static int SCThresholdConfTest09(void) p->alerts.cnt = 0; p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); - FAIL_IF(p->alerts.cnt != 1 || !(PACKET_TEST_ACTION(p, ACTION_DROP))); + FAIL_IF(p->alerts.cnt != 1 || !(PacketTestAction(p, ACTION_DROP))); TimeSetIncrementTime(10); TimeGet(&p->ts); @@ -1668,12 +1668,12 @@ static int SCThresholdConfTest09(void) p->alerts.cnt = 0; p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); - FAIL_IF(p->alerts.cnt != 1 || PACKET_TEST_ACTION(p, ACTION_DROP)); + FAIL_IF(p->alerts.cnt != 1 || PacketTestAction(p, ACTION_DROP)); p->alerts.cnt = 0; p->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); - FAIL_IF(p->alerts.cnt != 1 || PACKET_TEST_ACTION(p, ACTION_DROP)); + FAIL_IF(p->alerts.cnt != 1 || PacketTestAction(p, ACTION_DROP)); UTHFreePacket(p); DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx); @@ -1730,21 +1730,21 @@ static int SCThresholdConfTest10(void) /* All should be alerted, none dropped */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p1); - FAIL_IF(PACKET_TEST_ACTION(p1, ACTION_DROP)); + FAIL_IF(PacketTestAction(p1, ACTION_DROP)); FAIL_IF(PacketAlertCheck(p1, 10) != 1); p1->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); - FAIL_IF(PACKET_TEST_ACTION(p2, ACTION_DROP)); + FAIL_IF(PacketTestAction(p2, ACTION_DROP)); FAIL_IF(PacketAlertCheck(p2, 10) != 1); p2->action = 0; SigMatchSignatures(&th_v, de_ctx, det_ctx, p1); - FAIL_IF(PACKET_TEST_ACTION(p1, ACTION_DROP)); + FAIL_IF(PacketTestAction(p1, ACTION_DROP)); FAIL_IF(PacketAlertCheck(p1, 10) != 1); p1->action = 0; /* Match #4 should be dropped*/ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); - FAIL_IF_NOT(PACKET_TEST_ACTION(p2, ACTION_DROP)); + FAIL_IF_NOT(PacketTestAction(p2, ACTION_DROP)); FAIL_IF(PacketAlertCheck(p2, 10) != 1); p2->action = 0; @@ -1753,7 +1753,7 @@ static int SCThresholdConfTest10(void) /* Still dropped because timeout not expired */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p1); - FAIL_IF_NOT(PACKET_TEST_ACTION(p1, ACTION_DROP)); + FAIL_IF_NOT(PacketTestAction(p1, ACTION_DROP)); FAIL_IF(PacketAlertCheck(p1, 10) != 1); p1->action = 0; @@ -1762,7 +1762,7 @@ static int SCThresholdConfTest10(void) /* Not dropped because timeout expired */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p1); - FAIL_IF(PACKET_TEST_ACTION(p1, ACTION_DROP)); + FAIL_IF(PacketTestAction(p1, ACTION_DROP)); FAIL_IF(PacketAlertCheck(p1, 10) != 1); /* Ensure that a Threshold entry was installed at the sig */ @@ -2135,7 +2135,7 @@ static int SCThresholdConfTest15(void) /* 10000 shouldn't match */ FAIL_IF(PacketAlertCheck(p, 10000) != 0); /* however, it should have set the drop flag */ - FAIL_IF(!(PACKET_TEST_ACTION(p, ACTION_DROP))); + FAIL_IF(!(PacketTestAction(p, ACTION_DROP))); UTHFreePacket(p); DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx); @@ -2186,7 +2186,7 @@ static int SCThresholdConfTest16(void) FAIL_IF(PacketAlertCheck(p, 1000) != 0); /* however, it should have set the drop flag */ - FAIL_IF(!(PACKET_TEST_ACTION(p, ACTION_DROP))); + FAIL_IF(!(PacketTestAction(p, ACTION_DROP))); UTHFreePacket(p); DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx); @@ -2238,7 +2238,7 @@ static int SCThresholdConfTest17(void) /* 10000 shouldn't match */ FAIL_IF(PacketAlertCheck(p, 10000) != 0); /* however, it should have set the drop flag */ - FAIL_IF(!(PACKET_TEST_ACTION(p, ACTION_DROP))); + FAIL_IF(!(PacketTestAction(p, ACTION_DROP))); UTHFreePacket(p); DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx); @@ -2528,15 +2528,15 @@ static int SCThresholdConfTest22(void) /* All should be alerted, none dropped */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p1); - FAIL_IF(PACKET_TEST_ACTION(p1, ACTION_DROP)); + FAIL_IF(PacketTestAction(p1, ACTION_DROP)); FAIL_IF(PacketAlertCheck(p1, 10) != 1); SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); - FAIL_IF(PACKET_TEST_ACTION(p2, ACTION_DROP)); + FAIL_IF(PacketTestAction(p2, ACTION_DROP)); FAIL_IF(PacketAlertCheck(p2, 10) != 1); SigMatchSignatures(&th_v, de_ctx, det_ctx, p3); - FAIL_IF(PACKET_TEST_ACTION(p3, ACTION_DROP)); + FAIL_IF(PacketTestAction(p3, ACTION_DROP)); FAIL_IF(PacketAlertCheck(p3, 10) != 1); p1->action = p2->action = p3->action = 0; @@ -2547,7 +2547,7 @@ static int SCThresholdConfTest22(void) /* p1 still shouldn't be dropped after 2nd alert */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p1); - FAIL_IF(PACKET_TEST_ACTION(p1, ACTION_DROP)); + FAIL_IF(PacketTestAction(p1, ACTION_DROP)); FAIL_IF(PacketAlertCheck(p1, 10) != 1); p1->action = 0; @@ -2558,15 +2558,15 @@ static int SCThresholdConfTest22(void) /* All should be alerted, only p1 must be dropped due to rate_filter*/ SigMatchSignatures(&th_v, de_ctx, det_ctx, p1); - FAIL_IF_NOT(PACKET_TEST_ACTION(p1, ACTION_DROP)); + FAIL_IF_NOT(PacketTestAction(p1, ACTION_DROP)); FAIL_IF(PacketAlertCheck(p1, 10) != 1); SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); - FAIL_IF(PACKET_TEST_ACTION(p2, ACTION_DROP)); + FAIL_IF(PacketTestAction(p2, ACTION_DROP)); FAIL_IF(PacketAlertCheck(p2, 10) != 1); SigMatchSignatures(&th_v, de_ctx, det_ctx, p3); - FAIL_IF(PACKET_TEST_ACTION(p3, ACTION_DROP)); + FAIL_IF(PacketTestAction(p3, ACTION_DROP)); FAIL_IF(PacketAlertCheck(p3, 10) != 1); p1->action = p2->action = p3->action = 0; @@ -2577,15 +2577,15 @@ static int SCThresholdConfTest22(void) /* All should be alerted, none dropped (because timeout expired) */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p1); - FAIL_IF(PACKET_TEST_ACTION(p1, ACTION_DROP)); + FAIL_IF(PacketTestAction(p1, ACTION_DROP)); FAIL_IF(PacketAlertCheck(p1, 10) != 1); SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); - FAIL_IF(PACKET_TEST_ACTION(p2, ACTION_DROP)); + FAIL_IF(PacketTestAction(p2, ACTION_DROP)); FAIL_IF(PacketAlertCheck(p2, 10) != 1); SigMatchSignatures(&th_v, de_ctx, det_ctx, p3); - FAIL_IF(PACKET_TEST_ACTION(p3, ACTION_DROP)); + FAIL_IF(PacketTestAction(p3, ACTION_DROP)); FAIL_IF(PacketAlertCheck(p3, 10) != 1); UTHFreePacket(p3); @@ -2662,7 +2662,7 @@ static int SCThresholdConfTest23(void) TimeGet(&p1->ts); SigMatchSignatures(&th_v, de_ctx, det_ctx, p1); /* First packet should be alerted, not dropped */ - FAIL_IF(PACKET_TEST_ACTION(p1, ACTION_DROP)); + FAIL_IF(PacketTestAction(p1, ACTION_DROP)); FAIL_IF(PacketAlertCheck(p1, 10) != 1); TimeSetIncrementTime(2); @@ -2671,7 +2671,7 @@ static int SCThresholdConfTest23(void) /* Second packet should be dropped because it considered as "the same pair" and rate_filter count reached*/ - FAIL_IF_NOT(PACKET_TEST_ACTION(p2, ACTION_DROP)); + FAIL_IF_NOT(PacketTestAction(p2, ACTION_DROP)); FAIL_IF(PacketAlertCheck(p2, 10) != 1); UTHFreePacket(p2);