{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/corefx/pulls/comments/41564184","id":41564184,"diff_hunk":"@@ -0,0 +1,199 @@\n+﻿// Copyright (c) Microsoft. All rights reserved.\n+// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n+\n+using System.Collections.Generic;\n+using System.IO;\n+using System.Linq;\n+using System.Net.Sockets;\n+\n+namespace System.Net.NetworkInformation\n+{\n+    internal class LinuxIPInterfaceProperties : IPInterfaceProperties\n+    {\n+        private readonly LinuxNetworkInterface _linuxNetworkInterface;\n+        private readonly string _dnsSuffix;\n+        private readonly UnicastIPAddressInformationCollection _unicastAddresses;\n+        private readonly MulticastIPAddressInformationCollection _multicastAddreses;\n+        private readonly IPAddressCollection _dnsAddresses;\n+        private readonly GatewayIPAddressInformationCollection _gatewayAddresses;\n+        private readonly LinuxIPv4InterfaceProperties _ipv4Properties;\n+        private readonly LinuxIPv6InterfaceProperties _ipv6Properties;\n+\n+        public LinuxIPInterfaceProperties(LinuxNetworkInterface lni)\n+        {\n+            _linuxNetworkInterface = lni;\n+            _dnsSuffix = GetDnsSuffix();\n+            _unicastAddresses = GetUnicastAddresses();\n+            _multicastAddreses = GetMulticastAddresses();\n+            _dnsAddresses = GetDnsAddresses();\n+            _gatewayAddresses = GetGatewayAddresses();\n+            _ipv4Properties = new LinuxIPv4InterfaceProperties(_linuxNetworkInterface);\n+            _ipv6Properties = new LinuxIPv6InterfaceProperties(_linuxNetworkInterface);\n+        }\n+\n+        public override bool IsDnsEnabled\n+        {\n+            get\n+            {\n+                // /etc/nsswitchc.conf may be of use here.\n+                // the absence of \"dns\" in that file could indicate that DNS is not enabled.\n+                return DnsAddresses.Count > 0;\n+            }\n+        }\n+\n+        public override string DnsSuffix { get { return _dnsSuffix; } }\n+\n+        public override bool IsDynamicDnsEnabled\n+        {\n+            get\n+            {\n+                throw new NotImplementedException();\n+            }\n+        }\n+\n+        public override UnicastIPAddressInformationCollection UnicastAddresses { get { return _unicastAddresses; } }\n+\n+        public override MulticastIPAddressInformationCollection MulticastAddresses { get { return _multicastAddreses; } }\n+\n+        public override IPAddressInformationCollection AnycastAddresses\n+        {\n+            get\n+            {\n+                throw new PlatformNotSupportedException();\n+            }\n+        }\n+\n+        public override IPAddressCollection DnsAddresses { get { return _dnsAddresses; } }\n+\n+        public override GatewayIPAddressInformationCollection GatewayAddresses { get { return _gatewayAddresses; } }\n+\n+        public override IPAddressCollection DhcpServerAddresses\n+        {\n+            get\n+            {\n+                throw new NotImplementedException();\n+            }\n+        }\n+\n+        public override IPAddressCollection WinsServersAddresses\n+        {\n+            get\n+            {\n+                // TODO: Can we return false? Is this Windows-specific?\n+                throw new PlatformNotSupportedException();","path":"src/System.Net.NetworkInformation/src/System/Net/NetworkInformation/LinuxIPInterfaceProperties.cs","position":83,"original_position":83,"commit_id":"3b953b446bbf206fc5d04945d8bb981f8c753040","original_commit_id":"4db7bae698bd34a3aee4c43dd9e6205d7f517ecc","user":{"login":"CIPop","id":8635911,"avatar_url":"https://avatars.githubusercontent.com/u/8635911?v=3","gravatar_id":"","url":"https://api.github.com/users/CIPop","html_url":"https://github.com/CIPop","followers_url":"https://api.github.com/users/CIPop/followers","following_url":"https://api.github.com/users/CIPop/following{/other_user}","gists_url":"https://api.github.com/users/CIPop/gists{/gist_id}","starred_url":"https://api.github.com/users/CIPop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CIPop/subscriptions","organizations_url":"https://api.github.com/users/CIPop/orgs","repos_url":"https://api.github.com/users/CIPop/repos","events_url":"https://api.github.com/users/CIPop/events{/privacy}","received_events_url":"https://api.github.com/users/CIPop/received_events","type":"User","site_admin":false},"body":"Also see `nmblookup`: http://unix.stackexchange.com/questions/38070/is-there-a-command-in-linux-to-query-a-hostname-from-wins-server","created_at":"2015-10-08T20:27:20Z","updated_at":"2015-10-08T20:27:20Z","html_url":"https://github.com/dotnet/corefx/pull/3707#discussion_r41564184","pull_request_url":"https://api.github.com/repos/dotnet/corefx/pulls/3707","_links":{"self":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/comments/41564184"},"html":{"href":"https://github.com/dotnet/corefx/pull/3707#discussion_r41564184"},"pull_request":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/3707"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/corefx/pulls/3707","id":47091959,"html_url":"https://github.com/dotnet/corefx/pull/3707","diff_url":"https://github.com/dotnet/corefx/pull/3707.diff","patch_url":"https://github.com/dotnet/corefx/pull/3707.patch","issue_url":"https://api.github.com/repos/dotnet/corefx/issues/3707","number":3707,"state":"open","locked":false,"title":"Bring x-plat work for System.Net.NetworkInformation into dev branch","user":{"login":"mellinoe","id":8918977,"avatar_url":"https://avatars.githubusercontent.com/u/8918977?v=3","gravatar_id":"","url":"https://api.github.com/users/mellinoe","html_url":"https://github.com/mellinoe","followers_url":"https://api.github.com/users/mellinoe/followers","following_url":"https://api.github.com/users/mellinoe/following{/other_user}","gists_url":"https://api.github.com/users/mellinoe/gists{/gist_id}","starred_url":"https://api.github.com/users/mellinoe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mellinoe/subscriptions","organizations_url":"https://api.github.com/users/mellinoe/orgs","repos_url":"https://api.github.com/users/mellinoe/repos","events_url":"https://api.github.com/users/mellinoe/events{/privacy}","received_events_url":"https://api.github.com/users/mellinoe/received_events","type":"User","site_admin":false},"body":"I've merged all of my existing work against corefx/master, and moved into a dev/ni-xplat branch. Changes to the shared code were mainly limited to the project file (splitting things into separate sections), and introducing a few \"Pal\" files, which contain platform-specific redirections for the various global accessors we expose in this library.\r\n# Shimming\r\n\r\nI have shim'd out the implementation of interface address discovery and enumeration (getifaddrs), and have built on top of that in LinuxNetworkInterface and OsxNetworkInterface.\r\n\r\nI intend to introduce more shim'd methods for OSX's statistics querying, as I believe it can be used on BSD systems as well (sysctl).\r\n\r\n-------------------------------------\r\n\r\n\r\nAs of right now, most of the following types are implemented. Some may have some members which are not implemented, but the majority are unless I've noted otherwise.\r\n\r\n# Linux\r\nNetworkInterface\r\n* IPInterfaceStatistics\r\n* Address collections\r\n    * NOTE: Most of the properties on these are not supported\r\n* IPInterfaceProperties\r\n\r\nIPGlobalProperties\r\n* All of the protocol statistics\r\n* DomainName, HostName, etc (instance properties)\r\n* Address collections\r\n\r\n# OSX\r\nNetworkInterface\r\n* Only enumerating interfaces and addresses (shared code with Linux)\r\n\r\n# Unimplemented\r\nNetworkChange is not at all implemented yet. I do not know of a good way to hook a notification for this yet.\r\nEverything is still stubbed out on OSX currently. I have some idea how to implement the majority of the statistics queries, which should be portable as well.","created_at":"2015-10-07T22:42:03Z","updated_at":"2015-10-08T20:27:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9d081ec1f31d589d2b6ec2baab41465b5a0b4bdc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/corefx/pulls/3707/commits","review_comments_url":"https://api.github.com/repos/dotnet/corefx/pulls/3707/comments","review_comment_url":"https://api.github.com/repos/dotnet/corefx/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/corefx/issues/3707/comments","statuses_url":"https://api.github.com/repos/dotnet/corefx/statuses/3b953b446bbf206fc5d04945d8bb981f8c753040","head":{"label":"mellinoe:ni-xplat","ref":"ni-xplat","sha":"3b953b446bbf206fc5d04945d8bb981f8c753040","user":{"login":"mellinoe","id":8918977,"avatar_url":"https://avatars.githubusercontent.com/u/8918977?v=3","gravatar_id":"","url":"https://api.github.com/users/mellinoe","html_url":"https://github.com/mellinoe","followers_url":"https://api.github.com/users/mellinoe/followers","following_url":"https://api.github.com/users/mellinoe/following{/other_user}","gists_url":"https://api.github.com/users/mellinoe/gists{/gist_id}","starred_url":"https://api.github.com/users/mellinoe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mellinoe/subscriptions","organizations_url":"https://api.github.com/users/mellinoe/orgs","repos_url":"https://api.github.com/users/mellinoe/repos","events_url":"https://api.github.com/users/mellinoe/events{/privacy}","received_events_url":"https://api.github.com/users/mellinoe/received_events","type":"User","site_admin":false},"repo":{"id":26655317,"name":"corefx","full_name":"mellinoe/corefx","owner":{"login":"mellinoe","id":8918977,"avatar_url":"https://avatars.githubusercontent.com/u/8918977?v=3","gravatar_id":"","url":"https://api.github.com/users/mellinoe","html_url":"https://github.com/mellinoe","followers_url":"https://api.github.com/users/mellinoe/followers","following_url":"https://api.github.com/users/mellinoe/following{/other_user}","gists_url":"https://api.github.com/users/mellinoe/gists{/gist_id}","starred_url":"https://api.github.com/users/mellinoe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mellinoe/subscriptions","organizations_url":"https://api.github.com/users/mellinoe/orgs","repos_url":"https://api.github.com/users/mellinoe/repos","events_url":"https://api.github.com/users/mellinoe/events{/privacy}","received_events_url":"https://api.github.com/users/mellinoe/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mellinoe/corefx","description":"This repository contains the foundational libraries that make up the .NET Core development stack.","fork":true,"url":"https://api.github.com/repos/mellinoe/corefx","forks_url":"https://api.github.com/repos/mellinoe/corefx/forks","keys_url":"https://api.github.com/repos/mellinoe/corefx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mellinoe/corefx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mellinoe/corefx/teams","hooks_url":"https://api.github.com/repos/mellinoe/corefx/hooks","issue_events_url":"https://api.github.com/repos/mellinoe/corefx/issues/events{/number}","events_url":"https://api.github.com/repos/mellinoe/corefx/events","assignees_url":"https://api.github.com/repos/mellinoe/corefx/assignees{/user}","branches_url":"https://api.github.com/repos/mellinoe/corefx/branches{/branch}","tags_url":"https://api.github.com/repos/mellinoe/corefx/tags","blobs_url":"https://api.github.com/repos/mellinoe/corefx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mellinoe/corefx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mellinoe/corefx/git/refs{/sha}","trees_url":"https://api.github.com/repos/mellinoe/corefx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mellinoe/corefx/statuses/{sha}","languages_url":"https://api.github.com/repos/mellinoe/corefx/languages","stargazers_url":"https://api.github.com/repos/mellinoe/corefx/stargazers","contributors_url":"https://api.github.com/repos/mellinoe/corefx/contributors","subscribers_url":"https://api.github.com/repos/mellinoe/corefx/subscribers","subscription_url":"https://api.github.com/repos/mellinoe/corefx/subscription","commits_url":"https://api.github.com/repos/mellinoe/corefx/commits{/sha}","git_commits_url":"https://api.github.com/repos/mellinoe/corefx/git/commits{/sha}","comments_url":"https://api.github.com/repos/mellinoe/corefx/comments{/number}","issue_comment_url":"https://api.github.com/repos/mellinoe/corefx/issues/comments{/number}","contents_url":"https://api.github.com/repos/mellinoe/corefx/contents/{+path}","compare_url":"https://api.github.com/repos/mellinoe/corefx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mellinoe/corefx/merges","archive_url":"https://api.github.com/repos/mellinoe/corefx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mellinoe/corefx/downloads","issues_url":"https://api.github.com/repos/mellinoe/corefx/issues{/number}","pulls_url":"https://api.github.com/repos/mellinoe/corefx/pulls{/number}","milestones_url":"https://api.github.com/repos/mellinoe/corefx/milestones{/number}","notifications_url":"https://api.github.com/repos/mellinoe/corefx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mellinoe/corefx/labels{/name}","releases_url":"https://api.github.com/repos/mellinoe/corefx/releases{/id}","created_at":"2014-11-14T20:04:38Z","updated_at":"2014-11-14T20:07:32Z","pushed_at":"2015-10-08T20:15:49Z","git_url":"git://github.com/mellinoe/corefx.git","ssh_url":"git@github.com:mellinoe/corefx.git","clone_url":"https://github.com/mellinoe/corefx.git","svn_url":"https://github.com/mellinoe/corefx","homepage":"","size":34513,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:dev/ni-xplat","ref":"dev/ni-xplat","sha":"4414185df30092a182c450b1e82350dbba2b3b2f","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":26295345,"name":"corefx","full_name":"dotnet/corefx","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/corefx","description":"This repo contains the .NET Core foundational libraries, called CoreFX. It includes classes for collections, file systems, console, XML, async and many others.","fork":false,"url":"https://api.github.com/repos/dotnet/corefx","forks_url":"https://api.github.com/repos/dotnet/corefx/forks","keys_url":"https://api.github.com/repos/dotnet/corefx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/corefx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/corefx/teams","hooks_url":"https://api.github.com/repos/dotnet/corefx/hooks","issue_events_url":"https://api.github.com/repos/dotnet/corefx/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/corefx/events","assignees_url":"https://api.github.com/repos/dotnet/corefx/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/corefx/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/corefx/tags","blobs_url":"https://api.github.com/repos/dotnet/corefx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/corefx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/corefx/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/corefx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/corefx/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/corefx/languages","stargazers_url":"https://api.github.com/repos/dotnet/corefx/stargazers","contributors_url":"https://api.github.com/repos/dotnet/corefx/contributors","subscribers_url":"https://api.github.com/repos/dotnet/corefx/subscribers","subscription_url":"https://api.github.com/repos/dotnet/corefx/subscription","commits_url":"https://api.github.com/repos/dotnet/corefx/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/corefx/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/corefx/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/corefx/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/corefx/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/corefx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/corefx/merges","archive_url":"https://api.github.com/repos/dotnet/corefx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/corefx/downloads","issues_url":"https://api.github.com/repos/dotnet/corefx/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/corefx/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/corefx/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/corefx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/corefx/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/corefx/releases{/id}","created_at":"2014-11-06T23:42:48Z","updated_at":"2015-10-08T13:39:53Z","pushed_at":"2015-10-08T20:15:50Z","git_url":"git://github.com/dotnet/corefx.git","ssh_url":"git@github.com:dotnet/corefx.git","clone_url":"https://github.com/dotnet/corefx.git","svn_url":"https://github.com/dotnet/corefx","homepage":"http://dotnet.github.io/core/","size":77007,"stargazers_count":8426,"watchers_count":8426,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1843,"mirror_url":null,"open_issues_count":636,"forks":1843,"open_issues":636,"watchers":8426,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/3707"},"html":{"href":"https://github.com/dotnet/corefx/pull/3707"},"issue":{"href":"https://api.github.com/repos/dotnet/corefx/issues/3707"},"comments":{"href":"https://api.github.com/repos/dotnet/corefx/issues/3707/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/3707/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/3707/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/corefx/statuses/3b953b446bbf206fc5d04945d8bb981f8c753040"}}}}