]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
segfault gone, but does not work
authorMiek Gieben <miekg@NLnetLabs.nl>
Mon, 31 Jan 2005 13:59:03 +0000 (13:59 +0000)
committerMiek Gieben <miekg@NLnetLabs.nl>
Mon, 31 Jan 2005 13:59:03 +0000 (13:59 +0000)
doc/overview
net.c
resolver.c
run-test4.c

index f823da0de6561cd7af2ace6baeb4e0dedd9591a4..6173dbf8dae23c18700957fca2988a343d0baa67 100644 (file)
@@ -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 c677ebf630955bd070b5325562ebff9bb6fa85bc..c1dd514a04d6dabe6f3407a3eeea6969e6d8a04c 100644 (file)
--- a/net.c
+++ b/net.c
@@ -18,7 +18,9 @@
 #include <ldns/resolver.h>
 #include <ldns/buffer.h>
 #include <ldns/wire2host.h>
+#include <ldns/host2wire.h>
 #include <ldns/host2str.h>
+#include <ldns/resolver.h>
 
 #include <netinet/in.h>
 #include <sys/socket.h>
@@ -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);
                
index bb7e07f1ad2b8b619db34a30c026164163478bee..21f54e3ed6b6a566582af496d0c583945d9e3210 100644 (file)
@@ -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;
 }
index f4542a3879a54c4f9c93cc55c64a7b186770756b..75316f363832ff7ae44383f77804019b2610a328 100644 (file)
@@ -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;
 }