[ldns-users] ldns_resolver_set_ip6() and ldns_resolver_query() leads to SIGSEGV
Zbynek Michl
zbynek.michl at nic.cz
Mon Feb 15 12:54:21 UTC 2010
Hello,
when I read resolver addresses from /etc/resolv.conf where are only IPv4
addresses and set IPv6 resolvers preference to LDNS_RESOLV_INET6, then
ldns_resolver_query() calling causes a crash.
My /etc/resolv.conf:
nameserver 127.0.0.1
nameserver 172.20.20.40
Sample code:
/* create a new resolver from /etc/resolv.conf */
s = ldns_resolver_new_frm_file(&res, NULL);
if (s != LDNS_STATUS_OK) {
exit(EXIT_FAILURE);
}
/* set IPv6 resolver preference */
ldns_resolver_set_ip6(res, LDNS_RESOLV_INET6);
/* use the resolver to send a query for the mx
* records of the domain given on the command line
*/
p = ldns_resolver_query(res, domain, LDNS_RR_TYPE_MX, LDNS_RR_CLASS_IN,
LDNS_RD);
When I compile it and run, on ldns_resolver_query() calling program crashes
(Segmentation fault).
The same failure occurs when I set IPv4 preference and resolv.conf contains only
IPv6 addresses.
gdb backtrace:
Program received signal SIGSEGV, Segmentation fault.
ldns_pkt_tc (packet=0x0) at packet.c:58
58 {
(gdb) bt
#0 ldns_pkt_tc (packet=0x0) at packet.c:58
#1 0x00007ffff73d3072 in ldns_resolver_send_pkt (answer=0x7fffffffe200,
r=0x602290, query_pkt=0x602070) at resolver.c:968
#2 0x00007ffff73d3246 in ldns_resolver_send (answer=0x7fffffffe268, r=0x602290,
name=0x602010, t=LDNS_RR_TYPE_MX,
c=LDNS_RR_CLASS_IN, flags=8) at resolver.c:1090
#3 0x00007ffff73d3308 in ldns_resolver_query (r=0x602290, name=0x602010,
t=LDNS_RR_TYPE_MX, c=LDNS_RR_CLASS_IN, flags=8)
at resolver.c:908
Regards,
Zbynek
More information about the ldns-users
mailing list