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

check for WSAEMSGSIZE errors when receiving UDP packets on Windows #3982

Merged
merged 2 commits into from
Jul 21, 2023

Conversation

marten-seemann
Copy link
Member

Fixes #3956. @thepaul, could you give this patch a try?

@codecov
Copy link

codecov bot commented Jul 20, 2023

Codecov Report

Merging #3982 (ab84587) into master (56cd866) will increase coverage by 0.07%.
The diff coverage is 80.00%.

@@            Coverage Diff             @@
##           master    #3982      +/-   ##
==========================================
+ Coverage   82.92%   82.99%   +0.07%     
==========================================
  Files         146      146              
  Lines       14707    14801      +94     
==========================================
+ Hits        12195    12284      +89     
- Misses       2022     2030       +8     
+ Partials      490      487       -3     
Impacted Files Coverage Δ
transport.go 63.43% <33.33%> (-0.48%) ⬇️
send_queue.go 100.00% <100.00%> (ø)
sys_conn_df_linux.go 41.51% <100.00%> (+1.12%) ⬆️
sys_conn_df_windows.go 62.50% <100.00%> (+5.36%) ⬆️

... and 3 files with indirect coverage changes

Copy link
Collaborator

@sukunrt sukunrt left a comment

Choose a reason for hiding this comment

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

For windows this looks okay.
What happens on linux here? https://man7.org/linux/man-pages/man3/recvfrom.3p.html says

If a message is too long to fit in the supplied
buffer, and MSG_PEEK is not set in the flags argument, the excess
bytes shall be discarded.

Is this fine?

You might have to do handling for macOS since we merged #3946

@thepaul
Copy link

thepaul commented Jul 20, 2023

Fixes #3956. @thepaul, could you give this patch a try?

This does indeed fix the problem, according to my tests.

You might have to do handling for macOS since we merged #3946

No changes should be necessary- the DF bit on outgoing datagrams shouldn't affect recvfrom(). It would affect things if we were using recvmsg() instead, and able to receive MSG_TRUNC control messages, but quic-go isn't there yet I think.

@sukunrt
Copy link
Collaborator

sukunrt commented Jul 20, 2023

@thepaul yes, there's no real change involved here. My comment was related to changes in sys_conn_df.go done in https://github.com/quic-go/quic-go/pull/3946/files

That commit changed the build flags on sys_conn_df.go and introduced sys_conn_df_darwin.go. An older version of these files is modified in this PR.

@thepaul
Copy link

thepaul commented Jul 20, 2023

Oh yes, I did read that change- sorry I wasn't clear! That change seems to amount to "set the DF bit on outgoing packets", and my claim is that that won't affect what is received with recvfrom().

@sukunrt
Copy link
Collaborator

sukunrt commented Jul 20, 2023

This PR splits isMsgSizeErr into isSendMsgSizeErr and isRecvMsgSizeErr. That change needs to be made in this file too https://github.com/quic-go/quic-go/blob/master/sys_conn_df_darwin.go

@marten-seemann
Copy link
Member Author

This PR splits isMsgSizeErr into isSendMsgSizeErr and isRecvMsgSizeErr. That change needs to be made in this file too https://github.com/quic-go/quic-go/blob/master/sys_conn_df_darwin.go

I see. This PR was based on an older commit, that's why CI succeeded on push, but failed on pull_request. I rebased and fixed.

sys_conn_df_darwin.go Outdated Show resolved Hide resolved
@marten-seemann marten-seemann merged commit 2bcfe5b into master Jul 21, 2023
28 checks passed
@marten-seemann marten-seemann deleted the check-msg-size-error branch July 21, 2023 17:28
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.

potential failure on Windows if UDP payload > 1472 bytes
3 participants