Search code examples
pcapdpdk

Pktgen error - Invalid PCAP filename, must include port number as P:filename


I'm trying to run Pktgen and record packet data to a pcap file. When I'm running this command:

./usr/local/bin/pktgen --no-telemetry -l 4,6,8 -n 4 -a 0000:03:02.0 -m 1024 -- -T -P -m [6:8].0 -s 0:pcap/captured_packets.pcap

It returns the following error message:

_pcap_open: failed to read the file header
!ERROR!: Invalid PCAP filename (0:pcap/captured_packets.pcap) must include port number as P:filename

What is wrong with the command? It seems to like the syntax of the command should be correct, so maybe it has something to do with the ports? If I run it without -s 0:pcap/captured_packets.pcap Pktgen works as it should.

I have also checked out a previous thread on this (Sending pcap file via packetgen dpdk), but it didn't give any further input into how to solve the issue.


Solution

  • For pktgen, the -s <port>:<pcap file> is only used for playback. It has a couple of drawbacks, including that it doesn't honor pcap timestamps and will just play at whatever rate is configured by the user. The other drawback is that I believe pktgen does not send jumbo packets in their entirety, but will limit any sent packet to the size of the payload section in a single rte_membuf.

    If you're interested in using DPDK to record pcaps, you may look into dpdk-pdump and dumpcap.

    I've also had good performance in the past when building my own packet recorder, especially since I know I can program it to receive and record any jumbo packets and run across any number of queues and threads.