CommonUnixIPGlobalProperties assumes that libc has getdomainname and gethostname functions.
On solaris these functions are not defined on libc but instead they are defined on libnsl. You can see a related discussion at https://lists.gnu.org/archive/html/bug-gnulib/2010-11/msg00328.html.
Mono.Unix.Native.Syscall also defines getdomainname and gethostname. https://github.com/mono/mono/blob/b7a308f660de8174b64697a422abfc7315d07b8c/mcs/class/Mono.Posix/Mono.Unix.Native/Syscall.cs#L4230
This uses MPH lib which defines the functions here: https://github.com/mono/mono/blob/b7a308f660de8174b64697a422abfc7315d07b8c/support/unistd.c#L212
The patch at https://bugzilla.xamarin.com/show_bug.cgi?id=32010 will add the correct getdomainname and gethostname functions to unistd.c (maybe ?). In order to fix CommonUnixIPGlobalProperties I think we should have it call into Mono.Unix.Native.Syscall.getdomainname instead of declaring getdomainname as an extern to libc.
This popped up because the System.Net.CookieContainer class was migrated to use the ms reference sources. The ms reference sources grab the domain name https://github.com/Microsoft/referencesource/blob/master/System/net/System/Net/cookiecontainer.cs#L122.
A simple test case for solaris would be:
I'm not sure if calling getdomainname on libnsl is actually the correct thing to do here. According that that linked discussion the usage of getdomainname is discouraged because it really returns the NIS domainname, not necessarily the DNS domain name.
Although we have not fully updated our website to reflect this yet, we do not actively support solaris/sparc anymore. (On testing, I was not readily able to even compile current mono on a stock Solaris 11.) We are happy to take community patches, however.
Do you have the ability to compile Mono yourself? There are two things I am wondering:
- Have you had an opportunity to test the patch in #32010? Can you confirm it works?
- Would you be willing to submit a patch for the CommonUnixIPGlobalProperties issue? Unfortunately the mono class libraries cannot take a dependency on Mono.Posix, so what I would recommend is having something at compile time detect the platform is solaris rather than and substitute libnsl in the DllImport.
I am assigning this bug to you, please feel free to assign back to me with your response.
The specific environment I was using was SmartOS.
They use pkgsrc to build mono: https://pkgsrc.joyent.com
There are currently quite a few patches required to build mono successfully: ftp://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/lang/mono/patches/
I haven't tried to compile mono my self yet. I'm assuming it's as simple as running a bmake in the pkgsrc/mono directory.
I have not tried the patch in #32010 yet.
Do you have an example on how to perform the substitution?
I'm not sure I have the time to actually tackle the bug, but if I have time this weekend I'll see if I can get mono compiled.