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

Add sctp.Association.Abort(reason string) method #183

Merged
merged 1 commit into from
May 11, 2022

Conversation

jeremija
Copy link
Member

@jeremija jeremija commented Feb 20, 2021

According to RFC 4960 Section 9.1. Also see my comment at #176, more precisely: #176 (comment)

Closes #182.

I don't think we currently do any tag verification for any packets, but we can implement that later.

I think that Close method should be modified to call Abort("close") or similar; I was unable to find any part of the spec that allows just closing the underlying connection.

@jeremija jeremija requested review from enobufs and Sean-Der February 20, 2021 09:44
@codecov
Copy link

codecov bot commented Feb 20, 2021

Codecov Report

Merging #183 (5eb7e48) into master (da38088) will decrease coverage by 2.54%.
The diff coverage is 88.09%.

❗ Current head 5eb7e48 differs from pull request most recent head 50c75e6. Consider uploading reports for the commit 50c75e6 to get more accurate results

@@            Coverage Diff             @@
##           master     #183      +/-   ##
==========================================
- Coverage   80.64%   78.09%   -2.55%     
==========================================
  Files          47       47              
  Lines        3901     2648    -1253     
==========================================
- Hits         3146     2068    -1078     
+ Misses        617      441     -176     
- Partials      138      139       +1     
Flag Coverage Δ
go 78.09% <88.09%> (-2.55%) ⬇️
wasm 64.53% <2.38%> (-3.29%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
error_cause_user_initiated_abort.go 77.77% <77.77%> (ø)
association.go 81.50% <90.32%> (-2.90%) ⬇️
error_cause.go 37.77% <100.00%> (+3.73%) ⬆️
chunk_init_ack.go 19.35% <0.00%> (-18.15%) ⬇️
chunk_init.go 19.35% <0.00%> (-17.01%) ⬇️
chunk_init_common.go 54.16% <0.00%> (-11.36%) ⬇️
packet.go 67.90% <0.00%> (-5.18%) ⬇️
chunk_cookie_ack.go 55.55% <0.00%> (-4.45%) ⬇️
chunk_payload_data.go 68.96% <0.00%> (-3.88%) ⬇️
paramtype.go 13.79% <0.00%> (-3.67%) ⬇️
... and 40 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update da38088...50c75e6. Read the comment docs.

@jeremija jeremija force-pushed the jeremija/issue-182-implement-abort branch 2 times, most recently from ddb16a6 to c3b10d2 Compare February 20, 2021 09:50
Copy link
Member

@enobufs enobufs left a comment

Choose a reason for hiding this comment

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

Just one minor request from me. There's merge conflict to resolve. Other changes look good to me.

import (
"fmt"
)

Copy link
Member

Choose a reason for hiding this comment

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

Are you able to add the following text just to be consistent with other error_cause_xxx.go files?

/*
   This error cause MAY be included in ABORT chunks that are sent
   because of an upper-layer request.  The upper layer can specify an
   Upper Layer Abort Reason that is transported by SCTP transparently
   and MAY be delivered to the upper-layer protocol at the peer.

        0                   1                   2                   3
        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |         Cause Code=12         |      Cause Length=Variable    |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       /                    Upper Layer Abort Reason                   /
       \                                                               \
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, I'll try to address it over the next couple of days

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

Copy link
Member

@enobufs enobufs May 7, 2022

Choose a reason for hiding this comment

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

Thanks @jeremija !

Some auto tests are failing with TestAssociation_HandlePacketBeforeInit/Abort.
From what I can see, a.handleAbort() calls a.close() which sets the state to closed. Then the test case calls a.Close() which complains "use of closed network connection".

I think calling a.close() on the receipt of Abort chunk is right. I believe we could safely skip a.Close() in the test when the test case is "Abort" in TestAssociation_HandlePacketBeforeInit.

Otherwise, it all looks good to me!

Copy link
Member

Choose a reason for hiding this comment

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

This is something from before but I think this test case name should be changed to something like: "TestAssociation_HandlePacketInCookieWaitState" IMO.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, I didn't realize there was a failing test. It should be fixed now. I also renamed the test case.

@enobufs
Copy link
Member

enobufs commented May 9, 2022

@jeremija I am pretty sure this is a test issue. If you'd prefer, I can sort this out for you. Please let me know.

@jeremija jeremija force-pushed the jeremija/issue-182-implement-abort branch 2 times, most recently from cf3a11a to 23f7b42 Compare May 10, 2022 07:50
According to RFC 4960. Also see my comment at #176.

Closes #182.

I don't think we currently do any tag verification for any packets, but
we can implement that later.
@jeremija jeremija force-pushed the jeremija/issue-182-implement-abort branch from 23f7b42 to 50c75e6 Compare May 10, 2022 07:50
Copy link
Member

@enobufs enobufs left a comment

Choose a reason for hiding this comment

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

Thanks @jeremija . LGTM!

@enobufs enobufs merged commit e4e606d into master May 11, 2022
@enobufs enobufs deleted the jeremija/issue-182-implement-abort branch May 11, 2022 03:00
@at-wat at-wat mentioned this pull request Nov 24, 2022
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.

Implement Abort according to RFC 4960
2 participants