[svn] commit: r1484 - /trunk/src/lib/dns/tests/testdata/gen-wiredata.py.in
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Mar 17 17:23:30 UTC 2010
Author: jinmei
Date: Wed Mar 17 17:23:29 2010
New Revision: 1484
Log:
(partially) supported NSEC generation
Modified:
trunk/src/lib/dns/tests/testdata/gen-wiredata.py.in
Modified: trunk/src/lib/dns/tests/testdata/gen-wiredata.py.in
==============================================================================
--- trunk/src/lib/dns/tests/testdata/gen-wiredata.py.in (original)
+++ trunk/src/lib/dns/tests/testdata/gen-wiredata.py.in Wed Mar 17 17:23:29 2010
@@ -6,6 +6,7 @@
re_hex = re.compile('0x[0-9a-fA-F]+')
re_decimal = re.compile('\d+$')
+re_string = re.compile("\'(.+)\'$")
dnssec_timefmt = '%Y%m%d%H%M%S'
@@ -46,6 +47,9 @@
return int(value, 16)
if re.search(re_decimal, value):
return int(value)
+ m = re.match(re_string, value)
+ if m:
+ return m.group(1)
lovalue = value.lower()
if lovalue in xtable:
return xtable[lovalue]
@@ -190,6 +194,29 @@
self.retry, self.expire,
self.minimum))
+class NSEC:
+ rdlen = -1 # auto-calculate
+ nextname = 'next.example.com'
+ block = 0
+ maplen = -1 # auto-calculate
+ bitmap = '040000000003'
+ def dump(self, f):
+ name_wire = encode_name(self.nextname)
+ rdlen = self.rdlen
+ maplen = self.maplen
+ if maplen < 0:
+ maplen = int(len(self.bitmap) / 2)
+ # if rdlen needs to be calculated, it must be based on the bitmap
+ # length, because the configured maplen can be fake.
+ if rdlen < 0:
+ rdlen = int(len(name_wire) / 2) + 2 + int(len(self.bitmap) / 2)
+ f.write('\n# NSEC RDATA (RDLEN=%d)\n' % rdlen)
+ f.write('%04x\n' % rdlen);
+ f.write('# Next Name=%s\n' % self.nextname)
+ f.write('%s\n' % name_wire)
+ f.write('# Bitmap: Block=%d, Length=%d\n' % (self.block, maplen))
+ f.write('%02x %02x %s\n' % (self.block, maplen, self.bitmap))
+
class RRSIG:
rdlen = -1 # auto-calculate
covered = 1 # A
@@ -228,8 +255,9 @@
def get_config_param(section):
config_param = {'header' : (DNSHeader, header_xtables),
- 'question' : (DNSQuestion, question_xtables),
- 'edns' : (EDNS, {}), 'soa' : (SOA, {}), 'rrsig' : (RRSIG, {}) }
+ 'question' : (DNSQuestion, question_xtables),
+ 'edns' : (EDNS, {}), 'soa' : (SOA, {}),
+ 'rrsig' : (RRSIG, {}), 'nsec' : (NSEC, {})}
s = section
m = re.match('^([^:]+)/\d+$', section)
if m:
More information about the bind10-changes
mailing list