DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Tianli Lai <laitianli@tom.com>
Cc: dev@dpdk.org, Reshma Pattan <reshma.pattan@intel.com>
Subject: Re: [PATCH] app/dumpcap:fix coredump problem because pcap_dump 3th argument is null
Date: Fri, 11 Oct 2024 07:30:46 -0700	[thread overview]
Message-ID: <20241011073046.7b728867@hermes.local> (raw)
In-Reply-To: <20240301104129.3725-1-laitianli@tom.com>

On Fri,  1 Mar 2024 18:41:29 +0800
Tianli Lai <laitianli@tom.com> wrote:

> if rte_pktmbuf_read() return NULL, pcap_dump() would coredump.
> 
> Signed-off-by: Tianli Lai <laitianli@tom.com>

To safely handle jumbo packets, the code here should increase
the size of temp_data, then the RTE_MIN() is not needed either.

See drivers/net/pcap/pcap_ethdev.c

	for (i = 0; i < nb_pkts; i++) {
		mbuf = bufs[i];
		len = caplen = rte_pktmbuf_pkt_len(mbuf);
		if (unlikely(!rte_pktmbuf_is_contiguous(mbuf) &&
				len > sizeof(temp_data))) {
			caplen = sizeof(temp_data);
		}

		calculate_timestamp(&header.ts);
		header.len = len;
		header.caplen = caplen;
		/* rte_pktmbuf_read() returns a pointer to the data directly
		 * in the mbuf (when the mbuf is contiguous) or, otherwise,
		 * a pointer to temp_data after copying into it.
		 */
		pcap_dump((u_char *)dumper, &header,
			rte_pktmbuf_read(mbuf, 0, caplen, temp_data));

      parent reply	other threads:[~2024-10-11 14:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-01 10:41 Tianli Lai
2024-03-01  3:36 ` Stephen Hemminger
2024-10-03 22:09 ` [PATCH] app/dumpcap: fix handling of jumbo frames Stephen Hemminger
2024-10-11 12:46   ` David Marchand
2024-10-11 14:30 ` Stephen Hemminger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241011073046.7b728867@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=laitianli@tom.com \
    --cc=reshma.pattan@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).