[Mono-list] SOL_IP and SOL_IPV6 on FreeBSD

Gonzalo Paniagua Javier gonzalo@ximian.com
Thu, 21 Aug 2003 19:20:16 +0200


--=-6QJP7tWP2pqxsybdm/lV
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

El jue, 21-08-2003 a las 18:20, Chipzz escribió:
> Someone has been a little careless it appears...
> 
> checking for SOL_IP... no
> checking for SOL_IPV6... no
> 
> ...
> 
> socket-io.c: In function `ves_icall_System_Net_Sockets_Socket_SetSocketOption_in
> ternal':
> socket-io.c:1513: `SOL_IPV6' undeclared (first use in this function)
> socket-io.c:1513: (Each undeclared identifier is reported only once
> socket-io.c:1513: for each function it appears in.)
> socket-io.c:1532: `SOL_IP' undeclared (first use in this function)
> 
> System is FreeBSD, 5.1-RELEASE for base and 5.1-CURRENT for ports.
> 
> Please CC me as I'm not subscribed to the list.

Try this patch. If it works for you, I'll commit.

-Gonzalo


--=-6QJP7tWP2pqxsybdm/lV
Content-Disposition: attachment; filename=solip.patch
Content-Type: text/plain; name=solip.patch; charset=iso-8859-1
Content-Transfer-Encoding: 7bit

? entry
? icall307
? manualreset.txt
? mythp
? type
Index: socket-io.c
===================================================================
RCS file: /cvs/public/mono/mono/metadata/socket-io.c,v
retrieving revision 1.44
diff -u -r1.44 socket-io.c
--- socket-io.c	16 Aug 2003 02:08:07 -0000	1.44
+++ socket-io.c	21 Aug 2003 17:31:13 -0000
@@ -1465,6 +1465,30 @@
 	int system_level;
 	int system_name;
 	int ret;
+#ifdef AF_INET6
+	int sol_ip;
+	int sol_ipv6;
+
+#ifdef HAVE_SOL_IPV6
+	sol_ipv6 = SOL_IPV6;
+#else
+	{
+		struct protoent *pent;
+		pent = getprotobyname ("ipv6");
+		sol_ipv6 = (pent != NULL) ? pent->p_proto : 41;
+	}
+#endif
+
+#ifdef HAVE_SOL_IP
+	sol_ip = SOL_IP;
+#else
+	{
+		struct protoent *pent;
+		pent = getprotobyname ("ip");
+		sol_ip = (pent != NULL) ? pent->p_proto : 0;
+	}
+#endif
+#endif /* AF_INET6 */
 
 	MONO_ARCH_SAVE_REGS;
 
@@ -1510,7 +1534,7 @@
 			MonoObject *address = NULL;
 
 #ifdef AF_INET6
-			if(system_level == SOL_IPV6) {
+			if(system_level == sol_ipv6) {
 				struct ipv6_mreq mreq6;
 
 				/*
@@ -1529,7 +1553,7 @@
 				ret = setsockopt (sock, system_level,
 						  system_name, &mreq6,
 						  sizeof (mreq6));
-			} else if(system_level == SOL_IP)
+			} else if(system_level == sol_ip)
 #endif /* AF_INET6 */
 			{
 #ifdef HAVE_STRUCT_IP_MREQN

--=-6QJP7tWP2pqxsybdm/lV--