optimize log

This commit is contained in:
Nick Peng
2019-08-20 23:10:05 +08:00
parent 87f04571b1
commit da9ef34588
2 changed files with 4 additions and 4 deletions

View File

@@ -956,7 +956,7 @@ static int _dns_decode_domain(struct dns_context *context, char *output, int siz
} }
ptr = context->data + len; ptr = context->data + len;
if (ptr > context->data + context->maxsize) { if (ptr > context->data + context->maxsize) {
tlog(TLOG_DEBUG, "length is not enouth %u:%ld, %p, %p", context->maxsize, (long)(ptr - context->data), context->ptr, context->data); tlog(TLOG_DEBUG, "length is not enough %u:%ld, %p, %p", context->maxsize, (long)(ptr - context->data), context->ptr, context->data);
return -1; return -1;
} }
is_compressed = 1; is_compressed = 1;
@@ -974,7 +974,7 @@ static int _dns_decode_domain(struct dns_context *context, char *output, int siz
} }
if (ptr > context->data + context->maxsize) { if (ptr > context->data + context->maxsize) {
tlog(TLOG_DEBUG, "length is not enouth %u:%ld, %p, %p", context->maxsize, (long)(ptr - context->data), context->ptr, context->data); tlog(TLOG_DEBUG, "length is not enough %u:%ld, %p, %p", context->maxsize, (long)(ptr - context->data), context->ptr, context->data);
return -1; return -1;
} }
@@ -983,7 +983,7 @@ static int _dns_decode_domain(struct dns_context *context, char *output, int siz
/* copy sub string */ /* copy sub string */
copy_len = (len < size - output_len) ? len : size - 1 - output_len; copy_len = (len < size - output_len) ? len : size - 1 - output_len;
if ((ptr + copy_len) > (context->data + context->maxsize)) { if ((ptr + copy_len) > (context->data + context->maxsize)) {
tlog(TLOG_DEBUG, "length is not enouth %u:%ld, %p, %p", context->maxsize, (long)(ptr - context->data), context->ptr, context->data); tlog(TLOG_DEBUG, "length is not enough %u:%ld, %p, %p", context->maxsize, (long)(ptr - context->data), context->ptr, context->data);
return -1; return -1;
} }
memcpy(output, ptr, copy_len); memcpy(output, ptr, copy_len);

View File

@@ -2132,7 +2132,7 @@ static int _dns_server_recv(struct dns_server_conn_head *conn, unsigned char *in
tlog(TLOG_DEBUG, "recv query packet from %s, len = %d", gethost_by_addr(name, sizeof(name), (struct sockaddr *)from), inpacket_len); tlog(TLOG_DEBUG, "recv query packet from %s, len = %d", gethost_by_addr(name, sizeof(name), (struct sockaddr *)from), inpacket_len);
decode_len = dns_decode(packet, DNS_PACKSIZE, inpacket, inpacket_len); decode_len = dns_decode(packet, DNS_PACKSIZE, inpacket, inpacket_len);
if (decode_len < 0) { if (decode_len < 0) {
tlog(TLOG_ERROR, "decode failed.\n"); tlog(TLOG_DEBUG, "decode failed.\n");
goto errout; goto errout;
} }