diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2017-01-30 17:34:59 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2017-01-30 17:34:59 +0000 |
commit | 7a2d3d8f3db0c5d0084d72a131c225a28e22e9b9 (patch) | |
tree | f0c8791c2fe7e1f679399ddfb7fc81c65db7b6b5 /src | |
parent | 32a9d6006bd1c6179d49a8f661e65423fbdd7e79 (diff) | |
download | s6-dns-7a2d3d8f3db0c5d0084d72a131c225a28e22e9b9.tar.xz |
Add guarded debugging output to diagnose failure on ppc
Diffstat (limited to 'src')
-rw-r--r-- | src/libs6dns/s6dns_engine.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libs6dns/s6dns_engine.c b/src/libs6dns/s6dns_engine.c index c991c16..5cb77e5 100644 --- a/src/libs6dns/s6dns_engine.c +++ b/src/libs6dns/s6dns_engine.c @@ -14,6 +14,7 @@ #include <skalibs/djbunix.h> #include <skalibs/ip46.h> #include <skalibs/random.h> +#include <skalibs/lolstdio.h> #include <s6-dns/s6dns-constants.h> #include <s6-dns/s6dns-message.h> #include <s6-dns/s6dns-engine.h> @@ -32,22 +33,32 @@ static int relevant (char const *q, unsigned int qlen, char const *ans, unsigned { s6dns_message_header_t h ; uint16_t id ; + LOLDEBUG("entering relevant()") ; s6dns_message_header_unpack(ans, &h) ; + LOLDEBUG(" testing answer qr, opcode, z, counts.qd") ; if (!h.qr || h.opcode || h.z || (h.counts.qd != 1)) return 0 ; + LOLDEBUG(" testing answer rd") ; if (h.rd != (q[2] & 1)) return 0 ; + LOLDEBUG(" if strict(%d), testing h.aa and query rd", strict) ; if (strict && !h.aa && !(q[2] & 1)) return 0 ; uint16_unpack_big(q, &id) ; + LOLDEBUG(" testing answer id") ; if (id != h.id) return 0 ; } { char buf[255] ; unsigned int pos = 12 ; unsigned int n = s6dns_message_get_domain_internal(buf, 255, ans, anslen, &pos) ; + LOLDEBUG(" testing return from s6dns_message_get_domain_internal()") ; if (!n) return -1 ; + LOLDEBUG(" testing that pos+4 <= anslen") ; if (pos + 4 > anslen) return (errno = EPROTO, -1) ; + LOLDEBUG(" testing answer domain against query") ; if (qdomain_diff(buf, n, q + 12, qlen - 16)) return 0 ; + LOLDEBUG(" testing answer qclass and qtype against query" ) ; if (byte_diff(q + qlen - 4, 4, ans + pos)) return 0 ; } + LOLDEBUG("relevant() returns 1") ; return 1 ; } |