FreeBSD Bugzilla – Attachment 150260 Details for
Bug 194660
lang/mono Add mono/metadata/mono-route.c for non-Linux ParseRouteInfo_local
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
PR194660: Add mono/metadata/mono-route.c for non-Linux ParseRouteInfo_local
PR194660.patch (text/plain), 28.31 KB, created by
Ben Woods
on 2014-12-06 11:22:40 UTC
(
hide
)
Description:
PR194660: Add mono/metadata/mono-route.c for non-Linux ParseRouteInfo_local
Filename:
MIME Type:
Creator:
Ben Woods
Created:
2014-12-06 11:22:40 UTC
Size:
28.31 KB
patch
obsolete
>--- mcs/class/System/System.Net.NetworkInformation/GatewayIPAddressInformationCollection.cs.orig 2014-09-22 13:23:08 UTC >+++ mcs/class/System/System.Net.NetworkInformation/GatewayIPAddressInformationCollection.cs >@@ -128,18 +128,18 @@ namespace System.Net.NetworkInformation > } > } > >- class LinuxGatewayIPAddressInformationCollection : GatewayIPAddressInformationCollection >+ class UnixGatewayIPAddressInformationCollection : GatewayIPAddressInformationCollection > { >- public static readonly LinuxGatewayIPAddressInformationCollection Empty = new LinuxGatewayIPAddressInformationCollection (true); >+ public static readonly UnixGatewayIPAddressInformationCollection Empty = new UnixGatewayIPAddressInformationCollection (true); > > bool is_readonly; > >- private LinuxGatewayIPAddressInformationCollection (bool isReadOnly) >+ private UnixGatewayIPAddressInformationCollection (bool isReadOnly) > { > this.is_readonly = isReadOnly; > } > >- public LinuxGatewayIPAddressInformationCollection (IPAddressCollection col) >+ public UnixGatewayIPAddressInformationCollection (IPAddressCollection col) > { > foreach (IPAddress a in col) > Add (new GatewayIPAddressInformationImpl (a)); >--- mcs/class/System/System.Net.NetworkInformation/IPInterfaceProperties.cs.orig 2014-09-22 13:23:08 UTC >+++ mcs/class/System/System.Net.NetworkInformation/IPInterfaceProperties.cs >@@ -30,6 +30,7 @@ using System.Collections.Generic; > using System.Globalization; > using System.IO; > using System.Net.Sockets; >+using System.Runtime.CompilerServices; > using System.Text.RegularExpressions; > > namespace System.Net.NetworkInformation { >@@ -59,7 +60,6 @@ namespace System.Net.NetworkInformation > protected UnixNetworkInterface iface; > List <IPAddress> addresses; > IPAddressCollection dns_servers; >- IPAddressCollection gateways; > string dns_suffix; > DateTime last_parse; > >@@ -74,38 +74,6 @@ namespace System.Net.NetworkInformation > throw new NotImplementedException (); > } > >- void ParseRouteInfo (string iface) >- { >- try { >- gateways = new IPAddressCollection (); >- using (StreamReader reader = new StreamReader ("/proc/net/route")) { >- string line; >- reader.ReadLine (); // Ignore first line >- while ((line = reader.ReadLine ()) != null) { >- line = line.Trim (); >- if (line.Length == 0) >- continue; >- >- string [] parts = line.Split ('\t'); >- if (parts.Length < 3) >- continue; >- string gw_address = parts [2].Trim (); >- byte [] ipbytes = new byte [4]; >- if (gw_address.Length == 8 && iface.Equals (parts [0], StringComparison.OrdinalIgnoreCase)) { >- for (int i = 0; i < 4; i++) { >- if (!Byte.TryParse (gw_address.Substring (i * 2, 2), NumberStyles.HexNumber, null, out ipbytes [3 - i])) >- continue; >- } >- IPAddress ip = new IPAddress (ipbytes); >- if (!ip.Equals (IPAddress.Any)) >- gateways.Add (ip); >- } >- } >- } >- } catch { >- } >- } >- > static Regex ns = new Regex (@"\s*nameserver\s+(?<address>.*)"); > static Regex search = new Regex (@"\s*search\s+(?<domain>.*)"); > void ParseResolvConf () >@@ -188,16 +156,6 @@ namespace System.Net.NetworkInformation > return dns_suffix; > } > } >- >- public override GatewayIPAddressInformationCollection GatewayAddresses { >- get { >- ParseRouteInfo (this.iface.Name.ToString()); >- if (gateways.Count > 0) >- return new LinuxGatewayIPAddressInformationCollection (gateways); >- else >- return LinuxGatewayIPAddressInformationCollection.Empty; >- } >- } > > [MonoTODO ("Always returns true")] > public override bool IsDnsEnabled { >@@ -260,6 +218,8 @@ namespace System.Net.NetworkInformation > > class LinuxIPInterfaceProperties : UnixIPInterfaceProperties > { >+ IPAddressCollection gateways; >+ > public LinuxIPInterfaceProperties (LinuxNetworkInterface iface, List <IPAddress> addresses) > : base (iface, addresses) > { >@@ -272,10 +232,54 @@ namespace System.Net.NetworkInformation > > return ipv4iface_properties; > } >+ >+ void ParseRouteInfo (string iface) >+ { >+ try { >+ using (StreamReader reader = new StreamReader ("/proc/net/route")) { >+ string line; >+ reader.ReadLine (); // Ignore first line >+ while ((line = reader.ReadLine ()) != null) { >+ line = line.Trim (); >+ if (line.Length == 0) >+ continue; >+ >+ string [] parts = line.Split ('\t'); >+ if (parts.Length < 3) >+ continue; >+ string gw_address = parts [2].Trim (); >+ byte [] ipbytes = new byte [4]; >+ if (gw_address.Length == 8 && iface.Equals (parts [0], StringComparison.OrdinalIgnoreCase)) { >+ for (int i = 0; i < 4; i++) { >+ if (!Byte.TryParse (gw_address.Substring (i * 2, 2), NumberStyles.HexNumber, null, out ipbytes [3 - i])) >+ continue; >+ } >+ IPAddress ip = new IPAddress (ipbytes); >+ if (!ip.Equals (IPAddress.Any) && !gateways.Contains (ip)) >+ gateways.Add (ip); >+ } >+ } >+ } >+ } catch { >+ } >+ } >+ >+ public override GatewayIPAddressInformationCollection GatewayAddresses { >+ get { >+ gateways = new IPAddressCollection (); >+ ParseRouteInfo (this.iface.Name.ToString()); >+ if (gateways.Count > 0) >+ return new UnixGatewayIPAddressInformationCollection (gateways); >+ else >+ return UnixGatewayIPAddressInformationCollection.Empty; >+ } >+ } > } > > class MacOsIPInterfaceProperties : UnixIPInterfaceProperties > { >+ IPAddressCollection gateways; >+ > public MacOsIPInterfaceProperties (MacOsNetworkInterface iface, List <IPAddress> addresses) > : base (iface, addresses) > { >@@ -288,6 +292,37 @@ namespace System.Net.NetworkInformation > > return ipv4iface_properties; > } >+ >+ [MethodImplAttribute(MethodImplOptions.InternalCall)] >+ private extern static bool ParseRouteInfo_internal(string iface, out string[] gw_addr_list); >+ >+ public override GatewayIPAddressInformationCollection GatewayAddresses { >+ get { >+ gateways = new IPAddressCollection (); >+ string[] gw_addrlist; >+ if (!ParseRouteInfo_internal (this.iface.Name.ToString(), out gw_addrlist)) >+ return UnixGatewayIPAddressInformationCollection.Empty; >+ >+ for(int i=0; i<gw_addrlist.Length; i++) { >+ try { >+ IPAddress ip = IPAddress.Parse(gw_addrlist[i]); >+ if (!ip.Equals (IPAddress.Any) && !gateways.Contains (ip)) >+ gateways.Add (ip); >+ } catch (ArgumentNullException) { >+ /* Ignore this, as the >+ * internal call might have >+ * left some blank entries at >+ * the end of the array >+ */ >+ } >+ } >+ >+ if (gateways.Count > 0) >+ return new UnixGatewayIPAddressInformationCollection (gateways); >+ else >+ return UnixGatewayIPAddressInformationCollection.Empty; >+ } >+ } > } > > class Win32IPInterfaceProperties2 : IPInterfaceProperties >--- mono/metadata/Makefile.am.orig 2014-10-04 09:27:43 UTC >+++ mono/metadata/Makefile.am >@@ -157,6 +157,8 @@ common_sources = \ > mono-perfcounters.h \ > mono-perfcounters-def.h \ > mono-ptr-array.h \ >+ mono-route.c \ >+ mono-route.h \ > mono-wsq.c \ > mono-wsq.h \ > monitor.h \ >--- mono/metadata/Makefile.in.orig 2014-11-15 15:44:57 UTC >+++ mono/metadata/Makefile.in >@@ -121,7 +121,7 @@ am__libmonoruntime_static_la_SOURCES_DIS > mono-debug-debugger.c mono-endian.c mono-endian.h mono-hash.h \ > mono-mlist.c mono-mlist.h mono-perfcounters.c \ > mono-perfcounters.h mono-perfcounters-def.h mono-ptr-array.h \ >- mono-wsq.c mono-wsq.h monitor.h nacl-stub.c \ >+ mono-route.c mono-route.h mono-wsq.c mono-wsq.h monitor.h nacl-stub.c \ > normalization-tables.h number-formatter.h object-internals.h \ > opcodes.c socket-io.c socket-io.h process.c process.h \ > profiler.c profiler-private.h rand.h rand.c runtime.c \ >@@ -171,6 +171,7 @@ am__objects_4 = $(am__objects_3) libmono > libmonoruntime_static_la-mono-endian.lo \ > libmonoruntime_static_la-mono-mlist.lo \ > libmonoruntime_static_la-mono-perfcounters.lo \ >+ libmonoruntime_static_la-mono-route.lo \ > libmonoruntime_static_la-mono-wsq.lo \ > libmonoruntime_static_la-nacl-stub.lo \ > libmonoruntime_static_la-opcodes.lo \ >@@ -230,8 +231,8 @@ am__libmonoruntime_la_SOURCES_DIST = con > mono-config.c mono-cq.c mono-cq.h mono-debug.h mono-debug.c \ > mono-debug-debugger.h mono-debug-debugger.c mono-endian.c \ > mono-endian.h mono-hash.h mono-mlist.c mono-mlist.h \ >- mono-perfcounters.c mono-perfcounters.h \ >- mono-perfcounters-def.h mono-ptr-array.h mono-wsq.c mono-wsq.h \ >+ mono-perfcounters.c mono-perfcounters.h mono-perfcounters-def.h \ >+ mono-ptr-array.h mono-route.c mono-route.h mono-wsq.c mono-wsq.h \ > monitor.h nacl-stub.c normalization-tables.h \ > number-formatter.h object-internals.h opcodes.c socket-io.c \ > socket-io.h process.c process.h profiler.c profiler-private.h \ >@@ -271,6 +272,7 @@ am__objects_12 = $(am__objects_11) libmo > libmonoruntime_la-mono-endian.lo \ > libmonoruntime_la-mono-mlist.lo \ > libmonoruntime_la-mono-perfcounters.lo \ >+ libmonoruntime_la-mono-route.lo \ > libmonoruntime_la-mono-wsq.lo libmonoruntime_la-nacl-stub.lo \ > libmonoruntime_la-opcodes.lo libmonoruntime_la-socket-io.lo \ > libmonoruntime_la-process.lo libmonoruntime_la-profiler.lo \ >@@ -318,7 +320,7 @@ am__libmonoruntimesgen_static_la_SOURCES > mono-debug-debugger.c mono-endian.c mono-endian.h mono-hash.h \ > mono-mlist.c mono-mlist.h mono-perfcounters.c \ > mono-perfcounters.h mono-perfcounters-def.h mono-ptr-array.h \ >- mono-wsq.c mono-wsq.h monitor.h nacl-stub.c \ >+ mono-route.c mono-route.h mono-wsq.c mono-wsq.h monitor.h nacl-stub.c \ > normalization-tables.h number-formatter.h object-internals.h \ > opcodes.c socket-io.c socket-io.h process.c process.h \ > profiler.c profiler-private.h rand.h rand.c runtime.c \ >@@ -385,6 +387,7 @@ am__objects_19 = $(am__objects_18) \ > libmonoruntimesgen_static_la-mono-endian.lo \ > libmonoruntimesgen_static_la-mono-mlist.lo \ > libmonoruntimesgen_static_la-mono-perfcounters.lo \ >+ libmonoruntimesgen_static_la-mono-route.lo \ > libmonoruntimesgen_static_la-mono-wsq.lo \ > libmonoruntimesgen_static_la-nacl-stub.lo \ > libmonoruntimesgen_static_la-opcodes.lo \ >@@ -472,7 +475,7 @@ am__libmonoruntimesgen_la_SOURCES_DIST = > mono-debug-debugger.c mono-endian.c mono-endian.h mono-hash.h \ > mono-mlist.c mono-mlist.h mono-perfcounters.c \ > mono-perfcounters.h mono-perfcounters-def.h mono-ptr-array.h \ >- mono-wsq.c mono-wsq.h monitor.h nacl-stub.c \ >+ mono-route.c mono-route.h mono-wsq.c mono-wsq.h monitor.h nacl-stub.c \ > normalization-tables.h number-formatter.h object-internals.h \ > opcodes.c socket-io.c socket-io.h process.c process.h \ > profiler.c profiler-private.h rand.h rand.c runtime.c \ >@@ -538,6 +541,7 @@ am__objects_26 = $(am__objects_25) libmo > libmonoruntimesgen_la-mono-endian.lo \ > libmonoruntimesgen_la-mono-mlist.lo \ > libmonoruntimesgen_la-mono-perfcounters.lo \ >+ libmonoruntimesgen_la-mono-route.lo \ > libmonoruntimesgen_la-mono-wsq.lo \ > libmonoruntimesgen_la-nacl-stub.lo \ > libmonoruntimesgen_la-opcodes.lo \ >@@ -1031,6 +1035,8 @@ common_sources = \ > mono-perfcounters.h \ > mono-perfcounters-def.h \ > mono-ptr-array.h \ >+ mono-route.c \ >+ mono-route.h \ > mono-wsq.c \ > mono-wsq.h \ > monitor.h \ >@@ -1353,6 +1359,7 @@ distclean-compile: > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonoruntime_la-mono-hash.Plo@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonoruntime_la-mono-mlist.Plo@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonoruntime_la-mono-perfcounters.Plo@am__quote@ >+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonoruntime_la-mono-route.Plo@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonoruntime_la-mono-wsq.Plo@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonoruntime_la-nacl-stub.Plo@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonoruntime_la-null-gc.Plo@am__quote@ >@@ -1414,6 +1421,7 @@ distclean-compile: > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonoruntime_static_la-mono-hash.Plo@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonoruntime_static_la-mono-mlist.Plo@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonoruntime_static_la-mono-perfcounters.Plo@am__quote@ >+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonoruntime_static_la-mono-route.Plo@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonoruntime_static_la-mono-wsq.Plo@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonoruntime_static_la-nacl-stub.Plo@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonoruntime_static_la-null-gc.Plo@am__quote@ >@@ -1474,6 +1482,7 @@ distclean-compile: > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonoruntimesgen_la-mono-hash.Plo@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonoruntimesgen_la-mono-mlist.Plo@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonoruntimesgen_la-mono-perfcounters.Plo@am__quote@ >+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonoruntimesgen_la-mono-route.Plo@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonoruntimesgen_la-mono-wsq.Plo@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonoruntimesgen_la-nacl-stub.Plo@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonoruntimesgen_la-object.Plo@am__quote@ >@@ -1566,6 +1575,7 @@ distclean-compile: > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonoruntimesgen_static_la-mono-hash.Plo@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonoruntimesgen_static_la-mono-mlist.Plo@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonoruntimesgen_static_la-mono-perfcounters.Plo@am__quote@ >+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonoruntimesgen_static_la-mono-route.Plo@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonoruntimesgen_static_la-mono-wsq.Plo@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonoruntimesgen_static_la-nacl-stub.Plo@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonoruntimesgen_static_la-object.Plo@am__quote@ >@@ -1874,6 +1884,13 @@ libmonoruntime_static_la-mono-perfcounte > @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ > @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntime_static_la_CFLAGS) $(CFLAGS) -c -o libmonoruntime_static_la-mono-perfcounters.lo `test -f 'mono-perfcounters.c' || echo '$(srcdir)/'`mono-perfcounters.c > >+libmonoruntime_static_la-mono-route.lo: mono-route.c >+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntime_static_la_CFLAGS) $(CFLAGS) -MT libmonoruntime_static_la-mono-route.lo -MD -MP -MF $(DEPDIR)/libmonoruntime_static_la-mono-route.Tpo -c -o libmonoruntime_static_la-mono-route.lo `test -f 'mono-route.c' || echo '$(srcdir)/'`mono-route.c >+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmonoruntime_static_la-mono-route.Tpo $(DEPDIR)/libmonoruntime_static_la-mono-route.Plo >+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mono-route.c' object='libmonoruntime_static_la-mono-route.lo' libtool=yes @AMDEPBACKSLASH@ >+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ >+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntime_static_la_CFLAGS) $(CFLAGS) -c -o libmonoruntime_static_la-mono-route.lo `test -f 'mono-route.c' || echo '$(srcdir)/'`mono-route.c >+ > libmonoruntime_static_la-mono-wsq.lo: mono-wsq.c > @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntime_static_la_CFLAGS) $(CFLAGS) -MT libmonoruntime_static_la-mono-wsq.lo -MD -MP -MF $(DEPDIR)/libmonoruntime_static_la-mono-wsq.Tpo -c -o libmonoruntime_static_la-mono-wsq.lo `test -f 'mono-wsq.c' || echo '$(srcdir)/'`mono-wsq.c > @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmonoruntime_static_la-mono-wsq.Tpo $(DEPDIR)/libmonoruntime_static_la-mono-wsq.Plo >@@ -2301,6 +2318,13 @@ libmonoruntime_la-mono-perfcounters.lo: > @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ > @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntime_la_CFLAGS) $(CFLAGS) -c -o libmonoruntime_la-mono-perfcounters.lo `test -f 'mono-perfcounters.c' || echo '$(srcdir)/'`mono-perfcounters.c > >+libmonoruntime_la-mono-route.lo: mono-route.c >+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntime_la_CFLAGS) $(CFLAGS) -MT libmonoruntime_la-mono-route.lo -MD -MP -MF $(DEPDIR)/libmonoruntime_la-mono-route.Tpo -c -o libmonoruntime_la-mono-route.lo `test -f 'mono-route.c' || echo '$(srcdir)/'`mono-route.c >+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmonoruntime_la-mono-route.Tpo $(DEPDIR)/libmonoruntime_la-mono-route.Plo >+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mono-route.c' object='libmonoruntime_la-mono-route.lo' libtool=yes @AMDEPBACKSLASH@ >+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ >+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntime_la_CFLAGS) $(CFLAGS) -c -o libmonoruntime_la-mono-route.lo `test -f 'mono-route.c' || echo '$(srcdir)/'`mono-route.c >+ > libmonoruntime_la-mono-wsq.lo: mono-wsq.c > @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntime_la_CFLAGS) $(CFLAGS) -MT libmonoruntime_la-mono-wsq.lo -MD -MP -MF $(DEPDIR)/libmonoruntime_la-mono-wsq.Tpo -c -o libmonoruntime_la-mono-wsq.lo `test -f 'mono-wsq.c' || echo '$(srcdir)/'`mono-wsq.c > @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmonoruntime_la-mono-wsq.Tpo $(DEPDIR)/libmonoruntime_la-mono-wsq.Plo >@@ -2728,6 +2752,13 @@ libmonoruntimesgen_static_la-mono-perfco > @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ > @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntimesgen_static_la_CFLAGS) $(CFLAGS) -c -o libmonoruntimesgen_static_la-mono-perfcounters.lo `test -f 'mono-perfcounters.c' || echo '$(srcdir)/'`mono-perfcounters.c > >+libmonoruntimesgen_static_la-mono-route.lo: mono-route.c >+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntimesgen_static_la_CFLAGS) $(CFLAGS) -MT libmonoruntimesgen_static_la-mono-route.lo -MD -MP -MF $(DEPDIR)/libmonoruntimesgen_static_la-mono-route.Tpo -c -o libmonoruntimesgen_static_la-mono-route.lo `test -f 'mono-route.c' || echo '$(srcdir)/'`mono-route.c >+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmonoruntimesgen_static_la-mono-route.Tpo $(DEPDIR)/libmonoruntimesgen_static_la-mono-route.Plo >+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mono-route.c' object='libmonoruntimesgen_static_la-mono-route.lo' libtool=yes @AMDEPBACKSLASH@ >+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ >+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntimesgen_static_la_CFLAGS) $(CFLAGS) -c -o libmonoruntimesgen_static_la-mono-route.lo `test -f 'mono-route.c' || echo '$(srcdir)/'`mono-route.c >+ > libmonoruntimesgen_static_la-mono-wsq.lo: mono-wsq.c > @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntimesgen_static_la_CFLAGS) $(CFLAGS) -MT libmonoruntimesgen_static_la-mono-wsq.lo -MD -MP -MF $(DEPDIR)/libmonoruntimesgen_static_la-mono-wsq.Tpo -c -o libmonoruntimesgen_static_la-mono-wsq.lo `test -f 'mono-wsq.c' || echo '$(srcdir)/'`mono-wsq.c > @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmonoruntimesgen_static_la-mono-wsq.Tpo $(DEPDIR)/libmonoruntimesgen_static_la-mono-wsq.Plo >@@ -3372,6 +3403,13 @@ libmonoruntimesgen_la-mono-perfcounters. > @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ > @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntimesgen_la_CFLAGS) $(CFLAGS) -c -o libmonoruntimesgen_la-mono-perfcounters.lo `test -f 'mono-perfcounters.c' || echo '$(srcdir)/'`mono-perfcounters.c > >+libmonoruntimesgen_la-mono-route.lo: mono-route.c >+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntimesgen_la_CFLAGS) $(CFLAGS) -MT libmonoruntimesgen_la-mono-route.lo -MD -MP -MF $(DEPDIR)/libmonoruntimesgen_la-mono-route.Tpo -c -o libmonoruntimesgen_la-mono-route.lo `test -f 'mono-route.c' || echo '$(srcdir)/'`mono-route.c >+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmonoruntimesgen_la-mono-route.Tpo $(DEPDIR)/libmonoruntimesgen_la-mono-route.Plo >+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mono-route.c' object='libmonoruntimesgen_la-mono-route.lo' libtool=yes @AMDEPBACKSLASH@ >+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ >+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntimesgen_la_CFLAGS) $(CFLAGS) -c -o libmonoruntimesgen_la-mono-route.lo `test -f 'mono-route.c' || echo '$(srcdir)/'`mono-route.c >+ > libmonoruntimesgen_la-mono-wsq.lo: mono-wsq.c > @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntimesgen_la_CFLAGS) $(CFLAGS) -MT libmonoruntimesgen_la-mono-wsq.lo -MD -MP -MF $(DEPDIR)/libmonoruntimesgen_la-mono-wsq.Tpo -c -o libmonoruntimesgen_la-mono-wsq.lo `test -f 'mono-wsq.c' || echo '$(srcdir)/'`mono-wsq.c > @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmonoruntimesgen_la-mono-wsq.Tpo $(DEPDIR)/libmonoruntimesgen_la-mono-wsq.Plo >--- mono/metadata/icall-def.h.orig 2014-09-22 13:23:09 UTC >+++ mono/metadata/icall-def.h >@@ -443,6 +443,11 @@ ICALL(NDNS_1, "GetHostByAddr_internal(st > ICALL(NDNS_2, "GetHostByName_internal(string,string&,string[]&,string[]&)", ves_icall_System_Net_Dns_GetHostByName_internal) > ICALL(NDNS_3, "GetHostName_internal(string&)", ves_icall_System_Net_Dns_GetHostName_internal) > >+#if defined(PLATFORM_MACOSX) || defined(PLATFORM_BSD) >+ICALL_TYPE(MAC_IFACE_PROPS, "System.Net.NetworkInformation.MacOsIPInterfaceProperties", MAC_IFACE_PROPS_1) >+ICALL(MAC_IFACE_PROPS_1, "ParseRouteInfo_internal", ves_icall_System_Net_NetworkInformation_MacOsIPInterfaceProperties_ParseRouteInfo_internal) >+#endif >+ > ICALL_TYPE(SOCK, "System.Net.Sockets.Socket", SOCK_1) > ICALL(SOCK_1, "Accept_internal(intptr,int&,bool)", ves_icall_System_Net_Sockets_Socket_Accept_internal) > ICALL(SOCK_2, "Available_internal(intptr,int&)", ves_icall_System_Net_Sockets_Socket_Available_internal) >--- mono/metadata/icall.c.orig 2014-10-04 09:27:43 UTC >+++ mono/metadata/icall.c >@@ -45,6 +45,7 @@ > #include <mono/metadata/exception.h> > #include <mono/metadata/file-io.h> > #include <mono/metadata/console-io.h> >+#include <mono/metadata/mono-route.h> > #include <mono/metadata/socket-io.h> > #include <mono/metadata/mono-endian.h> > #include <mono/metadata/tokentype.h> >--- mono/metadata/mono-route.c.orig 2014-11-15 16:58:08 UTC >+++ mono/metadata/mono-route.c >@@ -0,0 +1,120 @@ >+/* >+ * mono-route.c: Read the network routing tables using sysctl(3) calls >+ * Required for Unix-like systems that don't have Linux's /proc/net/route >+ * >+ * Author: >+ * Ben Woods (woodsb02@gmail.com) >+ */ >+ >+#if defined(PLATFORM_MACOSX) || defined(PLATFORM_BSD) >+ >+#include <sys/socket.h> >+#include <net/if.h> >+#include <net/if_dl.h> >+#include <net/route.h> >+#include <netinet/in.h> >+#include <sys/param.h> >+#include <sys/sysctl.h> >+#include <stdlib.h> >+#include <string.h> >+#include <mono/metadata/object.h> >+#include <mono/metadata/mono-route.h> >+ >+extern MonoBoolean ves_icall_System_Net_NetworkInformation_MacOsIPInterfaceProperties_ParseRouteInfo_internal(MonoString *iface, MonoArray **gw_addr_list) >+{ >+ size_t needed; >+ in_addr_t in; >+ int mib[6]; >+ int num_gws=0, gwnum=0; >+ unsigned int ifindex = 0; >+ char *buf, *next, *lim, *ifacename; >+ struct rt_msghdr *rtm; >+ >+ MonoDomain *domain = mono_domain_get (); >+ >+ ifacename = mono_string_to_utf8(iface); >+ if ((ifindex = if_nametoindex(ifacename)) == 0) >+ return FALSE; >+ g_free(ifacename); >+ >+ // MIB array defining data to read from sysctl >+ mib[0] = CTL_NET; // Networking >+ mib[1] = PF_ROUTE; // Routing messages >+ mib[2] = 0; // Protocol number (always zero) >+ mib[3] = AF_INET; // Address family (IPv4) >+ mib[4] = NET_RT_DUMP; // Dump routing table >+ mib[5] = 0; // >+ >+ // First sysctl call with oldp set to NULL to determine size of available data >+ if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), NULL, &needed, NULL, 0) < 0) >+ return FALSE; >+ >+ // Allocate suffcient memory for available data based on the previous sysctl call >+ if ((buf = malloc(needed)) == NULL) >+ return FALSE; >+ >+ // Second sysctl call to retrieve data into appropriately sized buffer >+ if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), buf, &needed, NULL, 0) < 0) >+ return FALSE; >+ >+ lim = buf + needed; >+ for (next = buf; next < lim; next += rtm->rtm_msglen) { >+ rtm = (struct rt_msghdr *)next; >+ if (rtm->rtm_version != RTM_VERSION) >+ continue; >+ if (rtm->rtm_index != ifindex) >+ continue; >+ if((in = gateway_from_rtm(rtm)) == 0) >+ continue; >+ num_gws++; >+ } >+ >+ *gw_addr_list = mono_array_new(domain, mono_get_string_class (), num_gws); >+ >+ for (next = buf; next < lim; next += rtm->rtm_msglen) { >+ rtm = (struct rt_msghdr *)next; >+ if (rtm->rtm_version != RTM_VERSION) >+ continue; >+ if (rtm->rtm_index != ifindex) >+ continue; >+ if((in = gateway_from_rtm(rtm)) == 0) >+ continue; >+ >+ MonoString *addr_string; >+ char addr [16], *ptr; >+ >+ ptr = (char *) ∈ >+ snprintf(addr, 16, "%u.%u.%u.%u", >+ (unsigned char) ptr [0], >+ (unsigned char) ptr [1], >+ (unsigned char) ptr [2], >+ (unsigned char) ptr [3]); >+ >+ addr_string = mono_string_new (domain, addr); >+ mono_array_setref (*gw_addr_list, gwnum, addr_string); >+ gwnum++; >+ } >+ free(buf); >+ return TRUE; >+} >+ >+in_addr_t gateway_from_rtm(struct rt_msghdr *rtm) >+{ >+ struct sockaddr *gw; >+ unsigned int l; >+ >+ struct sockaddr *addr = (struct sockaddr *)(rtm + 1); >+ l = roundup(addr->sa_len, sizeof(long)); \ >+ gw = (struct sockaddr *)((char *) addr + l); \ >+ >+ if (rtm->rtm_addrs & RTA_GATEWAY) { >+ if(gw->sa_family == AF_INET) { >+ struct sockaddr_in *sockin = (struct sockaddr_in *)gw; >+ return(sockin->sin_addr.s_addr); >+ } >+ } >+ >+ return 0; >+} >+ >+#endif /* #if defined(PLATFORM_MACOSX) || defined(PLATFORM_BSD) */ >--- mono/metadata/mono-route.h.orig 2014-11-15 15:44:57 UTC >+++ mono/metadata/mono-route.h >@@ -0,0 +1,16 @@ >+#ifndef __MONO_ROUTE_H__ >+#define __MONO_ROUTE_H__ >+ >+#if defined(PLATFORM_MACOSX) || defined(PLATFORM_BSD) >+ >+#include <sys/socket.h> >+#include <net/route.h> >+#include <mono/metadata/object-internals.h> >+ >+in_addr_t gateway_from_rtm (struct rt_msghdr *rtm) MONO_INTERNAL; >+ >+/* Category icalls */ >+extern MonoBoolean ves_icall_System_Net_NetworkInformation_MacOsIPInterfaceProperties_ParseRouteInfo_internal (MonoString *iface, MonoArray **gw_addr_list) MONO_INTERNAL; >+ >+#endif /* #if defined(PLATFORM_MACOSX) || defined(PLATFORM_BSD) */ >+#endif /* __MONO_ROUTE_H__ */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 194660
:
148734
|
149029
|
149451
|
149452
|
149739
| 150260