[ldns-users] How to use _searchlist provided by ldns_struct_resolver?

Matthijs Mekking matthijs at NLnetLabs.nl
Mon Oct 18 11:11:00 UTC 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Zbynek,

On 10/15/2010 03:01 PM, Zbynek Michl wrote:
...
> So I would expect ldns_resolver_search() should try every combination
> for given name (with and without suffix(es)).

I guess by default adding the root domain (".") to the search list would
fix that.

> Btw reading of searchlist from resolv.conf containing more than one
> suffix (e.g. search mydomain.com mydomain.cz) still does not work properly.

Fixed this in r3357.

Best regards,
Matthijs

> 
> Thanks,
> Zbynek
> 
> On 20.9.2010 12:40, Matthijs Mekking wrote:
> Hi Zbynek,
> 
> I noticed that the dname2str function prints a dot after every label.
> And that function is used in ldns_resolver_search(...) to determine if
> the domain is a relative or a fqdn. I fixed this in trunk, r3347.
> 
> I found another bug in the ldns_resolver_search function. The
> ldns_resolver stops as soon it founds a packet. But it would be nice if
> the ldns_resolver continues its search if the RCODE of that packet is
> not NOERROR. This fix is in trunk since r3349.
> 
> Thanks for your report.
> 
> Best regards,
> 
> Matthijs
> 
> 
> On 09/14/2010 06:46 PM, Zbynek Michl wrote:
>>>> Hi Matthijs,
>>>>
>>>> I have tried to make a dname like this:
>>>>
>>>> domain = ldns_dname_new_frm_str("myhostname");
>>>> new_domain = ldns_dname_new_frm_data(ldns_rdf_size(domain) - 1,
>>>>                                       ldns_rdf_data(domain));
>>>> printf("domain: %s\n", ldns_rdf2str(domain));
>>>> printf("new_domain: %s\n", ldns_rdf2str(new_domain));
>>>>
>>>> It is strange for me that both printf()s print the same result (with dot
>>>> at the end). And then when I use:
>>>>
>>>> p = ldns_resolver_search(res, new_domain, LDNS_RR_TYPE_A,
>>>>                           LDNS_RR_CLASS_IN, LDNS_RD);
>>>>
>>>> resolver returns FORMERR, because ldns_resolver_search() uses
>>>> ldns_rdf2str() which causes to call ldns_resolver_query() with incorrect
>>>> domain name.
>>>>
>>>>
>>>> Another error of ldns_resolver_search() is that it does not check RCODE.
>>>> In case of this resolv.conf:
>>>>
>>>> search mydomain.com
>>>> search mydomain.cz
>>>>
>>>> and query for "myhostname" will try just first search value even if
>>>> NXDOMAIN is returned.
>>>>
>>>> Last error that I have observed is that ldns_resolver_new_frm_file()
>>>> reads just first domain name on line, so this searchlist definition is
>>>> not read completely:
>>>>
>>>> search mydomain.com mydomain.cz
>>>>
>>>>
>>>> Regards,
>>>> Zbynek
>>>>
>>>> On 12.5.2010 09:04, Matthijs Mekking wrote:
>>>> Hi Zbynek,
>>>>
>>>> Sorry for the late follow-up. You are right that making a dname from
>>>> string always returns an absolute dname. You can try making a dname with
>>>> ldns_dname_new_frm_data().
>>>>
>>>> Best regards,
>>>>
>>>> Matthijs
>>>>
>>>> Zbynek Michl wrote:
>>>>>>> Hello,
>>>>>>>
>>>>>>> I am trying to use search list, but unsuccessfully. Here is an
>>>>>>> sample:
>>>>>>>
>>>>>>> --- CODE ---
>>>>>>> ldns_rdf *domain = ldns_dname_new_frm_str("myhostname");
>>>>>>> ldns_rdf *search = ldns_dname_new_frm_str("mydomain.cz");
>>>>>>>
>>>>>>> ldns_resolver_push_searchlist(res, search);
>>>>>>>
>>>>>>> p = ldns_resolver_search(res, domain, LDNS_RR_TYPE_A,
>>>>>>>                LDNS_RR_CLASS_IN, LDNS_RD);
>>>>>>> --- /CODE ---
>>>>>>>
>>>>>>> The problem is that "myhostname.mydomain.cz" will never be tried,
>>>>>>> because of ldns_dname_new_frm_str() adds "." to the end of
>>>>>>> "myhostname"
>>>>>>> and therefore ldns_resolver_search() will not concatenate
>>>>>>> "mydomain.cz".
>>>>>>> So how can I create "myhostname" RDF without trailing "."? Or any
>>>>>>> other
>>>>>>> suggestion?
>>>>>>>
>>>>>>> Cheers,
>>>>>>> Zbynek
>>>>>>> _______________________________________________
>>>>>>> ldns-users mailing list
>>>>>>> ldns-users at open.nlnetlabs.nl
>>>>>>> http://open.nlnetlabs.nl/mailman/listinfo/ldns-users
>>>>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJMvCtEAAoJEA8yVCPsQCW5ksUH/18uKaUonr99L0qCKX8802T6
YqPdMI7aM+hUMhoxmCAN6xLrUAtyoWtien201ip/UiVss3I3n9aw1jqjCUCzV3VH
sh4gjyR+IvwOHljlc73/Qv8H1ZQGnfiUr3F+E49jKKr8XnqWI5Za3nkBAkUqtZQ1
su6fTV/8Z+kpy6WClr0yKPGCS0S8iytVJwgvbLwBrGb6lpZV4Jj1DaP0EI3O3QXd
zx4nFEdq4yBhn7qGgIyXuB09gB8y3miVl7zsqdJUQqLpyFyhGRdcVLbWmHZuwJeD
pm9IPE3sSlSFHR0Fr+ozcus8bG3MM3H/Ij6M9lUJTw4gQjSoHSfE1Y/ONHsUcsw=
=gsMr
-----END PGP SIGNATURE-----



More information about the ldns-users mailing list