Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set SCTP zero checksum #1015

Merged
merged 2 commits into from
Nov 1, 2023

Conversation

melpon
Copy link
Contributor

@melpon melpon commented Oct 24, 2023

Based on the discussion at #1012, where it was concluded that enabling SCTP_ACCEPT_ZERO_CHECKSUM is not an issue, I have implemented zero checksum.

Copy link
Owner

@paullouisageneau paullouisageneau left a comment

Choose a reason for hiding this comment

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

I don't think this works, since checksums for outgoing packets will always be computed here, even if the remote side is willing to accept zero-checksum packets:

*checksum = usrsctp_crc32c(data, len);

src/impl/sctptransport.cpp Outdated Show resolved Hide resolved
src/impl/sctptransport.cpp Outdated Show resolved Hide resolved
@melpon
Copy link
Contributor Author

melpon commented Oct 24, 2023

I see, it seems I misunderstood the specification. Thank you for the comment. I'll make the corrections.

@melpon
Copy link
Contributor Author

melpon commented Oct 25, 2023

I had been working on an implementation to eliminate the CRC calculation during transmission, but there were some issues.

The first issue is that it seems usrsctp users cannot be informed when SCTP_ZERO_CHECKSUM_ACCEPTABLE is received. As a result, it's not possible to determine within sctptransport.c whether there's a need to compute the CRC during transmission.

Thus, I decided to disable CRC offloading and let usrsctp handle the CRC computation. As long as we include usrsctp_setsockopt(IPPROTO_SCTP, SCTP_ACCEPT_ZERO_CHECKSUM), the CRC check during reception should not be conducted, similar to when CRC offloading is enabled.

The second issue is that, when usrsctp is connected using the AF_CONN address family, it appears to compute the CRC even if SCTP_ACCEPT_ZERO_CHECKSUM has been received from the server. This seems like a bug, so I've submitted a Pull Request addressing this at sctplab/usrsctp#690. However, it's uncertain if or when it will be merged.

If there's a better implementation approach, please let me know.

Copy link
Owner

@paullouisageneau paullouisageneau left a comment

Choose a reason for hiding this comment

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

It looks good now, thank you! I hope the issue with AF_CONN sockets in usrsctp can be sorted out, thanks for submitting the PR.

@paullouisageneau paullouisageneau changed the title Implements SCTP zero checksum Implement SCTP zero checksum Nov 1, 2023
@paullouisageneau paullouisageneau changed the title Implement SCTP zero checksum Set SCTP zero checksum Nov 1, 2023
@paullouisageneau paullouisageneau merged commit d5948b7 into paullouisageneau:master Nov 1, 2023
11 checks passed
paullouisageneau added a commit that referenced this pull request Nov 17, 2023
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