From: Miek Gieben Date: Mon, 31 Jan 2005 13:59:03 +0000 (+0000) Subject: segfault gone, but does not work X-Git-Tag: release-0.50~497 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=791c34e4dcbecc983cf64ecaa71a774808b97cce;p=thirdparty%2Fldns.git segfault gone, but does not work --- diff --git a/doc/overview b/doc/overview index f823da0d..6173dbf8 100644 --- a/doc/overview +++ b/doc/overview @@ -12,6 +12,7 @@ ldns - Overview document o I you know what you do you should be able to bypass the resolver module and directly talk to the network module. o All modules will export functions to be used to client applications. + o All the stuff from the network is put in ldns_buffer's 2. Different parts of ldns: diff --git a/net.c b/net.c index c677ebf6..c1dd514a 100644 --- a/net.c +++ b/net.c @@ -18,7 +18,9 @@ #include #include #include +#include #include +#include #include #include @@ -64,7 +66,9 @@ ldns_send(ldns_resolver *r, ldns_pkt *query_pkt) ns_array = ldns_resolver_nameservers(r); reply = NULL; - if (ldns_pkt2buffer_str(qb, query_pkt) != LDNS_STATUS_OK) { + qb = ldns_buffer_new(MAX_PACKET_SIZE); + + if (ldns_pkt2buffer_wire(qb, query_pkt) != LDNS_STATUS_OK) { return NULL; } @@ -73,6 +77,9 @@ ldns_send(ldns_resolver *r, ldns_pkt *query_pkt) ns_ip = ldns_rdf2native_aaaaa(ns_array[i]); ns_ip_len = ldns_rdf_size(ns_array[i]); + ldns_rdf_print(stdout, ns_ip); + printf("\n"); + /* query */ reply = ldns_send_udp(qb, ns_ip, ns_ip_len); diff --git a/resolver.c b/resolver.c index bb7e07f1..21f54e3e 100644 --- a/resolver.c +++ b/resolver.c @@ -293,11 +293,11 @@ ldns_resolver_send(ldns_resolver *r, ldns_rdf *name, ldns_rr_type type, ldns_rr_ query_pkt = ldns_pkt_query_new(name, type, class); if (!query_pkt) { printf("Failed to generate pkt\n"); + return NULL; } /* return NULL on error */ -/* answer_pkt = ldns_send(*r, query_pkt); - */ + answer_pkt = ldns_send(r, query_pkt); return answer_pkt; } diff --git a/run-test4.c b/run-test4.c index f4542a38..75316f36 100644 --- a/run-test4.c +++ b/run-test4.c @@ -55,10 +55,9 @@ main(void) printf("error pkt sending\n"); return 1; } - /* print the resulting pkt to stdout */ - /* DISABLE FOR NOW ldns_pkt_print(stdout, pkt); */ + ldns_pkt_print(stdout, pkt); return 0; }