From: Victor Julien Date: Fri, 5 Nov 2021 10:31:58 +0000 (+0100) Subject: af-packet: simplify tpacket-v2 setup code X-Git-Tag: suricata-7.0.0-beta1~1241 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ace349d4d9208e18836c4312b220a93b1e3b154c;p=thirdparty%2Fsuricata.git af-packet: simplify tpacket-v2 setup code Setup can no longer fail, so make the function void and remove dead error checking code. --- diff --git a/src/source-af-packet.c b/src/source-af-packet.c index e6a214bfc1..d285faacbc 100644 --- a/src/source-af-packet.c +++ b/src/source-af-packet.c @@ -923,7 +923,7 @@ static inline void AFPReadApplyBypass(const AFPThreadVars *ptv, Packet *p) /** \internal * \brief setup packet for AFPReadFromRing */ -static bool AFPReadFromRingSetupPacket( +static void AFPReadFromRingSetupPacket( AFPThreadVars *ptv, union thdr h, const unsigned int tp_status, Packet *p) { PKT_SET_SRC(p, PKT_SRC_WIRE); @@ -982,7 +982,6 @@ static bool AFPReadFromRingSetupPacket( p->flags |= PKT_IGNORE_CHECKSUM; } } - return true; } static inline int AFPReadFromRingWaitForPacket(AFPThreadVars *ptv) @@ -1072,10 +1071,7 @@ static int AFPReadFromRing(AFPThreadVars *ptv) if (p == NULL) { return AFPSuriFailure(ptv, h); } - if (AFPReadFromRingSetupPacket(ptv, h, tp_status, p) == false) { - TmqhOutputPacketpool(ptv->tv, p); - return AFPSuriFailure(ptv, h); - } + AFPReadFromRingSetupPacket(ptv, h, tp_status, p); if (TmThreadsSlotProcessPkt(ptv->tv, ptv->slot, p) != TM_ECODE_OK) { return AFPSuriFailure(ptv, h);