]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
copy id for hex packets.
authorWouter Wijngaards <wouter@NLnetLabs.nl>
Tue, 30 Oct 2007 10:57:46 +0000 (10:57 +0000)
committerWouter Wijngaards <wouter@NLnetLabs.nl>
Tue, 30 Oct 2007 10:57:46 +0000 (10:57 +0000)
examples/ldns-testpkts.c
examples/ldns-testpkts.h

index d11929b7939a09a14e4ef556514137a1824de1ad..f3ae4a3fb7d2e994af1d7bed5de86cf54646ab93 100644 (file)
@@ -781,9 +781,14 @@ handle_query(uint8_t* inbuf, ssize_t inlen, struct entry* entries, int* count,
                                answer_pkt = NULL;
                        } else {
                                verbose(3, "Could not parse hex data (%s), sending hex data directly.\n", ldns_get_errorstr_by_id(status));
+                               /* still try to adjust ID */
                                answer_size = ldns_buffer_capacity(p->reply_from_hex);
                                outbuf = LDNS_XMALLOC(uint8_t, answer_size);
                                memcpy(outbuf, ldns_buffer_export(p->reply_from_hex), answer_size);
+                               if(entry->copy_id) {
+                                       ldns_write_uint16(outbuf, 
+                                               ldns_pkt_id(query_pkt));
+                               }
                        }
                } else {
                        answer_pkt = ldns_pkt_clone(p->reply);
index df9ee5237f5b4067f1cd04d51d79adb50fb12440..1bb6c9e0130fcba5d3ea1efd8e25b57e1ca75beb 100644 (file)
@@ -78,7 +78,7 @@
                                ; with the SECTION keywords (only SECTION QUERY
                                ; is used to match queries). If the data cannot
                                ; be parsed, ADJUST rules for the answer packet
-                               ; are ignored
+                               ; are ignored. Only copy_id is done.
        HEX_ANSWER_END
        ENTRY_END