Skip to content

Fix: PSH flag must be set on last segment#52

Merged
gasbytes merged 2 commits intowolfSSL:masterfrom
danielinux:fix_psh_last_seg
Mar 2, 2026
Merged

Fix: PSH flag must be set on last segment#52
gasbytes merged 2 commits intowolfSSL:masterfrom
danielinux:fix_psh_last_seg

Conversation

@danielinux
Copy link
Member

In a train of packets, the last TCP segment is the one that should be marked with PSH, not the first.

Found via fenrir/240

Copilot AI review requested due to automatic review settings March 2, 2026 13:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes TCP segmentation flagging so that PSH is applied to the last segment in a queued send “train” (rather than the first), aligning behavior with typical TCP PSH semantics and the reported issue.

Changes:

  • Update wolfIP_sock_sendto() TCP path to set PSH after enqueuing, on the last queued segment.
  • Adjust the unit test to validate PSH on the last (second) segment and configure peer_mss to ensure deterministic segmentation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/wolfip.c Removes PSH-from-first-segment behavior and adds logic to set PSH on the last queued TCP segment.
src/test/unit/unit.c Updates the TCP multi-segment send test expectations and sets peer_mss to force a 2-segment enqueue.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gasbytes gasbytes self-requested a review March 2, 2026 14:14
@gasbytes gasbytes self-assigned this Mar 2, 2026
@gasbytes gasbytes merged commit 1876cdf into wolfSSL:master Mar 2, 2026
19 checks passed
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.

3 participants