Skip to content

Commit 9a2d802

Browse files
authored
Merge pull request #1415 from Unity-Technologies/ipv6-unity-fix
Allowing sockets to be created with icmpv6 (case 1309061)
2 parents 035ddac + 4630550 commit 9a2d802

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

mcs/class/System/System.Net.Sockets/Socket.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ void SocketDefaults ()
147147
this.DontFragment = false;
148148
if (protocolType == ProtocolType.Tcp)
149149
this.NoDelay = false;
150-
} else if (addressFamily == AddressFamily.InterNetworkV6) {
150+
// The socket was created successfully; enable IPV6_V6ONLY by default for normal AF_INET6 sockets.
151+
// This fails on raw sockets so we just let them be in default state.
152+
} else if (addressFamily == AddressFamily.InterNetworkV6 && socketType != SocketType.Raw) {
151153
this.DualMode = true;
152154
}
153155

mono/metadata/w32socket.c

+1
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ convert_proto (MonoProtocolType mono_proto)
378378
case ProtocolType_Pup:
379379
case ProtocolType_Udp:
380380
case ProtocolType_Idp:
381+
case ProtocolType_IcmpV6:
381382
/* These protocols are known (on my system at least) */
382383
return mono_proto;
383384
case ProtocolType_ND:

mono/metadata/w32socket.h

+8
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,19 @@ typedef enum {
7878
ProtocolType_Icmp=1,
7979
ProtocolType_Igmp=2,
8080
ProtocolType_Ggp=3,
81+
ProtocolType_IPv4=4,
8182
ProtocolType_Tcp=6,
8283
ProtocolType_Pup=12,
8384
ProtocolType_Udp=17,
8485
ProtocolType_Idp=22,
8586
ProtocolType_IPv6=41,
87+
ProtocolType_IPv6RoutingHeader=43,
88+
ProtocolType_IPv6FragmentHeader=44,
89+
ProtocolType_IPSecEncapsulatingSecurityPayload=50,
90+
ProtocolType_IPSecAuthenticationHeader=51,
91+
ProtocolType_IcmpV6=58,
92+
ProtocolType_IPv6NoNextHeader=59,
93+
ProtocolType_IPv6DestinationOptions=60,
8694
ProtocolType_ND=77,
8795
ProtocolType_Raw=255,
8896
ProtocolType_Unspecified=0,

0 commit comments

Comments
 (0)