From: Eric Leblond Date: Fri, 1 Apr 2016 11:52:24 +0000 (+0200) Subject: af-packet: remove useless code X-Git-Tag: suricata-3.1RC1~111 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d094039600ac832325bacb014583cca6a6eaa2f4;p=thirdparty%2Fsuricata.git af-packet: remove useless code No need for cooked header in the case of mmap capture. --- 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);