Hello,
I'm writing a QT application that uses avahi to resolve IPV4 and IPV6 addresses. I would like to have avahi return all IPV6 addresses registered to a particular host, but I've been unable to resolve more than 1. Sometimes I get the link-local and sometimes the globally scoped address. I tracked the issue to avahi-core/resolve-service.c in record_browser_callback() where it only reports the first address resolved. I included a patch that reports all addresses.

In order to resolve all addresses, the client must not free AvahiServiceResolver in the callback for the first address as in the example program client-browse-services.c in resolve_callback(). If the resolver is freed after receiving the first address, no more addresses will be sent.

Thanks.
-Kevin Edger

--
Kevin Ediger
Principal Design Engineer, Software
LI-COR Biosciences
Lincoln, NE
[EMAIL PROTECTED]

diff -pur avahi-0.6.23-orig/avahi-core/resolve-service.c avahi-0.6.23/avahi-core/resolve-service.c
--- avahi-0.6.23-orig/avahi-core/resolve-service.c	2008-06-17 18:13:44.000000000 -0500
+++ avahi-0.6.23/avahi-core/resolve-service.c	2008-11-06 17:22:45.000000000 -0600
@@ -252,10 +252,13 @@ static void record_browser_callback(
 
                     assert(!(r->user_flags & AVAHI_LOOKUP_NO_ADDRESS));
 
-                    if (!r->address_record) {
-                        r->address_record = avahi_record_ref(record);
-                        changed = 1;
+                    if (r->address_record) {
+                        avahi_record_unref(r->address_record);
+                        r->address_record = NULL;
                     }
+		    
+                    r->address_record = avahi_record_ref(record);
+                    changed = 1;
                     break;
                 
                 default:
_______________________________________________
avahi mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/avahi

Reply via email to