From: Victor Julien Date: Wed, 3 Nov 2021 20:09:46 +0000 (+0100) Subject: af-packet: simplify socket handling in tpacket v3 X-Git-Tag: suricata-7.0.0-beta1~1247 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e3d20acb98141fc8d109302158e898ed388f1b5a;p=thirdparty%2Fsuricata.git af-packet: simplify socket handling in tpacket v3 Tpacket v3 only supports workers mode, which means the packet that would reference a socket won't leave the thread. Therefore keeping a ref count on the socket is not needed. This patch removes the per packet reference count increment. The decrement was missing, so this fixes the ref cnt handling so that after a iface up/ down capture can recover. It should also lead to a minor performance increase as we avoid a round of atomic operations per packet. Bug: #4804. Bug: #4801. --- diff --git a/src/source-af-packet.c b/src/source-af-packet.c index 728266a48f..ed189e1801 100644 --- a/src/source-af-packet.c +++ b/src/source-af-packet.c @@ -1129,7 +1129,6 @@ static inline int AFPParsePacketV3(AFPThreadVars *ptv, struct tpacket_block_desc p->afp_v.relptr = ppd; p->ReleasePacket = AFPReleasePacketV3; p->afp_v.mpeer = ptv->mpeer; - AFPRefSocket(ptv->mpeer); p->afp_v.copy_mode = ptv->copy_mode; if (p->afp_v.copy_mode != AFP_COPY_MODE_NONE) {