Repository navigation
Fix IP defragmentation regression introduced in commit 219f2febd - #5256
Open
ParksProjets wants to merge 1 commit into
Open
ParksProjets wants to merge 1 commit into
ParksProjets wants to merge 1 commit into
Conversation
The cleanup commit 219f2fe broke IP defragmentation functions in the following ways: - Disordered fragments cause failure when last fragment was not the last packet in the list. - Bad fragmented packets were not returned when last fragment packet was not present. - "badfrag" was a list of tuple, instead of a list of packets AI-Assisted: no
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.
This PR fixes regressions introduced by cleanup commit 219f2fe (PR #4082). It broke IP defragmentation functions (
defrag()anddefragment()) in the following ways:Disordered fragments cause the functions to fail when the last fragment was not the last packet in the list. Before the cleanup, fragments handled in two passes: they were first sorted by ID, then defragmented. Now they are defragmentated 'on-the-flow', when the last fragment is found. However, if there were disordered fragments after the LF one, they were not considered and defragmentation failed.
Packets with missing framgments, where the LF fragment was also missing, were not returned by
defrag()as bad fragments.The bad fragments list returned by
defrag()function was a list of tuple instead ofa list of packets.These issues were not present in scapy 2.5.0.
Final note: I wrote this commit in a "quick-and-dirty" way; you can rewrite it if you don't like the code, as long as these issues are fixed.