summaryrefslogtreecommitdiff
path: root/src/libs6dns/s6dns_engine.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2019-02-20 11:35:14 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2019-02-20 11:35:14 +0000
commit78585c170875e78fe58fd80ea74916dd41e25bb9 (patch)
treeee33d05d9b34f1a79936d16a0a2978fc58bf5131 /src/libs6dns/s6dns_engine.c
parent64e1ab114e6fcf5e8405fb579f3ce71a5f146b28 (diff)
downloads6-dns-78585c170875e78fe58fd80ea74916dd41e25bb9.tar.xz
Adapt to skalibs/posixishard.h
Diffstat (limited to 'src/libs6dns/s6dns_engine.c')
-rw-r--r--src/libs6dns/s6dns_engine.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/libs6dns/s6dns_engine.c b/src/libs6dns/s6dns_engine.c
index 0057b14..a07b1dc 100644
--- a/src/libs6dns/s6dns_engine.c
+++ b/src/libs6dns/s6dns_engine.c
@@ -5,6 +5,8 @@
#include <strings.h>
#include <stdint.h>
#include <errno.h>
+
+#include <skalibs/posixishard.h>
#include <skalibs/uint16.h>
#include <skalibs/allreadwrite.h>
#include <skalibs/error.h>
@@ -14,7 +16,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>
@@ -33,32 +35,22 @@ 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(" answer qr = %u, opcode = %u, z = %u, qd = %u", h.qr, h.opcode, h.z, h.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 (memcmp(q + qlen - 4, ans + pos, 4)) return 0 ;
}
- LOLDEBUG("relevant() returns 1") ;
return 1 ;
}