[ldns-users] How to use _searchlist provided by ldns_struct_resolver?
matthijs at NLnetLabs.nl
Mon Sep 20 10:40:07 UTC 2010
-----BEGIN PGP SIGNED MESSAGE-----
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.
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,
> 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
> 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
> Best regards,
> Zbynek Michl wrote:
>>>> 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
>>>> ldns-users mailing list
>>>> ldns-users at open.nlnetlabs.nl
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
-----END PGP SIGNATURE-----
More information about the ldns-users