Fix and clarify default value for DontFragment property on UdpClient and Socket.#9416
Fix and clarify default value for DontFragment property on UdpClient and Socket.#9416StephenCleary wants to merge 1 commit intodotnet:mainfrom
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:
|
rzikm
left a comment
There was a problem hiding this comment.
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 bothUdpClientandSocket) isfalse. AFAICT, it's always beenfalse.