w->state.reply = reply_info;
if(error != 0) {
worker_process_query(worker, w, module_event_timeout);
+ w->state.reply = NULL;
return 0;
}
/* sanity check. */
/* error becomes timeout for the module as if this reply
* never arrived. */
worker_process_query(worker, w, module_event_timeout);
+ w->state.reply = NULL;
return 0;
}
worker_process_query(worker, w, module_event_reply);
+ w->state.reply = NULL;
return 0;
}
}
if(event == module_event_timeout) {
/* try TCP if UDP fails */
+ /* TODO: disabled now, make better retry with EDNS.
if(qstate->reply->c->type == comm_udp) {
qinfo_query_encode(qstate->buf, &qstate->qinfo);
(*env->send_query)(qstate->buf, &ie->fwd_addr,
ie->fwd_addrlen, TCP_QUERY_TIMEOUT, qstate, 1);
return;
}
+ */
qstate->ext_state[id] = module_error;
return;
}
}
comm_timer_disable(p->timer);
verbose(VERB_ALGO, "outnet handle udp reply");
- (void)(*p->cb)(p->c, p->cb_arg, NETEVENT_NOERROR, NULL);
+ (void)(*p->cb)(p->c, p->cb_arg, NETEVENT_NOERROR, reply_info);
pending_delete(outnet, p);
return 0;
}
struct entry* entry, struct fake_pending* pend)
{
struct comm_point c;
+ struct comm_reply repinfo;
memset(&c, 0, sizeof(c));
c.fd = -1;
c.buffer = ldns_buffer_new(runtime->bufsize);
if(pend->transport == transport_tcp)
c.type = comm_tcp;
fill_buffer_with_reply(c.buffer, entry, pend->pkt);
- if((*pend->callback)(&c, pend->cb_arg, NETEVENT_NOERROR, NULL)) {
+ repinfo.c = &c;
+ repinfo.addrlen = pend->addrlen;
+ memcpy(&repinfo.addr, &pend->addr, pend->addrlen);
+ if((*pend->callback)(&c, pend->cb_arg, NETEVENT_NOERROR, &repinfo)) {
fatal_exit("testbound: unexpected: callback returned 1");
}
ldns_buffer_free(c.buffer);
struct replay_moment* todo, int error)
{
struct fake_pending* p = runtime->pending_list;
+ struct comm_reply repinfo;
struct comm_point c;
memset(&c, 0, sizeof(c));
if(!p) fatal_exit("No pending queries.");
c.type = comm_tcp;
if(todo->evt_type == repevt_back_reply && todo->match) {
fill_buffer_with_reply(c.buffer, todo->match, p->pkt);
- }
- if((*p->callback)(&c, p->cb_arg, error, NULL)) {
+ }
+ repinfo.c = &c;
+ repinfo.addrlen = p->addrlen;
+ memcpy(&repinfo.addr, &p->addr, p->addrlen);
+ if((*p->callback)(&c, p->cb_arg, error, &repinfo)) {
fatal_exit("unexpected: pending callback returned 1");
}
/* delete the pending item. */