Sets ID correctly. And udp forwarder test - test of networking code against

ldns-testns and dig.


git-svn-id: file:///svn/unbound/trunk@71 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2007-02-07 08:50:17 +00:00
parent d8cbd99dc1
commit fc30ae4b9e
4 changed files with 12 additions and 0 deletions

View file

@ -74,6 +74,8 @@ worker_handle_reply(struct comm_point* c, void* arg, int error,
struct comm_reply* ATTR_UNUSED(reply_info)) struct comm_reply* ATTR_UNUSED(reply_info))
{ {
struct worker* worker = (struct worker*)arg; struct worker* worker = (struct worker*)arg;
LDNS_ID_SET(ldns_buffer_begin(worker->query_reply.c->buffer),
worker->query_id);
if(error != 0) { if(error != 0) {
replyerror(LDNS_RCODE_SERVFAIL, worker); replyerror(LDNS_RCODE_SERVFAIL, worker);
return 0; return 0;
@ -96,6 +98,8 @@ static void
worker_process_query(struct worker* worker) worker_process_query(struct worker* worker)
{ {
/* query the forwarding address */ /* query the forwarding address */
worker->query_id = LDNS_ID_WIRE(ldns_buffer_begin(
worker->query_reply.c->buffer));
pending_udp_query(worker->back, worker->query_reply.c->buffer, pending_udp_query(worker->back, worker->query_reply.c->buffer,
&worker->fwd_addr, worker->fwd_addrlen, UDP_QUERY_TIMEOUT, &worker->fwd_addr, worker->fwd_addrlen, UDP_QUERY_TIMEOUT,
worker_handle_reply, worker); worker_handle_reply, worker);

View file

@ -69,6 +69,8 @@ struct worker {
int num_requests; int num_requests;
/** our one and only query, packet buffer and where to send. */ /** our one and only query, packet buffer and where to send. */
struct comm_reply query_reply; struct comm_reply query_reply;
/** id of query */
uint16_t query_id;
/** address to forward to */ /** address to forward to */
struct sockaddr_storage fwd_addr; struct sockaddr_storage fwd_addr;

View file

@ -1,3 +1,9 @@
7 February 2007: Wouter
- return answer with the same ID as query was sent with.
- created udp forwarder test. I've done some effort to make it perform
quickly. After servers are created, no big sleep statements but
it checks the logfiles to see if servers have come up. Takes 0.14s.
6 February 2007: Wouter 6 February 2007: Wouter
- reviewed code and improved in places. - reviewed code and improved in places.

BIN
testdata/fwd_udp.tpkg vendored Normal file

Binary file not shown.