diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..1bd4430
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,6 @@
+BasedOnStyle: webkit
+IndentWidth: 4
+AlignConsecutiveAssignments: true
+AlignConsecutiveDeclarations: true
+AlignOperands: true
+SortIncludes: false
diff --git a/.copr/Makefile b/.copr/Makefile
new file mode 100644
index 0000000..29ed0bc
--- /dev/null
+++ b/.copr/Makefile
@@ -0,0 +1,23 @@
+top=..
+
+all: srpm
+
+prereq: $(top)/rpmbuild
+ rpm -q git rpm-build >/dev/null || dnf -y install git rpm-build
+
+update-dist-tools: $(top)/dist-tools
+ ( cd "$(top)/dist-tools" && git pull )
+
+$(top)/dist-tools:
+ git clone https://github.com/jelu/dist-tools.git "$(top)/dist-tools"
+
+$(top)/rpmbuild:
+ mkdir -p "$(top)"/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
+
+srpm: prereq update-dist-tools
+ test -f .gitmodules && git submodule update --init || true
+ echo "$(spec)" | grep -q "develop.spec" && auto_build_number=`date --utc +%s` message="Auto build `date --utc --iso-8601=seconds`" "$(top)/dist-tools/spec-new-changelog-entry" || true
+ overwrite=yes nosign=yes "$(top)/dist-tools/create-source-packages" rpm
+ cp ../*.orig.tar.gz "$(top)/rpmbuild/SOURCES/"
+ echo "$(spec)" | grep -q "develop.spec" && rpmbuild -bs --define "%_topdir $(top)/rpmbuild" --undefine=dist rpm/*.spec || rpmbuild -bs --define "%_topdir $(top)/rpmbuild" --undefine=dist "$(spec)"
+ cp "$(top)"/rpmbuild/SRPMS/*.src.rpm "$(outdir)"
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 0000000..38cc1c4
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1 @@
+custom: https://www.dns-oarc.net/donate
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..51f60df
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,95 @@
+# Prerequisites
+*.d
+
+# Object files
+*.o
+*.ko
+*.obj
+*.elf
+
+# Linker output
+*.ilk
+*.map
+*.exp
+
+# Precompiled Headers
+*.gch
+*.pch
+
+# Libraries
+*.lib
+*.a
+*.la
+*.lo
+
+# Shared objects (inc. Windows DLLs)
+*.dll
+*.so
+*.so.*
+*.dylib
+
+# Executables
+*.exe
+*.out
+*.app
+*.i*86
+*.x86_64
+*.hex
+
+# Debug files
+*.dSYM/
+*.su
+*.idb
+*.pdb
+
+# Kernel Module Compile Results
+*.mod*
+*.cmd
+.tmp_versions/
+modules.order
+Module.symvers
+Mkfile.old
+dkms.conf
+
+# Automake
+Makefile.in
+aclocal.m4
+ar-lib
+autom4te.cache
+compile
+config.guess
+config.sub
+configure
+depcomp
+install-sh
+ltmain.sh
+m4/libtool.m4
+m4/ltoptions.m4
+m4/ltsugar.m4
+m4/ltversion.m4
+m4/lt~obsolete.m4
+missing
+config.h.in
+config.h.in~
+test-driver
+
+# Configure
+Makefile
+config.log
+config.status
+libtool
+.deps
+src/config.h
+src/stamp-h1
+build
+.dirstamp
+
+# Project specific files
+src/dnsperf
+src/dnsperf.1
+src/resperf
+src/resperf.1
+src/test/test-suite.log
+src/test/test*.sh.log
+src/test/test*.sh.trs
+src/test/*.dist
diff --git a/.lgtm.yml b/.lgtm.yml
new file mode 100644
index 0000000..499e196
--- /dev/null
+++ b/.lgtm.yml
@@ -0,0 +1,15 @@
+extraction:
+ cpp:
+ prepare:
+ packages:
+ - build-essential
+ - automake
+ - autoconf
+ - libtool
+ - pkg-config
+ - libssl-dev
+ - libldns-dev
+ configure:
+ command:
+ - ./autogen.sh
+ - ./configure
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..410a33d
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,23 @@
+dist: xenial
+addons:
+ apt:
+ update: true
+ packages:
+ - libssl-dev
+ - libldns-dev
+language: c
+compiler:
+ - clang
+ - gcc
+install: ./autogen.sh
+script:
+ - ./configure --enable-warn-all
+ - make dist
+ - tar zxvf *.tar.gz
+ - cd dnsperf-[0-9]*
+ - mkdir build
+ - cd build
+ - ../configure --enable-warn-all
+ - make
+ - make test
+ - cat src/test/test*.sh.log
diff --git a/CHANGES b/CHANGES
new file mode 100644
index 0000000..e4b3f3b
--- /dev/null
+++ b/CHANGES
@@ -0,0 +1,399 @@
+2021-02-23 Jerry Lundström
+
+ Release 2.4.2
+
+ This release fixes a few issues with reading of the datafile which
+ could lead to "ran out of data" errors.
+
+ The problem was that reading from the datafile was done before finding
+ a socket to send it on, or socket readyness, and that lead to progressing
+ the queries without really doing anything.
+ Another issues that's been fixed was that if the read lines perfectly
+ aligned with the buffer, it would be treated like EOF and caused an exit.
+
+ 9937287 resperf TLS
+ 6736956 datafile
+ 55faec6 ran out of data
+
+2021-02-09 Jerry Lundström
+
+ Release 2.4.1
+
+ This release fixes an issue with the socket readiness function that
+ could cause a buffer overflow (`-T 10 -c 2000`) due to `select()` being
+ limited to check 1023 sockets. `poll()` is now used which has no limit.
+
+ There has also been a few fixes to the contrib script `queryparse` that
+ has to do with python v2 and v3 compatibility and better exception
+ handling.
+
+ 24e5bee poll
+ 7dceca7 Handle only common exceptions
+ 5603294 Fix error on python3
+ 48fa517 TSIG
+
+2020-12-09 Jerry Lundström
+
+ Release 2.4.0
+
+ This release removes the dependency on BIND's internal development
+ libraries! This make building and packaging a lot easier and less
+ troublesome in the future.
+
+ This software now depends only on OpenSSL (for TSIG feature) with an
+ optional depend on LDNS (for dynamic updates feature).
+
+ New option:
+ - Transport mode option `-m`/`-M` now recognizes `dot` alongside `tls`
+ for encrypted DNS
+ - Added `-W` for outputting warnings and errors to stdout
+
+ Other changes / bugfixes:
+ - Fix potential memory leak of query descriptions when using verbose
+ - Only use TLS v1.2 and above for DoT/TLS
+ - Add a lot of tests
+ - Add coverage testing
+
+ d17743b datafile
+ 434bbf2 Checks, coverage, log, test IPv6
+ 9fb305f Coverage
+ 123ebf1 DOT, TLS version, Sonarcloud
+ 26df0bd BIND dependency
+ ee660e7 Sonarcloud
+ c9ea0ab base64
+ 4e9be82 TSIG
+ 4275045 EDNS, https
+ 7c3f51c BIND dependency
+ 6e1be5d ISC dependencies
+ e36f19d Buffer
+ 485cdd2 ISC mem, tests
+ 663dc24 Namespace clash
+ 2c44987 dynamic updates, edns, headers
+ 5d109b2 Disable HMAC
+ 79cae93 datafile, query desc
+ 663d814 net
+ c867de6 isc_result_t
+ 651ee5d opt
+ 7d30804 isc_result_t
+ 58ad313 ISC linked list
+ 7b4da6d Info
+ 8079ebc Tests
+ e3fb685 Tests
+ 2bb603a Tests
+ 297b23b Test
+ c4e244b Test
+ 1caac35 Makefile
+ e9f2aaa Coverage
+ 27af853 Fix typo in configure.ac
+ 521faa6 Badges
+ 8fa2ec4 LGTM
+ 75c89e5 COPR
+
+2020-05-15 Jerry Lundström
+
+ Release 2.3.4
+
+ This release adds a workaround, thanks to patch from Petr Menšík, for
+ building on systems with BIND 9.16. Also improves error handling by
+ using thread-safe `strerror_r()` instead of `strerror()`.
+
+ 88c3ef4 strerror
+ 1917f67 openSUSE Tumbleweed
+ fd39641 AS_VAR_APPEND
+ aeeef74 bind 9.16
+ 07732cd BIND, libcrypto, clang format
+ 08146e3 Add crypto library to checks
+ e4307c2 Add checks to pass with BIND 9.16
+ 3f9aed3 Prepare check for bind 9.11/9.16 return types
+
+2020-05-06 Jerry Lundström
+
+ Release 2.3.3
+
+ This release changes the behavior of `dnsperf` and `resperf` when it
+ comes to TCP and TLS connections, and updates package building using
+ COPR (thanks to patch from Petr Menšík (Red Hat)).
+
+ Connection reset or close are now treated as "try again" so that the
+ run is finished and not aborted. As SIGPIPE might be received on usage
+ of closed connections it's now blocked in `dnsperf` and handled as
+ a fatal action in `resperf`.
+
+ 62885ad SIGPIPE
+ 106c50e connection
+ 3ef0899 README
+ 61a3b1c COPR
+ 35efa27 COPR
+ 46b37a1 COPR
+ 5c126ae COPR
+ 1c51b76 Provide full URL in spec
+ 2a4dd0e Allow recreation of source archive
+ 931d6cc Do not require root for archive creation
+
+2019-08-23 Jerry Lundström
+
+ Release 2.3.2
+
+ This release fixes a buffer overflow when using TSIG and algorithms
+ with digests larger then SHA256, reported by Mukund Sivaraman. Also
+ fix build dependencies for `sqrt()`.
+
+ e54aa58 Digest
+ bca5d8d sqrt
+ d9eaa5b Package
+
+2019-07-24 Jerry Lundström
+
+ Release 2.3.1
+
+ After a report and additional confirming results the use of `poll()` in
+ the network receive code for TCP and TLS has been removed. This `poll()`
+ initially gave better results while testing in a docker container on
+ it's loopback interface but when on physical networks it reduced
+ performance to 1/12th, so it had to go.
+
+ Thanks to Brian Wellington (Akamai/Nominum) for the initial report and
+ testing, and to Jan Hák (CZ.NIC) for testing and confirming the results.
+
+ Bugfix:
+ - Fix check for having more DNS messages in the receive buffer for TCP
+ and TLS
+
+ 670db9c TCP/TLS receive
+ b8925b2 recvbuf have more
+
+2019-07-17 Jerry Lundström
+
+ Release 2.3.0
+
+ This release adds support for DNS over TCP and TLS which can be selected
+ by using the mode option for `dnsperf` and `resperf`. The default server
+ port used is now determined by the transport mode, udp/tcp port 53 and
+ tls port 853.
+
+ Note that the mode option is different between the program because it was
+ already taken for `resperf`.
+
+ `dnsperf` changes:
+ - Add `-m` for setting transport mode, `udp` (default), `tcp` or `tls`
+ - Add verbose messages about network readiness and congestion
+
+ `resperf` changes:
+ - Add `-M` for setting transport mode, `udp` (default), `tcp` or `tls`
+ - Add `-v` for verbose mode to report about network readiness and
+ congestion
+
+ ffa49cf LGTM, SonarCloud
+ 4cd5441 TLS
+ 35624d1 TCP send, socket ready loop
+ fbf76aa TCP support
+ 5988b06 Funding
+
+2019-01-28 Jerry Lundström
+
+ Release 2.2.1
+
+ The commit pulled from a fork that used `inttypes.h`, instead of ISC
+ internal types, missed to remove the old conversion specifier.
+ This was reported and fixed by Vladimír Čunát.
+
+ 9534ce1 remove visible "u" characters after numbers
+
+2019-01-25 Jerry Lundström
+
+ Release 2.2.0
+
+ First release by DNS-OARC with a rework of the code to use autotools,
+ semantic versioning 2.0 and bugfixes pulled from other's forks.
+
+ Bugfixes:
+ - Fix infinite loop in argument parsing
+ - Fix min/max latency summing for multithreaded runs
+ - Fix calculation of per_thread socket counts
+ - Fixes to queryparse
+ - Mark correctly end of file
+ - Support python3
+ - Stop looping on end of file undefinitely
+ - Fix compilation issues and work around missing `dns_fixedname_initname()`
+ - Clang `scan-build` fixes
+
+ Other changes:
+ - add "configure --with-bind" option
+ - Handle bind library changes to HMAC (see #22) and other differences
+ between versions
+ - Workaround issue on FreeBSD (see #23)
+ - Use `snprintf()` and OpenBSD's `strlcat()`
+ - Add/update build dependencies for Debia, Ubuntu, CentOS, FreeBSD
+ and OpenBSD
+
+ ae9bc91 Clang format
+ b9bb085 CI, buildbot
+ b84e41b Autotools, README, changelog
+ a2e1732 License
+ 9dcb661 Remove $Id markers, Principal Author and Reviewed tags from the
+ full source tree
+ 0677bf0 Use dns_fixedname_initname() where possible
+ d8d4696 [master] add "configure --with-bind" option to dnsperf
+ b71a280 Add deb based distros dependencies
+ 439c614 Replace custom isc_boolean_t with C standard bool type
+ 407ae7c Replace custom isc_u?intNN_t types with C99 u?intNN_t types
+ c27afd4 Replace ISC_PRINT_QUADFORMAT with inttypes.h format constants
+ 6fdb2f7 Fix queryparse
+ 4909b78 README
+ 2782d50 README.md: Rectify link to software
+ e31ddf4 fix calculation of per_thread socket counts
+ 3bd7fb4 Fix min/max latency summing for multithreaded runs
+ 2207e27 Fix infinite loop in argument parsing.
+ 3bfe97a Include the github URL; remove the bug reports section.
+ 0cee04a Add note about bug reports.
+ 62c4b32 add .gitignore
+ c45f0be Initial import.
+ 149172b Initial commit
+
+2015-12-15
+
+ Release 2.1.0.0
+
+ In addition to various bug fixes, the following new capabilities
+ were added in this release:
+ - The `-C` option was added to `resperf`. This option enables the local
+ server to act as multiple clients. By default, the local server
+ acts as a single client.
+ - the `-T` option was added to `dnsperf`. This option separates the
+ number of clients from the number of threads and allows more
+ clients to be simulated effectively. Note that using this option
+ impacts CPU and memory, so we recommend limiting the number of
+ threads.
+
+2012-03-01
+
+ Release 2.0.0.0
+
+ In the `dnsperf` command, the following changes occurred:
+ - The socket buffer size is no longer set to 32 kilobytes by default.
+ - A new `-c clients` option was added to enable the server to act as
+ multiple clients. Each client uses the same source IP address with a
+ unique source port. Use the `clients` argument to specify the number of
+ clients represented by the server. We recommend limiting the number of
+ clients represented by the server because the `dnsperf` process uses two
+ threads for each client (one thread for sent packets and one for
+ received packets), which impacts CPU and memory.
+ - Example query files are no longer included with the `dnsperf` program.
+ Nominum provides a sample query file that is available for download at:
+ ftp://ftp.nominum.com/pub/nominum/dnsperf/data/
+ - Latency reporting improved. When the `-v` (verbose mode) option is
+ configured with the `dnsperf` command, the command output now includes
+ latency measurements and the DNS RCODE of each response. This enables
+ users to create their own latency graphs.
+ - Performance was enhanced on modern operating systems so that faster
+ name servers can be tested.
+ - The `dnsperf` command output is enhanced to display more information in a
+ compact format.
+
+ The following options were removed from the `dnsperf` command:
+ - The `-A` option for displaying command line arguments passed to the
+ `dnsperf` tool in the final statistics output. Now, the `dnsperf` command
+ output always displays command line arguments.
+ - The `-T` option for printing a histogram showing response latency after
+ completing a test run. Now, the `-v` option enables users to include
+ latency measurements in the `dnsperf` command output.
+ - The `-H` option for configuring the number of buckets for which response
+ latency is displayed. Now, the `-v` option enables users to include
+ latency measurements in the `dnsperf` command output.
+ - The `-1` option for configuring the `dnsperf` tool to run through the input
+ file exactly one time. (Now, you use the `-n 1` option to configure the
+ `dnsperf` tool to run through the input file one time.)
+ - The `-c` option for including the number of responses received (for
+ each DNS RCODE) in the final statistics output. Now, DNS RCODE responses
+ are always reported.
+
+ In the `resperf` command, the following changes occurred:
+ - The socket buffer size is no longer set to 32 kilobytes by default.
+ - The `-A` option, which displayed command line arguments passed to the
+ `resperf` tool in the final statistics output, was removed. Now, the
+ `resperf` command output always displays command line arguments.
+
+2011-12-22
+
+ Release 1.0.2.0
+
+ This release adds support for RHEL6-64 and for Solaris 10 x86-64.
+
+ Some new configuration options have been added. You can now specify:
+ - the local port from which to send requests
+ - the local address from which to send requests
+ - the maximum number of runs through the input file, up
+ to the timeout limit.
+ - when using TSIG, algorithms other than hmac-md5 can be used.
+
+ One default has been changed:
+ - The maximum number of outstanding requests now defaults
+ to 100.
+
+ A new example query file for IPv6, `queryfile-example-ipv6`, is now
+ included with the distribution.
+
+2008-01-10
+
+ Release 1.0.1.0
+
+ This release makes binary builds of `dnsperf` available in addition to
+ the source code version previously released.
+
+ This release of `dnsperf` includes a sample query file containing
+ 100,000 queries to help with performance testing. This query file is
+ useful for checking latencies or a continuous `dnsperf` run. In the
+ binary distribution, this file is found at:
+
+ /usr/local/nom/examples/dnsperf/queryfile-example-100thousand
+
+ In the source distribution, it is at:
+
+ ./examples/queryfile-example-100thousand
+
+ where `.` is the directory made by extracting the source tarball.
+
+ Nominum recommends using a query file with at least 3 million queries
+ for a full `resperf` run as described in the man page; we make such a
+ file available for download at:
+
+ ftp://ftp.nominum.com/pub/nominum/dnsperf/data/queryfile-example-3million.gz
+
+ The following fix is included in the source distribution:
+ - 20996: `makefile.in` does not allow overriding `mandir`
+ The `--mandir` argument to `configure`, which allows the user to
+ specify the location man pages are installed, was incorrectly
+ ignored.
+
+ `queryparse` is a contributed program available in the source
+ distribution of `dnsperf`. It can be found at `contrib/queryparse/`.
+ The following changes were made to that program:
+ - 19717: `contrib/queryparse` includes outgoing queries
+ The `queryparse` script had no way of distinguishing between incoming
+ queries and outgoing queries when applied to a traffic trace from a
+ caching server. This was addressed by adding a new flag (`-r`) that,
+ when included in the command line, will keep queries with
+ `RD=0`. Otherwise, it will default to discarding them.
+ - The ability to parse responses instead of queries was added.
+ - A check was added to avoid short packets.
+ - Logic was added to detect link type and correctly set the initial
+ offset to handle both Ethernet and Cisco HDLC frames.
+ - `queryparse` now uses `pcapy` instead of the `btk` python `libcap` module.
+
+ Note that announcements of new releases of `dnsperf` are sent to the
+ mailing list: dnsperf-announce@nominum.com. To be added to the
+ mailing list, send a message to dnsperf-announce-request@nominum.com
+ with "subscribe" as the subject.
+
+ Known Issues:
+ - None.
+
+2006-12-21
+
+ Release 1.0.0.1
+
+ This release addresses the following issue in the `dnsperf` program:
+ - 18838/18782: `dnsperf` slow down issue
+ Because of an error in how timeout checking was being done, queries
+ were rarely timing out, so the number of valid queries in flight kept
+ dropping. This error has been corrected.
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..68c771a
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,176 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..2cc5781
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,30 @@
+# Copyright 2019-2021 OARC, Inc.
+# Copyright 2017-2018 Akamai Technologies
+# Copyright 2006-2016 Nominum, Inc.
+# All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+ACLOCAL_AMFLAGS = -I m4
+
+MAINTAINERCLEANFILES = $(srcdir)/Makefile.in \
+ $(srcdir)/src/config.h.in~ \
+ $(srcdir)/configure
+
+SUBDIRS = src
+
+dist_doc_DATA = CHANGES README.md LICENSE
+
+EXTRA_DIST = m4 contrib
+
+test: check
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..524f734
--- /dev/null
+++ b/README.md
@@ -0,0 +1,117 @@
+# dnsperf
+
+[![Build Status](https://travis-ci.com/DNS-OARC/dnsperf.svg?branch=develop)](https://travis-ci.com/DNS-OARC/dnsperf) [![Total alerts](https://img.shields.io/lgtm/alerts/g/DNS-OARC/dnsperf.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/DNS-OARC/dnsperf/alerts/) [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=dns-oarc%3Adnsperf&metric=bugs)](https://sonarcloud.io/dashboard?id=dns-oarc%3Adnsperf) [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=dns-oarc%3Adnsperf&metric=security_rating)](https://sonarcloud.io/dashboard?id=dns-oarc%3Adnsperf)
+
+`dnsperf` and `resperf` are free tools developed by Nominum/Akamai (2006-2018)
+and DNS-OARC (since 2019) that make it simple to gather accurate latency and
+throughput metrics for Domain Name Service (DNS). These tools are easy-to-use
+and simulate typical Internet, so network operators can benchmark their naming
+and addressing infrastructure and plan for upgrades. The latest version of
+the `dnsperf` and `resperf` can be used with test files that include IPv6
+queries.
+
+`dnsperf` "self-paces" the DNS query load to simulate network conditions.
+New features in `dnsperf` improve the precision of latency measurements and
+allow for per packet per-query latency reporting is possible. `dnsperf` is
+now multithreaded, multiple `dnsperf` clients can be supported in multicore
+systems (each client requires two cores). The output of `dnsperf` has also
+been improved so it is more concise and useful. Latency data can be used to
+make detailed graphs, so it is simple for network operators to take advantage
+of the data.
+
+`resperf` systematically increases the query rate and monitors the response
+rate to simulate caching DNS services.
+
+See also the `dnsperf(1)` and `resperf(1)` man pages.
+
+More information may be found here:
+- https://www.dns-oarc.net/tools/dnsperf
+
+Issues should be reported here:
+- https://github.com/DNS-OARC/dnsperf/issues
+
+General support and discussion:
+- Mattermost: https://chat.dns-oarc.net/community/channels/oarc-software
+
+## Usage
+
+`dnsperf` and `resperf` read input files describing DNS queries, and send
+those queries to DNS servers to measure performance.
+
+## Dependencies
+
+`dnsperf` requires a couple of libraries beside a normal C compiling
+environment with autoconf, automake, libtool and pkgconfig.
+
+- [OpenSSL](https://www.openssl.org/) - for TSIG support
+- [LDNS](https://nlnetlabs.nl/projects/ldns/about/) - optional for dynamic update support
+
+To install the dependencies under Debian/Ubuntu:
+```
+apt-get install -y libssl-dev libldns-dev
+```
+
+To install the dependencies under CentOS (with EPEL enabled):
+```
+yum install -y openssl-devel ldns-devel
+```
+
+To install the dependencies under FreeBSD 12+ using `pkg`:
+```
+pkg install -y openssl ldns
+```
+
+To install the dependencies under OpenBSD 6+ using `pkg_add`:
+```
+pkg_add libldns
+```
+
+## Building from source tarball
+
+The [source tarball from DNS-OARC](https://www.dns-oarc.net/tools/dnsperf)
+comes prepared with `configure`:
+
+```
+tar zxvf dnsperf-version.tar.gz
+cd dnsperf-version
+./configure [options]
+make
+make install
+```
+
+## Building from Git repository
+
+```
+git clone https://github.com/DNS-OARC/dnsperf.git
+cd dnsperf
+./autogen.sh
+./configure [options]
+make
+make install
+```
+
+## Additional Software
+
+The contrib directory contains additional software related to `dnsperf` and
+`resperf`.
+
+## License
+
+```
+Copyright 2019-2021 OARC, Inc.
+Copyright 2017-2018 Akamai Technologies
+Copyright 2006-2016 Nominum, Inc.
+All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+```
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..0f6aea8
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,19 @@
+#!/bin/sh -e
+# Copyright 2019-2021 OARC, Inc.
+# Copyright 2017-2018 Akamai Technologies
+# Copyright 2006-2016 Nominum, Inc.
+# All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+autoreconf --force --install --include=m4
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..0eb9682
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,79 @@
+# Copyright 2019-2021 OARC, Inc.
+# Copyright 2017-2018 Akamai Technologies
+# Copyright 2006-2016 Nominum, Inc.
+# All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+AC_PREREQ(2.64)
+AC_INIT([dnsperf], [2.4.2], [admin@dns-oarc.net], [dnsperf], [https://github.com/DNS-OARC/dnsperf/issues])
+AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects])
+AC_CONFIG_SRCDIR([src/dnsperf.c])
+AC_CONFIG_HEADER([src/config.h])
+AC_CONFIG_MACRO_DIR([m4])
+
+# Checks for programs.
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_CANONICAL_HOST
+AC_C_INLINE
+LT_INIT([disable-static])
+
+# Check --enable-warn-all
+AC_ARG_ENABLE([warn-all], [AS_HELP_STRING([--enable-warn-all], [Enable all compiler warnings])], [AX_CFLAGS_WARN_ALL()])
+
+# Check --with-extra-cflags
+AC_ARG_WITH([extra-cflags], [AS_HELP_STRING([--with-extra-cflags=CFLAGS], [Add extra CFLAGS])], [
+ AC_MSG_NOTICE([appending extra CFLAGS... $withval])
+ AS_VAR_APPEND(CFLAGS, [" $withval"])
+])
+
+# Check --with-extra-ldflags
+AC_ARG_WITH([extra-ldflags], [AS_HELP_STRING([--with-extra-ldflags=LDFLAGS], [Add extra LDFLAGS])], [
+ AC_MSG_NOTICE([appending extra LDFLAGS... $withval])
+ AS_VAR_APPEND(LDFLAGS, [" $withval"])
+])
+
+# Check --enable-gcov
+AC_ARG_ENABLE([gcov], [AS_HELP_STRING([--enable-gcov], [Enable coverage testing])], [
+ coverage_cflags="--coverage -g -O0 -fno-inline -fno-inline-small-functions -fno-default-inline"
+ AC_MSG_NOTICE([enabling coverage testing... $coverage_cflags])
+ AS_VAR_APPEND(CFLAGS, [" $coverage_cflags"])
+])
+AM_CONDITIONAL([ENABLE_GCOV], [test "x$enable_gcov" != "xno"])
+AM_EXTRA_RECURSIVE_TARGETS([gcov])
+
+# Checks for support.
+AX_PTHREAD
+AC_CHECK_LIB([m], [sqrt])
+
+# Check for OpenSSL
+PKG_CHECK_MODULES([libssl], [libssl])
+PKG_CHECK_MODULES([libcrypto], [libcrypto])
+AC_CHECK_LIB([ssl], [TLS_method],
+ [AC_DEFINE([HAVE_TLS_METHOD], [1], [Define to 1 if you have the 'TLS_method' function])])
+
+# Check for LDNS
+PKG_CHECK_MODULES([libldns], [libldns >= 1.7.0], [AC_DEFINE([HAVE_LDNS], [1], [Define to 1 if you have the LDNS library])], [
+ PKG_CHECK_MODULES([libldns], [ldns >= 1.7.0], [AC_DEFINE([HAVE_LDNS], [1], [Define to 1 if you have the LDNS library])], [
+ AC_MSG_NOTICE([LDNS (>= 1.7.0) not found, dynamic update support disabled])
+ ])
+])
+
+# Output Makefiles
+AC_CONFIG_FILES([
+ Makefile
+ src/Makefile
+ src/test/Makefile
+])
+AC_OUTPUT
diff --git a/contrib/queryparse/INSTALL b/contrib/queryparse/INSTALL
new file mode 100644
index 0000000..c22d5b3
--- /dev/null
+++ b/contrib/queryparse/INSTALL
@@ -0,0 +1,48 @@
+
+Installation
+------------
+
+Queryparse requires the dnspython and pcapy python modules. Pcapy depends
+upon the pcap library.
+
+Libpcap may be obtained from http://www.tcpdump.org/
+Dnspython may be obtained from http://www.dnspython.org/
+Pcapy may be obtained from http://oss.coresecurity.com/projects/pcapy.html
+
+Ensure queryparse is somewhere in your path.
+
+
+Usage
+-----
+queryparse -i -o