From 7a2d3d8f3db0c5d0084d72a131c225a28e22e9b9 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Mon, 30 Jan 2017 17:34:59 +0000 Subject: Add guarded debugging output to diagnose failure on ppc --- src/libs6dns/s6dns_engine.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/libs6dns') 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 #include #include +#include #include #include #include @@ -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 ; } -- cgit v1.2.3