feature: fix/recalculate header checksum for ipv6-frag(mentation) pac…#900
Merged
fklassen merged 1 commit intoappneta:Feature_#897_IPv6-frag_checksumfrom Jun 30, 2025
Conversation
Contributor
Author
|
see issue: #897 |
Member
|
Thanks for the PR. Sorry for delay. I only work on TCPR when on vacation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
The tcpreplay program
tcprewritedoes not support IPv6 FRAG(mented) header checksum recalculation. The protocol0x2cis not included in the switch statement, and thus aTCPEDIT_WARNis generated and the header checksum is not recalculated.The option
--fixcsumdoes not work against the originalredacted-v6.pcappcap (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. Thetcprewritecode 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
0x2cis not included in the switch statement, and thus aTCPEDIT_WARNis generated and the header checksum is not recalculated.What is desired is that the protocol
0x2cbe recognized and the correct header checksum be calculated and replaced, rather than the warningTCPEDIT_WARNgenerated, and the generated pcap file not be corrupted with an invalid checksum.Add the protocol
0x2cto the constantssrc/tcpr.hAnd the protocol added to the switch statement in
src/tcpedit/checksum.csee:
To Reproduce
Steps to reproduce the behavior:
protocol == 0x2c(IPV6 FRAG(mented))tcpprepon pcaptcprewriteon 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
0x2cto 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.
Standards checklist: