GNOME Bugzilla – Bug 635554
IPv6 Link local addresses not supported.
Last modified: 2012-12-12 17:36:43 UTC
GLib/GIO cannot listen on IPv6 link local address. This bug is because GSocketAddress does not have a field for "sin6_scope_id" to fill in interface index (as stated in `man 7 ipv6`). How to go about this? Regards, Vijay
you can create your own struct sockaddr_in6 and then wrap it with g_socket_address_new_from_native(), but yeah, I guess we need to do something about this...
Hi Dan, Thanks for the reply. I at least now know I am in the right place :). I tried that - it won't work. This is a piece of code from Git of Glib ( http://git.gnome.org/browse/glib/tree/gio/gsocketaddress.c ) GSocketAddress * g_socket_address_new_from_native (gpointer native, gsize len) { ... /* lines 235 - 248 */ if (family == AF_INET6) { struct sockaddr_in6 *addr = (struct sockaddr_in6 *) native; GInetAddress *iaddr; GSocketAddress *sockaddr; if (len < sizeof (*addr)) return NULL; iaddr = g_inet_address_new_from_bytes ((guint8 *) &(addr->sin6_addr), AF_INET6); sockaddr = g_inet_socket_address_new (iaddr, g_ntohs (addr->sin6_port)); g_object_unref (iaddr); return sockaddr; } .. } It won't work since there is no property interface ID associated with the GSocketAddress. How can I make the changes?
Created attachment 204320 [details] [review] GInetSocketAddress: add IPv6 flowinfo and scope_id fields struct sin6_addr has two additional fields that struct sin_addr doesn't. Add support for those to GInetSocketAddress, and make sure they don't get lost when converting between glib and native types. ==== Very belated, but this should work... Needs a test program though, at least to make sure parsing/unparsing works right. I don't love the fact that this adds IPv6-specific API to GInetSocketAddress, but splitting it into v4 and v6 subtypes seemed excessive... But maybe that would be better?
Bug 635554 - IPv6 Link local addresses not supported. - UNCONFIRMED added a test to gio/tests/sockets and pushed Attachment 204320 [details] pushed as bf7408c - GInetSocketAddress: add IPv6 flowinfo and scope_id fields
So, if you're still around... did you ever end up using this? I've just discovered that the current implementation is broken (bug 684404 comment 3) and we're trying to figure out if we're going to break anyone if we fix it...