Skip to content

Commit

Permalink
Fix IPv6 detection in QUIC tests
Browse files Browse the repository at this point in the history
In dotnet#75341, some QUIC tests were changed to only run when IPv6 is supported.
IPv6 was detected by binding a socket. However the socket was bound with an
invalid combination of `SocketType.Dgram` and `ProtocolType.Tcp`. On macOS,
this fails with the exception:

```
System.Net.Sockets.SocketException (41): Protocol wrong type for socket
```

See the docs for listing of which combinations are valid to use together:

https://docs.microsoft.com/dotnet/api/system.net.sockets.sockettype

Since QUIC uses UDP, I think the intention was to bind a UDP socket.
  • Loading branch information
AustinWise committed Sep 9, 2022
1 parent c746b8b commit 8d2198e
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ internal static bool GetIsIPv6Available()
{
try
{
using Socket s = new Socket(AddressFamily.InterNetworkV6, SocketType.Dgram, ProtocolType.Tcp);
using Socket s = new Socket(AddressFamily.InterNetworkV6, SocketType.Dgram, ProtocolType.Udp);
s.Bind(new IPEndPoint(IPAddress.IPv6Loopback, 0));
return true;
}
Expand Down

0 comments on commit 8d2198e

Please sign in to comment.