From e4d8c0cd87ea5be38e941cef81c7d5341e9ea3e5 Mon Sep 17 00:00:00 2001 From: thfr Date: Mon, 25 Mar 2019 13:05:39 +0000 Subject: [PATCH] fix mono's DNS lookup by using MacOsNetworkInterfaceAPI like FreeBSD does, fixes GitHub issue #8168, ok robert@ (maintainer) --- lang/mono/Makefile | 4 +- ...Net_NetworkInformation_NetworkInterface_cs | 18 ++++++++ .../patch-mcs_class_System_System_Platform_cs | 42 +++++++++++++++++++ 3 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 lang/mono/patches/patch-mcs_class_System_System_Net_NetworkInformation_NetworkInterface_cs create mode 100644 lang/mono/patches/patch-mcs_class_System_System_Platform_cs diff --git a/lang/mono/Makefile b/lang/mono/Makefile index 27c5794eeaf..70bbd41fb40 100644 --- a/lang/mono/Makefile +++ b/lang/mono/Makefile @@ -1,11 +1,11 @@ -# $OpenBSD: Makefile,v 1.123 2019/01/11 18:49:37 jca Exp $ +# $OpenBSD: Makefile,v 1.124 2019/03/25 13:05:39 thfr Exp $ USE_WXNEEDED= Yes COMMENT= cross platform, open source .NET developement framework V= 5.14.0.177 -REVISION= 0 +REVISION= 1 DISTNAME= mono-${V} diff --git a/lang/mono/patches/patch-mcs_class_System_System_Net_NetworkInformation_NetworkInterface_cs b/lang/mono/patches/patch-mcs_class_System_System_Net_NetworkInformation_NetworkInterface_cs new file mode 100644 index 00000000000..c8b93733e31 --- /dev/null +++ b/lang/mono/patches/patch-mcs_class_System_System_Net_NetworkInformation_NetworkInterface_cs @@ -0,0 +1,18 @@ +$OpenBSD: patch-mcs_class_System_System_Net_NetworkInformation_NetworkInterface_cs,v 1.1 2019/03/25 13:05:39 thfr Exp $ + +Initialize network interface for OpenBSD like for FreeBSD to address issue +https://github.com/mono/mono/issues/8168 +Pull Request: https://github.com/mono/mono/pull/13633 + +Index: mcs/class/System/System.Net.NetworkInformation/NetworkInterface.cs +--- mcs/class/System/System.Net.NetworkInformation/NetworkInterface.cs.orig ++++ mcs/class/System/System.Net.NetworkInformation/NetworkInterface.cs +@@ -526,7 +526,7 @@ namespace System.Net.NetworkInformation { + bool runningOnUnix = (Environment.OSVersion.Platform == PlatformID.Unix); + + if (runningOnUnix) { +- if (Platform.IsMacOS || Platform.IsFreeBSD) ++ if (Platform.IsMacOS || Platform.IsFreeBSD || Platform.IsOpenBSD) + return new MacOsNetworkInterfaceAPI (); + + return new LinuxNetworkInterfaceAPI (); diff --git a/lang/mono/patches/patch-mcs_class_System_System_Platform_cs b/lang/mono/patches/patch-mcs_class_System_System_Platform_cs new file mode 100644 index 00000000000..de205ddc980 --- /dev/null +++ b/lang/mono/patches/patch-mcs_class_System_System_Platform_cs @@ -0,0 +1,42 @@ +$OpenBSD: patch-mcs_class_System_System_Platform_cs,v 1.1 2019/03/25 13:05:39 thfr Exp $ + +add bool for Platform.IsOpenBSD, to address +https://github.com/mono/mono/issues/8168 +Upstreamed in PR: https://github.com/mono/mono/pull/13633 + +Index: mcs/class/System/System/Platform.cs +--- mcs/class/System/System/Platform.cs.orig ++++ mcs/class/System/System/Platform.cs +@@ -48,6 +48,7 @@ namespace System { + + #else + static bool isFreeBSD; ++ static bool isOpenBSD; + + [DllImport ("libc")] + static extern int uname (IntPtr buf); +@@ -68,6 +69,9 @@ namespace System { + case "FreeBSD": + isFreeBSD = true; + break; ++ case "OpenBSD": ++ isOpenBSD = true; ++ break; + } + } + Marshal.FreeHGlobal (buf); +@@ -88,6 +92,14 @@ namespace System { + if (!checkedOS) + CheckOS(); + return isFreeBSD; ++ } ++ } ++ ++ public static bool IsOpenBSD { ++ get { ++ if (!checkedOS) ++ CheckOS(); ++ return isOpenBSD; + } + } + }