using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Net.Sockets; using System.Text.RegularExpressions; namespace System.Net.NetworkInformation { // Token: 0x0200016F RID: 367 internal abstract class UnixIPInterfaceProperties : IPInterfaceProperties { // Token: 0x06000C84 RID: 3204 RVA: 0x000255A8 File Offset: 0x000237A8 public UnixIPInterfaceProperties(UnixNetworkInterface iface, List addresses) { this.iface = iface; this.addresses = addresses; } // Token: 0x06000C86 RID: 3206 RVA: 0x000255E0 File Offset: 0x000237E0 public override IPv6InterfaceProperties GetIPv6Properties() { throw new NotImplementedException(); } // Token: 0x06000C87 RID: 3207 RVA: 0x000255E8 File Offset: 0x000237E8 private void ParseRouteInfo(string iface) { try { this.gateways = new IPAddressCollection(); using (StreamReader streamReader = new StreamReader("/proc/net/route")) { streamReader.ReadLine(); string text; while ((text = streamReader.ReadLine()) != null) { text = text.Trim(); if (text.Length != 0) { string[] array = text.Split(new char[] { '\t' }); if (array.Length >= 3) { string text2 = array[2].Trim(); byte[] array2 = new byte[4]; if (text2.Length == 8 && iface.Equals(array[0], StringComparison.OrdinalIgnoreCase)) { for (int i = 0; i < 4; i++) { if (!byte.TryParse(text2.Substring(i * 2, 2), NumberStyles.HexNumber, null, out array2[3 - i])) { } } IPAddress ipaddress = new IPAddress(array2); if (!ipaddress.Equals(IPAddress.Any)) { this.gateways.Add(ipaddress); } } } } } } } catch { } } // Token: 0x06000C88 RID: 3208 RVA: 0x00025744 File Offset: 0x00023944 private void ParseResolvConf() { try { DateTime lastWriteTime = File.GetLastWriteTime("/etc/resolv.conf"); if (!(lastWriteTime <= this.last_parse)) { this.last_parse = lastWriteTime; this.dns_suffix = string.Empty; this.dns_servers = new IPAddressCollection(); using (StreamReader streamReader = new StreamReader("/etc/resolv.conf")) { string text; while ((text = streamReader.ReadLine()) != null) { text = text.Trim(); if (text.Length != 0 && text[0] != '#') { global::System.Text.RegularExpressions.Match match = UnixIPInterfaceProperties.ns.Match(text); if (match.Success) { try { string text2 = match.Groups["address"].Value; text2 = text2.Trim(); this.dns_servers.Add(IPAddress.Parse(text2)); } catch { } } else { match = UnixIPInterfaceProperties.search.Match(text); if (match.Success) { string text2 = match.Groups["domain"].Value; string[] array = text2.Split(new char[] { ',' }); this.dns_suffix = array[0].Trim(); } } } } } } } catch { } finally { this.dns_servers.SetReadOnly(); } } // Token: 0x17000361 RID: 865 // (get) Token: 0x06000C89 RID: 3209 RVA: 0x00025908 File Offset: 0x00023B08 public override IPAddressInformationCollection AnycastAddresses { get { List list = new List(); return IPAddressInformationImplCollection.LinuxFromAnycast(list); } } // Token: 0x17000362 RID: 866 // (get) Token: 0x06000C8A RID: 3210 RVA: 0x00025924 File Offset: 0x00023B24 [global::System.MonoTODO("Always returns an empty collection.")] public override IPAddressCollection DhcpServerAddresses { get { IPAddressCollection ipaddressCollection = new IPAddressCollection(); ipaddressCollection.SetReadOnly(); return ipaddressCollection; } } // Token: 0x17000363 RID: 867 // (get) Token: 0x06000C8B RID: 3211 RVA: 0x00025940 File Offset: 0x00023B40 public override IPAddressCollection DnsAddresses { get { this.ParseResolvConf(); return this.dns_servers; } } // Token: 0x17000364 RID: 868 // (get) Token: 0x06000C8C RID: 3212 RVA: 0x00025950 File Offset: 0x00023B50 public override string DnsSuffix { get { this.ParseResolvConf(); return this.dns_suffix; } } // Token: 0x17000365 RID: 869 // (get) Token: 0x06000C8D RID: 3213 RVA: 0x00025960 File Offset: 0x00023B60 public override GatewayIPAddressInformationCollection GatewayAddresses { get { this.ParseRouteInfo(this.iface.Name.ToString()); if (this.gateways.Count > 0) { return new LinuxGatewayIPAddressInformationCollection(this.gateways); } return LinuxGatewayIPAddressInformationCollection.Empty; } } // Token: 0x17000366 RID: 870 // (get) Token: 0x06000C8E RID: 3214 RVA: 0x000259A8 File Offset: 0x00023BA8 [global::System.MonoTODO("Always returns true")] public override bool IsDnsEnabled { get { return true; } } // Token: 0x17000367 RID: 871 // (get) Token: 0x06000C8F RID: 3215 RVA: 0x000259AC File Offset: 0x00023BAC [global::System.MonoTODO("Always returns false")] public override bool IsDynamicDnsEnabled { get { return false; } } // Token: 0x17000368 RID: 872 // (get) Token: 0x06000C90 RID: 3216 RVA: 0x000259B0 File Offset: 0x00023BB0 public override MulticastIPAddressInformationCollection MulticastAddresses { get { List list = new List(); foreach (IPAddress ipaddress in this.addresses) { byte[] addressBytes = ipaddress.GetAddressBytes(); if (addressBytes[0] >= 224 && addressBytes[0] <= 239) { list.Add(ipaddress); } } return MulticastIPAddressInformationImplCollection.LinuxFromList(list); } } // Token: 0x17000369 RID: 873 // (get) Token: 0x06000C91 RID: 3217 RVA: 0x00025A44 File Offset: 0x00023C44 public override UnicastIPAddressInformationCollection UnicastAddresses { get { List list = new List(); foreach (IPAddress ipaddress in this.addresses) { global::System.Net.Sockets.AddressFamily addressFamily = ipaddress.AddressFamily; if (addressFamily != global::System.Net.Sockets.AddressFamily.InterNetwork) { if (addressFamily == global::System.Net.Sockets.AddressFamily.InterNetworkV6) { if (!ipaddress.IsIPv6Multicast) { list.Add(ipaddress); } } } else { byte b = ipaddress.GetAddressBytes()[0]; if (b < 224 || b > 239) { list.Add(ipaddress); } } } return UnicastIPAddressInformationImplCollection.LinuxFromList(list); } } // Token: 0x1700036A RID: 874 // (get) Token: 0x06000C92 RID: 3218 RVA: 0x00025B1C File Offset: 0x00023D1C [global::System.MonoTODO("Always returns an empty collection.")] public override IPAddressCollection WinsServersAddresses { get { return new IPAddressCollection(); } } // Token: 0x04000BDC RID: 3036 protected IPv4InterfaceProperties ipv4iface_properties; // Token: 0x04000BDD RID: 3037 protected UnixNetworkInterface iface; // Token: 0x04000BDE RID: 3038 private List addresses; // Token: 0x04000BDF RID: 3039 private IPAddressCollection dns_servers; // Token: 0x04000BE0 RID: 3040 private IPAddressCollection gateways; // Token: 0x04000BE1 RID: 3041 private string dns_suffix; // Token: 0x04000BE2 RID: 3042 private DateTime last_parse; // Token: 0x04000BE3 RID: 3043 private static global::System.Text.RegularExpressions.Regex ns = new global::System.Text.RegularExpressions.Regex("\\s*nameserver\\s+(?
.*)"); // Token: 0x04000BE4 RID: 3044 private static global::System.Text.RegularExpressions.Regex search = new global::System.Text.RegularExpressions.Regex("\\s*search\\s+(?.*)"); } }