Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] tcprewrite fails with "From tcpedit.c:tcpedit_packet() line 192: Packet length 98 is to short to contain an IPv6 header for DLT 0x0001" #611

Closed
yp-isi opened this issue Jun 25, 2020 · 2 comments
Assignees

Comments

@yp-isi
Copy link

yp-isi commented Jun 25, 2020

Describe the bug
TCP rewrite fails to parse input pcap file, exits with the error:

Fatal Error: Error rewriting packets: From tcpedit.c:tcpedit_packet() line 192:
Packet length 98 is to short to contain an IPv6 header for DLT 0x0001

To Reproduce
Steps to reproduce the behavior:

  1. Run tcprewrite as follows:
tcprewrite -vv -i afail1.pcap -o /dev/null --pnat="9.9.0.0/16:1.1.0.0/16"
  1. Observe the output:
reading from file -, link-type EN10MB (Ethernet)
17:11:17.1592871077 IP6 4950:3aa3:964b:a356:60a3:7dea:a836:3200 > 4efa:695:ee19:12d9:4906:6f8b:8bbb:6bd6: frag (0|36) 63927 > domain: 0 [0q] (28)

Fatal Error: Error rewriting packets: From tcpedit.c:tcpedit_packet() line 192:
Packet length 98 is to short to contain an IPv6 header for DLT 0x0001

Expected behavior
Not to fail. Even if the packet is not parse-able, it should either (a) drop it, (b) overwrite IPs, but not checksum, (c) leave such packets as is.

Screenshots
N/A

System (please complete the following information):

  • OS: linux
  • OS fedora 31
  • Tcpreplay Version
tcpreplay version: 4.3.2 (build git:v4.3.2)
Copyright 2013-2018 by Fred Klassen <tcpreplay at appneta dot com> - AppNeta
Copyright 2000-2012 by Aaron Turner <aturner at synfin dot net>
The entire Tcpreplay Suite is licensed under the GPLv3
Cache file supported: 04
Compiled against libdnet: 1.12
Compiled against libpcap: 1.9.1
64 bit packet counters: enabled
Verbose printing via tcpdump: enabled
Packet editing: disabled
Fragroute engine: enabled
Injection method: PF_PACKET send()
Not compiled with netmap

Additional context
Failed pcap attached.
afail1.pcap.gz

GabrielGanne added a commit to GabrielGanne/tcpreplay that referenced this issue Jul 13, 2020
Instead of hard failing on malformed packets, treat them as soft errors
and skip them. This concerns both malformed packets (eg. too short to
contain the expected protocol headers) and unsupported packets (eg.
fragmented IPv6 packets).

This is a partial fix for appneta#611

Signed-off-by: Gabriel Ganne <gabriel.ganne@gmail.com>
@fklassen fklassen self-assigned this Jul 23, 2020
@fklassen fklassen added the bug label Jul 23, 2020
@fklassen
Copy link
Member

I appears that the packet includes an IPv6 fragmentation header. Those are disabled by default, so it is extremely rare to find a capture with one in them.

I'm changing this to an "enhancement" since this packet type has never been supported.

@fklassen fklassen added enhancement and removed bug labels Mar 12, 2021
@fklassen
Copy link
Member

It appears to be working in 4.4.0-beta2. It was fixed with PR #677 which did some rewrites in general packet handling.

Marked as fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants