mafintosh / dns-packet

An abstract-encoding compliant module for encoding / decoding DNS packets
MIT License
207 stars 71 forks source link

Support CAA records #7

Closed kyleaedwards closed 7 years ago

kyleaedwards commented 7 years ago

Parsing CAA records according to RFC6844.

Currently there's a flag octet in the packet, but only a bit-0 (128) is being used to denote an "Issuer Critical" status. Since it's only using that one bit, do you have a preference on leaving the integer flags property on the decoded data object vs. converting that to a boolean called issuerCritical?

silverwind commented 7 years ago

a boolean called issuerCritical

I think I'd prefer that. Less work for the user when more flags are added later. But keep the flags number there.

silverwind commented 7 years ago

Thanks, landed in https://github.com/mafintosh/dns-packet/commit/c1e94b5d699b11cb531c706e05656b1e060b169a with some additional test in https://github.com/mafintosh/dns-packet/commit/a69aaa10231057304b811ead0a984c58ac67c54a.

silverwind commented 7 years ago

Hmm, CI brought up a error that seems specific to node 0.10:

ok 130 decoded object match on external buffer

buffer.js:714
    throw TypeError('value is out of bounds');
          ^
TypeError: value is out of bounds

    at TypeError (<anonymous>)
    at checkInt (buffer.js:714:11)
    at Buffer.writeUInt8 (buffer.js:724:5)
    at Object.rcaa.encode (/home/travis/build/mafintosh/dns-packet/index.js:344:7)
    at testEncoder (/home/travis/build/mafintosh/dns-packet/test.js:159:20)
    at Test.testEncoder.type (/home/travis/build/mafintosh/dns-packet/test.js:51:3)
    at Test.bound [as _cb] (/home/travis/build/mafintosh/dns-packet/node_modules/tape/lib/test.js:64:32)
    at Test.run (/home/travis/build/mafintosh/dns-packet/node_modules/tape/lib/test.js:83:10)
    at Test.bound [as run] (/home/travis/build/mafintosh/dns-packet/node_modules/tape/lib/test.js:64:32)
    at Object.next [as _onImmediate] (/home/travis/build/mafintosh/dns-packet/node_modules/tape/lib/results.js:71:15)

Any idea?

silverwind commented 7 years ago

Guess we could just initialize data.flags to 0 to prevent it.

silverwind commented 7 years ago

Did that in https://github.com/mafintosh/dns-packet/commit/03ca378b02e8bd4ac044e6d43aaa0a46e214e282.

kyleaedwards commented 7 years ago

Sorry about that, thanks for the quick fix!