{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/corefx/issues/8509","repository_url":"https://api.github.com/repos/dotnet/corefx","labels_url":"https://api.github.com/repos/dotnet/corefx/issues/8509/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/corefx/issues/8509/comments","events_url":"https://api.github.com/repos/dotnet/corefx/issues/8509/events","html_url":"https://github.com/dotnet/corefx/issues/8509","id":154769577,"number":8509,"title":"System.Net.IPAddress and IPv6 zone indices","user":{"login":"lemonmojo","id":186198,"avatar_url":"https://avatars.githubusercontent.com/u/186198?v=3","gravatar_id":"","url":"https://api.github.com/users/lemonmojo","html_url":"https://github.com/lemonmojo","followers_url":"https://api.github.com/users/lemonmojo/followers","following_url":"https://api.github.com/users/lemonmojo/following{/other_user}","gists_url":"https://api.github.com/users/lemonmojo/gists{/gist_id}","starred_url":"https://api.github.com/users/lemonmojo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lemonmojo/subscriptions","organizations_url":"https://api.github.com/users/lemonmojo/orgs","repos_url":"https://api.github.com/users/lemonmojo/repos","events_url":"https://api.github.com/users/lemonmojo/events{/privacy}","received_events_url":"https://api.github.com/users/lemonmojo/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dotnet/corefx/labels/System.Net","name":"System.Net","color":"d4c5f9"},{"url":"https://api.github.com/repos/dotnet/corefx/labels/X-Plat","name":"X-Plat","color":"fbca04"}],"state":"open","locked":false,"assignee":{"login":"ericeil","id":7407587,"avatar_url":"https://avatars.githubusercontent.com/u/7407587?v=3","gravatar_id":"","url":"https://api.github.com/users/ericeil","html_url":"https://github.com/ericeil","followers_url":"https://api.github.com/users/ericeil/followers","following_url":"https://api.github.com/users/ericeil/following{/other_user}","gists_url":"https://api.github.com/users/ericeil/gists{/gist_id}","starred_url":"https://api.github.com/users/ericeil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericeil/subscriptions","organizations_url":"https://api.github.com/users/ericeil/orgs","repos_url":"https://api.github.com/users/ericeil/repos","events_url":"https://api.github.com/users/ericeil/events{/privacy}","received_events_url":"https://api.github.com/users/ericeil/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/dotnet/corefx/milestones/8","html_url":"https://github.com/dotnet/corefx/milestones/1.0.0-rtm","labels_url":"https://api.github.com/repos/dotnet/corefx/milestones/8/labels","id":1719259,"number":8,"title":"1.0.0-rtm","description":"2016 https://github.com/aspnet/Home/wiki/Roadmap","creator":{"login":"joshfree","id":1302850,"avatar_url":"https://avatars.githubusercontent.com/u/1302850?v=3","gravatar_id":"","url":"https://api.github.com/users/joshfree","html_url":"https://github.com/joshfree","followers_url":"https://api.github.com/users/joshfree/followers","following_url":"https://api.github.com/users/joshfree/following{/other_user}","gists_url":"https://api.github.com/users/joshfree/gists{/gist_id}","starred_url":"https://api.github.com/users/joshfree/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshfree/subscriptions","organizations_url":"https://api.github.com/users/joshfree/orgs","repos_url":"https://api.github.com/users/joshfree/repos","events_url":"https://api.github.com/users/joshfree/events{/privacy}","received_events_url":"https://api.github.com/users/joshfree/received_events","type":"User","site_admin":false},"open_issues":81,"closed_issues":125,"state":"open","created_at":"2016-04-19T20:53:30Z","updated_at":"2016-05-18T14:24:35Z","due_on":"2016-06-30T07:00:00Z","closed_at":null},"comments":7,"created_at":"2016-05-13T18:07:52Z","updated_at":"2016-05-18T18:55:54Z","closed_at":null,"body":"I already reported this issue on mono's bugzilla but since it's mainly a .NET issue, I was redirected here.\r\nHere's my original bug entry: https://bugzilla.xamarin.com/show_bug.cgi?id=37724\r\n\r\nAs per this article (https://en.wikipedia.org/wiki/IPv6_address#Link-local_addresses_and_zone_indices) the syntax of specifying IPv6 zone indices and link-local addresses depends on the platform.\r\nOn MS Windows the index is determined by the interface number while on Unix-like OS's (including OS X) the interface name (ie. en0) is used.\r\n\r\nSystem.Net.IPAddress only has support for specifying the interface the MS Windows way in the form of it's \"ScopeId\" property which is a \"long\". So this causes issues on non-Windows systems and in some cases, specifically where the MS Windows notation is not supported as an alternate way of specifying the interface it renders this class completely useless.\r\nEven worse, IPAddress.Parse succeeds in parsing an IP Address with a zone index specified as name (ie. %en0\") but totally ignores/scraps the zone index resulting in a false positive.\r\n\r\nAt least on OS X (can't speak for other Unix or BSD based platforms) one can alternatively specify the zone index using the index of the interface. This is not well known or widely used though and requires finding an interface's index instead of just using it's name.\r\n\r\nSo on platforms where the number-based notation is available but not the default, IPAddress.Parse could be extended to look up the interface index using the System.Net.NetworkInformation.NetworkInterface class. On systems where this \"fallback\" isn't available this wouldn't work though and apart from introducing a new property and adjusting the parsing code I have no suggestion for this scenario."},"comment":{"url":"https://api.github.com/repos/dotnet/corefx/issues/comments/220124137","html_url":"https://github.com/dotnet/corefx/issues/8509#issuecomment-220124137","issue_url":"https://api.github.com/repos/dotnet/corefx/issues/8509","id":220124137,"user":{"login":"ericeil","id":7407587,"avatar_url":"https://avatars.githubusercontent.com/u/7407587?v=3","gravatar_id":"","url":"https://api.github.com/users/ericeil","html_url":"https://github.com/ericeil","followers_url":"https://api.github.com/users/ericeil/followers","following_url":"https://api.github.com/users/ericeil/following{/other_user}","gists_url":"https://api.github.com/users/ericeil/gists{/gist_id}","starred_url":"https://api.github.com/users/ericeil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericeil/subscriptions","organizations_url":"https://api.github.com/users/ericeil/orgs","repos_url":"https://api.github.com/users/ericeil/repos","events_url":"https://api.github.com/users/ericeil/events{/privacy}","received_events_url":"https://api.github.com/users/ericeil/received_events","type":"User","site_admin":false},"created_at":"2016-05-18T18:55:53Z","updated_at":"2016-05-18T18:55:53Z","body":"I just tried a test on the current CoreFx running on Ubuntu 14.04; the following address strings were correctly parsed:\r\n\r\n```\r\nfe80::1%lo\r\nfe80::1%eth0\r\n```\r\n\r\nThe resulting IPAddress objects had `ZoneId`s of 1 and 2, respectively, on my machine.  Note that the underlying native sockets API on Linux *and* OSX does deal directly in numeric IDs for these; the difference from Windows is just in how address strings are parsed, by APIs such as `getaddrinfo`.\r\n\r\n`IPAddress.ToString` appears to also do the \"right thing\" with these, as I end up with the original address strings (with names, rather than numeric indexes).\r\n\r\nSo, I suspect this has already been fixed.  @lemonmojo, can you check whether your scenario is working on the most recent (RC2) CoreFx release?\r\n\r\nI will work on adding some new test cases to ensure this doesn't regress."}}