Skip to content

Commit 9b81d71

Browse files
committed
Support IN DS messages
1 parent 7cf47bb commit 9b81d71

File tree

5 files changed

+15
-1
lines changed

5 files changed

+15
-1
lines changed

_test_data/ds-query

21 Bytes
Binary file not shown.

_test_data/ds-response

69 Bytes
Binary file not shown.

encode.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,13 @@ State.prototype.record = function(section_name, record) {
169169
, self.encode(record.data.target, 2 + 6, 'nocompress') // Offset for rdata length + priority, weight, and port.
170170
]
171171
break
172+
case 'IN DS':
173+
rdata = [ buf16(record.data.key_tag)
174+
, new Buffer([record.data.algorithm])
175+
, new Buffer([record.data.digest_type])
176+
, new Buffer(record.data.digest)
177+
]
178+
break
172179
case 'NONE A':
173180
// I think this is no data, from RFC 2136 S. 2.4.3.
174181
rdata = []

message.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,13 @@ DNSRecord.prototype.parse = function(body, section_name, record_num, sections) {
256256
self.data = parse.soa(body, rdata)
257257
self.data.rname = self.data.rname.replace(/\./, '@')
258258
break
259+
case 'IN DS':
260+
self.data = { 'key_tag' : rdata[0] << 8 | rdata[1]
261+
, 'algorithm' : rdata[2]
262+
, 'digest_type': rdata[3]
263+
, 'digest' : rdata.slice(4).toJSON() // Convert to a list of numbers.
264+
}
265+
break
259266
case 'NONE A':
260267
self.data = []
261268
break

test/message.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ test('Encoding messages', function(t) {
193193
, 'www.company.example-response', 'www.microsoft.com-query', 'www.microsoft.com-response'
194194
, 'iriscouch.com-query', 'iriscouch.com-response', 'foo.iriscouch.com-query', 'foo.iriscouch.com-response'
195195
, 'registry.npmjs.org-response', 'srv-query', 'srv-response', 'txt-query', 'txt-response'
196-
, 'ptr-query', 'ptr-response', 'aaaa-query', 'aaaa-response', 'ipv6_ptr-query'
196+
, 'ptr-query', 'ptr-response', 'aaaa-query', 'aaaa-response', 'ipv6_ptr-query', 'ds-query', 'ds-response'
197197
]
198198

199199
t.plan(3 * files.length) // 3 for each file

0 commit comments

Comments
 (0)