1 #ifndef BOOST_TEST_DYN_LINK
2 #define BOOST_TEST_DYN_LINK
5 #define BOOST_TEST_NO_MAIN
10 #include <boost/test/unit_test.hpp>
11 #include "dnswriter.hh"
12 #include "dnsrecords.hh"
13 #include "dns_random.hh"
15 #include "recpacketcache.hh"
16 #include "taskqueue.hh"
17 #include "rec-taskqueue.hh"
20 BOOST_AUTO_TEST_SUITE(test_recpacketcache_cc
)
22 BOOST_AUTO_TEST_CASE(test_recPacketCacheSimple
)
24 RecursorPacketCache
rpc(1000);
30 BOOST_CHECK_EQUAL(rpc
.size(), 0U);
32 DNSName
qname("www.powerdns.com");
33 vector
<uint8_t> packet
;
34 DNSPacketWriter
pw(packet
, qname
, QType::A
);
35 pw
.getHeader()->rd
= true;
36 pw
.getHeader()->qr
= false;
37 pw
.getHeader()->id
= dns_random_uint16();
38 string
qpacket((const char*)&packet
[0], packet
.size());
39 pw
.startRecord(qname
, QType::A
, ttd
);
41 time_t now
= time(nullptr);
42 BOOST_CHECK_EQUAL(rpc
.getResponsePacket(tag
, qpacket
, now
, &fpacket
, &age
, &qhash
), false);
43 BOOST_CHECK_EQUAL(rpc
.getResponsePacket(tag
, qpacket
, qname
, QType::A
, QClass::IN
, now
, &fpacket
, &age
, &qhash
), false);
45 ARecordContent
ar("127.0.0.1");
48 string
rpacket((const char*)&packet
[0], packet
.size());
50 rpc
.insertResponsePacket(tag
, qhash
, string(qpacket
), qname
, QType::A
, QClass::IN
, string(rpacket
), now
, ttd
, vState::Indeterminate
, boost::none
, false);
51 BOOST_CHECK_EQUAL(rpc
.size(), 1U);
52 rpc
.doPruneTo(now
, 0);
53 BOOST_CHECK_EQUAL(rpc
.size(), 0U);
54 rpc
.insertResponsePacket(tag
, qhash
, string(qpacket
), qname
, QType::A
, QClass::IN
, string(rpacket
), now
, ttd
, vState::Indeterminate
, boost::none
, false);
55 BOOST_CHECK_EQUAL(rpc
.size(), 1U);
56 rpc
.doWipePacketCache(qname
);
57 BOOST_CHECK_EQUAL(rpc
.size(), 0U);
59 rpc
.insertResponsePacket(tag
, qhash
, string(qpacket
), qname
, QType::A
, QClass::IN
, string(rpacket
), now
, ttd
, vState::Indeterminate
, boost::none
, false);
60 BOOST_CHECK_EQUAL(rpc
.size(), 1U);
62 bool found
= rpc
.getResponsePacket(tag
, qpacket
, now
, &fpacket
, &age
, &qhash2
);
63 BOOST_CHECK_EQUAL(found
, true);
64 BOOST_CHECK_EQUAL(qhash
, qhash2
);
65 BOOST_CHECK_EQUAL(fpacket
, rpacket
);
66 found
= rpc
.getResponsePacket(tag
, qpacket
, qname
, QType::A
, QClass::IN
, now
, &fpacket
, &age
, &qhash2
);
67 BOOST_CHECK_EQUAL(found
, true);
68 BOOST_CHECK_EQUAL(qhash
, qhash2
);
69 BOOST_CHECK_EQUAL(fpacket
, rpacket
);
72 qname
+= DNSName("co.uk");
73 DNSPacketWriter
pw2(packet
, qname
, QType::A
);
75 pw2
.getHeader()->rd
= true;
76 pw2
.getHeader()->qr
= false;
77 pw2
.getHeader()->id
= dns_random_uint16();
78 qpacket
.assign((const char*)&packet
[0], packet
.size());
80 found
= rpc
.getResponsePacket(tag
, qpacket
, now
, &fpacket
, &age
, &qhash
);
81 BOOST_CHECK_EQUAL(found
, false);
82 found
= rpc
.getResponsePacket(tag
, qpacket
, qname
, QType::A
, QClass::IN
, now
, &fpacket
, &age
, &qhash
);
83 BOOST_CHECK_EQUAL(found
, false);
85 rpc
.doWipePacketCache(DNSName("com"), 0xffff, true);
86 BOOST_CHECK_EQUAL(rpc
.size(), 0U);
89 BOOST_AUTO_TEST_CASE(test_recPacketCacheSimpleWithRefresh
)
91 RecursorPacketCache::s_refresh_ttlperc
= 30;
92 RecursorPacketCache
rpc(1000);
98 BOOST_CHECK_EQUAL(rpc
.size(), 0U);
102 DNSName
qname("www.powerdns.com");
103 vector
<uint8_t> packet
;
104 DNSPacketWriter
pw(packet
, qname
, QType::A
);
105 pw
.getHeader()->rd
= true;
106 pw
.getHeader()->qr
= false;
107 pw
.getHeader()->id
= dns_random_uint16();
108 string
qpacket((const char*)&packet
[0], packet
.size());
109 pw
.startRecord(qname
, QType::A
, ttd
);
111 time_t now
= time(nullptr);
113 BOOST_CHECK_EQUAL(rpc
.getResponsePacket(tag
, qpacket
, qname
, QType::A
, QClass::IN
, now
, &fpacket
, &age
, &qhash
), false);
115 ARecordContent
ar("127.0.0.1");
118 string
rpacket((const char*)&packet
[0], packet
.size());
120 rpc
.insertResponsePacket(tag
, qhash
, string(qpacket
), qname
, QType::A
, QClass::IN
, string(rpacket
), now
, ttd
, vState::Indeterminate
, boost::none
, false);
121 BOOST_CHECK_EQUAL(rpc
.size(), 1U);
123 bool found
= rpc
.getResponsePacket(tag
, qpacket
, qname
, QType::A
, QClass::IN
, now
, &fpacket
, &age
, &qhash2
);
124 BOOST_CHECK_EQUAL(found
, true);
125 BOOST_CHECK_EQUAL(qhash
, qhash2
);
126 BOOST_CHECK_EQUAL(fpacket
, rpacket
);
128 BOOST_REQUIRE_EQUAL(getTaskSize(), 0U);
130 // Half of time has passed, no task should have been submitted
132 found
= rpc
.getResponsePacket(tag
, qpacket
, qname
, QType::A
, QClass::IN
, now
, &fpacket
, &age
, &qhash2
);
133 BOOST_CHECK_EQUAL(found
, true);
134 BOOST_CHECK_EQUAL(qhash
, qhash2
);
135 BOOST_CHECK_EQUAL(fpacket
, rpacket
);
137 BOOST_REQUIRE_EQUAL(getTaskSize(), 0U);
139 // 75% of time has passed, task should have been submitted as refresh perc is 30 and (100-75) = 25 <= 30
141 found
= rpc
.getResponsePacket(tag
, qpacket
, qname
, QType::A
, QClass::IN
, now
, &fpacket
, &age
, &qhash2
);
142 BOOST_CHECK_EQUAL(found
, true);
143 BOOST_CHECK_EQUAL(qhash
, qhash2
);
144 BOOST_CHECK_EQUAL(fpacket
, rpacket
);
146 BOOST_REQUIRE_EQUAL(getTaskSize(), 1U);
147 auto task
= taskQueuePop();
148 BOOST_CHECK_EQUAL(task
.d_qname
, qname
);
151 BOOST_AUTO_TEST_CASE(test_recPacketCacheSimplePost2038
)
153 RecursorPacketCache
rpc(1000);
155 unsigned int tag
= 0;
159 BOOST_CHECK_EQUAL(rpc
.size(), 0U);
161 DNSName
qname("www.powerdns.com");
162 vector
<uint8_t> packet
;
163 DNSPacketWriter
pw(packet
, qname
, QType::A
);
164 pw
.getHeader()->rd
= true;
165 pw
.getHeader()->qr
= false;
166 pw
.getHeader()->id
= dns_random_uint16();
167 string
qpacket((const char*)&packet
[0], packet
.size());
168 pw
.startRecord(qname
, QType::A
, ttd
);
170 time_t future
= INT_MAX
- 1800; // with ttd of 3600, we pass the cliff
172 BOOST_CHECK_EQUAL(rpc
.getResponsePacket(tag
, qpacket
, future
, &fpacket
, &age
, &qhash
), false);
173 BOOST_CHECK_EQUAL(rpc
.getResponsePacket(tag
, qpacket
, qname
, QType::A
, QClass::IN
, future
, &fpacket
, &age
, &qhash
), false);
175 ARecordContent
ar("127.0.0.1");
178 string
rpacket((const char*)&packet
[0], packet
.size());
180 rpc
.insertResponsePacket(tag
, qhash
, string(qpacket
), qname
, QType::A
, QClass::IN
, string(rpacket
), future
, ttd
, vState::Indeterminate
, boost::none
, false);
181 BOOST_CHECK_EQUAL(rpc
.size(), 1U);
182 rpc
.doPruneTo(time(nullptr), 0);
183 BOOST_CHECK_EQUAL(rpc
.size(), 0U);
184 rpc
.insertResponsePacket(tag
, qhash
, string(qpacket
), qname
, QType::A
, QClass::IN
, string(rpacket
), future
, ttd
, vState::Indeterminate
, boost::none
, false);
185 BOOST_CHECK_EQUAL(rpc
.size(), 1U);
187 rpc
.doWipePacketCache(qname
);
188 BOOST_CHECK_EQUAL(rpc
.size(), 0U);
190 rpc
.insertResponsePacket(tag
, qhash
, string(qpacket
), qname
, QType::A
, QClass::IN
, string(rpacket
), future
, ttd
, vState::Indeterminate
, boost::none
, false);
191 BOOST_CHECK_EQUAL(rpc
.size(), 1U);
193 bool found
= rpc
.getResponsePacket(tag
, qpacket
, future
, &fpacket
, &age
, &qhash2
);
194 BOOST_CHECK_EQUAL(found
, true);
195 BOOST_CHECK_EQUAL(qhash
, qhash2
);
196 BOOST_CHECK_EQUAL(fpacket
, rpacket
);
197 found
= rpc
.getResponsePacket(tag
, qpacket
, qname
, QType::A
, QClass::IN
, future
, &fpacket
, &age
, &qhash2
);
198 BOOST_CHECK_EQUAL(found
, true);
199 BOOST_CHECK_EQUAL(qhash
, qhash2
);
200 BOOST_CHECK_EQUAL(fpacket
, rpacket
);
202 found
= rpc
.getResponsePacket(tag
, qpacket
, future
+ 3601, &fpacket
, &age
, &qhash2
);
203 BOOST_CHECK_EQUAL(found
, false);
204 found
= rpc
.getResponsePacket(tag
, qpacket
, qname
, QType::A
, QClass::IN
, future
+ 3601, &fpacket
, &age
, &qhash2
);
205 BOOST_CHECK_EQUAL(found
, false);
208 qname
+= DNSName("co.uk");
209 DNSPacketWriter
pw2(packet
, qname
, QType::A
);
211 pw2
.getHeader()->rd
= true;
212 pw2
.getHeader()->qr
= false;
213 pw2
.getHeader()->id
= dns_random_uint16();
214 qpacket
.assign((const char*)&packet
[0], packet
.size());
216 found
= rpc
.getResponsePacket(tag
, qpacket
, future
, &fpacket
, &age
, &qhash
);
217 BOOST_CHECK_EQUAL(found
, false);
218 found
= rpc
.getResponsePacket(tag
, qpacket
, qname
, QType::A
, QClass::IN
, future
, &fpacket
, &age
, &qhash
);
219 BOOST_CHECK_EQUAL(found
, false);
221 rpc
.doWipePacketCache(DNSName("com"), 0xffff, true);
222 BOOST_CHECK_EQUAL(rpc
.size(), 0U);
225 BOOST_AUTO_TEST_CASE(test_recPacketCache_Tags
)
227 /* Insert a response with tag1, the exact same query with a different tag
228 should lead to a miss. Inserting a different response with the second tag
229 should not override the first one, and we should get a hit for the
230 query with either tags, with the response matching the tag.
232 RecursorPacketCache
rpc(1000);
234 const unsigned int tag1
= 0;
235 const unsigned int tag2
= 42;
238 uint32_t temphash
= 0;
240 BOOST_CHECK_EQUAL(rpc
.size(), 0U);
242 DNSName
qname("www.powerdns.com");
243 vector
<uint8_t> packet
;
244 DNSPacketWriter
pw(packet
, qname
, QType::A
);
245 pw
.getHeader()->rd
= true;
246 pw
.getHeader()->qr
= false;
247 pw
.getHeader()->id
= dns_random_uint16();
248 string
qpacket(reinterpret_cast<const char*>(&packet
[0]), packet
.size());
249 pw
.startRecord(qname
, QType::A
, ttd
);
251 /* Both interfaces (with and without the qname/qtype/qclass) should get the same hash */
252 BOOST_CHECK_EQUAL(rpc
.getResponsePacket(tag1
, qpacket
, time(nullptr), &fpacket
, &age
, &qhash
), false);
253 BOOST_CHECK_EQUAL(rpc
.getResponsePacket(tag1
, qpacket
, qname
, QType::A
, QClass::IN
, time(nullptr), &fpacket
, &age
, &temphash
), false);
254 BOOST_CHECK_EQUAL(qhash
, temphash
);
256 /* Different tag, should still get get the same hash, for both interfaces */
257 BOOST_CHECK_EQUAL(rpc
.getResponsePacket(tag2
, qpacket
, time(nullptr), &fpacket
, &age
, &temphash
), false);
258 BOOST_CHECK_EQUAL(qhash
, temphash
);
259 BOOST_CHECK_EQUAL(rpc
.getResponsePacket(tag2
, qpacket
, qname
, QType::A
, QClass::IN
, time(nullptr), &fpacket
, &age
, &temphash
), false);
260 BOOST_CHECK_EQUAL(qhash
, temphash
);
263 ARecordContent
ar("127.0.0.1");
267 string
r1packet(reinterpret_cast<const char*>(&packet
[0]), packet
.size());
270 ARecordContent
ar("127.0.0.2");
274 string
r2packet(reinterpret_cast<const char*>(&packet
[0]), packet
.size());
276 BOOST_CHECK(r1packet
!= r2packet
);
278 /* inserting a response for tag1 */
279 rpc
.insertResponsePacket(tag1
, qhash
, string(qpacket
), qname
, QType::A
, QClass::IN
, string(r1packet
), time(0), ttd
, vState::Indeterminate
, boost::none
, false);
280 BOOST_CHECK_EQUAL(rpc
.size(), 1U);
282 /* inserting a different response for tag2, should not override the first one */
283 rpc
.insertResponsePacket(tag2
, qhash
, string(qpacket
), qname
, QType::A
, QClass::IN
, string(r2packet
), time(0), ttd
, vState::Indeterminate
, boost::none
, false);
284 BOOST_CHECK_EQUAL(rpc
.size(), 2U);
286 /* remove all responses from the cache */
287 rpc
.doPruneTo(time(nullptr), 0);
288 BOOST_CHECK_EQUAL(rpc
.size(), 0U);
291 rpc
.insertResponsePacket(tag1
, qhash
, string(qpacket
), qname
, QType::A
, QClass::IN
, string(r1packet
), time(0), ttd
, vState::Indeterminate
, boost::none
, false);
292 BOOST_CHECK_EQUAL(rpc
.size(), 1U);
294 rpc
.insertResponsePacket(tag2
, qhash
, string(qpacket
), qname
, QType::A
, QClass::IN
, string(r2packet
), time(0), ttd
, vState::Indeterminate
, boost::none
, false);
295 BOOST_CHECK_EQUAL(rpc
.size(), 2U);
297 /* remove the responses by qname, should remove both */
298 rpc
.doWipePacketCache(qname
);
299 BOOST_CHECK_EQUAL(rpc
.size(), 0U);
301 /* insert the response for tag1 */
302 rpc
.insertResponsePacket(tag1
, qhash
, string(qpacket
), qname
, QType::A
, QClass::IN
, string(r1packet
), time(0), ttd
, vState::Indeterminate
, boost::none
, false);
303 BOOST_CHECK_EQUAL(rpc
.size(), 1U);
305 /* we can retrieve it */
306 BOOST_CHECK_EQUAL(rpc
.getResponsePacket(tag1
, qpacket
, qname
, QType::A
, QClass::IN
, time(nullptr), &fpacket
, &age
, &temphash
), true);
307 BOOST_CHECK_EQUAL(qhash
, temphash
);
308 BOOST_CHECK_EQUAL(fpacket
, r1packet
);
310 /* with both interfaces */
311 BOOST_CHECK_EQUAL(rpc
.getResponsePacket(tag1
, qpacket
, time(nullptr), &fpacket
, &age
, &temphash
), true);
312 BOOST_CHECK_EQUAL(qhash
, temphash
);
313 BOOST_CHECK_EQUAL(fpacket
, r1packet
);
315 /* but not with the second tag */
316 BOOST_CHECK_EQUAL(rpc
.getResponsePacket(tag2
, qpacket
, qname
, QType::A
, QClass::IN
, time(nullptr), &fpacket
, &age
, &temphash
), false);
317 /* we should still get the same hash */
318 BOOST_CHECK_EQUAL(temphash
, qhash
);
320 /* adding a response for the second tag */
321 rpc
.insertResponsePacket(tag2
, qhash
, string(qpacket
), qname
, QType::A
, QClass::IN
, string(r2packet
), time(0), ttd
, vState::Indeterminate
, boost::none
, false);
322 BOOST_CHECK_EQUAL(rpc
.size(), 2U);
324 /* We still get the correct response for the first tag */
325 BOOST_CHECK_EQUAL(rpc
.getResponsePacket(tag1
, qpacket
, time(nullptr), &fpacket
, &age
, &temphash
), true);
326 BOOST_CHECK_EQUAL(qhash
, temphash
);
327 BOOST_CHECK_EQUAL(fpacket
, r1packet
);
329 BOOST_CHECK_EQUAL(rpc
.getResponsePacket(tag1
, qpacket
, qname
, QType::A
, QClass::IN
, time(nullptr), &fpacket
, &age
, &temphash
), true);
330 BOOST_CHECK_EQUAL(qhash
, temphash
);
331 BOOST_CHECK_EQUAL(fpacket
, r1packet
);
333 /* and the correct response for the second tag */
334 BOOST_CHECK_EQUAL(rpc
.getResponsePacket(tag2
, qpacket
, time(nullptr), &fpacket
, &age
, &temphash
), true);
335 BOOST_CHECK_EQUAL(qhash
, temphash
);
336 BOOST_CHECK_EQUAL(fpacket
, r2packet
);
338 BOOST_CHECK_EQUAL(rpc
.getResponsePacket(tag2
, qpacket
, qname
, QType::A
, QClass::IN
, time(nullptr), &fpacket
, &age
, &temphash
), true);
339 BOOST_CHECK_EQUAL(qhash
, temphash
);
340 BOOST_CHECK_EQUAL(fpacket
, r2packet
);
343 BOOST_AUTO_TEST_CASE(test_recPacketCache_TCP
)
345 /* Insert a response with UDP, the exact same query with a TCP flag
346 should lead to a miss.
348 RecursorPacketCache
rpc(1000);
352 uint32_t temphash
= 0;
354 BOOST_CHECK_EQUAL(rpc
.size(), 0U);
356 DNSName
qname("www.powerdns.com");
357 vector
<uint8_t> packet
;
358 DNSPacketWriter
pw(packet
, qname
, QType::A
);
359 pw
.getHeader()->rd
= true;
360 pw
.getHeader()->qr
= false;
361 pw
.getHeader()->id
= dns_random_uint16();
362 string
qpacket(reinterpret_cast<const char*>(&packet
[0]), packet
.size());
363 pw
.startRecord(qname
, QType::A
, ttd
);
365 /* Both interfaces (with and without the qname/qtype/qclass) should get the same hash */
366 BOOST_CHECK_EQUAL(rpc
.getResponsePacket(0, qpacket
, time(nullptr), &fpacket
, &age
, &qhash
), false);
367 BOOST_CHECK_EQUAL(rpc
.getResponsePacket(0, qpacket
, qname
, QType::A
, QClass::IN
, time(nullptr), &fpacket
, &age
, nullptr, &temphash
, nullptr, false), false);
368 BOOST_CHECK_EQUAL(qhash
, temphash
);
370 /* Different tcp/udp, should still get get the same hash, for both interfaces */
371 BOOST_CHECK_EQUAL(rpc
.getResponsePacket(0, qpacket
, time(nullptr), &fpacket
, &age
, &qhash
), false);
372 BOOST_CHECK_EQUAL(rpc
.getResponsePacket(0, qpacket
, qname
, QType::A
, QClass::IN
, time(nullptr), &fpacket
, &age
, nullptr, &temphash
, nullptr, true), false);
373 BOOST_CHECK_EQUAL(qhash
, temphash
);
376 ARecordContent
ar("127.0.0.1");
380 string
r1packet(reinterpret_cast<const char*>(&packet
[0]), packet
.size());
383 ARecordContent
ar("127.0.0.2");
387 string
r2packet(reinterpret_cast<const char*>(&packet
[0]), packet
.size());
389 BOOST_CHECK(r1packet
!= r2packet
);
391 /* inserting a response for udp */
392 rpc
.insertResponsePacket(0, qhash
, string(qpacket
), qname
, QType::A
, QClass::IN
, string(r1packet
), time(0), ttd
, vState::Indeterminate
, boost::none
, false);
393 BOOST_CHECK_EQUAL(rpc
.size(), 1U);
395 /* inserting a different response for tcp, should not override the first one */
396 rpc
.insertResponsePacket(0, qhash
, string(qpacket
), qname
, QType::A
, QClass::IN
, string(r2packet
), time(0), ttd
, vState::Indeterminate
, boost::none
, true);
397 BOOST_CHECK_EQUAL(rpc
.size(), 2U);
399 /* remove all responses from the cache */
400 rpc
.doPruneTo(time(nullptr), 0);
401 BOOST_CHECK_EQUAL(rpc
.size(), 0U);
404 rpc
.insertResponsePacket(0, qhash
, string(qpacket
), qname
, QType::A
, QClass::IN
, string(r1packet
), time(0), ttd
, vState::Indeterminate
, boost::none
, false);
405 BOOST_CHECK_EQUAL(rpc
.size(), 1U);
407 rpc
.insertResponsePacket(0, qhash
, string(qpacket
), qname
, QType::A
, QClass::IN
, string(r2packet
), time(0), ttd
, vState::Indeterminate
, boost::none
, true);
408 BOOST_CHECK_EQUAL(rpc
.size(), 2U);
410 /* remove the responses by qname, should remove both */
411 rpc
.doWipePacketCache(qname
);
412 BOOST_CHECK_EQUAL(rpc
.size(), 0U);
414 /* insert the response for tcp */
415 rpc
.insertResponsePacket(0, qhash
, string(qpacket
), qname
, QType::A
, QClass::IN
, string(r1packet
), time(0), ttd
, vState::Indeterminate
, boost::none
, true);
416 BOOST_CHECK_EQUAL(rpc
.size(), 1U);
419 /* we can retrieve it */
420 BOOST_CHECK_EQUAL(rpc
.getResponsePacket(0, qpacket
, qname
, QType::A
, QClass::IN
, time(nullptr), &fpacket
, &age
, &vState
, &temphash
, nullptr, true), true);
421 BOOST_CHECK_EQUAL(qhash
, temphash
);
422 BOOST_CHECK_EQUAL(fpacket
, r1packet
);
424 /* first interface assumes udp */
425 BOOST_CHECK_EQUAL(rpc
.getResponsePacket(0, qpacket
, time(nullptr), &fpacket
, &age
, &temphash
), false);
426 BOOST_CHECK_EQUAL(qhash
, temphash
);
427 BOOST_CHECK_EQUAL(fpacket
, r1packet
);
429 /* and not with explicit udp */
430 BOOST_CHECK_EQUAL(rpc
.getResponsePacket(0, qpacket
, qname
, QType::A
, QClass::IN
, time(nullptr), &fpacket
, &age
, &vState
, &temphash
, nullptr, false), false);
431 /* we should still get the same hash */
432 BOOST_CHECK_EQUAL(temphash
, qhash
);
434 /* adding a response for udp */
435 rpc
.insertResponsePacket(0, qhash
, string(qpacket
), qname
, QType::A
, QClass::IN
, string(r2packet
), time(0), ttd
, vState::Indeterminate
, boost::none
, false);
436 BOOST_CHECK_EQUAL(rpc
.size(), 2U);
438 /* We get the correct response for udp now */
439 BOOST_CHECK_EQUAL(rpc
.getResponsePacket(0, qpacket
, time(nullptr), &fpacket
, &age
, &temphash
), true);
440 BOOST_CHECK_EQUAL(qhash
, temphash
);
441 BOOST_CHECK_EQUAL(fpacket
, r2packet
);
443 BOOST_CHECK_EQUAL(rpc
.getResponsePacket(0, qpacket
, qname
, QType::A
, QClass::IN
, time(nullptr), &fpacket
, &age
, &temphash
), true);
444 BOOST_CHECK_EQUAL(qhash
, temphash
);
445 BOOST_CHECK_EQUAL(fpacket
, r2packet
);
447 /* and the correct response for tcp */
448 BOOST_CHECK_EQUAL(rpc
.getResponsePacket(0, qpacket
, qname
, QType::A
, QClass::IN
, time(nullptr), &fpacket
, &age
, &vState
, &temphash
, nullptr, true), true);
449 BOOST_CHECK_EQUAL(qhash
, temphash
);
450 BOOST_CHECK_EQUAL(fpacket
, r1packet
);
453 BOOST_AUTO_TEST_SUITE_END()