public LinuxIPInterfaceProperties(LinuxNetworkInterface lni, LinuxNetworkInterface.LinuxNetworkInterfaceSystemProperties systemProperties) : base(lni, globalConfig: true) { _linuxNetworkInterface = lni; _gatewayAddresses = GetGatewayAddresses(systemProperties); _dhcpServerAddresses = GetDhcpServerAddresses(); _winsServerAddresses = GetWinsServerAddresses(); _dnsSuffix = systemProperties.DnsSuffix; _dnsAddresses = systemProperties.DnsAddresses; _ipv4Properties = new LinuxIPv4InterfaceProperties(lni); _ipv6Properties = new LinuxIPv6InterfaceProperties(lni); }
// /proc/net/route contains some information about gateway addresses, // and separates the information about by each interface. public GatewayIPAddressInformationCollection GetGatewayAddresses(LinuxNetworkInterface.LinuxNetworkInterfaceSystemProperties systemProperties) { List <GatewayIPAddressInformation> collection = new List <GatewayIPAddressInformation>(); if (systemProperties.IPv4Routes != null) { StringParsingHelpers.ParseIPv4GatewayAddressesFromRouteFile(collection, systemProperties.IPv4Routes, _linuxNetworkInterface.Name); } if (systemProperties.IPv6Routes != null) { StringParsingHelpers.ParseIPv6GatewayAddressesFromRouteFile(collection, systemProperties.IPv6Routes, _linuxNetworkInterface.Name, _linuxNetworkInterface.Index); } return(new GatewayIPAddressInformationCollection(collection)); }