Skip to content

Update RX sequence number after refusing TCP FIN packet. - #1195

Merged
aggarg merged 4 commits into
FreeRTOS:mainfrom
ActoryOu:UpdateSeqAfterRefuseFin
Oct 7, 2024
Merged

aggarg merged 4 commits into
FreeRTOS:mainfrom
ActoryOu:UpdateSeqAfterRefuseFin

Conversation

@ActoryOu

@ActoryOu ActoryOu commented Oct 3, 2024

Copy link
Copy Markdown
Contributor

Update RX sequence number after refusing TCP FIN packet.

Description

As FreeRTOS Forum TCP Refusing FIN mentioned, the expected RX sequence is not well handled in the stack when refusing FIN. Update the RX sequence number when hitting this scenario.

Test Steps

Refer to this forum post for the test result.

  1. Create TCP connection.
  2. Keep sending packets.
  3. Receiving FIN packet.

Checklist:

  • I have tested my changes. No regression in existing tests.
  • [] I have modified and/or added unit-tests to cover the code changes in this Pull Request.

Related Issue

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@ActoryOu
ActoryOu requested a review from a team as a code owner October 3, 2024 05:22

@htibosch htibosch left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you @ActoryOu for this PR. I already commented the case on the FreeRTOS forum.
I also agree with this extra check:

+    if( lDistance == 1 )
+    {
         pxTCPWindow->rx.ulCurrentSequenceNumber =
             pxTCPWindow->rx.ulFINSequenceNumber + 1U;
+    }
}

tony-josi-aws
tony-josi-aws previously approved these changes Oct 3, 2024
tony-josi-aws
tony-josi-aws previously approved these changes Oct 3, 2024
@mike919192

Copy link
Copy Markdown
Contributor

Hi, I have backported the changes to TCP 3.1.0 for testing, using kernel 10.5.1 and Xilinx Zynq port. All appears to be working as expected. Let me know if there is any other information I can provide. Thanks for the great support!

Gain: Socket 6000 now has 1 / 1 child
prvSocketSetMSS: 1460 bytes for C0A81505ip:53356
Socket 6000 -> C0A81505ip:53356 State eCLOSED->eSYN_FIRST
prvWinScaleFactor: uxRxWinSize 2 MSS 1460 Factor 0
Socket 6000 -> C0A81505ip:53356 State eSYN_FIRST->eSYN_RECEIVED
TCP: passive 6000 => C0A81505ip:53356 set ESTAB (scaling 1)
Socket 6000 -> C0A81505ip:53356 State eSYN_RECEIVED->eESTABLISHED
Starting network tasks
Refusing FIN[6000,53356]: RxCompl 1 tx done 0
TCP: RST received from C0A81505ip:53356 for 6000
Socket 6000 -> C0A81505ip:53356 State eESTABLISHED->eCLOSED
error reading from socket
Notify txTask to shutdown
Tx task is deleting itself
Lost: Socket 6000 now has 0 / 1 children
FreeRTOS_closesocket[6000 to C0A81505ip:53356]: buffers 64 socks 1
Rx task is deleting itself

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
@aggarg
aggarg merged commit d89a9fa into FreeRTOS:main Oct 7, 2024
@ActoryOu
ActoryOu deleted the UpdateSeqAfterRefuseFin branch October 8, 2024 02:15
@rgezikov rgezikov mentioned this pull request Nov 7, 2026
2 tasks done
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.

5 participants