BIND 10 master, updated. 5cdde563b1ff647a83729c768f688188ac90bfd4 [1136] Add ChangeLog entry
BIND 10 source code commits
bind10-changes at lists.isc.org
Sun Mar 11 09:04:13 UTC 2012
The branch, master has been updated
via 5cdde563b1ff647a83729c768f688188ac90bfd4 (commit)
via 5a045dfb928e3a2d5702bea2e803a6f6ac5b030d (commit)
via 3d8de45a64068a289bc8eebca3b21c308047cdc8 (commit)
via ec745dbffae8c60801738225ecb3c71b9d758091 (commit)
via cebaf1622cb9e73257b9876bfe863a3102803766 (commit)
via 9ef6f17654ebfc0f103f8563a21db07dd141806f (commit)
via 8cff3a658f4c21b8e83042e475491dbdcd404983 (commit)
via 8a0d8d026e4489913560819c438299560db77724 (commit)
via abca9b6b8de3fcb0c6d99df48793eb975aea0e5e (commit)
via ea5ac57d508a17611cfae9d9ea1c238f59d52c51 (commit)
from 6b1caed1a4161932e68ef52f067d07d822d85c94 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 5cdde563b1ff647a83729c768f688188ac90bfd4
Author: Mukund Sivaraman <muks at isc.org>
Date: Sun Mar 11 14:33:24 2012 +0530
[1136] Add ChangeLog entry
commit 5a045dfb928e3a2d5702bea2e803a6f6ac5b030d
Author: Mukund Sivaraman <muks at isc.org>
Date: Fri Mar 9 08:01:45 2012 +0530
[1136] Add rdata_sshfp_fromWire2 to EXTRA_DIST
commit 3d8de45a64068a289bc8eebca3b21c308047cdc8
Author: Mukund Sivaraman <muks at isc.org>
Date: Fri Mar 9 07:57:29 2012 +0530
[1136] Fix year in copyright notice
commit ec745dbffae8c60801738225ecb3c71b9d758091
Author: Mukund Sivaraman <muks at isc.org>
Date: Fri Mar 9 07:55:46 2012 +0530
[1136] Add more tests from review
Specifically:
* Test lowercase and uppercase
* Test with different spacing
commit cebaf1622cb9e73257b9876bfe863a3102803766
Author: Mukund Sivaraman <muks at isc.org>
Date: Fri Mar 9 07:51:44 2012 +0530
[1136] Remove message about the wire file being a generated one
commit 9ef6f17654ebfc0f103f8563a21db07dd141806f
Author: Mukund Sivaraman <muks at isc.org>
Date: Fri Mar 9 07:49:20 2012 +0530
[1136] Rename non-generated wire data file
commit 8cff3a658f4c21b8e83042e475491dbdcd404983
Author: Mukund Sivaraman <muks at isc.org>
Date: Fri Mar 9 07:47:08 2012 +0530
[1136] Fix testcase to do case insensitive compare
commit 8a0d8d026e4489913560819c438299560db77724
Author: Mukund Sivaraman <muks at isc.org>
Date: Thu Mar 8 09:28:18 2012 +0530
[1136] Extra dist one more file
commit abca9b6b8de3fcb0c6d99df48793eb975aea0e5e
Author: Mukund Sivaraman <muks at isc.org>
Date: Thu Mar 8 09:23:59 2012 +0530
Fix comment in MX testcase
commit ea5ac57d508a17611cfae9d9ea1c238f59d52c51
Author: Mukund Sivaraman <muks at isc.org>
Date: Thu Mar 8 09:23:41 2012 +0530
[1136] Implement the SSHFP type, from RFC 4255
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 4 +
src/lib/dns/rdata/generic/sshfp_44.cc | 164 ++++++++++++++++++++
src/lib/dns/rdata/generic/{mx_15.h => sshfp_44.h} | 19 ++-
src/lib/dns/tests/Makefile.am | 1 +
src/lib/dns/tests/rdata_sshfp_unittest.cc | 94 +++++++++++
src/lib/dns/tests/testdata/Makefile.am | 3 +
src/lib/dns/tests/testdata/rdata_mx_fromWire | 2 +-
src/lib/dns/tests/testdata/rdata_sshfp_fromWire | 4 +
.../dns/tests/testdata/rdata_sshfp_fromWire1.spec | 6 +
src/lib/dns/tests/testdata/rdata_sshfp_fromWire2 | 4 +
.../dns/tests/testdata/rdata_sshfp_fromWire2.spec | 7 +
src/lib/util/python/gen_wiredata.py.in | 23 +++
12 files changed, 321 insertions(+), 10 deletions(-)
create mode 100644 src/lib/dns/rdata/generic/sshfp_44.cc
copy src/lib/dns/rdata/generic/{mx_15.h => sshfp_44.h} (75%)
create mode 100644 src/lib/dns/tests/rdata_sshfp_unittest.cc
create mode 100644 src/lib/dns/tests/testdata/rdata_sshfp_fromWire
create mode 100644 src/lib/dns/tests/testdata/rdata_sshfp_fromWire1.spec
create mode 100644 src/lib/dns/tests/testdata/rdata_sshfp_fromWire2
create mode 100644 src/lib/dns/tests/testdata/rdata_sshfp_fromWire2.spec
-----------------------------------------------------------------------
diff --git a/ChangeLog b/ChangeLog
index d9afae0..2a3b1cf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+399. [func] muks
+ Add support for the SSHFP RR type (RFC 4255).
+ (Trac #1136, git ea5ac57d508a17611cfae9d9ea1c238f59d52c51)
+
398. [func] jelte
The b10-xfrin module now logs more information on successful
incoming transfers. In the case of IXFR, it logs the number of
diff --git a/src/lib/dns/rdata/generic/sshfp_44.cc b/src/lib/dns/rdata/generic/sshfp_44.cc
new file mode 100644
index 0000000..6320fd9
--- /dev/null
+++ b/src/lib/dns/rdata/generic/sshfp_44.cc
@@ -0,0 +1,164 @@
+// Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC")
+//
+// Permission to use, copy, modify, and/or distribute this software for any
+// purpose with or without fee is hereby granted, provided that the above
+// copyright notice and this permission notice appear in all copies.
+//
+// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+// PERFORMANCE OF THIS SOFTWARE.
+
+#include <config.h>
+
+#include <string>
+
+#include <boost/lexical_cast.hpp>
+
+#include <exceptions/exceptions.h>
+
+#include <util/buffer.h>
+#include <util/encode/hex.h>
+#include <dns/name.h>
+#include <dns/messagerenderer.h>
+#include <dns/rdata.h>
+#include <dns/rdataclass.h>
+
+using namespace std;
+using namespace boost;
+using namespace isc::util;
+using namespace isc::util::encode;
+
+// BEGIN_ISC_NAMESPACE
+// BEGIN_RDATA_NAMESPACE
+
+SSHFP::SSHFP(InputBuffer& buffer, size_t rdata_len)
+{
+ if (rdata_len < 2) {
+ isc_throw(InvalidRdataLength, "SSHFP record too short");
+ }
+
+ algorithm_ = buffer.readUint8();
+ fingerprint_type_ = buffer.readUint8();
+
+ rdata_len -= 2;
+ fingerprint_.resize(rdata_len);
+ buffer.readData(&fingerprint_[0], rdata_len);
+}
+
+SSHFP::SSHFP(const std::string& sshfp_str)
+{
+ std::istringstream iss(sshfp_str);
+ // peekc should be of iss's char_type for isspace to work
+ std::istringstream::char_type peekc;
+ std::stringbuf fingerprintbuf;
+ uint32_t algorithm, fingerprint_type;
+
+ iss >> algorithm >> fingerprint_type;
+ if (iss.bad() || iss.fail()) {
+ isc_throw(InvalidRdataText, "Invalid SSHFP text");
+ }
+ if ((algorithm < 1) || (algorithm > 2)) {
+ isc_throw(InvalidRdataText, "SSHFP algorithm number out of range");
+ }
+ if (fingerprint_type != 1) {
+ isc_throw(InvalidRdataText, "SSHFP fingerprint type out of range");
+ }
+
+ iss.read(&peekc, 1);
+ if (!iss.good() || !isspace(peekc, iss.getloc())) {
+ isc_throw(InvalidRdataText, "SSHFP presentation format error");
+ }
+
+ iss >> &fingerprintbuf;
+
+ algorithm_ = algorithm;
+ fingerprint_type_ = fingerprint_type;
+ decodeHex(fingerprintbuf.str(), fingerprint_);
+}
+
+SSHFP::SSHFP(uint8_t algorithm, uint8_t fingerprint_type, const string& fingerprint)
+{
+ if ((algorithm < 1) || (algorithm > 2)) {
+ isc_throw(InvalidRdataText, "SSHFP algorithm number out of range");
+ }
+ if (fingerprint_type != 1) {
+ isc_throw(InvalidRdataText, "SSHFP fingerprint type out of range");
+ }
+
+ algorithm_ = algorithm;
+ fingerprint_type_ = fingerprint_type;
+ decodeHex(fingerprint, fingerprint_);
+}
+
+SSHFP::SSHFP(const SSHFP& other) :
+ Rdata(), algorithm_(other.algorithm_), fingerprint_type_(other.fingerprint_type_), fingerprint_(other.fingerprint_)
+{}
+
+void
+SSHFP::toWire(OutputBuffer& buffer) const {
+ buffer.writeUint8(algorithm_);
+ buffer.writeUint8(fingerprint_type_);
+ buffer.writeData(&fingerprint_[0], fingerprint_.size());
+}
+
+void
+SSHFP::toWire(AbstractMessageRenderer& renderer) const {
+ renderer.writeUint8(algorithm_);
+ renderer.writeUint8(fingerprint_type_);
+ renderer.writeData(&fingerprint_[0], fingerprint_.size());
+}
+
+string
+SSHFP::toText() const {
+ return (lexical_cast<string>(static_cast<int>(algorithm_)) +
+ " " + lexical_cast<string>(static_cast<int>(fingerprint_type_)) +
+ " " + encodeHex(fingerprint_));
+}
+
+int
+SSHFP::compare(const Rdata& other) const {
+ const SSHFP& other_sshfp = dynamic_cast<const SSHFP&>(other);
+
+ /* This doesn't really make any sort of sense, but in the name of
+ consistency... */
+
+ if (algorithm_ < other_sshfp.algorithm_) {
+ return (-1);
+ } else if (algorithm_ > other_sshfp.algorithm_) {
+ return (1);
+ }
+
+ if (fingerprint_type_ < other_sshfp.fingerprint_type_) {
+ return (-1);
+ } else if (fingerprint_type_ > other_sshfp.fingerprint_type_) {
+ return (1);
+ }
+
+ size_t this_len = fingerprint_.size();
+ size_t other_len = other_sshfp.fingerprint_.size();
+ size_t cmplen = min(this_len, other_len);
+ int cmp = memcmp(&fingerprint_[0], &other_sshfp.fingerprint_[0], cmplen);
+ if (cmp != 0) {
+ return (cmp);
+ } else {
+ return ((this_len == other_len)
+ ? 0 : (this_len < other_len) ? -1 : 1);
+ }
+}
+
+uint8_t
+SSHFP::getSSHFPAlgorithmNumber() const {
+ return (algorithm_);
+}
+
+uint8_t
+SSHFP::getSSHFPFingerprintType() const {
+ return (fingerprint_type_);
+}
+
+// END_RDATA_NAMESPACE
+// END_ISC_NAMESPACE
diff --git a/src/lib/dns/rdata/generic/sshfp_44.h b/src/lib/dns/rdata/generic/sshfp_44.h
new file mode 100644
index 0000000..c3ba944
--- /dev/null
+++ b/src/lib/dns/rdata/generic/sshfp_44.h
@@ -0,0 +1,58 @@
+// Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC")
+//
+// Permission to use, copy, modify, and/or distribute this software for any
+// purpose with or without fee is hereby granted, provided that the above
+// copyright notice and this permission notice appear in all copies.
+//
+// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+// PERFORMANCE OF THIS SOFTWARE.
+
+// BEGIN_HEADER_GUARD
+
+#include <stdint.h>
+
+#include <string>
+
+#include <dns/name.h>
+#include <dns/rdata.h>
+
+// BEGIN_ISC_NAMESPACE
+
+// BEGIN_COMMON_DECLARATIONS
+// END_COMMON_DECLARATIONS
+
+// BEGIN_RDATA_NAMESPACE
+
+class SSHFP : public Rdata {
+public:
+ // BEGIN_COMMON_MEMBERS
+ // END_COMMON_MEMBERS
+
+ SSHFP(uint8_t algorithm, uint8_t fingerprint_type, const std::string& fingerprint);
+
+ ///
+ /// Specialized methods
+ ///
+ uint8_t getSSHFPAlgorithmNumber() const;
+ uint8_t getSSHFPFingerprintType() const;
+
+private:
+ /// Note: this is a prototype version; we may reconsider
+ /// this representation later.
+ uint8_t algorithm_;
+ uint8_t fingerprint_type_;
+ std::vector<uint8_t> fingerprint_;
+};
+
+// END_RDATA_NAMESPACE
+// END_ISC_NAMESPACE
+// END_HEADER_GUARD
+
+// Local Variables:
+// mode: c++
+// End:
diff --git a/src/lib/dns/tests/Makefile.am b/src/lib/dns/tests/Makefile.am
index 7ba0314..26b4630 100644
--- a/src/lib/dns/tests/Makefile.am
+++ b/src/lib/dns/tests/Makefile.am
@@ -33,6 +33,7 @@ run_unittests_SOURCES += rdata_in_a_unittest.cc rdata_in_aaaa_unittest.cc
run_unittests_SOURCES += rdata_ns_unittest.cc rdata_soa_unittest.cc
run_unittests_SOURCES += rdata_txt_like_unittest.cc
run_unittests_SOURCES += rdata_mx_unittest.cc
+run_unittests_SOURCES += rdata_sshfp_unittest.cc
run_unittests_SOURCES += rdata_ptr_unittest.cc rdata_cname_unittest.cc
run_unittests_SOURCES += rdata_dname_unittest.cc
run_unittests_SOURCES += rdata_afsdb_unittest.cc
diff --git a/src/lib/dns/tests/rdata_sshfp_unittest.cc b/src/lib/dns/tests/rdata_sshfp_unittest.cc
new file mode 100644
index 0000000..dd133ce
--- /dev/null
+++ b/src/lib/dns/tests/rdata_sshfp_unittest.cc
@@ -0,0 +1,94 @@
+// Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC")
+//
+// Permission to use, copy, modify, and/or distribute this software for any
+// purpose with or without fee is hereby granted, provided that the above
+// copyright notice and this permission notice appear in all copies.
+//
+// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+// PERFORMANCE OF THIS SOFTWARE.
+
+#include <algorithm>
+#include <string>
+
+#include <util/buffer.h>
+#include <dns/messagerenderer.h>
+#include <dns/rdata.h>
+#include <dns/rdataclass.h>
+#include <dns/rrclass.h>
+#include <dns/rrtype.h>
+
+#include <gtest/gtest.h>
+
+#include <dns/tests/unittest_util.h>
+#include <dns/tests/rdata_unittest.h>
+#include <boost/algorithm/string.hpp>
+
+using isc::UnitTestUtil;
+using namespace std;
+using namespace isc::dns;
+using namespace isc::util;
+using namespace isc::dns::rdata;
+
+namespace {
+class Rdata_SSHFP_Test : public RdataTest {
+ // there's nothing to specialize
+};
+
+const string sshfp_txt("2 1 123456789abcdef67890123456789abcdef67890");
+const generic::SSHFP rdata_sshfp(2, 1, "123456789abcdef67890123456789abcdef67890");
+
+TEST_F(Rdata_SSHFP_Test, createFromText) {
+ // Basic test
+ const generic::SSHFP rdata_sshfp2(sshfp_txt);
+ EXPECT_EQ(0, rdata_sshfp2.compare(rdata_sshfp));
+
+ // With different spacing
+ const generic::SSHFP rdata_sshfp3("2 1 123456789abcdef67890123456789abcdef67890");
+ EXPECT_EQ(0, rdata_sshfp3.compare(rdata_sshfp));
+
+ // Combination of lowercase and uppercase
+ const generic::SSHFP rdata_sshfp4("2 1 123456789ABCDEF67890123456789abcdef67890");
+ EXPECT_EQ(0, rdata_sshfp4.compare(rdata_sshfp));
+}
+
+TEST_F(Rdata_SSHFP_Test, badText) {
+ EXPECT_THROW(const generic::SSHFP rdata_sshfp("1"), InvalidRdataText);
+ EXPECT_THROW(const generic::SSHFP rdata_sshfp("1 2"), InvalidRdataText);
+ EXPECT_THROW(const generic::SSHFP rdata_sshfp("BUCKLE MY SHOES"), InvalidRdataText);
+ EXPECT_THROW(const generic::SSHFP rdata_sshfp("1 2 foo bar"), InvalidRdataText);
+}
+
+TEST_F(Rdata_SSHFP_Test, copy) {
+ const generic::SSHFP rdata_sshfp2(rdata_sshfp);
+ EXPECT_EQ(0, rdata_sshfp.compare(rdata_sshfp2));
+}
+
+TEST_F(Rdata_SSHFP_Test, createFromWire) {
+ // Basic test
+ EXPECT_EQ(0, rdata_sshfp.compare(
+ *rdataFactoryFromFile(RRType("SSHFP"), RRClass("IN"),
+ "rdata_sshfp_fromWire")));
+ // Combination of lowercase and uppercase
+ EXPECT_EQ(0, rdata_sshfp.compare(
+ *rdataFactoryFromFile(RRType("SSHFP"), RRClass("IN"),
+ "rdata_sshfp_fromWire2")));
+ // TBD: more tests
+}
+
+TEST_F(Rdata_SSHFP_Test, toText) {
+ EXPECT_TRUE(boost::iequals(sshfp_txt, rdata_sshfp.toText()));
+}
+
+TEST_F(Rdata_SSHFP_Test, getSSHFPAlgorithmNumber) {
+ EXPECT_EQ(2, rdata_sshfp.getSSHFPAlgorithmNumber());
+}
+
+TEST_F(Rdata_SSHFP_Test, getSSHFPFingerprintType) {
+ EXPECT_EQ(1, rdata_sshfp.getSSHFPFingerprintType());
+}
+}
diff --git a/src/lib/dns/tests/testdata/Makefile.am b/src/lib/dns/tests/testdata/Makefile.am
index fdf1025..f450a59 100644
--- a/src/lib/dns/tests/testdata/Makefile.am
+++ b/src/lib/dns/tests/testdata/Makefile.am
@@ -44,6 +44,7 @@ BUILT_SOURCES += rdata_rp_fromWire1.wire rdata_rp_fromWire2.wire
BUILT_SOURCES += rdata_rp_fromWire3.wire rdata_rp_fromWire4.wire
BUILT_SOURCES += rdata_rp_fromWire5.wire rdata_rp_fromWire6.wire
BUILT_SOURCES += rdata_rp_toWire1.wire rdata_rp_toWire2.wire
+BUILT_SOURCES += rdata_sshfp_fromWire1.wire rdata_sshfp_fromWire2.wire
BUILT_SOURCES += rdata_afsdb_fromWire1.wire rdata_afsdb_fromWire2.wire
BUILT_SOURCES += rdata_afsdb_fromWire3.wire rdata_afsdb_fromWire4.wire
BUILT_SOURCES += rdata_afsdb_fromWire5.wire
@@ -125,6 +126,8 @@ EXTRA_DIST += rdata_rp_fromWire1.spec rdata_rp_fromWire2.spec
EXTRA_DIST += rdata_rp_fromWire3.spec rdata_rp_fromWire4.spec
EXTRA_DIST += rdata_rp_fromWire5.spec rdata_rp_fromWire6.spec
EXTRA_DIST += rdata_rp_toWire1.spec rdata_rp_toWire2.spec
+EXTRA_DIST += rdata_sshfp_fromWire rdata_sshfp_fromWire2
+EXTRA_DIST += rdata_sshfp_fromWire1.spec rdata_sshfp_fromWire2.spec
EXTRA_DIST += rdata_afsdb_fromWire1.spec rdata_afsdb_fromWire2.spec
EXTRA_DIST += rdata_afsdb_fromWire3.spec rdata_afsdb_fromWire4.spec
EXTRA_DIST += rdata_afsdb_fromWire5.spec
diff --git a/src/lib/dns/tests/testdata/rdata_mx_fromWire b/src/lib/dns/tests/testdata/rdata_mx_fromWire
index f56387d..407350f 100644
--- a/src/lib/dns/tests/testdata/rdata_mx_fromWire
+++ b/src/lib/dns/tests/testdata/rdata_mx_fromWire
@@ -11,5 +11,5 @@
00 0a
# EXCHANGE: non compressed
# 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 (bytes)
-#(4) m x (7) e x a m p l e (3) c o m .
+#(2) m x (7) e x a m p l e (3) c o m .
02 6d 78 07 65 78 61 6d 70 6c 65 03 63 6f 6d 00
diff --git a/src/lib/dns/tests/testdata/rdata_sshfp_fromWire b/src/lib/dns/tests/testdata/rdata_sshfp_fromWire
new file mode 100644
index 0000000..added40
--- /dev/null
+++ b/src/lib/dns/tests/testdata/rdata_sshfp_fromWire
@@ -0,0 +1,4 @@
+# SSHFP RDATA, RDLEN=22
+0016
+# ALGORITHM=2 FINGERPRINT_TYPE=1 FINGERPRINT=123456789abcdef67890123456789abcdef67890
+02 01 123456789abcdef67890123456789abcdef67890
diff --git a/src/lib/dns/tests/testdata/rdata_sshfp_fromWire1.spec b/src/lib/dns/tests/testdata/rdata_sshfp_fromWire1.spec
new file mode 100644
index 0000000..e28a62f
--- /dev/null
+++ b/src/lib/dns/tests/testdata/rdata_sshfp_fromWire1.spec
@@ -0,0 +1,6 @@
+#
+# A simplest form of SSHFP: all default parameters
+#
+[custom]
+sections: sshfp
+[sshfp]
diff --git a/src/lib/dns/tests/testdata/rdata_sshfp_fromWire2 b/src/lib/dns/tests/testdata/rdata_sshfp_fromWire2
new file mode 100644
index 0000000..a695548
--- /dev/null
+++ b/src/lib/dns/tests/testdata/rdata_sshfp_fromWire2
@@ -0,0 +1,4 @@
+# SSHFP RDATA, RDLEN=22
+0016
+# ALGORITHM=2 FINGERPRINT_TYPE=1 FINGERPRINT=123456789ABCDEF67890123456789abcdef67890
+02 01 123456789ABCDEF67890123456789abcdef67890
diff --git a/src/lib/dns/tests/testdata/rdata_sshfp_fromWire2.spec b/src/lib/dns/tests/testdata/rdata_sshfp_fromWire2.spec
new file mode 100644
index 0000000..59a336e
--- /dev/null
+++ b/src/lib/dns/tests/testdata/rdata_sshfp_fromWire2.spec
@@ -0,0 +1,7 @@
+#
+# SSHFP RDATA
+#
+[custom]
+sections: sshfp
+[sshfp]
+fingerprint: 123456789abcdef67890123456789abcdef67890
diff --git a/src/lib/util/python/gen_wiredata.py.in b/src/lib/util/python/gen_wiredata.py.in
index 8b3eac0..f997701 100755
--- a/src/lib/util/python/gen_wiredata.py.in
+++ b/src/lib/util/python/gen_wiredata.py.in
@@ -822,6 +822,29 @@ class RP(RR):
f.write('# MAILBOX=%s TEXT=%s\n' % (self.mailbox, self.text))
f.write('%s %s\n' % (mailbox_wire, text_wire))
+class SSHFP(RR):
+ '''Implements rendering SSHFP RDATA in the test data format.
+
+ Configurable parameters are as follows (see the description of the
+ same name of attribute for the default value):
+ - algorithm (int): The algorithm number.
+ - fingerprint_type (int): The fingerprint type.
+ - fingerprint (string): The fingerprint.
+ '''
+ algorithm = 2
+ fingerprint_type = 1
+ fingerprint = '123456789abcdef67890123456789abcdef67890'
+ def dump(self, f):
+ if self.rdlen is None:
+ self.rdlen = 2 + (len(self.fingerprint) / 2)
+ else:
+ self.rdlen = int(self.rdlen)
+ self.dump_header(f, self.rdlen)
+ f.write('# ALGORITHM=%d FINGERPRINT_TYPE=%d FINGERPRINT=%s\n' % (self.algorithm,
+ self.fingerprint_type,
+ self.fingerprint))
+ f.write('%02x %02x %s\n' % (self.algorithm, self.fingerprint_type, self.fingerprint))
+
class MINFO(RR):
'''Implements rendering MINFO RDATA in the test data format.
More information about the bind10-changes
mailing list