-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fix and clarify default value for DontFragment property on UdpClient and Socket. #9416
base: main
Are you sure you want to change the base?
Conversation
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label. |
Learn Build status updates of commit d44ab53: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While we don't explicitly set DontFragment
in the source code, the default value can be set by the OS.
using System.Net.Sockets;
var sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
System.Console.WriteLine($"Sock.DontFragment: {sock.DontFragment}");
produces different values on different OSes, true on windows and false on linux. So unfortunately neither the original version nor your proposed change is correct.
@dotnet/ncl Should we make the defaults consistent across OSes? I know there are some platform-dependent behaviors on sockets but this seems like something we can reasonably unify.
Good catch on checking TCP sockets. I only checked UDP, which was false on both Windows and Linux. |
I see value in keeping OS defaults. With that we would respect OS setting - Windows registry, /proc, sysctl or whatever. |
Summary
The default value of
DontFragment
(for bothUdpClient
andSocket
) isfalse
. AFAICT, it's always beenfalse
.