Skip to content
Snippets Groups Projects
Commit 6c871589 authored by Libor Peltan's avatar Libor Peltan Committed by Daniel Salzman
Browse files

test: huge rrset testcase: udp, tcp, axfr

parent 23df95e0
Branches
Tags
1 merge request!651Huge rrset
$ORIGIN example.com.
$TTL 3600
@ SOA dns1.example.com. hostmaster.example.com. (
2010111213 ; serial
6h ; refresh
1h ; retry
1w ; expire
1d ) ; minimum
NS dns1
dns1 A 192.0.2.1
labs.example.com. IN A 0.0.0.0
labs.example.com. IN DNAME rd.example.com.
#!/usr/bin/env python3
''' Test querying rset with too many rdata '''
import random
import dns.exception
import dns.rcode
import dns.tsig
from dnstest.utils import *
from dnstest.test import Test
t = Test(tsig=False)
master = t.server("knot")
ZONE = "example.com."
HUGE = "huge.%s" % ZONE
zone = t.zone(ZONE, storage=".")
rndfix = random.randint(1, 65000)
for i in range(1, 3000):
zone[0].append_rndAAAA(HUGE, rndfix, i)
t.link(zone, master)
t.start()
master.zone_wait(zone)
resp = master.dig(HUGE, "AAAA", udp=True)
resp.check(rcode="NOERROR", flags="TC")
resp.check_count(0, section="answer")
resp = master.dig(HUGE, "AAAA", udp=False)
resp.check(rcode="SERVFAIL", noflags="TC")
resp.check_count(0, section="answer")
resp = master.dig(ZONE, "AXFR", tries=1, timeout=2)
got_messages = 0
for msg in resp.resp:
got_messages += 1
if got_messages is 1:
isset(msg.rcode() == dns.rcode.NOERROR, "NOERROR")
elif got_messages is 2:
isset(msg.rcode() == dns.rcode.SERVFAIL, "SERVFAIL")
break
else:
break
if got_messages != 2:
set_err("AXFR MSGCOUNT")
detail_log("!AXFR message count: %i != 1" % got_messages)
t.end()
......@@ -252,6 +252,13 @@ class ZoneFile(object):
os.remove(old_name)
def append_rndAAAA(self, owner, rnd1=random.randint(1, 65000), rnd2=random.randint(1, 65000)):
'''Append AAAA record with owner owner and random IPv6'''
with open(self.path, "a") as file:
file.write("%s IN AAAA dead:beef:dead:beef:dead:beef:%04x:%04x\n" %
(owner, rnd1, rnd2))
def remove(self):
'''Remove zone file.'''
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment