about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-12-07 21:20:21 -0500
committerJune McEnroe <june@causal.agency>2020-12-07 21:20:21 -0500
commit908f428e6c6df6c7388e4fdccbb9d1d193668ca0 (patch)
tree7dee8ee9dc263a8da5fdb333446d9189930afa43
parentCorrectly handle . in nameString (diff)
downloadbubger-908f428e6c6df6c7388e4fdccbb9d1d193668ca0.tar.gz
bubger-908f428e6c6df6c7388e4fdccbb9d1d193668ca0.zip
Remove RCODE and ANCOUNT check
res_query already checks these.
-rw-r--r--getservinfo.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/getservinfo.c b/getservinfo.c
index 7565ef1..04685d7 100644
--- a/getservinfo.c
+++ b/getservinfo.c
@@ -100,14 +100,12 @@ int getservinfo(
 
 	uint8_t *ptr = msg;
 	u16(&ptr); // ID
-	uint16_t rcode = u16(&ptr) & 0x000F;
+	u16(&ptr); // QR, OPCODE, AA, TC, RD, RA, Z, RCODE
 	uint16_t qdcount = u16(&ptr);
-	uint16_t ancount = u16(&ptr);
+	u16(&ptr); // ANCOUNT
 	u16(&ptr); // NSCOUNT
 	u16(&ptr); // ARCOUNT
 
-	if (rcode || !ancount) return getaddrinfo(hostname, servname, hints, res);
-
 	for (uint16_t q = 0; q < qdcount; ++q) {
 		nameSkip(&ptr); // QNAME
 		u16(&ptr); // QTYPE