Open ChuckCottrill opened 1 month ago
layer-2 checksum is correct. layer-4 (TCP) checksum is incorrect
IPv4 has checksum https://en.wikipedia.org/wiki/Internet_checksum
IPv6 does not have checksum https://networkengineering.stackexchange.com/questions/64803/why-does-the-ipv6-header-not-include-a-checksum
IPv4, IPv6 Headers https://notes.shichao.io/tcpv1/ch5/
RFC-1701 checksum https://www.packetmania.net/en/2021/12/26/IPv4-IPv6-checksum/
RFC-1141 incremental update checksum https://datatracker.ietf.org/doc/html/rfc1141
TCP pseudo-header http://www.tcpipguide.com/free/t_TCPChecksumCalculationandtheTCPPseudoHeader-2.htm
Overview
The tcpreplay program
tcprewrite
does not support IPv6 FRAG(mented) header checksum recalculation. The protocol0x2c
is not included in the switch statement, and thus aTCPEDIT_WARN
is generated and the header checksum is not recalculated.The option
--fixcsum
does not work against the original11465.0-0.unknown_1.v6.pcap
pcap (and others) due to how the protocol value supplied todo_checksum()
is handled. The protocol is IPV6-FRAG(mented). There is a switch statement where the protocol value(== 0x2c)
is not one of the recognized values. Thetcprewrite
code explicitly returns indication (TCPEDIT_WARN
) that certain packets (both TCP and HTTP) do not have their checksum recalculated. Since the checksum needs to be correctly calculated, this incorrect checksum causes the pcap to fail testing.Expected Behavior
An IPV6 FRAGmented packet should have correct checksum calculated when packet is rewritten.
Description of desired solution
Since tcpreplay does not support IPv6-FRAG(ment) header checksum recalculation. The protocol
0x2c
is not included in the switch statement, and thus aTCPEDIT_WARN
is generated and the header checksum is not recalculated.What is desired is that the protocol
0x2c
be recognized and the correct header checksum be calculated and replaced, rather than the warningTCPEDIT_WARN
generated, and the generated pcap file not be corrupted with an invalid checksum.Add the protocol
0x2c
to the constantssrc/tcpr.h
And the protocol added to the switch statement in
src/tcpedit/checksum.c
see:
To Reproduce Steps to reproduce the behavior:
protocol == 0x2c
(IPV6 FRAG
(mented))tcpprep
on pcaptcprewrite
on pcap (change src/dest ip address to precipitate checksum recalculation)Describe alternatives you've considered
The header checksum is not correctly rewritten by tcpreplay in this situation. Either:
a) do nothing (unacceptable), b) rewrite checksum using some external program, c) recalculate header checksum for these packets (this solution) d) ideas? suggestions? how else can we recalculate header checksums?
Additional context The TCP case can be fixed with a patch to allow protocol value
0x2c
to be handled the same way asIPPROTO_TCP
, but this patch does not work for (HTTP protocol). Further investigation is needed. Screenshots If applicable, add screenshots to help explain your problem.System (please complete the following information):
Additional context Add any other context about the problem here.