Package: tcpreplay
Version: 2.99+3.0.beta11-3
Severity: normal
Tags: patch
Hi,
I'm trying to resend the output of ulogd-pcap to an Ethernet network
with tcpreplay. These pcap files are type DLT_RAW rather than the more
common DLT_EN10MB, so they need a fake Ethernet header around them.
The tcprewrite options '--dlt' (change DLT type) and '--dlink' (rewrite
L2 header) are made for this, but '--dlt' doesn't work:
% file ulogd.pcap
ulogd.pcap: tcpdump capture file (little-endian) - version 2.4 (raw IP, capture
length 65535)
% tcprewrite --dlink=ff,ff,de,ad,be,ef,00,00,de,ad,be,ef,08,00 --dlt=1 -i
ulogd.pcap -o ethernet.pcap
Unable to edit packets given options/DLT types:
Sorry, but tcpedit currently only supports writing to DLT_EN10MB output
Obviously, this is incorrect since I'm explicitly requesting DLT_EN10MB
output (defined as 1 in /usr/include/pcap_bpf.h).
Looking at the code, the '--dlt' option isn't taken into account properly
when tcpedit_validate() is called. The attached patch fixes this. Please
consider including it.
Cheers,
--
Niko Tyni [EMAIL PROTECTED]
--- tcpreplay-2.99+3.0.beta11/src/tcprewrite.c
+++ tcpreplay-2.99+3.0.beta11/src/tcprewrite.c
@@ -111,7 +111,7 @@
#endif
if (tcpedit_validate(&tcpedit, pcap_datalink(options.pin),
- pcap_datalink(options.pin)) < 0) {
+ HAVE_OPT(DLT) ? OPT_ARG(DLT) : pcap_datalink(options.pin)) < 0) {
errx(1, "Unable to edit packets given options/DLT types:\n%s",
tcpedit_geterr(&tcpedit));
}