Skip to content

Swift IPv4 add support for outbound fragments - #56

Merged
agnosticdev merged 3 commits into
mainfrom
agnosticdev/IPv4OutboundFragments
Jul 28, 2026
Merged

Swift IPv4 add support for outbound fragments#56
agnosticdev merged 3 commits into
mainfrom
agnosticdev/IPv4OutboundFragments

Conversation

@agnosticdev

Copy link
Copy Markdown
Collaborator

Add support for Swift IPv4 for outbound fragmentation.

@agnosticdev
agnosticdev requested a review from rpaulo July 22, 2026 23:35

mutating func writeOutboundFrames(_ frames: inout FrameArray) {
frames.iterateMutableFrames { frame in
var output = FrameArray()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we avoid unconditionally creating a new array here? If we don't need fragmentation, I'd rather modify in place

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One way we could do this is create a fragments array at the start of the function. Then keep frames.iterateMutableFrames for the standard path. If a frame in that array is detected to have a payload over the MTU and we need to split it those fragments are added to the fragment array. The thing to consider is that those newly generated fragments are then added to the end of the outbound frames array. This is a slight deviation in ordering that we may need to consider here.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the logic in b6e417a

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a change to preserve the ordering 37e1d07

@agnosticdev
agnosticdev merged commit 7cd7794 into main Jul 28, 2026
23 checks passed
@agnosticdev
agnosticdev deleted the agnosticdev/IPv4OutboundFragments branch July 28, 2026 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants