+4594. [func] "dnstap-read -x" prints a hex dump of the wire
+ format of each logged DNS message. [RT #44816]
+
4593. [doc] Update README using markdown, remove outdated FAQ
file in favor of the knowledge base.
number of changes from BIND 9.11 and earlier releases. New features
include:
+ * dnstap-read -x prints a hex dump of the wire format of each logged DNS
+ message.
* The query handling code has been substantially refactored for improved
- readability, maintainability and testability
+ readability, maintainability and testability .
* dnstap output files can now be configured to roll automatically when
- reaching a given size
+ reaching a given size.
* Log file timestamps can now also be formatted in ISO 8601 (local) or
- ISO 8601 (UTC) formats
+ ISO 8601 (UTC) formats.
* Logging channels and dnstap output files can now be configured to use
- a timestamp as the suffix when rolling to a new file
- * named-checkconf -l lists zones found in named.conf
- * Added support for the EDNS Padding and Keepalive options
+ a timestamp as the suffix when rolling to a new file.
+ * named-checkconf -l lists zones found in named.conf.
+ * Added support for the EDNS Padding and Keepalive options.
Building BIND
number of changes from BIND 9.11 and earlier releases. New features
include:
+* `dnstap-read -x` prints a hex dump of the wire format of each logged
+ DNS message.
* The query handling code has been substantially refactored for improved
- readability, maintainability and testability
+ readability, maintainability and testability .
* `dnstap` output files can now be configured to roll automatically when
- reaching a given size
+ reaching a given size.
* Log file timestamps can now also be formatted in ISO 8601 (local) or ISO
- 8601 (UTC) formats
+ 8601 (UTC) formats.
* Logging channels and `dnstap` output files can now be configured to use a
- timestamp as the suffix when rolling to a new file
-* `named-checkconf -l` lists zones found in `named.conf`
-* Added support for the EDNS Padding and Keepalive options
+ timestamp as the suffix when rolling to a new file.
+* `named-checkconf -l` lists zones found in `named.conf`.
+* Added support for the EDNS Padding and Keepalive options.
### <a name="build"/> Building BIND
NZD2NZF=$TOP/bin/tools/named-nzd2nzf
FSTRM_CAPTURE=@FSTRM_CAPTURE@
FEATURETEST=$TOP/bin/tests/system/feature-test
+WIRETEST=$TOP/bin/tests/wire_test
RANDFILE=$TOP/bin/tests/system/random.data
export SIGNER
export SUBDIRS
export TESTSOCK6
+export WIRETEST
rm -f */named.run
rm -f */named.stats
rm -f dig.out*
-rm -f dnstap.out
+rm -f dnstap.out dnstap.hex
rm -f dnstap.out.save
rm -f fstrm_capture.out
rm -f ns*/dnstap.out
status=`expr $status + $ret`
fi
+echo "I:checking dnstap-read hex output"
+hex=`$DNSTAPREAD -x ns3/dnstap.out | tail -1`
+echo $hex | $WIRETEST > dnstap.hex
+grep 'status: NOERROR' dnstap.hex > /dev/null 2>&1 || ret=1
+grep 'ANSWER: 3, AUTHORITY: 1' dnstap.hex > /dev/null 2>&1 || ret=1
+if [ $ret != 0 ]; then echo "I: failed"; fi
+status=`expr $status + $ret`
+
if [ -n "$FSTRM_CAPTURE" ] ; then
$DIG +short @10.53.0.4 -p 5300 a.example > dig.out
#include <isc/buffer.h>
#include <isc/commandline.h>
+#include <isc/hex.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/string.h>
isc_mem_t *mctx = NULL;
isc_boolean_t memrecord = ISC_FALSE;
isc_boolean_t printmessage = ISC_FALSE;
+isc_boolean_t hexmessage = ISC_FALSE;
isc_boolean_t yaml = ISC_FALSE;
const char *program = "dnstap-read";
static void
usage(void) {
- fprintf(stderr, "dnstap-read [-mp] [filename]\n");
+ fprintf(stderr, "dnstap-read [-mpxy] [filename]\n");
fprintf(stderr, "\t-m\ttrace memory allocations\n");
fprintf(stderr, "\t-p\tprint the full DNS message\n");
+ fprintf(stderr, "\t-x\tuse hex format to print DNS message\n");
fprintf(stderr, "\t-y\tprint YAML format (implies -p)\n");
}
isc_buffer_free(&b);
}
+static void
+print_hex(dns_dtdata_t *dt) {
+ isc_buffer_t *b = NULL;
+ isc_result_t result;
+ size_t textlen;
+
+ if (dt->msg == NULL) {
+ return;
+ }
+
+ textlen = (dt->msgdata.length * 2) + 1;
+ isc_buffer_allocate(mctx, &b, textlen);
+ if (b == NULL) {
+ fatal("out of memory");
+ }
+
+ result = isc_hex_totext(&dt->msgdata, 0, "", b);
+ CHECKM(result, "isc_hex_totext");
+
+ printf("%.*s\n", (int) isc_buffer_usedlength(b),
+ (char *) isc_buffer_base(b));
+
+ cleanup:
+ if (b != NULL)
+ isc_buffer_free(&b);
+}
+
static void
print_packet(dns_dtdata_t *dt, const dns_master_style_t *style) {
isc_buffer_t *b = NULL;
dns_dthandle_t *handle = NULL;
int rv = 0, ch;
- while ((ch = isc_commandline_parse(argc, argv, "mpy")) != -1) {
+ while ((ch = isc_commandline_parse(argc, argv, "mpxy")) != -1) {
switch (ch) {
case 'm':
isc_mem_debugging |= ISC_MEM_DEBUGRECORD;
case 'p':
printmessage = ISC_TRUE;
break;
+ case 'x':
+ hexmessage = ISC_TRUE;
+ break;
case 'y':
yaml = ISC_TRUE;
dns_master_indentstr = " ";
if (yaml) {
print_yaml(dt);
+ } else if (hexmessage) {
+ print_dtdata(dt);
+ print_hex(dt);
} else if (printmessage) {
print_dtdata(dt);
print_packet(dt, &dns_master_style_debug);
<command>dnstap-read</command>
<arg choice="opt" rep="norepeat"><option>-m</option></arg>
<arg choice="opt" rep="norepeat"><option>-p</option></arg>
+ <arg choice="opt" rep="norepeat"><option>-x</option></arg>
<arg choice="opt" rep="norepeat"><option>-y</option></arg>
<arg choice="req" rep="norepeat"><replaceable class="parameter">file</replaceable></arg>
</cmdsynopsis>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term>-x</term>
+ <listitem>
+ <para>
+ After printing the <command>dnstap</command> data, print
+ a hex dump of the wire form of the DNS message that was
+ encapsulated in the <command>dnstap</command> frame.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term>-y</term>
<listitem>
<section xml:id="relnotes_features"><info><title>New Features</title></info>
<itemizedlist>
+ <listitem>
+ <para>
+ The <command>dnstap-read -x</command> option prints a hex
+ dump of the wire format DNS message encapsulated in each
+ <command>dnstap</command> log entry. [RT #44816]
+ </para>
+ </listitem>
<listitem>
<para>
The <command>host -A</command> option returns most