From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from bert.emutex.com (bert.emutex.com [91.103.1.109]) by dpdk.org (Postfix) with ESMTP id 21170C320 for ; Wed, 17 Feb 2016 11:18:55 +0100 (CET) Received: from [92.51.199.138] (helo=statler.emutex.com) by bert.emutex.com with esmtp (Exim 4.84) (envelope-from ) id 1aVzC6-0006ig-W8; Wed, 17 Feb 2016 10:18:51 +0000 Received: from [10.10.68.150] by statler.emutex.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84) (envelope-from ) id 1aVzC8-0001c0-Es; Wed, 17 Feb 2016 10:18:52 +0000 To: Dror Birkman , john.mcnamara@intel.com References: <1453979390-36685-1-git-send-email-dror.birkman@lightcyber.com> From: Nicolas Pernas Maradei Message-ID: <56C4490C.20401@emutex.com> Date: Wed, 17 Feb 2016 10:18:52 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <1453979390-36685-1-git-send-email-dror.birkman@lightcyber.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH] pcap: fix captured frame length X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2016 10:18:55 -0000 Hi, I'm just adding the Acked-by line to the patch. Apologise I missed that one earlier. Nico. On 28/01/16 11:09, Dror Birkman wrote: > The actual captured length is header.caplen, whereas header.len is > the original length on the wire. > > Signed-off-by: Dror Birkman > Acked-by: Nicolas Pernas Maradei > --- > > > Without this fix, if the captured length is smaller than the original > length on the wire, mbuf will contain incorrect data. > > > drivers/net/pcap/rte_eth_pcap.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c > index f9230eb..1d121f8 100644 > --- a/drivers/net/pcap/rte_eth_pcap.c > +++ b/drivers/net/pcap/rte_eth_pcap.c > @@ -220,25 +220,25 @@ eth_pcap_rx(void *queue, > buf_size = (uint16_t)(rte_pktmbuf_data_room_size(pcap_q->mb_pool) - > RTE_PKTMBUF_HEADROOM); > > - if (header.len <= buf_size) { > + if (header.caplen <= buf_size) { > /* pcap packet will fit in the mbuf, go ahead and copy */ > rte_memcpy(rte_pktmbuf_mtod(mbuf, void *), packet, > - header.len); > - mbuf->data_len = (uint16_t)header.len; > + header.caplen); > + mbuf->data_len = (uint16_t)header.caplen; > } else { > /* Try read jumbo frame into multi mbufs. */ > if (unlikely(eth_pcap_rx_jumbo(pcap_q->mb_pool, > mbuf, > packet, > - header.len) == -1)) > + header.caplen) == -1)) > break; > } > > - mbuf->pkt_len = (uint16_t)header.len; > + mbuf->pkt_len = (uint16_t)header.caplen; > mbuf->port = pcap_q->in_port; > bufs[num_rx] = mbuf; > num_rx++; > - rx_bytes += header.len; > + rx_bytes += header.caplen; > } > pcap_q->rx_pkts += num_rx; > pcap_q->rx_bytes += rx_bytes;