[PATCH] Resolve Service address in DNSSD::RemoteService
strueg at mandriva.com
Thu Mar 6 22:26:42 GMT 2008
On Thursday 06 March 2008 20:45:20 Jakub Stachowski wrote:
> Dnia czwartek, 6 marca 2008, Sebastian Trüg napisał:
> > Hi all,
> > please find attached a patch for kdelibs/dnssd which adds handling of
> > service addresses. ATM we only get the hostname which is completely
> > useless in my network since I get stuff like "local.local".
> Why is it useless. There can be machine named 'local' after all. But if
> you then try to ping local.local. and there is lookup error then yes,
> something is broken.
I don't know enough about this topic. I just wanted to make it work for me and
thought I shared. :)
The name lookups failed here and since avahi provides the address... this
seemed like the easy and logical solution.
> > Address lookup was disabled via AVAHAI_LOOKUP_NO_ADDRESS. Why, I don't
> > know.
> I always treated hostname resolving as system resolver's job - in this case
> nss_mdnsd module. AFAIK recent glibc versions have this built-in.
Why exactly? If Avahi already provides it...
And how would I go about that? I tried to do the lookup via QHostInfo which
If this is a config problem I vote to work around it since IMHO the whole
point of something like Avahi is quick and simple connectivity. If I cannot
use that from a default Linux installation, what good is it?
> > Now the address is resolved and stored in ServiceBasePrivate,
> > accessible via the new address() method. I know that it would probably
> > make more sense to only store it in RemoteService but the design sees it
> > only as a trivial extension to ServiceBase without any new members.
> > Any objections?
> Two things:
> 1) What about mdnsd? mdnsd-remoteservice.cpp is patched to use
> ResolveEvent::m_address which does not exist. In fact mdnsd does not seem
> to be capable of resolving service and its host name in one shot. So I
> guess when resolve_callback gets called it has to first resolve hostname
> and only then emit resolved(true)
stupid me. I added that and was happy that it compiled. I never thought about
the fact that on my avahi-based system the mdns code would never get
> 2) Why use QString as type address? I think more specific type like
> QHostAddress would be better.
Correct. I just used QString because it is used by the DBus interface
(naturally) and it was the fast solution.
In the end the main goal was to get this discussion started. That is always
simpler with some code to debate about. ;)
More information about the kde-core-devel