After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 635554 - IPv6 Link local addresses not supported.
IPv6 Link local addresses not supported.
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: network
2.27.x
Other All
: Normal major
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2010-11-22 20:29 UTC by coolbuddy
Modified: 2012-12-12 17:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GInetSocketAddress: add IPv6 flowinfo and scope_id fields (9.25 KB, patch)
2011-12-29 14:47 UTC, Dan Winship
committed Details | Review

Description coolbuddy 2010-11-22 20:29:53 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
Comment 1 Dan Winship 2010-11-23 20:09:05 UTC
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...
Comment 2 coolbuddy 2010-11-26 15:24:45 UTC
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?
Comment 3 Dan Winship 2011-12-29 14:47:26 UTC
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?
Comment 4 Dan Winship 2012-01-16 18:41:38 UTC
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
Comment 5 Dan Winship 2012-12-12 17:36:43 UTC
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...