--- gnome-vfs-2.16.2/libgnomevfs/gnome-vfs-dns-sd.c.ipv6 2006-11-30 13:40:48.000000000 +0100 +++ gnome-vfs-2.16.2/libgnomevfs/gnome-vfs-dns-sd.c 2006-11-30 14:28:48.000000000 +0100 @@ -1959,6 +1959,7 @@ struct sync_resolve_data { AvahiSimplePoll *poll; gboolean got_data; + gboolean got_link_local_ipv6; char *host; int port; char *text; @@ -1997,6 +1998,13 @@ data = user_data; if (event == AVAHI_RESOLVER_FOUND) { + if (address->proto == AVAHI_PROTO_INET6 && + address->data.ipv6.address[0] == 0xfe && + address->data.ipv6.address[1] == 0x80) { + data->got_link_local_ipv6 = TRUE; + goto out; + } + data->got_data = TRUE; avahi_address_snprint (a, sizeof(a), address); data->host = g_strdup (a); @@ -2005,7 +2013,7 @@ data->text = g_malloc (data->text_len); avahi_string_list_serialize (txt, data->text, data->text_len); } - + out: avahi_service_resolver_free (r); avahi_simple_poll_quit (data->poll); } @@ -2090,8 +2098,13 @@ AvahiClient *client = NULL; AvahiServiceResolver *sr; int error; + AvahiProtocol protocol; struct sync_resolve_data resolve_data = {0}; + protocol = AVAHI_PROTO_UNSPEC; + + retry: + simple_poll = avahi_simple_poll_new (); resolve_data.poll = simple_poll; if (simple_poll == NULL) { @@ -2109,7 +2122,8 @@ return GNOME_VFS_ERROR_GENERIC; } - sr = avahi_service_resolver_new (client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, + resolve_data.got_link_local_ipv6 = FALSE; + sr = avahi_service_resolver_new (client, AVAHI_IF_UNSPEC, protocol, name, type, domain, AVAHI_PROTO_UNSPEC, 0, avahi_resolve_sync_callback, &resolve_data); if (sr == NULL) { @@ -2127,6 +2141,14 @@ avahi_client_free (client); avahi_simple_poll_free (simple_poll); + + if (resolve_data.got_link_local_ipv6) { + /* We ignore non-routable ipv6 link-local addresses here, because our + api doesn't give the iface, so they are useless. Prefer ipv4 address instead */ + protocol = AVAHI_PROTO_INET; + goto retry; + } + if (resolve_data.got_data) { *host = resolve_data.host; *port = resolve_data.port;