From d094039600ac832325bacb014583cca6a6eaa2f4 Mon Sep 17 00:00:00 2001 From: Eric Leblond Date: Fri, 1 Apr 2016 13:52:24 +0200 Subject: [PATCH] af-packet: remove useless code No need for cooked header in the case of mmap capture. --- src/source-af-packet.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/source-af-packet.c b/src/source-af-packet.c index f5cecd48d2..ea7f63e1cc 100644 --- a/src/source-af-packet.c +++ b/src/source-af-packet.c @@ -727,7 +727,6 @@ int AFPReadFromRing(AFPThreadVars *ptv) { Packet *p = NULL; union thdr h; - struct sockaddr_ll *from; uint8_t emergency_flush = 0; int read_pkts = 0; int loop_start = -1; @@ -789,20 +788,11 @@ int AFPReadFromRing(AFPThreadVars *ptv) * function. */ h.h2->tp_status |= TP_STATUS_USER_BUSY; - from = (void *)h.raw + TPACKET_ALIGN(ptv->tp_hdrlen); - ptv->pkts++; ptv->bytes += h.h2->tp_len; p->livedev = ptv->livedev; - - /* add forged header */ - if (ptv->cooked) { - SllHdr * hdrp = (SllHdr *)ptv->data; - /* XXX this is minimalist, but this seems enough */ - hdrp->sll_protocol = from->sll_protocol; - } - p->datalink = ptv->datalink; + if (h.h2->tp_len > h.h2->tp_snaplen) { SCLogDebug("Packet length (%d) > snaplen (%d), truncating", h.h2->tp_len, h.h2->tp_snaplen); -- 2.47.2