PCAP Replay
Replays a previously recorded PCAP or PCAPNG capture as if it were a live device. Nothing is sent to a network: the driver connects, and the frames it "receives" come out of the file.
This is a debugging and development transport. It is what lets you work on a driver against a capture taken from a machine you cannot reach, and it pairs naturally with the audit-log - record once, then replay as often as you need.
Transport syntax
The capture is named by the pcap-replay.pcap-file parameter; the address segment of the
connection string is not interpreted.
profinet:pcap-replay://?pcap-replay.pcap-file=/tmp/line-3.pcapng&pcap-replay.speed-factor=1.0
Name |
Type |
Default Value |
Required |
Description |
Name |
PCAP Replay |
|||
Code |
|
|||
Maven Dependency |
<dependency> <groupId>org.apache.plc4x</groupId> <artifactId>plc4j-transports-pcap-replay</artifactId> <version>1.0.0</version> </dependency> |
|||
Config options: |
||||
|
STRING |
required |
Path to the PCAP file to replay. |
|
|
STRING |
Local MAC address to simulate (acts as this device). |
||
|
STRING |
Remote MAC address to communicate with. |
||
|
INT |
0 |
EtherType / Protocol number to filter (e.g., 0x88B5 for PROFINET). |
|
|
DOUBLE |
0 |
Replay speed multiplier. 1.0 = real-time, 0.0 = as fast as possible, 2.0 = double speed. |
|
|
BOOLEAN |
false |
Loop the PCAP file when it reaches the end. |
|
|
BOOLEAN |
true |
Only replay packets from remote to local (simulates device responses). When false, replays all packets. |
|
|
BOOLEAN |
false |
Only replay packets from local to remote (simulates device requests). |
|
|
INT |
1500 |
Maximum frame size in bytes. |
|
|
INT |
0 |
Read timeout for blocking reads in milliseconds. |
|
|
INT |
1000 |
Buffer size for packet queue. |
|
|
BOOLEAN |
true |
Auto-detect MAC addresses from PCAP file based on first packet. |
|
|
BOOLEAN |
true |
Start replay automatically when transport is created. |
|
|
INT |
0 |
Filter by VLAN ID (0 means no VLAN filtering). |
|
Two options are worth knowing before the first run:
-
pcap-replay.speed-factordefaults to0, which replays the capture as fast as it can be read. Set it to1.0to reproduce the original timing - which is what you want when the bug you are chasing is a timing one. -
pcap-replay.only-incoming-packetsdefaults totrue, so by default only the frames the device sent are replayed and the driver’s own requests go nowhere. That is the right setting for standing in for a device.