mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
errors have addresses with them.
git-svn-id: file:///svn/unbound/trunk@692 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
907ab3d99a
commit
268ada0d33
7 changed files with 25 additions and 16 deletions
|
|
@ -1,3 +1,6 @@
|
||||||
|
18 October 2007: Wouter
|
||||||
|
- addresses are logged with errors.
|
||||||
|
|
||||||
17 October 2007: Wouter
|
17 October 2007: Wouter
|
||||||
- fixup another cycle detect and ns-addr timeout resolution bug.
|
- fixup another cycle detect and ns-addr timeout resolution bug.
|
||||||
This time by refusing delegations from the cache without addresses
|
This time by refusing delegations from the cache without addresses
|
||||||
|
|
|
||||||
|
|
@ -215,7 +215,7 @@ void delegpt_log(enum verbosity_value v, struct delegpt* dp)
|
||||||
log_info(" %s%s", buf, (ns->resolved?"*":""));
|
log_info(" %s%s", buf, (ns->resolved?"*":""));
|
||||||
}
|
}
|
||||||
for(a = dp->target_list; a; a = a->next_target) {
|
for(a = dp->target_list; a; a = a->next_target) {
|
||||||
log_addr(" ", &a->addr, a->addrlen);
|
log_addr(VERB_ALGO, " ", &a->addr, a->addrlen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1145,7 +1145,8 @@ processQueryTargets(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||||
&target->addr, target->addrlen, qstate);
|
&target->addr, target->addrlen, qstate);
|
||||||
if(!outq) {
|
if(!outq) {
|
||||||
log_err("error sending query to auth server; skip this address");
|
log_err("error sending query to auth server; skip this address");
|
||||||
log_addr("error for address:", &target->addr, target->addrlen);
|
log_addr(0, "error for address:",
|
||||||
|
&target->addr, target->addrlen);
|
||||||
return next_state(iq, QUERYTARGETS_STATE);
|
return next_state(iq, QUERYTARGETS_STATE);
|
||||||
}
|
}
|
||||||
outbound_list_insert(&iq->outlist, outq);
|
outbound_list_insert(&iq->outlist, outq);
|
||||||
|
|
|
||||||
|
|
@ -132,14 +132,14 @@ outnet_tcp_take_into_use(struct waiting_tcp* w, uint8_t* pkt, size_t pkt_len)
|
||||||
s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
|
s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||||
if(s == -1) {
|
if(s == -1) {
|
||||||
log_err("outgoing tcp: socket: %s", strerror(errno));
|
log_err("outgoing tcp: socket: %s", strerror(errno));
|
||||||
log_addr("failed address", &w->addr, w->addrlen);
|
log_addr(0, "failed address", &w->addr, w->addrlen);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
fd_set_nonblock(s);
|
fd_set_nonblock(s);
|
||||||
if(connect(s, (struct sockaddr*)&w->addr, w->addrlen) == -1) {
|
if(connect(s, (struct sockaddr*)&w->addr, w->addrlen) == -1) {
|
||||||
if(errno != EINPROGRESS) {
|
if(errno != EINPROGRESS) {
|
||||||
log_err("outgoing tcp: connect: %s", strerror(errno));
|
log_err("outgoing tcp: connect: %s", strerror(errno));
|
||||||
log_addr("failed address", &w->addr, w->addrlen);
|
log_addr(0, "failed address", &w->addr, w->addrlen);
|
||||||
close(s);
|
close(s);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -206,7 +206,8 @@ outnet_tcp_cb(struct comm_point* c, void* arg, int error,
|
||||||
/* check ID */
|
/* check ID */
|
||||||
if(ldns_buffer_limit(c->buffer) < sizeof(uint16_t) ||
|
if(ldns_buffer_limit(c->buffer) < sizeof(uint16_t) ||
|
||||||
LDNS_ID_WIRE(ldns_buffer_begin(c->buffer))!=pend->id) {
|
LDNS_ID_WIRE(ldns_buffer_begin(c->buffer))!=pend->id) {
|
||||||
log_addr("outnettcp: bad ID in reply, from:",
|
log_addr(VERB_DETAIL,
|
||||||
|
"outnettcp: bad ID in reply, from:",
|
||||||
&pend->query->addr, pend->query->addrlen);
|
&pend->query->addr, pend->query->addrlen);
|
||||||
error = NETEVENT_CLOSED;
|
error = NETEVENT_CLOSED;
|
||||||
}
|
}
|
||||||
|
|
@ -241,9 +242,8 @@ outnet_udp_cb(struct comm_point* c, void* arg, int error,
|
||||||
memcpy(&key.addr, &reply_info->addr, reply_info->addrlen);
|
memcpy(&key.addr, &reply_info->addr, reply_info->addrlen);
|
||||||
key.addrlen = reply_info->addrlen;
|
key.addrlen = reply_info->addrlen;
|
||||||
verbose(VERB_ALGO, "Incoming reply id = %4.4x", key.id);
|
verbose(VERB_ALGO, "Incoming reply id = %4.4x", key.id);
|
||||||
if(verbosity >= VERB_ALGO) {
|
log_addr(VERB_ALGO, "Incoming reply addr =",
|
||||||
log_addr("Incoming reply addr =", &reply_info->addr, reply_info->addrlen);
|
&reply_info->addr, reply_info->addrlen);
|
||||||
}
|
|
||||||
|
|
||||||
/* find it, see if this thing is a valid query response */
|
/* find it, see if this thing is a valid query response */
|
||||||
verbose(VERB_ALGO, "lookup size is %d entries", (int)outnet->pending->count);
|
verbose(VERB_ALGO, "lookup size is %d entries", (int)outnet->pending->count);
|
||||||
|
|
@ -1019,8 +1019,9 @@ serviced_tcp_callback(struct comm_point* c, void* arg, int error,
|
||||||
struct serviced_query* sq = (struct serviced_query*)arg;
|
struct serviced_query* sq = (struct serviced_query*)arg;
|
||||||
struct comm_reply r2;
|
struct comm_reply r2;
|
||||||
sq->pending = NULL; /* removed after this callback */
|
sq->pending = NULL; /* removed after this callback */
|
||||||
if(error != NETEVENT_NOERROR && verbosity >= VERB_DETAIL)
|
if(error != NETEVENT_NOERROR)
|
||||||
log_addr("tcp error for address", &sq->addr, sq->addrlen);
|
log_addr(VERB_DETAIL, "tcp error for address",
|
||||||
|
&sq->addr, sq->addrlen);
|
||||||
if(error==NETEVENT_NOERROR)
|
if(error==NETEVENT_NOERROR)
|
||||||
infra_update_tcp_works(sq->outnet->infra, &sq->addr,
|
infra_update_tcp_works(sq->outnet->infra, &sq->addr,
|
||||||
sq->addrlen);
|
sq->addrlen);
|
||||||
|
|
|
||||||
|
|
@ -178,7 +178,7 @@ pending_find_match(struct replay_runtime* runtime, struct entry** entry,
|
||||||
"with entry line %d", timenow,
|
"with entry line %d", timenow,
|
||||||
p->start_step, p->end_step, (*entry)->lineno);
|
p->start_step, p->end_step, (*entry)->lineno);
|
||||||
if(p->addrlen != 0)
|
if(p->addrlen != 0)
|
||||||
log_addr("matched ip", &p->addr, p->addrlen);
|
log_addr(0, "matched ip", &p->addr, p->addrlen);
|
||||||
log_pkt("matched pkt: ", (*entry)->reply_list->reply);
|
log_pkt("matched pkt: ", (*entry)->reply_list->reply);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -146,13 +146,16 @@ memdup(void* data, size_t len)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
log_addr(const char* str, struct sockaddr_storage* addr, socklen_t addrlen)
|
log_addr(enum verbosity_value v, const char* str,
|
||||||
|
struct sockaddr_storage* addr, socklen_t addrlen)
|
||||||
{
|
{
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
const char* family = "unknown";
|
const char* family = "unknown";
|
||||||
char dest[100];
|
char dest[100];
|
||||||
int af = (int)((struct sockaddr_in*)addr)->sin_family;
|
int af = (int)((struct sockaddr_in*)addr)->sin_family;
|
||||||
void* sinaddr = &((struct sockaddr_in*)addr)->sin_addr;
|
void* sinaddr = &((struct sockaddr_in*)addr)->sin_addr;
|
||||||
|
if(verbosity < v)
|
||||||
|
return;
|
||||||
switch(af) {
|
switch(af) {
|
||||||
case AF_INET: family="ip4"; break;
|
case AF_INET: family="ip4"; break;
|
||||||
case AF_INET6: family="ip6";
|
case AF_INET6: family="ip6";
|
||||||
|
|
@ -166,8 +169,8 @@ log_addr(const char* str, struct sockaddr_storage* addr, socklen_t addrlen)
|
||||||
}
|
}
|
||||||
dest[sizeof(dest)-1] = 0;
|
dest[sizeof(dest)-1] = 0;
|
||||||
port = ntohs(((struct sockaddr_in*)addr)->sin_port);
|
port = ntohs(((struct sockaddr_in*)addr)->sin_port);
|
||||||
verbose(VERB_DETAIL, "%s %s %s %d (len %d)",
|
log_info("%s %s %s %d (len %d)", str, family, dest, (int)port,
|
||||||
str, family, dest, (int)port, (int)addrlen);
|
(int)addrlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
||||||
|
|
@ -145,12 +145,13 @@ void* memdup(void* data, size_t len);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prints the sockaddr in readable format with log_info. Debug helper.
|
* Prints the sockaddr in readable format with log_info. Debug helper.
|
||||||
|
* @param v: at what verbosity level to print this.
|
||||||
* @param str: descriptive string printed with it.
|
* @param str: descriptive string printed with it.
|
||||||
* @param addr: the sockaddr to print. Can be ip4 or ip6.
|
* @param addr: the sockaddr to print. Can be ip4 or ip6.
|
||||||
* @param addrlen: length of addr.
|
* @param addrlen: length of addr.
|
||||||
*/
|
*/
|
||||||
void log_addr(const char* str, struct sockaddr_storage* addr,
|
void log_addr(enum verbosity_value v, const char* str,
|
||||||
socklen_t addrlen);
|
struct sockaddr_storage* addr, socklen_t addrlen);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prints zone name and sockaddr in readable format with log_info. Debug.
|
* Prints zone name and sockaddr in readable format with log_info. Debug.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue