{"action":"created","issue":{"url":"https://api.github.com/repos/libuv/libuv/issues/582","labels_url":"https://api.github.com/repos/libuv/libuv/issues/582/labels{/name}","comments_url":"https://api.github.com/repos/libuv/libuv/issues/582/comments","events_url":"https://api.github.com/repos/libuv/libuv/issues/582/events","html_url":"https://github.com/libuv/libuv/issues/582","id":112432242,"number":582,"title":"Usage of uv_ip6_name() is not reversible - looses sin6_scope_id/interface-name","user":{"login":"lhecker","id":2256941,"avatar_url":"https://avatars.githubusercontent.com/u/2256941?v=3","gravatar_id":"","url":"https://api.github.com/users/lhecker","html_url":"https://github.com/lhecker","followers_url":"https://api.github.com/users/lhecker/followers","following_url":"https://api.github.com/users/lhecker/following{/other_user}","gists_url":"https://api.github.com/users/lhecker/gists{/gist_id}","starred_url":"https://api.github.com/users/lhecker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lhecker/subscriptions","organizations_url":"https://api.github.com/users/lhecker/orgs","repos_url":"https://api.github.com/users/lhecker/repos","events_url":"https://api.github.com/users/lhecker/events{/privacy}","received_events_url":"https://api.github.com/users/lhecker/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-10-20T18:38:13Z","updated_at":"2015-11-04T20:59:11Z","closed_at":null,"body":"While trying to setup a multicast UDP socket on every network interface (which is required at least on OS X) I noticed a unfortunate problem:\r\n`uv_interface_addresses(uv_interface_address_t**, int*)` returns a list of `sockaddr` structs which must be turned into strings for the use with `uv_udp_set_membership(uv_udp_t*, const char*, const char*, uv_membership)` using for instance `uv_ip6_name()`.\r\n\r\nIf you use uv_ip6_name()` the `sin6_scope_id` information will be lost though, since the function ignores it.\r\n\r\n`uv_udp_set_membership()` then turns the string back into a `sockaddr_in6` struct using `uv_ip6_addr()`. Due to the previous `uv_ip6_name()` the interface name will be missing and the correct `sin6_scope_id` won't be set and thus multicast won't work on OS X.\r\n\r\nTo fix this I see 3 options:\r\n- Don't fix it and require users to use `if_indextoname()` to append the interface name to the string returned by `uv_ip6_name()`.\r\n- Modify `uv_ip6_name()` to add the correct interface name.\r\n- Add another `uv_udp_set_membership_*()` method which makes it possible to pass a `sockaddr` directly instead. This could also be extended to do the same for other methods from the `uv_udp_*` set.\r\n\r\n(I personally prefer the last option.)\r\n\r\nLet me know what you guys think about this and I'd be willing to submit a PR as soon as I get to it. :smiley:"},"comment":{"url":"https://api.github.com/repos/libuv/libuv/issues/comments/153863520","html_url":"https://github.com/libuv/libuv/issues/582#issuecomment-153863520","issue_url":"https://api.github.com/repos/libuv/libuv/issues/582","id":153863520,"user":{"login":"piscisaureus","id":218257,"avatar_url":"https://avatars.githubusercontent.com/u/218257?v=3","gravatar_id":"","url":"https://api.github.com/users/piscisaureus","html_url":"https://github.com/piscisaureus","followers_url":"https://api.github.com/users/piscisaureus/followers","following_url":"https://api.github.com/users/piscisaureus/following{/other_user}","gists_url":"https://api.github.com/users/piscisaureus/gists{/gist_id}","starred_url":"https://api.github.com/users/piscisaureus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/piscisaureus/subscriptions","organizations_url":"https://api.github.com/users/piscisaureus/orgs","repos_url":"https://api.github.com/users/piscisaureus/repos","events_url":"https://api.github.com/users/piscisaureus/events{/privacy}","received_events_url":"https://api.github.com/users/piscisaureus/received_events","type":"User","site_admin":false},"created_at":"2015-11-04T20:59:11Z","updated_at":"2015-11-04T20:59:11Z","body":"@lhecker my comment?"}}