mirror of
https://gitlab.isc.org/isc-projects/bind9.git
synced 2025-04-18 09:44:09 +03:00
Complete rewrite the BIND 9 build system
The rewrite of BIND 9 build system is a large work and cannot be reasonable split into separate merge requests. Addition of the automake has a positive effect on the readability and maintainability of the build system as it is more declarative, it allows conditional and we are able to drop all of the custom make code that BIND 9 developed over the years to overcome the deficiencies of autoconf + custom Makefile.in files. This squashed commit contains following changes: - conversion (or rather fresh rewrite) of all Makefile.in files to Makefile.am by using automake - the libtool is now properly integrated with automake (the way we used it was rather hackish as the only official way how to use libtool is via automake - the dynamic module loading was rewritten from a custom patchwork to libtool's libltdl (which includes the patchwork to support module loading on different systems internally) - conversion of the unit test executor from kyua to automake parallel driver - conversion of the system test executor from custom make/shell to automake parallel driver - The GSSAPI has been refactored, the custom SPNEGO on the basis that all major KRB5/GSSAPI (mit-krb5, heimdal and Windows) implementations support SPNEGO mechanism. - The various defunct tests from bin/tests have been removed: bin/tests/optional and bin/tests/pkcs11 - The text files generated from the MD files have been removed, the MarkDown has been designed to be readable by both humans and computers - The xsl header is now generated by a simple sed command instead of perl helper - The <irs/platform.h> header has been removed - cleanups of configure.ac script to make it more simpler, addition of multiple macros (there's still work to be done though) - the tarball can now be prepared with `make dist` - the system tests are partially able to run in oot build Here's a list of unfinished work that needs to be completed in subsequent merge requests: - `make distcheck` doesn't yet work (because of system tests oot run is not yet finished) - documentation is not yet built, there's a different merge request with docbook to sphinx-build rst conversion that needs to be rebased and adapted on top of the automake - msvc build is non functional yet and we need to decide whether we will just cross-compile bind9 using mingw-w64 or fix the msvc build - contributed dlz modules are not included neither in the autoconf nor automake
This commit is contained in:
parent
4df5a5832c
commit
978c7b2e89
3
.gitignore
vendored
3
.gitignore
vendored
@ -4,11 +4,13 @@
|
||||
*.gcno
|
||||
*.la
|
||||
*.lo
|
||||
*.log
|
||||
*.o
|
||||
*.orig
|
||||
*.plist/ # ccc-analyzer store its results in .plist directories
|
||||
*.rej
|
||||
*.so
|
||||
*.trs
|
||||
*_test
|
||||
*.ipch # vscode/intellisense precompiled header
|
||||
*~
|
||||
@ -63,3 +65,4 @@ timestamp
|
||||
/cppcheck.results
|
||||
/tsan
|
||||
/util/check-make-install
|
||||
/INSTALL
|
||||
|
@ -32,6 +32,7 @@ variables:
|
||||
TARBALL_EXTENSION: xz
|
||||
|
||||
stages:
|
||||
- autoconf
|
||||
- precheck
|
||||
- build
|
||||
- unit
|
||||
@ -168,7 +169,7 @@ stages:
|
||||
.autoconf: &autoconf_job
|
||||
<<: *release_branch_triggering_rules
|
||||
<<: *base_image
|
||||
stage: precheck
|
||||
stage: autoconf
|
||||
script:
|
||||
- autoreconf -fi
|
||||
artifacts:
|
||||
@ -186,6 +187,7 @@ stages:
|
||||
--with-json-c \
|
||||
--prefix=$HOME/.local \
|
||||
--without-make-clean \
|
||||
--with-python=python3 \
|
||||
$EXTRA_CONFIGURE \
|
||||
|| cat config.log
|
||||
|
||||
@ -253,8 +255,8 @@ stages:
|
||||
- *setup_interfaces
|
||||
- *setup_softhsm
|
||||
script:
|
||||
- ( cd bin/tests/system && make -j${TEST_PARALLEL_JOBS:-1} -k test V=1 )
|
||||
- test -s bin/tests/system/systests.output
|
||||
- ( cd bin/tests/system && make -j${TEST_PARALLEL_JOBS:-1} -k check V=1 ) || cat bin/tests/system/test-suite.log
|
||||
- test -s bin/tests/system/test-suite.log
|
||||
|
||||
.system_test: &system_test_job
|
||||
<<: *system_test_common
|
||||
@ -313,9 +315,7 @@ stages:
|
||||
before_script:
|
||||
- *setup_softhsm
|
||||
script:
|
||||
- make unit
|
||||
after_script:
|
||||
- *kyua_report_html
|
||||
- cd lib && make -j${TEST_PARALLEL_JOBS:-1} -k check V=1
|
||||
|
||||
.unit_test: &unit_test_job
|
||||
<<: *unit_test_common
|
||||
@ -328,16 +328,12 @@ stages:
|
||||
<<: *unit_test_common
|
||||
allow_failure: true
|
||||
after_script:
|
||||
- *kyua_report_html
|
||||
- find lib -name 'tsan.*' -exec python3 util/parse_tsan.py {} \;
|
||||
artifacts:
|
||||
expire_in: "1 day"
|
||||
paths:
|
||||
- lib/*/tests/tsan.*
|
||||
- tsan/
|
||||
- kyua.log
|
||||
- kyua.results
|
||||
- kyua_html/
|
||||
when: on_failure
|
||||
|
||||
.cppcheck_args: &run_cppcheck |
|
||||
@ -377,7 +373,6 @@ autoreconf:
|
||||
misc:
|
||||
<<: *precheck_job
|
||||
script:
|
||||
- sh util/check-ans-prereq.sh
|
||||
- sh util/checklibs.sh > checklibs.out
|
||||
- sh util/tabify-changes < CHANGES > CHANGES.tmp
|
||||
- diff -urNap CHANGES CHANGES.tmp
|
||||
@ -451,16 +446,14 @@ tarball-create:
|
||||
stage: precheck
|
||||
<<: *base_image
|
||||
script:
|
||||
- source version
|
||||
- export BIND_DIRECTORY="bind-${MAJORVER}.${MINORVER}.${PATCHVER}${RELEASETYPE}${RELEASEVER}"
|
||||
- git archive --prefix="${BIND_DIRECTORY}/" --output="${BIND_DIRECTORY}.tar" HEAD
|
||||
- mkdir "${BIND_DIRECTORY}"
|
||||
- echo "SRCID=$(git rev-list --max-count=1 HEAD | cut -b1-7)" > "${BIND_DIRECTORY}/srcid"
|
||||
- tar --append --file="${BIND_DIRECTORY}.tar" "${BIND_DIRECTORY}/srcid"
|
||||
- ${TARBALL_COMPRESSOR} "${BIND_DIRECTORY}.tar"
|
||||
- *configure
|
||||
- make -j${BUILD_PARALLEL_JOBS:-1} dist V=1
|
||||
artifacts:
|
||||
paths:
|
||||
- bind-*.tar.${TARBALL_EXTENSION}
|
||||
- bind-*.tar.*
|
||||
needs:
|
||||
- job: autoreconf
|
||||
artifacts: true
|
||||
only:
|
||||
- tags
|
||||
|
||||
@ -477,6 +470,7 @@ docs:
|
||||
needs:
|
||||
- job: autoreconf
|
||||
artifacts: true
|
||||
allow_failure: true
|
||||
artifacts:
|
||||
paths:
|
||||
- doc/arm/
|
||||
@ -524,7 +518,7 @@ gcc:centos6:amd64:
|
||||
variables:
|
||||
CC: gcc
|
||||
CFLAGS: "${CFLAGS_COMMON}"
|
||||
EXTRA_CONFIGURE: "--with-libidn2 --disable-warn-error"
|
||||
EXTRA_CONFIGURE: "--with-libidn2 --disable-warn-error --without-python"
|
||||
<<: *centos_centos6_amd64_image
|
||||
<<: *build_job
|
||||
|
||||
@ -805,7 +799,7 @@ gcc:tumbleweed:amd64:
|
||||
variables:
|
||||
CC: gcc
|
||||
CFLAGS: "${CFLAGS_COMMON}"
|
||||
EXTRA_CONFIGURE: "--with-libidn2"
|
||||
EXTRA_CONFIGURE: "--with-libidn2 --with-python"
|
||||
<<: *tumbleweed_latest_amd64_image
|
||||
<<: *build_job
|
||||
|
||||
@ -1152,77 +1146,17 @@ system:clang:openbsd6.6:amd64:
|
||||
- schedules
|
||||
- web
|
||||
|
||||
# Jobs for Visual Studio 2017 builds on Windows (amd64)
|
||||
|
||||
msvc:windows:amd64:
|
||||
<<: *windows_build_job
|
||||
<<: *default_triggering_rules
|
||||
variables:
|
||||
VSCONF: Release
|
||||
|
||||
system:msvc:windows:amd64:
|
||||
<<: *windows_system_test_job
|
||||
variables:
|
||||
VSCONF: Release
|
||||
needs:
|
||||
- job: msvc:windows:amd64
|
||||
artifacts: true
|
||||
|
||||
msvc-debug:windows:amd64:
|
||||
<<: *windows_build_job
|
||||
variables:
|
||||
VSCONF: Debug
|
||||
only:
|
||||
- schedules
|
||||
- tags
|
||||
- web
|
||||
|
||||
system:msvc-debug:windows:amd64:
|
||||
<<: *windows_system_test_job
|
||||
variables:
|
||||
VSCONF: Debug
|
||||
needs:
|
||||
- job: msvc-debug:windows:amd64
|
||||
artifacts: true
|
||||
|
||||
# Job producing a release tarball
|
||||
|
||||
release:
|
||||
<<: *base_image
|
||||
stage: release
|
||||
script:
|
||||
# Determine BIND version
|
||||
- source version
|
||||
- export BIND_DIRECTORY="bind-${MAJORVER}.${MINORVER}.${PATCHVER}${RELEASETYPE}${RELEASEVER}"
|
||||
# Remove redundant files and system test utilities from Windows build artifacts
|
||||
- find Build/Release/ -name "*.pdb" -print -delete
|
||||
- find Build/Debug/ \( -name "*.bsc" -o -name "*.idb" \) -print -delete
|
||||
- find Build/ -regextype posix-extended -regex "Build/.*/($(find bin/tests/ -type f | sed -nE "s|^bin/tests(/system)?/win32/(.*)\.vcxproj$|\2|p" | paste -d"|" -s))\..*" -print -delete
|
||||
# Create Windows zips
|
||||
- openssl dgst -sha256 "${BIND_DIRECTORY}.tar.${TARBALL_EXTENSION}" | tee Build/Release/SHA256 Build/Debug/SHA256
|
||||
- ( cd Build/Release; zip "../../BIND${BIND_DIRECTORY#bind-}.x64.zip" * )
|
||||
- ( cd Build/Debug; zip "../../BIND${BIND_DIRECTORY#bind-}.debug.x64.zip" * )
|
||||
# Prepare release tarball contents (tarballs + zips + documentation)
|
||||
- mkdir -p release/doc/arm
|
||||
- pushd release
|
||||
- mv "../${BIND_DIRECTORY}.tar.${TARBALL_EXTENSION}" ../BIND*.zip .
|
||||
- tar --extract --file="${BIND_DIRECTORY}.tar.${TARBALL_EXTENSION}"
|
||||
- mv "${BIND_DIRECTORY}"/{CHANGES*,COPYRIGHT,LICENSE,README,srcid} .
|
||||
- mv "${BIND_DIRECTORY}"/doc/arm/{Bv9ARM{*.html,.pdf},man.*,notes.{html,pdf,txt}} doc/arm/
|
||||
- rm -rf "${BIND_DIRECTORY}"
|
||||
- cp doc/arm/notes.html "RELEASE-NOTES-${BIND_DIRECTORY}.html"
|
||||
- cp doc/arm/notes.pdf "RELEASE-NOTES-${BIND_DIRECTORY}.pdf"
|
||||
- cp doc/arm/notes.txt "RELEASE-NOTES-${BIND_DIRECTORY}.txt"
|
||||
- popd
|
||||
# Create release tarball
|
||||
- tar --create --file="${CI_COMMIT_TAG}.tar.gz" --gzip release/
|
||||
needs:
|
||||
- job: tarball-create
|
||||
artifacts: true
|
||||
- job: msvc:windows:amd64
|
||||
artifacts: true
|
||||
- job: msvc-debug:windows:amd64
|
||||
artifacts: true
|
||||
only:
|
||||
- tags
|
||||
artifacts:
|
||||
|
53
AUTHORS
Normal file
53
AUTHORS
Normal file
@ -0,0 +1,53 @@
|
||||
Mark Andrews
|
||||
Andreas Gustafsson
|
||||
Evan Hunt
|
||||
Brian Wellington
|
||||
Bob Halley
|
||||
David Lawrence
|
||||
Michael Graff
|
||||
Michael Sawyer
|
||||
Ondřej Surý
|
||||
James Brister
|
||||
Tatuya JINMEI 神明達哉
|
||||
Francis Dupont
|
||||
Michał Kępień
|
||||
Danny Mayer
|
||||
Mukund Sivaraman
|
||||
Jeremy C. Reed
|
||||
William King
|
||||
Stephen Morris
|
||||
Witold Kręcicki
|
||||
Curtis Blackburn
|
||||
Scott Mann
|
||||
Rob Austein
|
||||
Jim Reid
|
||||
Eric Luce
|
||||
Olafur Gudmundsson
|
||||
Stephen Jacob
|
||||
Damien Neil
|
||||
Tony Finch
|
||||
Jakob Schlyter
|
||||
Petr Menšík
|
||||
Vernon Schryver
|
||||
Matt Nelson
|
||||
Shane Kerr
|
||||
Paul Ebersman
|
||||
Ray Bellis
|
||||
Shawn Routhier
|
||||
Ben Cottrell
|
||||
Tomas Hozza
|
||||
johnd
|
||||
Bill Parker
|
||||
李昶
|
||||
Kevin Chen
|
||||
Jonathan Casey
|
||||
Mary Stahl
|
||||
Mathieu Arnold
|
||||
David Hankins
|
||||
Paul Hoffman
|
||||
Paul Vixie
|
||||
Brian Conry
|
||||
Anay Panvalkar
|
||||
colleen
|
||||
Robert Edmonds
|
||||
João Damas
|
@ -1,79 +0,0 @@
|
||||
CODE OF CONDUCT
|
||||
|
||||
BIND 9 Code of Conduct
|
||||
|
||||
Like the technical community as a whole, the BIND 9 team and community is
|
||||
made up of a mixture of professionals and volunteers from all over the
|
||||
world, working on every aspect of the mission - including mentorship,
|
||||
teaching, and connecting people.
|
||||
|
||||
Diversity is one of our huge strengths, but it can also lead to
|
||||
communication issues and unhappiness. To that end, we have a few ground
|
||||
rules that we ask people to adhere to. This code applies equally to the
|
||||
core development team, open source contributors and those seeking help and
|
||||
guidance.
|
||||
|
||||
This isn't an exhaustive list of things that you can't do. Rather, take it
|
||||
in the spirit in which it's intended - a guide to make it easier to enrich
|
||||
all of us and the technical communities in which we participate.
|
||||
|
||||
This code of conduct applies to all spaces managed by the BIND 9 project
|
||||
or Internet Systems Consortium. This includes chat, the mailing lists, the
|
||||
issue tracker, and any other fora created by the project team which the
|
||||
community uses for communication. In addition, violations of this code
|
||||
outside these spaces may affect a person's ability to participate within
|
||||
them.
|
||||
|
||||
If you believe someone is violating the code of conduct, we ask that you
|
||||
report it by emailing conduct@isc.org. For more details please see our
|
||||
Reporting Guidelines.
|
||||
|
||||
* Be friendly and patient.
|
||||
* Be welcoming. We strive to be a community that welcomes and supports
|
||||
people of all backgrounds and identities. This includes, but is not
|
||||
limited to members of any race, ethnicity, culture, national origin,
|
||||
colour, immigration status, social and economic class, educational
|
||||
level, sex, sexual orientation, gender identity and expression, age,
|
||||
size, family status, political belief, religion, and mental and
|
||||
physical ability.
|
||||
* Be considerate. Your work will be used by other people, and you in
|
||||
turn will depend on the work of others. Any decision you take will
|
||||
affect users and colleagues, and you should take those consequences
|
||||
into account when making decisions. Remember that we're a world-wide
|
||||
community, so you might not be communicating in someone else's primary
|
||||
language.
|
||||
* Be respectful. Not all of us will agree all the time, but disagreement
|
||||
is no excuse for poor behavior and poor manners. We might all
|
||||
experience some frustration now and then, but we cannot allow that
|
||||
frustration to turn into a personal attack. It's important to remember
|
||||
that a community where people feel uncomfortable or threatened is not
|
||||
a productive one. Members of the BIND 9 community should be respectful
|
||||
when dealing with other members as well as with people outside the
|
||||
BIND 9 community.
|
||||
* Be careful in the words that you choose. We are a community of
|
||||
professionals, and we conduct ourselves professionally. Be kind to
|
||||
others. Do not insult or put down other participants. Harassment and
|
||||
other exclusionary behavior aren't acceptable. This includes, but is
|
||||
not limited to:
|
||||
+ Violent threats or language directed against another person.
|
||||
+ Discriminatory jokes and language.
|
||||
+ Posting sexually explicit or violent material.
|
||||
+ Posting (or threatening to post) other people's personally
|
||||
identifying information ("doxing").
|
||||
+ Personal insults, especially those using racist or sexist terms.
|
||||
+ Unwelcome sexual attention.
|
||||
+ Advocating for, or encouraging, any of the above behavior.
|
||||
+ Repeated harassment of others. In general, if someone asks you to
|
||||
stop, then stop.
|
||||
* When we disagree, try to understand why. Disagreements, both social
|
||||
and technical, happen all the time and BIND 9 is no exception. It is
|
||||
important that we resolve disagreements and differing views
|
||||
constructively. Remember that we're different. The strength of BIND 9
|
||||
comes from its varied community, people from a wide range of
|
||||
backgrounds. Different people have different perspectives on issues.
|
||||
Being unable to understand why someone holds a viewpoint doesn't mean
|
||||
that they're wrong. Don't forget that it is human to err and blaming
|
||||
each other doesn't get us anywhere. Instead, focus on helping to
|
||||
resolve issues and learning from mistakes.
|
||||
|
||||
Original text courtesy of the Django Code of Conduct project.
|
196
CONTRIBUTING
196
CONTRIBUTING
@ -1,196 +0,0 @@
|
||||
CONTRIBUTING
|
||||
|
||||
BIND Source Access and Contributor Guidelines
|
||||
|
||||
Feb 22, 2018
|
||||
|
||||
Contents
|
||||
|
||||
1. Access to source code
|
||||
2. Reporting bugs
|
||||
3. Contributing code
|
||||
|
||||
Introduction
|
||||
|
||||
Thank you for using BIND!
|
||||
|
||||
BIND is open source software that implements the Domain Name System (DNS)
|
||||
protocols for the Internet. It is a reference implementation of those
|
||||
protocols, but it is also production-grade software, suitable for use in
|
||||
high-volume and high-reliability applications. It is by far the most
|
||||
widely used DNS software, providing a robust and stable platform on top of
|
||||
which organizations can build distributed computing systems with the
|
||||
knowledge that those systems are fully compliant with published DNS
|
||||
standards.
|
||||
|
||||
BIND is and will always remain free and openly available. It can be used
|
||||
and modified in any way by anyone.
|
||||
|
||||
BIND is maintained by the Internet Systems Consortium, a public-benefit
|
||||
501(c)(3) nonprofit, using a "managed open source" approach: anyone can
|
||||
see the source, but only ISC employees have commit access. Until recently,
|
||||
the source could only be seen once ISC had published a release: read
|
||||
access to the source repository was restricted just as commit access was.
|
||||
That's now changing, with the opening of a public git mirror to the BIND
|
||||
source tree (see below).
|
||||
|
||||
At Internet Systems Consortium, we're committed to building communities
|
||||
that are welcoming and inclusive; environments where people are encouraged
|
||||
to share ideas, treat each other with respect, and collaborate towards the
|
||||
best solutions. To reinforce our commitment, the Internet Systems
|
||||
Consortium has adopted the Contributor Covenant version 1.4 as our Code of
|
||||
Conduct for BIND 9 project, as well as for the conduct of our developers
|
||||
throughout the industry.
|
||||
|
||||
Access to source code
|
||||
|
||||
Public BIND releases are always available from the ISC FTP site.
|
||||
|
||||
A public-access GIT repository is also available at https://gitlab.isc.org
|
||||
. This repository is a mirror, updated several times per day, of the
|
||||
source repository maintained by ISC. It contains all the public release
|
||||
branches; upcoming releases can be viewed in their current state at any
|
||||
time. It does not contain development branches or unreviewed work in
|
||||
progress. Commits which address security vulnerablilities are withheld
|
||||
until after public disclosure.
|
||||
|
||||
You can browse the source online via https://gitlab.isc.org/isc-projects/
|
||||
bind9
|
||||
|
||||
To clone the repository, use:
|
||||
|
||||
$ git clone https://gitlab.isc.org/isc-projects/bind9.git
|
||||
|
||||
Release branch names are of the form v9_X, where X represents the second
|
||||
number in the BIND 9 version number. So, to check out the BIND 9.12
|
||||
branch, use:
|
||||
|
||||
$ git checkout v9_12
|
||||
|
||||
Whenever a branch is ready for publication, a tag will be placed of the
|
||||
form v9_X_Y. The 9.12.0 release, for instance, is tagged as v9_12_0.
|
||||
|
||||
The branch in which the next major release is being developed is called
|
||||
master.
|
||||
|
||||
Reporting bugs
|
||||
|
||||
Reports of flaws in the BIND package, including software bugs, errors in
|
||||
the documentation, missing files in the tarball, suggested changes or
|
||||
requests for new features, etc, can be filed using https://gitlab.isc.org/
|
||||
isc-projects/bind9/issues.
|
||||
|
||||
Due to a large ticket backlog, we are sometimes slow to respond,
|
||||
especially if a bug is cosmetic or if a feature request is vague or low in
|
||||
priority, but we will try at least to acknowledge legitimate bug reports
|
||||
within a week.
|
||||
|
||||
ISC's ticketing system is publicly readable; however, you must have an
|
||||
account to file a new issue. You can either register locally or use
|
||||
credentials from an existing account at GitHub, GitLab, Google, Twitter,
|
||||
or Facebook.
|
||||
|
||||
Reporting possible security issues
|
||||
|
||||
If you think you may be seeing a potential security vulnerability in BIND
|
||||
(for example, a crash with REQUIRE, INSIST, or ASSERT failure), please
|
||||
report it immediately by emailing to security-officer@isc.org. Plain-text
|
||||
e-mail is not a secure choice for communications concerning undisclosed
|
||||
security issues so please encrypt your communications to us if possible,
|
||||
using the ISC Security Officer public key.
|
||||
|
||||
Do not discuss undisclosed security vulnerabilities on any public mailing
|
||||
list. ISC has a long history of handling reported vulnerabilities promptly
|
||||
and effectively and we respect and acknowledge responsible reporters.
|
||||
|
||||
ISC's Security Vulnerability Disclosure Policy is documented at https://
|
||||
kb.isc.org/article/AA-00861/0.
|
||||
|
||||
If you have a crash, you may want to consult ?What to do if your BIND or
|
||||
DHCP server has crashed.?
|
||||
|
||||
Contributing code
|
||||
|
||||
BIND is licensed under the Mozilla Public License 2.0. Earier versions
|
||||
(BIND 9.10 and earlier) were licensed under the ISC License
|
||||
|
||||
ISC does not require an explicit copyright assignment for patch
|
||||
contributions. However, by submitting a patch to ISC, you implicitly
|
||||
certify that you are the author of the code, that you intend to reliquish
|
||||
exclusive copyright, and that you grant permission to publish your work
|
||||
under the open source license used for the BIND version(s) to which your
|
||||
patch will be applied.
|
||||
|
||||
BIND code
|
||||
|
||||
Patches for BIND may be submitted directly via merge requests in ISC's
|
||||
Gitlab source repository for BIND.
|
||||
|
||||
Patches can also be submitted as diffs against a specific version of BIND
|
||||
-- preferably the current top of the master branch. Diffs may be generated
|
||||
using either git format-patch or git diff.
|
||||
|
||||
Those wanting to write code for BIND may be interested in the developer
|
||||
information page, which includes information about BIND design and coding
|
||||
practices, including discussion of internal APIs and overall system
|
||||
architecture. (This is a work in progress, and still quite preliminary.)
|
||||
|
||||
Every patch submitted will be reviewed by ISC engineers following our code
|
||||
review process before it is merged.
|
||||
|
||||
It may take considerable time to review patch submissions, especially if
|
||||
they don't meet ISC style and quality guidelines. If a patch is a good
|
||||
idea, we can and will do additional work to bring it up to par, but if
|
||||
we're busy with other work, it may take us a long time to get to it.
|
||||
|
||||
To ensure your patch is acted on as promptly as possible, please:
|
||||
|
||||
* Try to adhere to the BIND 9 coding style.
|
||||
* Run make check to ensure your change hasn't caused any functional
|
||||
regressions.
|
||||
* Document your work, both in the patch itself and in the accompanying
|
||||
email.
|
||||
* In patches that make non-trivial functional changes, include system
|
||||
tests if possible; when introducing or substantially altering a
|
||||
library API, include unit tests. See Testing for more information.
|
||||
|
||||
Changes to configure
|
||||
|
||||
If you need to make changes to configure, you should not edit it directly;
|
||||
instead, edit configure.in, then run autoconf. Similarly, instead of
|
||||
editing config.h.in directly, edit configure.in and run autoheader.
|
||||
|
||||
When submitting a patch as a diff, it's fine to omit the configure diffs
|
||||
to save space. Just send the configure.in diffs and we'll generate the new
|
||||
configure during the review process.
|
||||
|
||||
Documentation
|
||||
|
||||
All functional changes should be documented. There are three types of
|
||||
documentation in the BIND source tree:
|
||||
|
||||
* Man pages are kept alongside the source code for the commands they
|
||||
document, in files ending in .docbook; for example, the named man page
|
||||
is bin/named/named.docbook.
|
||||
* The BIND 9 Administrator Reference Manual is mostly in doc/arm/
|
||||
Bv9ARM-book.xml, plus a few other XML files that are included in it.
|
||||
* API documentation is in the header file describing the API, in
|
||||
Doxygen-formatted comments.
|
||||
|
||||
It is not necessary to edit any documentation files other than these; all
|
||||
PDF, HTML, and nroff-format man page files will be updated automatically
|
||||
from the docbook and XML files after merging.
|
||||
|
||||
Patches to improve existing documentation are also very welcome!
|
||||
|
||||
Tests
|
||||
|
||||
BIND is a large and complex project. We rely heavily on continuous
|
||||
automated testing and cannot merge new code without adequate test
|
||||
coverage. Please see the 'Testing' section of doc/dev/dev.md for more
|
||||
information.
|
||||
|
||||
Thanks
|
||||
|
||||
Thank you for your interest in contributing to the ongoing development of
|
||||
BIND.
|
615
HISTORY
615
HISTORY
@ -1,615 +0,0 @@
|
||||
HISTORY
|
||||
|
||||
Functional enhancements from prior major releases of BIND 9
|
||||
|
||||
BIND 9.16
|
||||
|
||||
BIND 9.16 (a stable branch based on the 9.15 development branch) includes
|
||||
a number of changes from BIND 9.14 and earlier releases. New features
|
||||
include:
|
||||
|
||||
* New dnssec-policy statement to configure a key and signing policy for
|
||||
zones, enabling automatic key regeneration and rollover.
|
||||
* New network manager based on libuv.
|
||||
* Added support for the new GeoIP2 geolocation API, libmaxminddb.
|
||||
* Improved DNSSEC trust anchor configuration using the trust-anchors
|
||||
statement, permitting configuration of trust anchors in DS as well as
|
||||
DNSKEY format.
|
||||
* YAML output for dig, mdig, and delv.
|
||||
|
||||
BIND 9.14
|
||||
|
||||
BIND 9.14 (a stable branch based on the 9.13 development branch) includes
|
||||
a number of changes from BIND 9.12 and earlier releases. New features
|
||||
include:
|
||||
|
||||
* A new "plugin" mechanism has been added to allow query functionality
|
||||
to be extended using dynamically loadable libraries. The "filter-aaaa"
|
||||
feature has been removed from named and is now implemented as a
|
||||
plugin.
|
||||
* Socket and task code has been refactored to improve performance.
|
||||
* QNAME minimization, as described in RFC 7816, is now supported.
|
||||
* "Root key sentinel" support, enabling validating resolvers to indicate
|
||||
via a special query which trust anchors are configured for the root
|
||||
zone.
|
||||
* Secondary zones can now be configured as "mirror" zones; their
|
||||
contents are transferred in as with traditional slave zones, but are
|
||||
subject to DNSSEC validation and are not treated as authoritative data
|
||||
when answering. This makes it easier to configure a local copy of the
|
||||
root zone as described in RFC 7706.
|
||||
* The "validate-except" option allows configuration of domains below
|
||||
which DNSSEC validation should not be performed.
|
||||
* The default value of "dnssec-validation" is now "auto".
|
||||
* IDNA2008 is now supported when linking with libidn2.
|
||||
* "named -V" now outputs the default paths for files used by named and
|
||||
other tools.
|
||||
|
||||
In addition, workarounds that were formerly in place to enable resolution
|
||||
of domains whose authoritative servers did not respond to EDNS queries
|
||||
have been removed. See https://dnsflagday.net for more details.
|
||||
|
||||
Cryptographic support has been modernized. BIND now uses the best
|
||||
available pseudo-random number generator for the platform on which it's
|
||||
built. Very old versions of OpenSSL are no longer supported. Cryptography
|
||||
is now mandatory: building BIND without DNSSEC is no longer supported.
|
||||
|
||||
Special code to support certain legacy operating systems has also been
|
||||
removed; see the file PLATFORMS.md for details of supported platforms. In
|
||||
addition to OpenSSL, BIND now requires support for IPv6, threads, and
|
||||
standard atomic operations provided by the C compiler.
|
||||
|
||||
BIND 9.12
|
||||
|
||||
BIND 9.12 includes a number of changes from BIND 9.11 and earlier
|
||||
releases. New features include:
|
||||
|
||||
* named and related libraries have been substantially refactored for
|
||||
improved query performance -- particularly on delegation heavy zones
|
||||
-- and for improved readability, maintainability, and testability.
|
||||
* Code implementing the name server query processing logic has been
|
||||
moved into a new libns library, for easier testing and use in tools
|
||||
other than named.
|
||||
* Cached, validated NSEC and other records can now be used to synthesize
|
||||
NXDOMAIN responses.
|
||||
* The DNS Response Policy Service API (DNSRPS) is now supported.
|
||||
* Setting 'max-journal-size default' now limits the size of journal
|
||||
files to twice the size of the zone.
|
||||
* dnstap-read -x prints a hex dump of the wire format of each logged DNS
|
||||
message.
|
||||
* dnstap output files can now be configured to roll automatically when
|
||||
reaching a given size.
|
||||
* Log file timestamps can now also be formatted in ISO 8601 (local) or
|
||||
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.
|
||||
* 'new-zones-directory' option sets the location where the configuration
|
||||
data for zones added by rndc addzone is stored.
|
||||
* The default key algorithm in rndc-confgen is now hmac-sha256.
|
||||
* filter-aaaa-on-v4 and filter-aaaa-on-v6 options are now available by
|
||||
default without a configure option.
|
||||
* The obsolete isc-hmac-fixup command has been removed.
|
||||
|
||||
BIND 9.11
|
||||
|
||||
BIND 9.11.0 includes a number of changes from BIND 9.10 and earlier
|
||||
releases. New features include:
|
||||
|
||||
* Added support for Catalog Zones, a new method for provisioning
|
||||
servers: a list of zones to be served is stored in a DNS zone, along
|
||||
with their configuration parameters. Changes to the catalog zone are
|
||||
propagated to slaves via normal AXFR/IXFR, whereupon the zones that
|
||||
are listed in it are automatically added, deleted or reconfigured.
|
||||
* Added support for "dnstap", a fast and flexible method of capturing
|
||||
and logging DNS traffic.
|
||||
* Added support for "dyndb", a new API for loading zone data from an
|
||||
external database, developed by Red Hat for the FreeIPA project.
|
||||
* "fetchlimit" quotas are now compiled in by default. These are for the
|
||||
use of recursive resolvers that are are under high query load for
|
||||
domains whose authoritative servers are nonresponsive or are
|
||||
experiencing a denial of service attack:
|
||||
+ "fetches-per-server" limits the number of simultaneous queries
|
||||
that can be sent to any single authoritative server. The
|
||||
configured value is a starting point; it is automatically adjusted
|
||||
downward if the server is partially or completely non-responsive.
|
||||
The algorithm used to adjust the quota can be configured via the
|
||||
"fetch-quota-params" option.
|
||||
+ "fetches-per-zone" limits the number of simultaneous queries that
|
||||
can be sent for names within a single domain. (Note: Unlike
|
||||
"fetches-per-server", this value is not self-tuning.)
|
||||
+ New stats counters have been added to count queries spilled due to
|
||||
these quotas.
|
||||
* Added a new "dnssec-keymgr" key mainenance utility, which can generate
|
||||
or update keys as needed to ensure that a zone's keys match a defined
|
||||
DNSSEC policy.
|
||||
* The experimental "SIT" feature in BIND 9.10 has been renamed "COOKIE"
|
||||
and is no longer optional. EDNS COOKIE is a mechanism enabling clients
|
||||
to detect off-path spoofed responses, and servers to detect
|
||||
spoofed-source queries. Clients that identify themselves using COOKIE
|
||||
options are not subject to response rate limiting (RRL) and can
|
||||
receive larger UDP responses.
|
||||
* SERVFAIL responses can now be cached for a limited time (defaulting to
|
||||
1 second, with an upper limit of 30). This can reduce the frequency of
|
||||
retries when a query is persistently failing.
|
||||
* Added an "nsip-wait-recurse" switch to RPZ. This causes NSIP rules to
|
||||
be skipped if a name server IP address isn't in the cache yet; the
|
||||
address will be looked up and the rule will be applied on future
|
||||
queries.
|
||||
* Added a Python RNDC module. This allows multiple commands to sent over
|
||||
a persistent RNDC channel, which saves time.
|
||||
* The "controls" block in named.conf can now grant read-only "rndc"
|
||||
access to specified clients or keys. Read-only clients could, for
|
||||
example, check "rndc status" but could not reconfigure or shut down
|
||||
the server.
|
||||
* "rndc" commands can now return arbitrarily large amounts of text to
|
||||
the caller.
|
||||
* The zone serial number of a dynamically updatable zone can now be set
|
||||
via "rndc signing -serial ". This allows inline-signing zones to be
|
||||
set to a specific serial number.
|
||||
* The new "rndc nta" command can be used to set a Negative Trust Anchor
|
||||
(NTA), disabling DNSSEC validation for a specific domain; this can be
|
||||
used when responses from a domain are known to be failing validation
|
||||
due to administrative error rather than because of a spoofing attack.
|
||||
Negative trust anchors are strictly temporary; by default they expire
|
||||
after one hour, but can be configured to last up to one week.
|
||||
* "rndc delzone" can now be used on zones that were not originally
|
||||
created by "rndc addzone".
|
||||
* "rndc modzone" reconfigures a single zone, without requiring the
|
||||
entire server to be reconfigured.
|
||||
* "rndc showzone" displays the current configuration of a zone.
|
||||
* "rndc managed-keys" can be used to check the status of RFC 5011
|
||||
managed trust anchors, or to force trust anchors to be refreshed.
|
||||
* "max-cache-size" can now be set to a percentage of available memory.
|
||||
The default is 90%.
|
||||
* Update forwarding performance has been improved by allowing a single
|
||||
TCP connection to be shared by multiple updates.
|
||||
* The EDNS Client Subnet (ECS) option is now supported for authoritative
|
||||
servers; if a query contains an ECS option then ACLs containing
|
||||
"geoip" or "ecs" elements can match against the the address encoded in
|
||||
the option. This can be used to select a view for a query, so that
|
||||
different answers can be provided depending on the client network.
|
||||
* The EDNS EXPIRE option has been implemented on the client side,
|
||||
allowing a slave server to set the expiration timer correctly when
|
||||
transferring zone data from another slave server.
|
||||
* The key generation and manipulation tools (dnssec-keygen,
|
||||
dnssec-settime, dnssec-importkey, dnssec-keyfromlabel) now take
|
||||
"-Psync" and "-Dsync" options to set the publication and deletion
|
||||
times of CDS and CDNSKEY parent-synchronization records. Both named
|
||||
and dnssec-signzone can now publish and remove these records at the
|
||||
scheduled times.
|
||||
* A new "minimal-any" option reduces the size of UDP responses for query
|
||||
type ANY by returning a single arbitrarily selected RRset instead of
|
||||
all RRsets.
|
||||
* A new "masterfile-style" zone option controls the formatting of text
|
||||
zone files: When set to "full", a zone file is dumped in
|
||||
single-line-per-record format.
|
||||
* "serial-update-method" can now be set to "date". On update, the serial
|
||||
number will be set to the current date in YYYYMMDDNN format.
|
||||
* "dnssec-signzone -N date" sets the serial number to YYYYMMDDNN.
|
||||
* "named -L " causes named to send log messages to the specified file by
|
||||
default instead of to the system log.
|
||||
* "dig +ttlunits" prints TTL values with time-unit suffixes: w, d, h, m,
|
||||
s for weeks, days, hours, minutes, and seconds.
|
||||
* "dig +unknownformat" prints dig output in RFC 3597 "unknown record"
|
||||
presentation format.
|
||||
* "dig +ednsopt" allows dig to set arbitrary EDNS options on requests.
|
||||
* "dig +ednsflags" allows dig to set yet-to-be-defined EDNS flags on
|
||||
requests.
|
||||
* "mdig" is an alternate version of dig which sends multiple pipelined
|
||||
TCP queries to a server. Instead of waiting for a response after
|
||||
sending a query, it sends all queries immediately and displays
|
||||
responses in the order received.
|
||||
* "serial-query-rate" no longer controls NOTIFY messages. These are
|
||||
separately controlled by "notify-rate" and "startup-notify-rate".
|
||||
* "nsupdate" now performs "check-names" processing by default on records
|
||||
to be added. This can be disabled with "check-names no".
|
||||
* The statistics channel now supports DEFLATE compression, reducing the
|
||||
size of the data sent over the network when querying statistics.
|
||||
* New counters have been added to the statistics channel to track the
|
||||
sizes of incoming queries and outgoing responses in histogram buckets,
|
||||
as specified in RSSAC002.
|
||||
* A new NXDOMAIN redirect method (option "nxdomain-redirect") has been
|
||||
added, allowing redirection to a specified DNS namespace instead of a
|
||||
single redirect zone.
|
||||
* When starting up, named now ensures that no other named process is
|
||||
already running.
|
||||
* Files created by named to store information, including "mkeys" and
|
||||
"nzf" files, are now named after their corresponding views unless the
|
||||
view name contains characters incompatible with use as a filename. Old
|
||||
style filenames (based on the hash of the view name) will still work.
|
||||
|
||||
BIND 9.10.0
|
||||
|
||||
BIND 9.10.0 includes a number of changes from BIND 9.9 and earlier
|
||||
releases. New features include:
|
||||
|
||||
* DNS Response-rate limiting (DNS RRL), which blunts the impact of
|
||||
reflection and amplification attacks, is always compiled in and no
|
||||
longer requires a compile-time option to enable it.
|
||||
* An experimental "Source Identity Token" (SIT) EDNS option is now
|
||||
available. Similar to DNS Cookies as invented by Donald Eastlake 3rd,
|
||||
these are designed to enable clients to detect off-path spoofed
|
||||
responses, and to enable servers to detect spoofed-source queries.
|
||||
Servers can be configured to send smaller responses to clients that
|
||||
have not identified themselves using a SIT option, reducing the
|
||||
effectiveness of amplification attacks. RRL processing has also been
|
||||
updated; clients proven to be legitimate via SIT are not subject to
|
||||
rate limiting. Use "configure --enable-sit" to enable this feature in
|
||||
BIND.
|
||||
* A new zone file format, "map", stores zone data in a format that can
|
||||
be mapped directly into memory, allowing significantly faster zone
|
||||
loading.
|
||||
* "delv" (domain entity lookup and validation) is a new tool with
|
||||
dig-like semantics for looking up DNS data and performing internal
|
||||
DNSSEC validation. This allows easy validation in environments where
|
||||
the resolver may not be trustworthy, and assists with troubleshooting
|
||||
of DNSSEC problems. (NOTE: In previous development releases of BIND
|
||||
9.10, this utility was called "delve". The spelling has been changed
|
||||
to avoid confusion with the "delve" utility included with the Xapian
|
||||
search engine.)
|
||||
* Improved EDNS(0) processing for better resolver performance and
|
||||
reliability over slow or lossy connections.
|
||||
* A new "configure --with-tuning=large" option tunes certain compiled-in
|
||||
constants and default settings to values better suited to large
|
||||
servers with abundant memory. This can improve performance on such
|
||||
servers, but will consume more memory and may degrade performance on
|
||||
smaller systems.
|
||||
* Substantial improvement in response-policy zone (RPZ) performance. Up
|
||||
to 32 response-policy zones can be configured with minimal performance
|
||||
loss.
|
||||
* To improve recursive resolver performance, cache records which are
|
||||
still being requested by clients can now be automatically refreshed
|
||||
from the authoritative server before they expire, reducing or
|
||||
eliminating the time window in which no answer is available in the
|
||||
cache.
|
||||
* New "rpz-client-ip" triggers and drop policies allowing response
|
||||
policies based on the IP address of the client.
|
||||
* ACLs can now be specified based on geographic location using the
|
||||
MaxMind GeoIP databases. Use "configure --with-geoip" to enable.
|
||||
* Zone data can now be shared between views, allowing multiple views to
|
||||
serve the same zones authoritatively without storing multiple copies
|
||||
in memory.
|
||||
* New XML schema (version 3) for the statistics channel includes many
|
||||
new statistics and uses a flattened XML tree for faster parsing. The
|
||||
older schema is now deprecated.
|
||||
* A new stylesheet, based on the Google Charts API, displays XML
|
||||
statistics in charts and graphs on javascript-enabled browsers.
|
||||
* The statistics channel can now provide data in JSON format as well as
|
||||
XML.
|
||||
* New stats counters track TCP and UDP queries received per zone, and
|
||||
EDNS options received in total.
|
||||
* The internal and export versions of the BIND libraries (libisc,
|
||||
libdns, etc) have been unified so that external library clients can
|
||||
use the same libraries as BIND itself.
|
||||
* A new compile-time option, "configure --enable-native-pkcs11", allows
|
||||
BIND 9 cryptography functions to use the PKCS#11 API natively, so that
|
||||
BIND can drive a cryptographic hardware service module (HSM) directly
|
||||
instead of using a modified OpenSSL as an intermediary. (Note: This
|
||||
feature requires an HSM to have a full implementation of the PKCS#11
|
||||
API; many current HSMs only have partial implementations. The new
|
||||
"pkcs11-tokens" command can be used to check API completeness. Native
|
||||
PKCS#11 is known to work with the Thales nShield HSM and with SoftHSM
|
||||
version 2 from the Open DNSSEC project.)
|
||||
* The new "max-zone-ttl" option enforces maximum TTLs for zones. This
|
||||
can simplify the process of rolling DNSSEC keys by guaranteeing that
|
||||
cached signatures will have expired within the specified amount of
|
||||
time.
|
||||
* "dig +subnet" sends an EDNS CLIENT-SUBNET option when querying.
|
||||
* "dig +expire" sends an EDNS EXPIRE option when querying. When this
|
||||
option is sent with an SOA query to a server that supports it, it will
|
||||
report the expiry time of a slave zone.
|
||||
* New "dnssec-coverage" tool to check DNSSEC key coverage for a zone and
|
||||
report if a lapse in signing coverage has been inadvertently
|
||||
scheduled.
|
||||
* Signing algorithm flexibility and other improvements for the "rndc"
|
||||
control channel.
|
||||
* "named-checkzone" and "named-compilezone" can now read journal files,
|
||||
allowing them to process dynamic zones.
|
||||
* Multiple DLZ databases can now be configured. Individual zones can be
|
||||
configured to be served from a specific DLZ database. DLZ databases
|
||||
now serve zones of type "master" and "redirect".
|
||||
* "rndc zonestatus" reports information about a specified zone.
|
||||
* "named" now listens on IPv6 as well as IPv4 interfaces by default.
|
||||
* "named" now preserves the capitalization of names when responding to
|
||||
queries: for instance, a query for "example.com" may be answered with
|
||||
"example.COM" if the name was configured that way in the zone file.
|
||||
Some clients have a bug causing them to depend on the older behavior,
|
||||
in which the case of the answer always matched the case of the query,
|
||||
rather than the case of the name configured in the DNS. Such clients
|
||||
can now be specified in the new "no-case-compress" ACL; this will
|
||||
restore the older behavior of "named" for those clients only.
|
||||
* new "dnssec-importkey" command allows the use of offline DNSSEC keys
|
||||
with automatic DNSKEY management.
|
||||
* New "named-rrchecker" tool to verify the syntactic correctness of
|
||||
individual resource records.
|
||||
* When re-signing a zone, the new "dnssec-signzone -Q" option drops
|
||||
signatures from keys that are still published but are no longer
|
||||
active.
|
||||
* "named-checkconf -px" will print the contents of configuration files
|
||||
with the shared secrets obscured, making it easier to share
|
||||
configuration (e.g. when submitting a bug report) without revealing
|
||||
private information.
|
||||
* "rndc scan" causes named to re-scan network interfaces for changes in
|
||||
local addresses.
|
||||
* On operating systems with support for routing sockets, network
|
||||
interfaces are re-scanned automatically whenever they change.
|
||||
* "tsig-keygen" is now available as an alternate command name to use for
|
||||
"ddns-confgen".
|
||||
|
||||
BIND 9.9.0
|
||||
|
||||
BIND 9.9.0 includes a number of changes from BIND 9.8 and earlier
|
||||
releases. New features include:
|
||||
|
||||
* Inline signing, allowing automatic DNSSEC signing of master zones
|
||||
without modification of the zonefile, or "bump in the wire" signing in
|
||||
slaves.
|
||||
* NXDOMAIN redirection.
|
||||
* New 'rndc flushtree' command clears all data under a given name from
|
||||
the DNS cache.
|
||||
* New 'rndc sync' command dumps pending changes in a dynamic zone to
|
||||
disk without a freeze/thaw cycle.
|
||||
* New 'rndc signing' command displays or clears signing status records
|
||||
in 'auto-dnssec' zones.
|
||||
* NSEC3 parameters for 'auto-dnssec' zones can now be set prior to
|
||||
signing, eliminating the need to initially sign with NSEC.
|
||||
* Startup time improvements on large authoritative servers.
|
||||
* Slave zones are now saved in raw format by default.
|
||||
* Several improvements to response policy zones (RPZ).
|
||||
* Improved hardware scalability by using multiple threads to listen for
|
||||
queries and using finer-grained client locking
|
||||
* The 'also-notify' option now takes the same syntax as 'masters', so it
|
||||
can used named masterlists and TSIG keys.
|
||||
* 'dnssec-signzone -D' writes an output file containing only DNSSEC
|
||||
data, which can be included by the primary zone file.
|
||||
* 'dnssec-signzone -R' forces removal of signatures that are not expired
|
||||
but were created by a key which no longer exists.
|
||||
* 'dnssec-signzone -X' allows a separate expiration date to be specified
|
||||
for DNSKEY signatures from other signatures.
|
||||
* New '-L' option to dnssec-keygen, dnssec-settime, and
|
||||
dnssec-keyfromlabel sets the default TTL for the key.
|
||||
* dnssec-dsfromkey now supports reading from standard input, to make it
|
||||
easier to convert DNSKEY to DS.
|
||||
* RFC 1918 reverse zones have been added to the empty-zones table per
|
||||
RFC 6303.
|
||||
* Dynamic updates can now optionally set the zone's SOA serial number to
|
||||
the current UNIX time.
|
||||
* DLZ modules can now retrieve the source IP address of the querying
|
||||
client.
|
||||
* 'request-ixfr' option can now be set at the per-zone level.
|
||||
* 'dig +rrcomments' turns on comments about DNSKEY records, indicating
|
||||
their key ID, algorithm and function
|
||||
* Simplified nsupdate syntax and added readline support
|
||||
|
||||
BIND 9.8.0
|
||||
|
||||
BIND 9.8.0 includes a number of changes from BIND 9.7 and earlier
|
||||
releases. New features include:
|
||||
|
||||
* Built-in trust anchor for the root zone, which can be switched on via
|
||||
"dnssec-validation auto;"
|
||||
* Support for DNS64.
|
||||
* Support for response policy zones (RPZ).
|
||||
* Support for writable DLZ zones.
|
||||
* Improved ease of configuration of GSS/TSIG for interoperability with
|
||||
Active Directory
|
||||
* Support for GOST signing algorithm for DNSSEC.
|
||||
* Removed RTT Banding from server selection algorithm.
|
||||
* New "static-stub" zone type.
|
||||
* Allow configuration of resolver timeouts via "resolver-query-timeout"
|
||||
option.
|
||||
* The DLZ "dlopen" driver is now built by default.
|
||||
* Added a new include file with function typedefs for the DLZ "dlopen"
|
||||
driver.
|
||||
* Made "--with-gssapi" default.
|
||||
* More verbose error reporting from DLZ LDAP.
|
||||
|
||||
BIND 9.7.0
|
||||
|
||||
BIND 9.7.0 includes a number of changes from BIND 9.6 and earlier
|
||||
releases. Most are intended to simplify DNSSEC configuration. New features
|
||||
include:
|
||||
|
||||
* Fully automatic signing of zones by "named".
|
||||
* Simplified configuration of DNSSEC Lookaside Validation (DLV).
|
||||
* Simplified configuration of Dynamic DNS, using the "ddns-confgen"
|
||||
command line tool or the "local" update-policy option. (As a side
|
||||
effect, this also makes it easier to configure automatic zone
|
||||
re-signing.)
|
||||
* New named option "attach-cache" that allows multiple views to share a
|
||||
single cache.
|
||||
* DNS rebinding attack prevention.
|
||||
* New default values for dnssec-keygen parameters.
|
||||
* Support for RFC 5011 automated trust anchor maintenance
|
||||
* Smart signing: simplified tools for zone signing and key maintenance.
|
||||
* The "statistics-channels" option is now available on Windows.
|
||||
* A new DNSSEC-aware libdns API for use by non-BIND9 applications
|
||||
* On some platforms, named and other binaries can now print out a stack
|
||||
backtrace on assertion failure, to aid in debugging.
|
||||
* A "tools only" installation mode on Windows, which only installs dig,
|
||||
host, nslookup and nsupdate.
|
||||
* Improved PKCS#11 support, including Keyper support and explicit
|
||||
OpenSSL engine selection.
|
||||
|
||||
BIND 9.6.0
|
||||
|
||||
* Full NSEC3 support
|
||||
* Automatic zone re-signing
|
||||
* New update-policy methods tcp-self and 6to4-self
|
||||
* The BIND 8 resolver library, libbind, has been removed from the BIND 9
|
||||
distribution and is now available as a separate download.
|
||||
* Change the default pid file location from /var/run to /var/run/
|
||||
{named,lwresd} for improved chroot/setuid support.
|
||||
|
||||
BIND 9.5.0
|
||||
|
||||
* GSS-TSIG support (RFC 3645).
|
||||
* DHCID support.
|
||||
* Experimental http server and statistics support for named via xml.
|
||||
* More detailed statistics counters including those supported in BIND 8.
|
||||
* Faster ACL processing.
|
||||
* Use Doxygen to generate internal documentation.
|
||||
* Efficient LRU cache-cleaning mechanism.
|
||||
* NSID support.
|
||||
|
||||
BIND 9.4.0
|
||||
|
||||
* Implemented "additional section caching (or acache)", an internal
|
||||
cache framework for additional section content to improve response
|
||||
performance. Several configuration options were provided to control
|
||||
the behavior.
|
||||
* New notify type 'master-only'. Enable notify for master zones only.
|
||||
* Accept 'notify-source' style syntax for query-source.
|
||||
* rndc now allows addresses to be set in the server clauses.
|
||||
* New option "allow-query-cache". This lets "allow-query" be used to
|
||||
specify the default zone access level rather than having to have every
|
||||
zone override the global value. "allow-query-cache" can be set at both
|
||||
the options and view levels. If "allow-query-cache" is not set then
|
||||
"allow-recursion" is used if set, otherwise "allow-query" is used if
|
||||
set unless "recursion no;" is set in which case "none;" is used,
|
||||
otherwise the default (localhost; localnets;) is used.
|
||||
* rndc: the source address can now be specified.
|
||||
* ixfr-from-differences now takes master and slave in addition to yes
|
||||
and no at the options and view levels.
|
||||
* Allow the journal's name to be changed via named.conf.
|
||||
* 'rndc notify zone [class [view]]' resend the NOTIFY messages for the
|
||||
specified zone.
|
||||
* 'dig +trace' now randomly selects the next servers to try. Report if
|
||||
there is a bad delegation.
|
||||
* Improve check-names error messages.
|
||||
* Make public the function to read a key file, dst_key_read_public().
|
||||
* dig now returns the byte count for axfr/ixfr.
|
||||
* allow-update is now settable at the options / view level.
|
||||
* named-checkconf now checks the logging configuration.
|
||||
* host now can turn on memory debugging flags with '-m'.
|
||||
* Don't send notify messages to self.
|
||||
* Perform sanity checks on NS records which refer to 'in zone' names.
|
||||
* New zone option "notify-delay". Specify a minimum delay between sets
|
||||
of NOTIFY messages.
|
||||
* Extend adjusting TTL warning messages.
|
||||
* Named and named-checkzone can now both check for non-terminal wildcard
|
||||
records.
|
||||
* "rndc freeze/thaw" now freezes/thaws all zones.
|
||||
* named-checkconf now check acls to verify that they only refer to
|
||||
existing acls.
|
||||
* The server syntax has been extended to support a range of servers.
|
||||
* Report differences between hints and real NS rrset and associated
|
||||
address records.
|
||||
* Preserve the case of domain names in rdata during zone transfers.
|
||||
* Restructured the data locking framework using architecture dependent
|
||||
atomic operations (when available), improving response performance on
|
||||
multi-processor machines significantly. x86, x86_64, alpha, powerpc,
|
||||
and mips are currently supported.
|
||||
* UNIX domain controls are now supported.
|
||||
* Add support for additional zone file formats for improving loading
|
||||
performance. The masterfile-format option in named.conf can be used to
|
||||
specify a non-default format. A separate command named-compilezone was
|
||||
provided to generate zone files in the new format. Additionally, the
|
||||
-I and -O options for dnssec-signzone specify the input and output
|
||||
formats.
|
||||
* dnssec-signzone can now randomize signature end times (dnssec-signzone
|
||||
-j jitter).
|
||||
* Add support for CH A record.
|
||||
* Add additional zone data constancy checks. named-checkzone has
|
||||
extended checking of NS, MX and SRV record and the hosts they
|
||||
reference. named has extended post zone load checks. New zone options:
|
||||
check-mx and integrity-check.
|
||||
* edns-udp-size can now be overridden on a per server basis.
|
||||
* dig can now specify the EDNS version when making a query.
|
||||
* Added framework for handling multiple EDNS versions.
|
||||
* Additional memory debugging support to track size and mctx arguments.
|
||||
* Detect duplicates of UDP queries we are recursing on and drop them.
|
||||
New stats category "duplicates".
|
||||
* "USE INTERNAL MALLOC" is now runtime selectable.
|
||||
* The lame cache is now done on a <qname,qclass,qtype> basis as some
|
||||
servers only appear to be lame for certain query types.
|
||||
* Limit the number of recursive clients that can be waiting for a single
|
||||
query (<qname,qtype,qclass>) to resolve. New options clients-per-query
|
||||
and max-clients-per-query.
|
||||
* dig: report the number of extra bytes still left in the packet after
|
||||
processing all the records.
|
||||
* Support for IPSECKEY rdata type.
|
||||
* Raise the UDP receive buffer size to 32k if it is less than 32k.
|
||||
* x86 and x86_64 now have separate atomic locking implementations.
|
||||
* named-checkconf now validates update-policy entries.
|
||||
* Attempt to make the amount of work performed in a iteration self
|
||||
tuning. The covers nodes clean from the cache per iteration, nodes
|
||||
written to disk when rewriting a master file and nodes destroyed per
|
||||
iteration when destroying a zone or a cache.
|
||||
* ISC string copy API.
|
||||
* Automatic empty zone creation for D.F.IP6.ARPA and friends. Note: RFC
|
||||
1918 zones are not yet covered by this but are likely to be in a
|
||||
future release.
|
||||
* New options: empty-server, empty-contact, empty-zones-enable and
|
||||
disable-empty-zone.
|
||||
* dig now has a '-q queryname' and '+showsearch' options.
|
||||
* host/nslookup now continue (default)/fail on SERVFAIL.
|
||||
* dig now warns if 'RA' is not set in the answer when 'RD' was set in
|
||||
the query. host/nslookup skip servers that fail to set 'RA' when 'RD'
|
||||
is set unless a server is explicitly set.
|
||||
* Integrate contributed DLZ code into named.
|
||||
* Integrate contributed IDN code from JPNIC.
|
||||
* libbind: corresponds to that from BIND 8.4.7.
|
||||
|
||||
BIND 9.3.0
|
||||
|
||||
* DNSSEC is now DS based (RFC 3658).
|
||||
* DNSSEC lookaside validation.
|
||||
* check-names is now implemented.
|
||||
* rrset-order is more complete.
|
||||
* IPv4/IPv6 transition support, dual-stack-servers.
|
||||
* IXFR deltas can now be generated when loading master files,
|
||||
ixfr-from-differences.
|
||||
* It is now possible to specify the size of a journal, max-journal-size.
|
||||
* It is now possible to define a named set of master servers to be used
|
||||
in masters clause, masters.
|
||||
* The advertised EDNS UDP size can now be set, edns-udp-size.
|
||||
* allow-v6-synthesis has been obsoleted.
|
||||
* Zones containing MD and MF will now be rejected.
|
||||
* dig, nslookup name. now report "Not Implemented" as NOTIMP rather than
|
||||
NOTIMPL. This will have impact on scripts that are looking for
|
||||
NOTIMPL.
|
||||
* libbind: corresponds to that from BIND 8.4.5.
|
||||
|
||||
BIND 9.2.0
|
||||
|
||||
* The size of the cache can now be limited using the "max-cache-size"
|
||||
option.
|
||||
* The server can now automatically convert RFC1886-style recursive
|
||||
lookup requests into RFC2874-style lookups, when enabled using the new
|
||||
option "allow-v6-synthesis". This allows stub resolvers that support
|
||||
AAAA records but not A6 record chains or binary labels to perform
|
||||
lookups in domains that make use of these IPv6 DNS features.
|
||||
* Performance has been improved.
|
||||
* The man pages now use the more portable "man" macros rather than the
|
||||
"mandoc" macros, and are installed by "make install".
|
||||
* The named.conf parser has been completely rewritten. It now supports
|
||||
"include" directives in more places such as inside "view" statements,
|
||||
and it no longer has any reserved words.
|
||||
* The "rndc status" command is now implemented.
|
||||
* rndc can now be configured automatically.
|
||||
* A BIND 8 compatible stub resolver library is now included in lib/bind.
|
||||
* OpenSSL has been removed from the distribution. This means that to use
|
||||
DNSSEC, OpenSSL must be installed and the --with-openssl option must
|
||||
be supplied to configure. This does not apply to the use of TSIG,
|
||||
which does not require OpenSSL.
|
||||
* The source distribution now builds on Windows. See win32utils/
|
||||
readme1.txt and win32utils/win32-build.txt for details.
|
||||
* This distribution also includes a new lightweight stub resolver
|
||||
library and associated resolver daemon that fully support forward and
|
||||
reverse lookups of both IPv4 and IPv6 addresses. This library is
|
||||
considered experimental and is not a complete replacement for the BIND
|
||||
8 resolver library. Applications that use the BIND 8 res_* functions
|
||||
to perform DNS lookups or dynamic updates still need to be linked
|
||||
against the BIND 8 libraries. For DNS lookups, they can also use the
|
||||
new "getrrsetbyname()" API.
|
||||
* BIND 9.2 is capable of acting as an authoritative server for DNSSEC
|
||||
secured zones. This functionality is believed to be stable and
|
||||
complete except for lacking support for verifications involving
|
||||
wildcard records in secure zones.
|
||||
* When acting as a caching server, BIND 9.2 can be configured to perform
|
||||
DNSSEC secure resolution on behalf of its clients. This part of the
|
||||
DNSSEC implementation is still considered experimental. For detailed
|
||||
information about the state of the DNSSEC implementation, see the file
|
||||
doc/misc/dnssec.
|
11
Makefile.am
Normal file
11
Makefile.am
Normal file
@ -0,0 +1,11 @@
|
||||
include $(top_srcdir)/Makefile.top
|
||||
|
||||
SUBDIRS = . libltdl lib bin # doc
|
||||
|
||||
BUILT_SOURCES = bind.keys.h
|
||||
CLEANFILES = bind.keys.h
|
||||
|
||||
bind.keys.h: bind.keys Makefile
|
||||
${PERL} ${top_srcdir}/util/bindkeys.pl < ${top_srcdir}/bind.keys > $@
|
||||
|
||||
dist_sysconf_DATA = bind.keys
|
10
Makefile.tests
Normal file
10
Makefile.tests
Normal file
@ -0,0 +1,10 @@
|
||||
# Hey Emacs, this is -*- makefile-automake -*- file!
|
||||
# vim: filetype=automake
|
||||
|
||||
AM_CPPFLAGS += \
|
||||
$(CMOCKA_CFLAGS) \
|
||||
-DTESTS=\"$(abs_srcdir)\" \
|
||||
-DNAMED_PLUGINDIR=\"$(libdir)/named\"
|
||||
|
||||
LDADD = \
|
||||
$(CMOCKA_LIBS)
|
79
Makefile.top
Normal file
79
Makefile.top
Normal file
@ -0,0 +1,79 @@
|
||||
# Hey Emacs, this is -*- makefile-automake -*- file!
|
||||
# vim: filetype=automake
|
||||
|
||||
ACLOCAL_AMFLAGS = -I $(top_srcdir)/m4
|
||||
|
||||
AM_CFLAGS = \
|
||||
$(STD_CFLAGS)
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
$(STD_CPPFLAGS) \
|
||||
-include $(top_builddir)/config.h \
|
||||
-I$(srcdir)/include
|
||||
|
||||
if HAVE_GSSAPI
|
||||
AM_CPPFLAGS += \
|
||||
$(GSSAPI_CFLAGS)
|
||||
endif
|
||||
|
||||
LIBISC_CFLAGS = \
|
||||
-I$(top_srcdir)/include \
|
||||
-I$(top_srcdir)/lib/isc/unix/include \
|
||||
-I$(top_srcdir)/lib/isc/pthreads/include \
|
||||
-I$(top_srcdir)/lib/isc/include \
|
||||
-I$(top_builddir)/lib/isc/include
|
||||
|
||||
if HAVE_JSON_C
|
||||
LIBISC_CFLAGS += \
|
||||
$(JSON_C_CFLAGS)
|
||||
endif HAVE_JSON_C
|
||||
|
||||
if HAVE_LIBXML2
|
||||
LIBISC_CFLAGS += \
|
||||
$(LIBXML2_CFLAGS)
|
||||
endif HAVE_LIBXML2
|
||||
|
||||
LIBISC_LIBS = $(top_builddir)/lib/isc/libisc.la
|
||||
|
||||
LIBDNS_CFLAGS = \
|
||||
-I$(top_srcdir)/lib/dns/include \
|
||||
-I$(top_builddir)/lib/dns/include
|
||||
|
||||
LIBDNS_LIBS = \
|
||||
$(top_builddir)/lib/dns/libdns.la
|
||||
|
||||
LIBNS_CFLAGS = \
|
||||
-I$(top_srcdir)/lib/ns/include
|
||||
|
||||
LIBNS_LIBS = \
|
||||
$(top_builddir)/lib/ns/libns.la
|
||||
|
||||
LIBIRS_CFLAGS = \
|
||||
-I$(top_srcdir)/lib/irs/include
|
||||
|
||||
LIBIRS_LIBS = \
|
||||
$(top_builddir)/lib/irs/libirs.la
|
||||
|
||||
LIBISCCFG_CFLAGS = \
|
||||
-I$(top_srcdir)/lib/isccfg/include
|
||||
|
||||
LIBISCCFG_LIBS = \
|
||||
$(top_builddir)/lib/isccfg/libisccfg.la
|
||||
|
||||
LIBISCCC_CFLAGS = \
|
||||
-I$(top_srcdir)/lib/isccc/include/
|
||||
|
||||
LIBISCCC_LIBS = \
|
||||
$(top_builddir)/lib/isccc/libisccc.la
|
||||
|
||||
LIBBIND9_CFLAGS = \
|
||||
-I$(top_srcdir)/lib/bind9/include
|
||||
|
||||
LIBBIND9_LIBS = \
|
||||
$(top_builddir)/lib/bind9/libbind9.la
|
||||
|
||||
LIBLTDL_CFLAGS = \
|
||||
-I$(top_srcdir)/libltdl
|
||||
|
||||
LIBLTDL_LIBS = \
|
||||
$(top_builddir)/libltdl/libltdlc.la
|
28
OPTIONS
28
OPTIONS
@ -1,28 +0,0 @@
|
||||
OPTIONS
|
||||
|
||||
Setting the STD_CDEFINES environment variable before running configure can
|
||||
be used to enable certain compile-time options that are not explicitly
|
||||
defined in configure.
|
||||
|
||||
Some of these settings are:
|
||||
|
||||
Setting Description
|
||||
Overwrite memory with tag values when allocating
|
||||
-DISC_MEM_DEFAULTFILL=1 or freeing it; this impairs performance but
|
||||
makes debugging of memory problems easier.
|
||||
Don't track memory allocations by file and line
|
||||
-DISC_MEM_TRACKLINES=0 number; this improves performance but makes
|
||||
debugging more difficult.
|
||||
-DISC_FACILITY=LOG_LOCAL0 Change the default syslog facility for named
|
||||
-DNS_CLIENT_DROPPORT=0 Disable dropping queries from particular
|
||||
well-known ports:
|
||||
-DCHECK_SIBLING=0 Don't check sibling glue in named-checkzone
|
||||
-DCHECK_LOCAL=0 Don't check out-of-zone addresses in
|
||||
named-checkzone
|
||||
-DNS_RUN_PID_DIR=0 Create default PID files in ${localstatedir}/run
|
||||
rather than ${localstatedir}/run/named/
|
||||
Disable the use of inline functions to implement
|
||||
-DISC_BUFFER_USEINLINE=0 the isc_buffer API: this reduces performance but
|
||||
may be useful when debugging
|
||||
-DISC_HEAP_CHECK Test heap consistency after every heap
|
||||
operation; used when debugging
|
99
PLATFORMS
99
PLATFORMS
@ -1,99 +0,0 @@
|
||||
PLATFORMS
|
||||
|
||||
Supported platforms
|
||||
|
||||
In general, this version of BIND will build and run on any POSIX-compliant
|
||||
system with a C11-compliant C compiler, BSD-style sockets with
|
||||
RFC-compliant IPv6 support, POSIX-compliant threads, the libuv
|
||||
asynchronous I/O library, and the OpenSSL cryptography library.
|
||||
|
||||
The following C11 features are used in BIND 9:
|
||||
|
||||
* Atomic operations support from the compiler is needed, either in the
|
||||
form of builtin operations, C11 atomics, or the Interlocked family of
|
||||
functions on Windows.
|
||||
|
||||
* Thread Local Storage support from the compiler is needed, either in
|
||||
the form of C11 _Thread_local/thread_local, the __thread GCC
|
||||
extension, or the __declspec(thread) MSVC extension on Windows.
|
||||
|
||||
BIND 9.17 requires a fairly recent version of libuv (at least 1.x). For
|
||||
some of the older systems listed below, you will have to install an
|
||||
updated libuv package from sources such as EPEL, PPA, or other native
|
||||
sources for updated packages. The other option is to build and install
|
||||
libuv from source.
|
||||
|
||||
Certain optional BIND features have additional library dependencies. These
|
||||
include libxml2 and libjson-c for statistics, libmaxminddb for
|
||||
geolocation, libfstrm and libprotobuf-c for DNSTAP, and libidn2 for
|
||||
internationalized domain name conversion.
|
||||
|
||||
ISC regularly tests BIND on many operating systems and architectures, but
|
||||
lacks the resources to test all of them. Consequently, ISC is only able to
|
||||
offer support on a "best effort" basis for some.
|
||||
|
||||
Regularly tested platforms
|
||||
|
||||
As of Mar 2020, BIND 9.17 is fully supported and regularly tested on the
|
||||
following systems:
|
||||
|
||||
* Debian 9, 10
|
||||
* Ubuntu LTS 16.04, 18.04
|
||||
* Fedora 31
|
||||
* Red Hat Enterprise Linux / CentOS 7, 8
|
||||
* FreeBSD 11.3, 12.1
|
||||
* OpenBSD 6.6
|
||||
* Alpine Linux
|
||||
|
||||
The amd64, i386, armhf and arm64 CPU architectures are all fully
|
||||
supported.
|
||||
|
||||
Best effort
|
||||
|
||||
The following are platforms on which BIND is known to build and run. ISC
|
||||
makes every effort to fix bugs on these platforms, but may be unable to do
|
||||
so quickly due to lack of hardware, less familiarity on the part of
|
||||
engineering staff, and other constraints. With the exception of Windows
|
||||
Server 2012 R2, none of these are tested regularly by ISC.
|
||||
|
||||
* Windows Server 2012 R2, 2016 / x64
|
||||
* Windows 10 / x64
|
||||
* macOS 10.12+
|
||||
* Solaris 11
|
||||
* NetBSD
|
||||
* Other Linux distributions still supported by their vendors, such as:
|
||||
+ Ubuntu 19.04+
|
||||
+ Gentoo
|
||||
+ Arch Linux
|
||||
* OpenWRT/LEDE 17.01+
|
||||
* Other CPU architectures (mips, mipsel, sparc, ...)
|
||||
|
||||
Community maintained
|
||||
|
||||
These systems may not all have the required dependencies for building BIND
|
||||
easily available, although it will be possible in many cases to compile
|
||||
those directly from source. The community and interested parties may wish
|
||||
to help with maintenance, and we welcome patch contributions, although we
|
||||
cannot guarantee that we will accept them. All contributions will be
|
||||
assessed against the risk of adverse effect on officially supported
|
||||
platforms.
|
||||
|
||||
* Platforms past or close to their respective EOL dates, such as:
|
||||
+ Ubuntu 14.04, 18.10
|
||||
+ CentOS 6
|
||||
+ Debian Jessie
|
||||
+ FreeBSD 10.x
|
||||
|
||||
Unsupported platforms
|
||||
|
||||
These are platforms on which BIND 9.17 is known not to build or run:
|
||||
|
||||
* Platforms without at least OpenSSL 1.0.2
|
||||
* Windows 10 / x86
|
||||
* Windows Server 2012 and older
|
||||
* Solaris 10 and older
|
||||
* Platforms that don't support IPv6 Advanced Socket API (RFC 3542)
|
||||
* Platforms that don't support atomic operations (via compiler or
|
||||
library)
|
||||
* Linux without NPTL (Native POSIX Thread Library)
|
||||
* Platforms on which libuv cannot be compiled
|
369
README
369
README
@ -1,369 +0,0 @@
|
||||
README
|
||||
|
||||
BIND 9
|
||||
|
||||
Contents
|
||||
|
||||
1. Introduction
|
||||
2. Reporting bugs and getting help
|
||||
3. Contributing to BIND
|
||||
4. BIND 9.17 features
|
||||
5. Building BIND
|
||||
6. macOS
|
||||
7. Dependencies
|
||||
8. Compile-time options
|
||||
9. Automated testing
|
||||
10. Documentation
|
||||
11. Change log
|
||||
12. Acknowledgments
|
||||
|
||||
Introduction
|
||||
|
||||
BIND (Berkeley Internet Name Domain) is a complete, highly portable
|
||||
implementation of the DNS (Domain Name System) protocol.
|
||||
|
||||
The BIND name server, named, is able to serve as an authoritative name
|
||||
server, recursive resolver, DNS forwarder, or all three simultaneously. It
|
||||
implements views for split-horizon DNS, automatic DNSSEC zone signing and
|
||||
key management, catalog zones to facilitate provisioning of zone data
|
||||
throughout a name server constellation, response policy zones (RPZ) to
|
||||
protect clients from malicious data, response rate limiting (RRL) and
|
||||
recursive query limits to reduce distributed denial of service attacks,
|
||||
and many other advanced DNS features. BIND also includes a suite of
|
||||
administrative tools, including the dig and delv DNS lookup tools,
|
||||
nsupdate for dynamic DNS zone updates, rndc for remote name server
|
||||
administration, and more.
|
||||
|
||||
BIND 9 began as a complete re-write of the BIND architecture that was used
|
||||
in versions 4 and 8. Internet Systems Consortium (https://www.isc.org), a
|
||||
501(c)(3) public benefit corporation dedicated to providing software and
|
||||
services in support of the Internet infrastructure, developed BIND 9 and
|
||||
is responsible for its ongoing maintenance and improvement. BIND is open
|
||||
source software licensed under the terms of the Mozilla Public License,
|
||||
version 2.0.
|
||||
|
||||
For a summary of features introduced in past major releases of BIND, see
|
||||
the file HISTORY.
|
||||
|
||||
For a detailed list of changes made throughout the history of BIND 9, see
|
||||
the file CHANGES. See below for details on the CHANGES file format.
|
||||
|
||||
For up-to-date versions and release notes, see https://www.isc.org/
|
||||
download/.
|
||||
|
||||
For information about supported platforms, see PLATFORMS.
|
||||
|
||||
Reporting bugs and getting help
|
||||
|
||||
To report non-security-sensitive bugs or request new features, you may
|
||||
open an Issue in the BIND 9 project on the ISC GitLab server at https://
|
||||
gitlab.isc.org/isc-projects/bind9.
|
||||
|
||||
Please note that, unless you explicitly mark the newly created Issue as
|
||||
"confidential", it will be publicly readable. Please do not include any
|
||||
information in bug reports that you consider to be confidential unless the
|
||||
issue has been marked as such. In particular, if submitting the contents
|
||||
of your configuration file in a non-confidential Issue, it is advisable to
|
||||
obscure key secrets: this can be done automatically by using
|
||||
named-checkconf -px.
|
||||
|
||||
If the bug you are reporting is a potential security issue, such as an
|
||||
assertion failure or other crash in named, please do NOT use GitLab to
|
||||
report it. Instead, send mail to security-officer@isc.org using our
|
||||
OpenPGP key to secure your message. (Information about OpenPGP and links
|
||||
to our key can be found at https://www.isc.org/pgpkey.) Please do not
|
||||
discuss the bug on any public mailing list.
|
||||
|
||||
For a general overview of ISC security policies, read the Knowledge Base
|
||||
article at https://kb.isc.org/docs/aa-00861.
|
||||
|
||||
Professional support and training for BIND are available from ISC at
|
||||
https://www.isc.org/support.
|
||||
|
||||
To join the BIND Users mailing list, or view the archives, visit https://
|
||||
lists.isc.org/mailman/listinfo/bind-users.
|
||||
|
||||
If you're planning on making changes to the BIND 9 source code, you may
|
||||
also want to join the BIND Workers mailing list, at https://lists.isc.org/
|
||||
mailman/listinfo/bind-workers.
|
||||
|
||||
Contributing to BIND
|
||||
|
||||
ISC maintains a public git repository for BIND; details can be found at
|
||||
http://www.isc.org/git/.
|
||||
|
||||
Information for BIND contributors can be found in the following files: -
|
||||
General information: CONTRIBUTING.md - Code of Conduct: CODE_OF_CONDUCT.md
|
||||
- BIND 9 code style: doc/dev/style.md - BIND architecture and developer
|
||||
guide: doc/dev/dev.md
|
||||
|
||||
Patches for BIND may be submitted as merge requests in the ISC GitLab
|
||||
server at at https://gitlab.isc.org/isc-projects/bind9/merge_requests.
|
||||
|
||||
By default, external contributors don't have ability to fork BIND in the
|
||||
GitLab server, but if you wish to contribute code to BIND, you may request
|
||||
permission to do so. Thereafter, you can create git branches and directly
|
||||
submit requests that they be reviewed and merged.
|
||||
|
||||
If you prefer, you may also submit code by opening a GitLab Issue and
|
||||
including your patch as an attachment, preferably generated by git
|
||||
format-patch.
|
||||
|
||||
BIND 9.17 features
|
||||
|
||||
BIND 9.17 is the newest development branch of BIND 9. It includes a number
|
||||
of changes from BIND 9.16 and earlier releases. New features include:
|
||||
|
||||
* New option "max-ixfr-ratio" to limit the size of outgoing IXFR
|
||||
responses before falling back to full zone transfers.
|
||||
* "rndc nta -d" and "rndc secroots" now include "validate-except"
|
||||
entries when listing negative trust anchors.
|
||||
|
||||
Building BIND
|
||||
|
||||
Minimally, BIND requires a UNIX or Linux system with an ANSI C compiler,
|
||||
basic POSIX support, and a 64-bit integer type. BIND also requires the
|
||||
libuv asynchronous I/O library, and a cryptography provider library such
|
||||
as OpenSSL or a hardware service module supporting PKCS#11. On Linux, BIND
|
||||
requires the libcap library to set process privileges, though this
|
||||
requirement can be overridden by disabling capability support at compile
|
||||
time. See Compile-time options below for details on other libraries that
|
||||
may be required to support optional features.
|
||||
|
||||
Successful builds have been observed on many versions of Linux and UNIX,
|
||||
including RHEL/CentOS, Fedora, Debian, Ubuntu, SLES, openSUSE, Slackware,
|
||||
Alpine, FreeBSD, NetBSD, OpenBSD, macOS, Solaris, OpenIndiana, OmniOS CE,
|
||||
HP-UX, and OpenWRT.
|
||||
|
||||
BIND is also available for Windows Server 2012 R2 and higher. See
|
||||
win32utils/build.txt for details on building for Windows systems.
|
||||
|
||||
To build on a UNIX or Linux system, use:
|
||||
|
||||
$ ./configure
|
||||
$ make
|
||||
|
||||
If you're planning on making changes to the BIND 9 source, you should run
|
||||
make depend. If you're using Emacs, you might find make tags helpful.
|
||||
|
||||
Several environment variables that can be set before running configure
|
||||
will affect compilation. Significant ones are:
|
||||
|
||||
Variable Description
|
||||
CC The C compiler to use. configure tries to figure out the
|
||||
right one for supported systems.
|
||||
C compiler flags. Defaults to include -g and/or -O2 as
|
||||
CFLAGS supported by the compiler. Please include '-g' if you need
|
||||
to set CFLAGS.
|
||||
System header file directories. Can be used to specify
|
||||
STD_CINCLUDES where add-on thread or IPv6 support is, for example.
|
||||
Defaults to empty string.
|
||||
Any additional preprocessor symbols you want defined.
|
||||
STD_CDEFINES Defaults to empty string. For a list of possible settings,
|
||||
see the file OPTIONS.
|
||||
LDFLAGS Linker flags. Defaults to empty string.
|
||||
BUILD_CC Needed when cross-compiling: the native C compiler to use
|
||||
when building for the target system.
|
||||
BUILD_CFLAGS CFLAGS for the target system during cross-compiling.
|
||||
BUILD_CPPFLAGS CPPFLAGS for the target system during cross-compiling.
|
||||
BUILD_LDFLAGS LDFLAGS for the target system during cross-compiling.
|
||||
BUILD_LIBS LIBS for the target system during cross-compiling.
|
||||
|
||||
Additional environment variables affecting the build are listed at the end
|
||||
of the configure help text, which can be obtained by running the command:
|
||||
|
||||
$ ./configure --help
|
||||
|
||||
macOS
|
||||
|
||||
Building on macOS assumes that the "Command Tools for Xcode" is installed.
|
||||
This can be downloaded from https://developer.apple.com/download/more/ or,
|
||||
if you have Xcode already installed, you can run xcode-select --install.
|
||||
(Note that an Apple ID may be required to access the download page.)
|
||||
|
||||
Compile-time options
|
||||
|
||||
To see a full list of configuration options, run configure --help.
|
||||
|
||||
To build shared libraries, specify --with-libtool on the configure command
|
||||
line.
|
||||
|
||||
For the server to support DNSSEC, you need to build it with crypto
|
||||
support. To use OpenSSL, you should have OpenSSL 1.0.2e or newer
|
||||
installed. If the OpenSSL library is installed in a nonstandard location,
|
||||
specify the prefix using --with-openssl=<PREFIX> on the configure command
|
||||
line. To use a PKCS#11 hardware service module for cryptographic
|
||||
operations, specify the path to the PKCS#11 provider library using
|
||||
--with-pkcs11=<PREFIX>, and configure BIND with --enable-native-pkcs11.
|
||||
|
||||
To support the HTTP statistics channel, the server must be linked with at
|
||||
least one of the following libraries: libxml2 http://xmlsoft.org or json-c
|
||||
https://github.com/json-c/json-c. If these are installed at a nonstandard
|
||||
location, then:
|
||||
|
||||
* for libxml2, specify the prefix using --with-libxml2=/prefix,
|
||||
* for json-c, adjust PKG_CONFIG_PATH.
|
||||
|
||||
To support compression on the HTTP statistics channel, the server must be
|
||||
linked against libzlib. If this is installed in a nonstandard location,
|
||||
specify the prefix using --with-zlib=/prefix.
|
||||
|
||||
To support storing configuration data for runtime-added zones in an LMDB
|
||||
database, the server must be linked with liblmdb. If this is installed in
|
||||
a nonstandard location, specify the prefix using with-lmdb=/prefix.
|
||||
|
||||
To support MaxMind GeoIP2 location-based ACLs, the server must be linked
|
||||
with libmaxminddb. This is turned on by default if the library is found;
|
||||
if the library is installed in a nonstandard location, specify the prefix
|
||||
using --with-maxminddb=/prefix. GeoIP2 support can be switched off with
|
||||
--disable-geoip.
|
||||
|
||||
For DNSTAP packet logging, you must have installed libfstrm https://
|
||||
github.com/farsightsec/fstrm and libprotobuf-c https://
|
||||
developers.google.com/protocol-buffers, and BIND must be configured with
|
||||
--enable-dnstap.
|
||||
|
||||
Certain compiled-in constants and default settings can be decreased to
|
||||
values better suited to small machines, e.g. OpenWRT boxes, by specifying
|
||||
--with-tuning=small on the configure command line. This will decrease
|
||||
memory usage by using smaller structures, but will degrade performance.
|
||||
|
||||
On Linux, process capabilities are managed in user space using the libcap
|
||||
library, which can be installed on most Linux systems via the libcap-dev
|
||||
or libcap-devel package. Process capability support can also be disabled
|
||||
by configuring with --disable-linux-caps.
|
||||
|
||||
On some platforms it is necessary to explicitly request large file support
|
||||
to handle files bigger than 2GB. This can be done by using
|
||||
--enable-largefile on the configure command line.
|
||||
|
||||
Support for the "fixed" rrset-order option can be enabled or disabled by
|
||||
specifying --enable-fixed-rrset or --disable-fixed-rrset on the configure
|
||||
command line. By default, fixed rrset-order is disabled to reduce memory
|
||||
footprint.
|
||||
|
||||
The --enable-querytrace option causes named to log every step of
|
||||
processing every query. This should only be enabled when debugging,
|
||||
because it has a significant negative impact on query performance.
|
||||
|
||||
make install will install named and the various BIND 9 libraries. By
|
||||
default, installation is into /usr/local, but this can be changed with the
|
||||
--prefix option when running configure.
|
||||
|
||||
You may specify the option --sysconfdir to set the directory where
|
||||
configuration files like named.conf go by default, and --localstatedir to
|
||||
set the default parent directory of run/named.pid. --sysconfdir defaults
|
||||
to $prefix/etc and --localstatedir defaults to $prefix/var.
|
||||
|
||||
Automated testing
|
||||
|
||||
A system test suite can be run with make test. The system tests require
|
||||
you to configure a set of virtual IP addresses on your system (this allows
|
||||
multiple servers to run locally and communicate with one another). These
|
||||
IP addresses can be configured by running the command bin/tests/system/
|
||||
ifconfig.sh up as root.
|
||||
|
||||
Some tests require Perl and the Net::DNS and/or IO::Socket::INET6 modules,
|
||||
and will be skipped if these are not available. Some tests require Python
|
||||
and the dnspython module and will be skipped if these are not available.
|
||||
See bin/tests/system/README for further details.
|
||||
|
||||
Unit tests are implemented using the CMocka unit testing framework. To
|
||||
build them, use configure --with-cmocka. Execution of tests is done by the
|
||||
Kyua test execution engine; if the kyua command is available, then unit
|
||||
tests can be run via make test or make unit.
|
||||
|
||||
Documentation
|
||||
|
||||
The BIND 9 Administrator Reference Manual is included with the source
|
||||
distribution, in DocBook XML, HTML, and PDF format, in the doc/arm
|
||||
directory.
|
||||
|
||||
Some of the programs in the BIND 9 distribution have man pages in their
|
||||
directories. In particular, the command line options of named are
|
||||
documented in bin/named/named.8.
|
||||
|
||||
Frequently (and not-so-frequently) asked questions and their answers can
|
||||
be found in the ISC Knowledge Base at https://kb.isc.org.
|
||||
|
||||
Additional information on various subjects can be found in other README
|
||||
files throughout the source tree.
|
||||
|
||||
Change log
|
||||
|
||||
A detailed list of all changes that have been made throughout the
|
||||
development BIND 9 is included in the file CHANGES, with the most recent
|
||||
changes listed first. Change notes include tags indicating the category of
|
||||
the change that was made; these categories are:
|
||||
|
||||
Category Description
|
||||
[func] New feature
|
||||
[bug] General bug fix
|
||||
[security] Fix for a significant security flaw
|
||||
[experimental] Used for new features when the syntax or other aspects of
|
||||
the design are still in flux and may change
|
||||
[port] Portability enhancement
|
||||
[maint] Updates to built-in data such as root server addresses and
|
||||
keys
|
||||
[tuning] Changes to built-in configuration defaults and constants to
|
||||
improve performance
|
||||
[performance] Other changes to improve server performance
|
||||
[protocol] Updates to the DNS protocol such as new RR types
|
||||
[test] Changes to the automatic tests, not affecting server
|
||||
functionality
|
||||
[cleanup] Minor corrections and refactoring
|
||||
[doc] Documentation
|
||||
[contrib] Changes to the contributed tools and libraries in the
|
||||
'contrib' subdirectory
|
||||
Used in the master development branch to reserve change
|
||||
[placeholder] numbers for use in other branches, e.g. when fixing a bug
|
||||
that only exists in older releases
|
||||
|
||||
In general, [func] and [experimental] tags will only appear in new-feature
|
||||
releases (i.e., those with version numbers ending in zero). Some new
|
||||
functionality may be backported to older releases on a case-by-case basis.
|
||||
All other change types may be applied to all currently-supported releases.
|
||||
|
||||
Bug report identifiers
|
||||
|
||||
Most notes in the CHANGES file include a reference to a bug report or
|
||||
issue number. Prior to 2018, these were usually of the form [RT #NNN] and
|
||||
referred to entries in the "bind9-bugs" RT database, which was not open to
|
||||
the public. More recent entries use the form [GL #NNN] or, less often, [GL
|
||||
!NNN], which, respectively, refer to issues or merge requests in the
|
||||
GitLab database. Most of these are publicly readable, unless they include
|
||||
information which is confidential or security sensitive.
|
||||
|
||||
To look up a GitLab issue by its number, use the URL https://
|
||||
gitlab.isc.org/isc-projects/bind9/issues/NNN. To look up a merge request,
|
||||
use https://gitlab.isc.org/isc-projects/bind9/merge_requests/NNN.
|
||||
|
||||
In rare cases, an issue or merge request number may be followed with the
|
||||
letter "P". This indicates that the information is in the private ISC
|
||||
GitLab instance, which is not visible to the public.
|
||||
|
||||
Acknowledgments
|
||||
|
||||
* The original development of BIND 9 was underwritten by the following
|
||||
organizations:
|
||||
|
||||
Sun Microsystems, Inc.
|
||||
Hewlett Packard
|
||||
Compaq Computer Corporation
|
||||
IBM
|
||||
Process Software Corporation
|
||||
Silicon Graphics, Inc.
|
||||
Network Associates, Inc.
|
||||
U.S. Defense Information Systems Agency
|
||||
USENIX Association
|
||||
Stichting NLnet - NLnet Foundation
|
||||
Nominum, Inc.
|
||||
|
||||
* This product includes software developed by the OpenSSL Project for
|
||||
use in the OpenSSL Toolkit. http://www.OpenSSL.org/
|
||||
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
(eay@cryptsoft.com)
|
||||
|
||||
* This product includes software written by Tim Hudson
|
||||
(tjh@cryptsoft.com)
|
17
README.md
17
README.md
@ -171,14 +171,7 @@ affect compilation. Significant ones are:
|
||||
|--------------------|-----------------------------------------------|
|
||||
|`CC`|The C compiler to use. `configure` tries to figure out the right one for supported systems.|
|
||||
|`CFLAGS`|C compiler flags. Defaults to include -g and/or -O2 as supported by the compiler. Please include '-g' if you need to set `CFLAGS`. |
|
||||
|`STD_CINCLUDES`|System header file directories. Can be used to specify where add-on thread or IPv6 support is, for example. Defaults to empty string.|
|
||||
|`STD_CDEFINES`|Any additional preprocessor symbols you want defined. Defaults to empty string. For a list of possible settings, see the file [OPTIONS](OPTIONS.md).|
|
||||
|`LDFLAGS`|Linker flags. Defaults to empty string.|
|
||||
|`BUILD_CC`|Needed when cross-compiling: the native C compiler to use when building for the target system.|
|
||||
|`BUILD_CFLAGS`|`CFLAGS` for the target system during cross-compiling.|
|
||||
|`BUILD_CPPFLAGS`|`CPPFLAGS` for the target system during cross-compiling.|
|
||||
|`BUILD_LDFLAGS`|`LDFLAGS` for the target system during cross-compiling.|
|
||||
|`BUILD_LIBS`|`LIBS` for the target system during cross-compiling.|
|
||||
|
||||
Additional environment variables affecting the build are listed at the
|
||||
end of the `configure` help text, which can be obtained by running the
|
||||
@ -273,7 +266,7 @@ defaults to `$prefix/etc` and `--localstatedir` defaults to `$prefix/var`.
|
||||
|
||||
### <a name="testing"/> Automated testing
|
||||
|
||||
A system test suite can be run with `make test`. The system tests require
|
||||
A system test suite can be run with `make check`. The system tests require
|
||||
you to configure a set of virtual IP addresses on your system (this allows
|
||||
multiple servers to run locally and communicate with one another). These
|
||||
IP addresses can be configured by running the command
|
||||
@ -284,11 +277,9 @@ and will be skipped if these are not available. Some tests require Python
|
||||
and the `dnspython` module and will be skipped if these are not available.
|
||||
See bin/tests/system/README for further details.
|
||||
|
||||
Unit tests are implemented using the [CMocka unit testing framework](https://cmocka.org/).
|
||||
To build them, use `configure --with-cmocka`. Execution of tests is done
|
||||
by the [Kyua test execution engine](https://github.com/jmmv/kyua); if the
|
||||
`kyua` command is available, then unit tests can be run via `make test`
|
||||
or `make unit`.
|
||||
Unit tests are implemented using the CMocka unit testing framework. To build
|
||||
them, use `configure --with-cmocka`. Execution of tests is done by the automake
|
||||
parallel test driver; unit tests are also run by `make check`.
|
||||
|
||||
### <a name="doc"/> Documentation
|
||||
|
||||
|
5
bin/Makefile.am
Normal file
5
bin/Makefile.am
Normal file
@ -0,0 +1,5 @@
|
||||
SUBDIRS = named rndc dig delv dnssec tools nsupdate check confgen tests plugins
|
||||
|
||||
if HAVE_PKCS11
|
||||
SUBDIRS += pkcs11
|
||||
endif
|
34
bin/check/Makefile.am
Normal file
34
bin/check/Makefile.am
Normal file
@ -0,0 +1,34 @@
|
||||
include $(top_srcdir)/Makefile.top
|
||||
|
||||
AM_CPPFLAGS += \
|
||||
$(LIBISC_CFLAGS) \
|
||||
$(LIBDNS_CFLAGS) \
|
||||
$(LIBNS_CFLAGS) \
|
||||
$(LIBISCCFG_CFLAGS) \
|
||||
$(LIBBIND9_CFLAGS)
|
||||
|
||||
AM_CPPFLAGS += \
|
||||
-DNAMED_CONFFILE=\"${sysconfdir}/named.conf\"
|
||||
|
||||
noinst_LTLIBRARIES = libcheck-tool.la
|
||||
|
||||
libcheck_tool_la_SOURCES = \
|
||||
check-tool.h \
|
||||
check-tool.c
|
||||
|
||||
LDADD = \
|
||||
libcheck-tool.la \
|
||||
$(LIBISC_LIBS) \
|
||||
$(LIBDNS_LIBS) \
|
||||
$(LIBNS_LIBS) \
|
||||
$(LIBISCCFG_LIBS) \
|
||||
$(LIBBIND9_LIBS)
|
||||
|
||||
sbin_PROGRAMS = named-checkconf named-checkzone
|
||||
|
||||
install-exec-hook:
|
||||
ln -f $(DESTDIR)$(sbindir)/named-checkzone \
|
||||
$(DESTDIR)$(sbindir)/named-compilezone
|
||||
|
||||
uninstall-hook:
|
||||
-rm -f $(DESTDIR)$(sbindir)/named-compilezone
|
@ -16,6 +16,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <isc/attributes.h>
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/dir.h>
|
||||
#include <isc/hash.h>
|
||||
@ -56,8 +57,8 @@ isc_log_t *logc = NULL;
|
||||
} while (0)
|
||||
|
||||
/*% usage */
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_NORETURN static void
|
||||
usage(void);
|
||||
|
||||
static void
|
||||
usage(void) {
|
||||
@ -655,7 +656,7 @@ main(int argc, char **argv) {
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
printf(VERSION "\n");
|
||||
printf("%s\n", PACKAGE_VERSION);
|
||||
exit(0);
|
||||
|
||||
case 'x':
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <isc/app.h>
|
||||
#include <isc/attributes.h>
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/dir.h>
|
||||
#include <isc/file.h>
|
||||
@ -63,8 +64,8 @@ static enum { progmode_check, progmode_compile } progmode;
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_NORETURN static void
|
||||
usage(void);
|
||||
|
||||
static void
|
||||
usage(void) {
|
||||
@ -354,7 +355,7 @@ main(int argc, char **argv) {
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
printf(VERSION "\n");
|
||||
printf("%s\n", PACKAGE_VERSION);
|
||||
exit(0);
|
||||
|
||||
case 'w':
|
||||
|
30
bin/confgen/Makefile.am
Normal file
30
bin/confgen/Makefile.am
Normal file
@ -0,0 +1,30 @@
|
||||
include $(top_srcdir)/Makefile.top
|
||||
|
||||
AM_CPPFLAGS += \
|
||||
$(LIBISC_CFLAGS) \
|
||||
$(LIBDNS_CFLAGS) \
|
||||
-DRNDC_KEYFILE=\"${sysconfdir}/rndc.key\"
|
||||
|
||||
LDADD = \
|
||||
libconfgen.la \
|
||||
$(LIBISC_LIBS) \
|
||||
$(LIBDNS_LIBS)
|
||||
|
||||
noinst_LTLIBRARIES = libconfgen.la
|
||||
|
||||
libconfgen_la_SOURCES = \
|
||||
include/confgen/os.h \
|
||||
keygen.h \
|
||||
keygen.c \
|
||||
util.h \
|
||||
util.c \
|
||||
unix/os.c
|
||||
|
||||
sbin_PROGRAMS = rndc-confgen ddns-confgen
|
||||
|
||||
install-exec-hook:
|
||||
ln -f $(DESTDIR)$(sbindir)/ddns-confgen \
|
||||
$(DESTDIR)$(sbindir)/tsig-confgen
|
||||
|
||||
uninstall-hook:
|
||||
-rm -f $(DESTDIR)$(sbindir)/tsig-confgen
|
@ -22,6 +22,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <isc/assertions.h>
|
||||
#include <isc/attributes.h>
|
||||
#include <isc/base64.h>
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/commandline.h>
|
||||
@ -57,8 +58,8 @@ const char *progname;
|
||||
static enum { progmode_keygen, progmode_confgen } progmode;
|
||||
bool verbose = false; /* needed by util.c but not used here */
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
usage(int status) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_NORETURN static void
|
||||
usage(int status);
|
||||
|
||||
static void
|
||||
usage(int status) {
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <isc/assertions.h>
|
||||
#include <isc/attributes.h>
|
||||
#include <isc/base64.h>
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/commandline.h>
|
||||
@ -60,8 +61,8 @@ bool verbose = false;
|
||||
|
||||
const char *keyfile, *keydef;
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
usage(int status) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_NORETURN static void
|
||||
usage(int status);
|
||||
|
||||
static void
|
||||
usage(int status) {
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include <isc/attributes.h>
|
||||
#include <isc/formatcheck.h>
|
||||
#include <isc/lang.h>
|
||||
#include <isc/platform.h>
|
||||
@ -35,9 +36,8 @@ ISC_LANG_BEGINDECLS
|
||||
void
|
||||
notify(const char *fmt, ...) ISC_FORMAT_PRINTF(1, 2);
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE void
|
||||
fatal(const char *format, ...)
|
||||
ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_NORETURN void
|
||||
fatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
|
||||
|
||||
ISC_LANG_ENDDECLS
|
||||
|
||||
|
21
bin/delv/Makefile.am
Normal file
21
bin/delv/Makefile.am
Normal file
@ -0,0 +1,21 @@
|
||||
include $(top_srcdir)/Makefile.top
|
||||
|
||||
AM_CPPFLAGS += \
|
||||
-I$(top_builddir)/include \
|
||||
$(LIBISC_CFLAGS) \
|
||||
$(LIBDNS_CFLAGS) \
|
||||
$(LIBISCCFG_CFLAGS) \
|
||||
$(LIBIRS_CFLAGS)
|
||||
|
||||
AM_CPPFLAGS += \
|
||||
-DSYSCONFDIR=\"${sysconfdir}\"
|
||||
|
||||
bin_PROGRAMS = delv
|
||||
|
||||
delv_SOURCES = \
|
||||
delv.c
|
||||
delv_LDADD = \
|
||||
$(LIBISC_LIBS) \
|
||||
$(LIBDNS_LIBS) \
|
||||
$(LIBISCCFG_LIBS) \
|
||||
$(LIBIRS_LIBS)
|
@ -28,6 +28,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include <isc/app.h>
|
||||
#include <isc/attributes.h>
|
||||
#include <isc/base64.h>
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/hex.h>
|
||||
@ -205,9 +206,8 @@ usage(void) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
fatal(const char *format, ...)
|
||||
ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_NORETURN static void
|
||||
fatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
|
||||
|
||||
static void
|
||||
fatal(const char *format, ...) {
|
||||
@ -1327,7 +1327,7 @@ dash_option(char *option, char *next, bool *open_type_class) {
|
||||
/* handled in preparse_args() */
|
||||
break;
|
||||
case 'v':
|
||||
fputs("delv " VERSION "\n", stderr);
|
||||
fprintf(stderr, "delv %s\n", PACKAGE_VERSION);
|
||||
exit(0);
|
||||
/* NOTREACHED */
|
||||
default:
|
||||
|
30
bin/dig/Makefile.am
Normal file
30
bin/dig/Makefile.am
Normal file
@ -0,0 +1,30 @@
|
||||
include $(top_srcdir)/Makefile.top
|
||||
|
||||
AM_CPPFLAGS += \
|
||||
$(LIBISC_CFLAGS) \
|
||||
$(LIBDNS_CFLAGS) \
|
||||
$(LIBISCCFG_CFLAGS) \
|
||||
$(LIBIRS_CFLAGS) \
|
||||
$(LIBBIND9_CFLAGS) \
|
||||
$(LIBIDN2_CFLAGS)
|
||||
|
||||
LDADD = \
|
||||
libdighost.la \
|
||||
$(LIBISC_LIBS) \
|
||||
$(LIBDNS_LIBS) \
|
||||
$(LIBISCCFG_LIBS) \
|
||||
$(LIBIRS_LIBS) \
|
||||
$(LIBBIND9_LIBS) \
|
||||
$(LIBIDN2_LIBS)
|
||||
|
||||
noinst_LTLIBRARIES = libdighost.la
|
||||
|
||||
libdighost_la_SOURCES = \
|
||||
dighost.h \
|
||||
dighost.c
|
||||
|
||||
bin_PROGRAMS = dig host nslookup
|
||||
|
||||
nslookup_LDADD = \
|
||||
$(LDADD) \
|
||||
$(READLINE_LIB)
|
@ -18,6 +18,7 @@
|
||||
#include <time.h>
|
||||
|
||||
#include <isc/app.h>
|
||||
#include <isc/attributes.h>
|
||||
#include <isc/netaddr.h>
|
||||
#include <isc/parseint.h>
|
||||
#include <isc/platform.h>
|
||||
@ -41,7 +42,7 @@
|
||||
#include <dns/result.h>
|
||||
#include <dns/tsig.h>
|
||||
|
||||
#include <dig/dig.h>
|
||||
#include "dighost.h"
|
||||
|
||||
#define ADD_STRING(b, s) \
|
||||
{ \
|
||||
@ -109,8 +110,8 @@ usage(void) {
|
||||
fprintf(stderr, "Press <Help> for complete list of options\n");
|
||||
}
|
||||
#else /* if TARGET_OS_IPHONE */
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_NORETURN static void
|
||||
usage(void);
|
||||
|
||||
static void
|
||||
usage(void) {
|
||||
@ -125,7 +126,7 @@ usage(void) {
|
||||
/*% version */
|
||||
static void
|
||||
version(void) {
|
||||
fputs("DiG " VERSION "\n", stderr);
|
||||
fprintf(stderr, "DiG %s\n", PACKAGE_VERSION);
|
||||
}
|
||||
|
||||
/*% help */
|
||||
@ -912,7 +913,8 @@ printgreeting(int argc, char **argv, dig_lookup_t *lookup) {
|
||||
|
||||
if (printcmd) {
|
||||
snprintf(lookup->cmdline, sizeof(lookup->cmdline),
|
||||
"%s; <<>> DiG " VERSION " <<>>", first ? "\n" : "");
|
||||
"%s; <<>> DiG %s <<>>", first ? "\n" : "",
|
||||
PACKAGE_VERSION);
|
||||
i = 1;
|
||||
while (i < argc) {
|
||||
snprintf(append, sizeof(append), " %s", argv[i++]);
|
||||
@ -2658,7 +2660,7 @@ dig_query_setup(bool is_batchfile, bool config_only, int argc, char **argv) {
|
||||
}
|
||||
|
||||
void
|
||||
dig_startup() {
|
||||
dig_startup(void) {
|
||||
isc_result_t result;
|
||||
|
||||
debug("dig_startup()");
|
||||
@ -2669,12 +2671,12 @@ dig_startup() {
|
||||
}
|
||||
|
||||
void
|
||||
dig_query_start() {
|
||||
dig_query_start(void) {
|
||||
start_lookup();
|
||||
}
|
||||
|
||||
void
|
||||
dig_shutdown() {
|
||||
dig_shutdown(void) {
|
||||
destroy_lookup(default_lookup);
|
||||
if (atomic_load(&batchname) != 0) {
|
||||
if (batchfp != stdin) {
|
||||
|
@ -84,7 +84,7 @@
|
||||
|
||||
#include <bind9/getaddresses.h>
|
||||
|
||||
#include <dig/dig.h>
|
||||
#include "dighost.h"
|
||||
|
||||
#if USE_PKCS11
|
||||
#include <pk11/result.h>
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <isc/attributes.h>
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/bufferlist.h>
|
||||
#include <isc/formatcheck.h>
|
||||
@ -77,7 +78,7 @@
|
||||
ISC_LANG_BEGINDECLS
|
||||
|
||||
typedef struct dig_lookup dig_lookup_t;
|
||||
typedef struct dig_query dig_query_t;
|
||||
typedef struct dig_query dig_query_t;
|
||||
typedef struct dig_server dig_server_t;
|
||||
typedef ISC_LIST(dig_server_t) dig_serverlist_t;
|
||||
typedef struct dig_searchlist dig_searchlist_t;
|
||||
@ -112,76 +113,76 @@ struct dig_lookup {
|
||||
* sources. */
|
||||
char textname[MXNAME]; /*% Name we're going to be
|
||||
* looking up */
|
||||
char cmdline[MXNAME];
|
||||
dns_rdatatype_t rdtype;
|
||||
dns_rdatatype_t qrdtype;
|
||||
char cmdline[MXNAME];
|
||||
dns_rdatatype_t rdtype;
|
||||
dns_rdatatype_t qrdtype;
|
||||
dns_rdataclass_t rdclass;
|
||||
bool rdtypeset;
|
||||
bool rdclassset;
|
||||
char name_space[BUFSIZE];
|
||||
char oname_space[BUFSIZE];
|
||||
isc_buffer_t namebuf;
|
||||
isc_buffer_t onamebuf;
|
||||
isc_buffer_t renderbuf;
|
||||
char * sendspace;
|
||||
dns_name_t * name;
|
||||
isc_interval_t interval;
|
||||
dns_message_t * sendmsg;
|
||||
dns_name_t * oname;
|
||||
bool rdtypeset;
|
||||
bool rdclassset;
|
||||
char name_space[BUFSIZE];
|
||||
char oname_space[BUFSIZE];
|
||||
isc_buffer_t namebuf;
|
||||
isc_buffer_t onamebuf;
|
||||
isc_buffer_t renderbuf;
|
||||
char *sendspace;
|
||||
dns_name_t *name;
|
||||
isc_interval_t interval;
|
||||
dns_message_t *sendmsg;
|
||||
dns_name_t *oname;
|
||||
ISC_LINK(dig_lookup_t) link;
|
||||
ISC_LIST(dig_query_t) q;
|
||||
ISC_LIST(dig_query_t) connecting;
|
||||
dig_query_t * current_query;
|
||||
dig_serverlist_t my_server_list;
|
||||
dig_query_t *current_query;
|
||||
dig_serverlist_t my_server_list;
|
||||
dig_searchlist_t *origin;
|
||||
dig_query_t * xfr_q;
|
||||
uint32_t retries;
|
||||
int nsfound;
|
||||
uint16_t udpsize;
|
||||
int16_t edns;
|
||||
int16_t padding;
|
||||
uint32_t ixfr_serial;
|
||||
isc_buffer_t rdatabuf;
|
||||
char rdatastore[MXNAME];
|
||||
dst_context_t * tsigctx;
|
||||
isc_buffer_t * querysig;
|
||||
uint32_t msgcounter;
|
||||
dns_fixedname_t fdomain;
|
||||
isc_sockaddr_t * ecs_addr;
|
||||
char * cookie;
|
||||
dns_ednsopt_t * ednsopts;
|
||||
unsigned int ednsoptscnt;
|
||||
isc_dscp_t dscp;
|
||||
unsigned int ednsflags;
|
||||
dns_opcode_t opcode;
|
||||
int rrcomments;
|
||||
unsigned int eoferr;
|
||||
dig_query_t *xfr_q;
|
||||
uint32_t retries;
|
||||
int nsfound;
|
||||
uint16_t udpsize;
|
||||
int16_t edns;
|
||||
int16_t padding;
|
||||
uint32_t ixfr_serial;
|
||||
isc_buffer_t rdatabuf;
|
||||
char rdatastore[MXNAME];
|
||||
dst_context_t *tsigctx;
|
||||
isc_buffer_t *querysig;
|
||||
uint32_t msgcounter;
|
||||
dns_fixedname_t fdomain;
|
||||
isc_sockaddr_t *ecs_addr;
|
||||
char *cookie;
|
||||
dns_ednsopt_t *ednsopts;
|
||||
unsigned int ednsoptscnt;
|
||||
isc_dscp_t dscp;
|
||||
unsigned int ednsflags;
|
||||
dns_opcode_t opcode;
|
||||
int rrcomments;
|
||||
unsigned int eoferr;
|
||||
};
|
||||
|
||||
/*% The dig_query structure */
|
||||
struct dig_query {
|
||||
unsigned int magic;
|
||||
unsigned int magic;
|
||||
dig_lookup_t *lookup;
|
||||
bool waiting_connect, pending_free, waiting_senddone, first_pass,
|
||||
first_soa_rcvd, second_rr_rcvd, first_repeat_rcvd, recv_made,
|
||||
warn_id, timedout;
|
||||
uint32_t first_rr_serial;
|
||||
uint32_t second_rr_serial;
|
||||
uint32_t msg_count;
|
||||
uint32_t rr_count;
|
||||
bool ixfr_axfr;
|
||||
char * servname;
|
||||
char * userarg;
|
||||
isc_buffer_t recvbuf, lengthbuf, tmpsendbuf, sendbuf;
|
||||
char * recvspace, *tmpsendspace, lengthspace[4];
|
||||
uint32_t first_rr_serial;
|
||||
uint32_t second_rr_serial;
|
||||
uint32_t msg_count;
|
||||
uint32_t rr_count;
|
||||
bool ixfr_axfr;
|
||||
char *servname;
|
||||
char *userarg;
|
||||
isc_buffer_t recvbuf, lengthbuf, tmpsendbuf, sendbuf;
|
||||
char *recvspace, *tmpsendspace, lengthspace[4];
|
||||
isc_socket_t *sock;
|
||||
ISC_LINK(dig_query_t) link;
|
||||
ISC_LINK(dig_query_t) clink;
|
||||
isc_sockaddr_t sockaddr;
|
||||
isc_time_t time_sent;
|
||||
isc_time_t time_recv;
|
||||
uint64_t byte_count;
|
||||
isc_timer_t * timer;
|
||||
isc_time_t time_sent;
|
||||
isc_time_t time_recv;
|
||||
uint64_t byte_count;
|
||||
isc_timer_t *timer;
|
||||
};
|
||||
|
||||
struct dig_server {
|
||||
@ -202,38 +203,38 @@ typedef ISC_LIST(dig_lookup_t) dig_lookuplist_t;
|
||||
* Externals from dighost.c
|
||||
*/
|
||||
|
||||
extern dig_lookuplist_t lookup_list;
|
||||
extern dig_serverlist_t server_list;
|
||||
extern dig_lookuplist_t lookup_list;
|
||||
extern dig_serverlist_t server_list;
|
||||
extern dig_searchlistlist_t search_list;
|
||||
extern unsigned int extrabytes;
|
||||
extern unsigned int extrabytes;
|
||||
|
||||
extern bool check_ra, have_ipv4, have_ipv6, specified_source, usesearch,
|
||||
showsearch, yaml;
|
||||
extern in_port_t port;
|
||||
extern unsigned int timeout;
|
||||
extern isc_mem_t * mctx;
|
||||
extern int sendcount;
|
||||
extern int ndots;
|
||||
extern int lookup_counter;
|
||||
extern int exitcode;
|
||||
extern isc_sockaddr_t bind_address;
|
||||
extern char keynametext[MXNAME];
|
||||
extern char keyfile[MXNAME];
|
||||
extern char keysecret[MXNAME];
|
||||
extern in_port_t port;
|
||||
extern unsigned int timeout;
|
||||
extern isc_mem_t *mctx;
|
||||
extern int sendcount;
|
||||
extern int ndots;
|
||||
extern int lookup_counter;
|
||||
extern int exitcode;
|
||||
extern isc_sockaddr_t bind_address;
|
||||
extern char keynametext[MXNAME];
|
||||
extern char keyfile[MXNAME];
|
||||
extern char keysecret[MXNAME];
|
||||
extern const dns_name_t *hmacname;
|
||||
extern unsigned int digestbits;
|
||||
extern dns_tsigkey_t * tsigkey;
|
||||
extern bool validated;
|
||||
extern isc_taskmgr_t * taskmgr;
|
||||
extern isc_task_t * global_task;
|
||||
extern bool free_now;
|
||||
extern bool debugging, debugtiming, memdebugging;
|
||||
extern bool keep_open;
|
||||
extern unsigned int digestbits;
|
||||
extern dns_tsigkey_t *tsigkey;
|
||||
extern bool validated;
|
||||
extern isc_taskmgr_t *taskmgr;
|
||||
extern isc_task_t *global_task;
|
||||
extern bool free_now;
|
||||
extern bool debugging, debugtiming, memdebugging;
|
||||
extern bool keep_open;
|
||||
|
||||
extern char *progname;
|
||||
extern int tries;
|
||||
extern int fatalexit;
|
||||
extern bool verbose;
|
||||
extern int tries;
|
||||
extern int fatalexit;
|
||||
extern bool verbose;
|
||||
|
||||
/*
|
||||
* Routines in dighost.c.
|
||||
@ -247,15 +248,14 @@ getaddresses(dig_lookup_t *lookup, const char *host, isc_result_t *resultp);
|
||||
isc_result_t
|
||||
get_reverse(char *reverse, size_t len, char *value, bool strict);
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE void
|
||||
fatal(const char *format, ...)
|
||||
ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_NORETURN void
|
||||
fatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
|
||||
|
||||
void
|
||||
warn(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE void
|
||||
digexit(void) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_NORETURN void
|
||||
digexit(void);
|
||||
|
||||
void
|
||||
debug(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
|
||||
@ -333,7 +333,7 @@ set_search_domain(char *domain);
|
||||
* Routines to be defined in dig.c, host.c, and nslookup.c. and
|
||||
* then assigned to the appropriate function pointer
|
||||
*/
|
||||
extern isc_result_t (*dighost_printmessage)(dig_query_t * query,
|
||||
extern isc_result_t (*dighost_printmessage)(dig_query_t *query,
|
||||
const isc_buffer_t *msgbuf,
|
||||
dns_message_t *msg, bool headers);
|
||||
|
@ -21,6 +21,7 @@
|
||||
#endif /* ifdef HAVE_LOCALE_H */
|
||||
|
||||
#include <isc/app.h>
|
||||
#include <isc/attributes.h>
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/netaddr.h>
|
||||
#include <isc/print.h>
|
||||
@ -38,7 +39,7 @@
|
||||
#include <dns/rdatastruct.h>
|
||||
#include <dns/rdatatype.h>
|
||||
|
||||
#include <dig/dig.h>
|
||||
#include "dighost.h"
|
||||
|
||||
static bool short_form = true, listed_server = false;
|
||||
static bool default_lookups = true;
|
||||
@ -101,8 +102,8 @@ rcode_totext(dns_rcode_t rcode) {
|
||||
return (totext.deconsttext);
|
||||
}
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
show_usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_NORETURN static void
|
||||
show_usage(void);
|
||||
|
||||
static void
|
||||
show_usage(void) {
|
||||
@ -581,7 +582,7 @@ static const char *optstring = "46aAc:dilnm:p:rst:vVwCDN:R:TUW:";
|
||||
/*% version */
|
||||
static void
|
||||
version(void) {
|
||||
fputs("host " VERSION "\n", stderr);
|
||||
fprintf(stderr, "host %s\n", PACKAGE_VERSION);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include <isc/app.h>
|
||||
#include <isc/attributes.h>
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/event.h>
|
||||
@ -35,7 +36,7 @@
|
||||
#include <dns/rdatastruct.h>
|
||||
#include <dns/rdatatype.h>
|
||||
|
||||
#include <dig/dig.h>
|
||||
#include "dighost.h"
|
||||
|
||||
#if defined(HAVE_READLINE)
|
||||
#if defined(HAVE_EDIT_READLINE_READLINE_H)
|
||||
@ -629,7 +630,7 @@ set_ndots(const char *value) {
|
||||
|
||||
static void
|
||||
version(void) {
|
||||
fputs("nslookup " VERSION "\n", stderr);
|
||||
fprintf(stderr, "nslookup %s\n", PACKAGE_VERSION);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -879,8 +880,8 @@ get_next_command(void) {
|
||||
isc_mem_free(mctx, buf);
|
||||
}
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_NORETURN static void
|
||||
usage(void);
|
||||
|
||||
static void
|
||||
usage(void) {
|
||||
|
38
bin/dnssec/Makefile.am
Normal file
38
bin/dnssec/Makefile.am
Normal file
@ -0,0 +1,38 @@
|
||||
include $(top_srcdir)/Makefile.top
|
||||
|
||||
AM_CPPFLAGS += \
|
||||
$(LIBISC_CFLAGS) \
|
||||
$(LIBDNS_CFLAGS)
|
||||
|
||||
AM_CPPFLAGS += \
|
||||
-DNAMED_CONFFILE=\"${sysconfdir}/named.conf\"
|
||||
|
||||
noinst_LTLIBRARIES = libdnssectool.la
|
||||
|
||||
LDADD = \
|
||||
libdnssectool.la \
|
||||
$(LIBISC_LIBS) \
|
||||
$(LIBDNS_LIBS)
|
||||
|
||||
sbin_PROGRAMS = \
|
||||
dnssec-cds \
|
||||
dnssec-dsfromkey \
|
||||
dnssec-importkey \
|
||||
dnssec-keyfromlabel \
|
||||
dnssec-keygen \
|
||||
dnssec-revoke \
|
||||
dnssec-settime \
|
||||
dnssec-signzone \
|
||||
dnssec-verify
|
||||
|
||||
libdnssectool_la_SOURCES = \
|
||||
dnssectool.h \
|
||||
dnssectool.c
|
||||
|
||||
dnssec_keygen_CPPFLAGS = \
|
||||
$(AM_CPPFLAGS) \
|
||||
$(LIBISCCFG_CFLAGS)
|
||||
|
||||
dnssec_keygen_LDADD = \
|
||||
$(LDADD) \
|
||||
$(LIBISCCFG_LIBS)
|
@ -21,6 +21,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <isc/attributes.h>
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/file.h>
|
||||
@ -1020,8 +1021,8 @@ nsdiff(uint32_t ttl, dns_rdataset_t *oldset, dns_rdataset_t *newset) {
|
||||
}
|
||||
}
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_NORETURN static void
|
||||
usage(void);
|
||||
|
||||
static void
|
||||
usage(void) {
|
||||
@ -1029,7 +1030,7 @@ usage(void) {
|
||||
fprintf(stderr,
|
||||
" %s options [options] -f <file> -d <path> <domain>\n",
|
||||
program);
|
||||
fprintf(stderr, "Version: %s\n", VERSION);
|
||||
fprintf(stderr, "Version: %s\n", PACKAGE_VERSION);
|
||||
fprintf(stderr, "Options:\n"
|
||||
" -a <algorithm> digest algorithm (SHA-1 / "
|
||||
"SHA-256 / SHA-384)\n"
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <isc/attributes.h>
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/hash.h>
|
||||
@ -320,8 +321,8 @@ emits(bool showall, bool cds, dns_rdata_t *rdata) {
|
||||
}
|
||||
}
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_NORETURN static void
|
||||
usage(void);
|
||||
|
||||
static void
|
||||
usage(void) {
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <isc/attributes.h>
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/hash.h>
|
||||
@ -264,15 +265,15 @@ emit(const char *dir, dns_rdata_t *rdata) {
|
||||
dst_key_free(&key);
|
||||
}
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_NORETURN static void
|
||||
usage(void);
|
||||
|
||||
static void
|
||||
usage(void) {
|
||||
fprintf(stderr, "Usage:\n");
|
||||
fprintf(stderr, " %s options [-K dir] keyfile\n\n", program);
|
||||
fprintf(stderr, " %s options -f file [keyname]\n\n", program);
|
||||
fprintf(stderr, "Version: %s\n", VERSION);
|
||||
fprintf(stderr, "Version: %s\n", PACKAGE_VERSION);
|
||||
fprintf(stderr, "Options:\n");
|
||||
fprintf(stderr, " -f file: read key from zone file\n");
|
||||
fprintf(stderr, " -K <directory>: directory in which to store "
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <isc/attributes.h>
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/mem.h>
|
||||
@ -47,14 +48,14 @@
|
||||
|
||||
const char *program = "dnssec-keyfromlabel";
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_NORETURN static void
|
||||
usage(void);
|
||||
|
||||
static void
|
||||
usage(void) {
|
||||
fprintf(stderr, "Usage:\n");
|
||||
fprintf(stderr, " %s -l label [options] name\n\n", program);
|
||||
fprintf(stderr, "Version: %s\n", VERSION);
|
||||
fprintf(stderr, "Version: %s\n", PACKAGE_VERSION);
|
||||
fprintf(stderr, "Required options:\n");
|
||||
fprintf(stderr, " -l label: label of the key pair\n");
|
||||
fprintf(stderr, " name: owner of the key\n");
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <isc/attributes.h>
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/mem.h>
|
||||
@ -70,8 +71,8 @@ const char *program = "dnssec-keygen";
|
||||
|
||||
isc_log_t *lctx = NULL;
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_NORETURN static void
|
||||
usage(void);
|
||||
|
||||
static void
|
||||
progress(int p);
|
||||
@ -136,7 +137,7 @@ static void
|
||||
usage(void) {
|
||||
fprintf(stderr, "Usage:\n");
|
||||
fprintf(stderr, " %s [options] name\n\n", program);
|
||||
fprintf(stderr, "Version: %s\n", VERSION);
|
||||
fprintf(stderr, "Version: %s\n", PACKAGE_VERSION);
|
||||
fprintf(stderr, " name: owner of the key\n");
|
||||
fprintf(stderr, "Options:\n");
|
||||
fprintf(stderr, " -K <directory>: write keys into directory\n");
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <isc/attributes.h>
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/file.h>
|
||||
@ -40,14 +41,14 @@ const char *program = "dnssec-revoke";
|
||||
|
||||
static isc_mem_t *mctx = NULL;
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_NORETURN static void
|
||||
usage(void);
|
||||
|
||||
static void
|
||||
usage(void) {
|
||||
fprintf(stderr, "Usage:\n");
|
||||
fprintf(stderr, " %s [options] keyfile\n\n", program);
|
||||
fprintf(stderr, "Version: %s\n", VERSION);
|
||||
fprintf(stderr, "Version: %s\n", PACKAGE_VERSION);
|
||||
#if USE_PKCS11
|
||||
fprintf(stderr,
|
||||
" -E engine: specify PKCS#11 provider "
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <isc/attributes.h>
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/file.h>
|
||||
@ -44,14 +45,14 @@ const char *program = "dnssec-settime";
|
||||
|
||||
static isc_mem_t *mctx = NULL;
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_NORETURN static void
|
||||
usage(void);
|
||||
|
||||
static void
|
||||
usage(void) {
|
||||
fprintf(stderr, "Usage:\n");
|
||||
fprintf(stderr, " %s [options] keyfile\n\n", program);
|
||||
fprintf(stderr, "Version: %s\n", VERSION);
|
||||
fprintf(stderr, "Version: %s\n", PACKAGE_VERSION);
|
||||
fprintf(stderr, "General options:\n");
|
||||
#if USE_PKCS11
|
||||
fprintf(stderr,
|
||||
|
@ -33,6 +33,7 @@
|
||||
|
||||
#include <isc/app.h>
|
||||
#include <isc/atomic.h>
|
||||
#include <isc/attributes.h>
|
||||
#include <isc/base32.h>
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/event.h>
|
||||
@ -3125,11 +3126,11 @@ print_version(FILE *fp) {
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(fp, "; dnssec_signzone version " VERSION "\n");
|
||||
fprintf(fp, "; dnssec_signzone version %s\n", PACKAGE_VERSION);
|
||||
}
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_NORETURN static void
|
||||
usage(void);
|
||||
|
||||
static void
|
||||
usage(void) {
|
||||
@ -3138,7 +3139,7 @@ usage(void) {
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
fprintf(stderr, "Version: %s\n", VERSION);
|
||||
fprintf(stderr, "Version: %s\n", PACKAGE_VERSION);
|
||||
|
||||
fprintf(stderr, "Options: (default value in parenthesis) \n");
|
||||
fprintf(stderr, "\t-S:\tsmart signing: automatically finds key files\n"
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <time.h>
|
||||
|
||||
#include <isc/app.h>
|
||||
#include <isc/attributes.h>
|
||||
#include <isc/base32.h>
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/event.h>
|
||||
@ -137,8 +138,8 @@ loadzone(char *file, char *origin, dns_rdataclass_t rdclass, dns_db_t **db) {
|
||||
}
|
||||
}
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_NORETURN static void
|
||||
usage(void);
|
||||
|
||||
static void
|
||||
usage(void) {
|
||||
@ -147,7 +148,7 @@ usage(void) {
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
fprintf(stderr, "Version: %s\n", VERSION);
|
||||
fprintf(stderr, "Version: %s\n", PACKAGE_VERSION);
|
||||
|
||||
fprintf(stderr, "Options: (default value in parenthesis) \n");
|
||||
fprintf(stderr, "\t-v debuglevel (0)\n");
|
||||
|
@ -112,7 +112,7 @@ vbprintf(int level, const char *fmt, ...) {
|
||||
|
||||
void
|
||||
version(const char *name) {
|
||||
fprintf(stderr, "%s %s\n", name, VERSION);
|
||||
fprintf(stderr, "%s %s\n", name, PACKAGE_VERSION);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <isc/attributes.h>
|
||||
#include <isc/log.h>
|
||||
#include <isc/platform.h>
|
||||
#include <isc/stdtime.h>
|
||||
@ -42,9 +43,8 @@ extern uint8_t dtype[8];
|
||||
|
||||
typedef void(fatalcallback_t)(void);
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE void
|
||||
fatal(const char *format, ...)
|
||||
ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_NORETURN void
|
||||
fatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
|
||||
|
||||
void
|
||||
setfatalcallback(fatalcallback_t *callback);
|
||||
@ -55,8 +55,8 @@ check_result(isc_result_t result, const char *message);
|
||||
void
|
||||
vbprintf(int level, const char *fmt, ...) ISC_FORMAT_PRINTF(2, 3);
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE void
|
||||
version(const char *program) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_NORETURN void
|
||||
version(const char *program);
|
||||
|
||||
void
|
||||
sig_format(dns_rdata_rrsig_t *sig, char *cp, unsigned int size);
|
||||
|
2
bin/named/.gitignore
vendored
2
bin/named/.gitignore
vendored
@ -1,3 +1,3 @@
|
||||
.libs
|
||||
/named
|
||||
named-symtbl.c
|
||||
/xsl.c
|
||||
|
109
bin/named/Makefile.am
Normal file
109
bin/named/Makefile.am
Normal file
@ -0,0 +1,109 @@
|
||||
include $(top_srcdir)/Makefile.top
|
||||
|
||||
AM_CPPFLAGS += \
|
||||
-I$(srcdir)/unix/include \
|
||||
-I$(top_builddir)/include \
|
||||
$(LIBISC_CFLAGS) \
|
||||
$(LIBDNS_CFLAGS) \
|
||||
$(LIBNS_CFLAGS) \
|
||||
$(LIBISCCC_CFLAGS) \
|
||||
$(LIBISCCFG_CFLAGS) \
|
||||
$(LIBBIND9_CFLAGS) \
|
||||
$(LIBLTDL_CFLAGS) \
|
||||
$(OPENSSL_CFLAGS) \
|
||||
$(LIBCAP_CFLAGS) \
|
||||
$(LMDB_CFLAGS) \
|
||||
$(MAXMINDDB_CFLAGS) \
|
||||
$(DNSTAP_CFLAGS) \
|
||||
$(ZLIB_CFLAGS)
|
||||
|
||||
if HAVE_JSON_C
|
||||
AM_CPPFLAGS += \
|
||||
$(JSON_C_CFLAGS)
|
||||
endif HAVE_JSON_C
|
||||
|
||||
if HAVE_LIBXML2
|
||||
AM_CPPFLAGS += \
|
||||
$(LIBXML2_CFLAGS)
|
||||
endif HAVE_LIBXML2
|
||||
|
||||
AM_CPPFLAGS += \
|
||||
-DNAMED_LOCALSTATEDIR=\"${localstatedir}\" \
|
||||
-DNAMED_SYSCONFDIR=\"${sysconfdir}\"
|
||||
|
||||
sbin_PROGRAMS = named
|
||||
|
||||
nodist_named_SOURCES = xsl.c
|
||||
BUILT_SOURCES = xsl.c
|
||||
CLEANFILES = xsl.c
|
||||
|
||||
xsl.c: bind9.xsl Makefile
|
||||
(echo 'const char xslmsg[] =' && \
|
||||
$(SED) -e 's,\",\\\",g' \
|
||||
-e 's,^,\",' \
|
||||
-e 's,$$,\",' && \
|
||||
echo ";") \
|
||||
< "${srcdir}/bind9.xsl" > $@
|
||||
|
||||
named_SOURCES = \
|
||||
builtin.c \
|
||||
config.c \
|
||||
control.c \
|
||||
controlconf.c \
|
||||
fuzz.c \
|
||||
log.c \
|
||||
logconf.c \
|
||||
main.c \
|
||||
server.c \
|
||||
statschannel.c \
|
||||
tkeyconf.c \
|
||||
tsigconf.c \
|
||||
zoneconf.c \
|
||||
unix/dlz_dlopen_driver.c \
|
||||
unix/os.c \
|
||||
include/named/builtin.h \
|
||||
include/named/config.h \
|
||||
include/named/control.h \
|
||||
include/named/fuzz.h \
|
||||
include/named/geoip.h \
|
||||
include/named/globals.h \
|
||||
include/named/log.h \
|
||||
include/named/logconf.h \
|
||||
include/named/main.h \
|
||||
include/named/server.h \
|
||||
include/named/smf_globals.h \
|
||||
include/named/statschannel.h \
|
||||
include/named/tkeyconf.h \
|
||||
include/named/tsigconf.h \
|
||||
include/named/types.h \
|
||||
include/named/zoneconf.h \
|
||||
unix/include/named/os.h \
|
||||
xsl_p.h
|
||||
|
||||
if HAVE_GEOIP2
|
||||
AM_CPPFLAGS += \
|
||||
-DMAXMINDDB_PREFIX=\"@MAXMINDDB_PREFIX@\"
|
||||
named_SOURCES += \
|
||||
geoip.c
|
||||
endif
|
||||
|
||||
named_LDADD = \
|
||||
$(LIBISC_LIBS) \
|
||||
$(LIBDNS_LIBS) \
|
||||
$(LIBNS_LIBS) \
|
||||
$(LIBISCCC_LIBS) \
|
||||
$(LIBISCCFG_LIBS) \
|
||||
$(LIBBIND9_LIBS) \
|
||||
$(LIBLTDL_LIBS) \
|
||||
$(OPENSSL_LIBS) \
|
||||
$(LIBCAP_LIBS) \
|
||||
$(LMDB_LIBS) \
|
||||
$(MAXMINDDB_LIBS) \
|
||||
$(DNSTAP_LIBS) \
|
||||
$(LIBXML2_LIBS) \
|
||||
$(ZLIB_LIBS)
|
||||
|
||||
if HAVE_JSON_C
|
||||
named_LDADD += \
|
||||
$(JSON_C_LIBS)
|
||||
endif HAVE_JSON_C
|
File diff suppressed because it is too large
Load Diff
@ -347,7 +347,7 @@ do_version_lookup(dns_sdblookup_t *lookup) {
|
||||
return (put_txt(lookup, named_g_server->version));
|
||||
}
|
||||
} else {
|
||||
return (put_txt(lookup, named_g_version));
|
||||
return (put_txt(lookup, PACKAGE_VERSION));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1191,9 +1191,9 @@ add_listener(named_controls_t *cp, controllistener_t **listenerp,
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
int pf = isc_sockaddr_pf(&listener->address);
|
||||
if ((pf == AF_INET && isc_net_probeipv4() != ISC_R_SUCCESS) ||
|
||||
#ifdef ISC_PLATFORM_HAVESYSUNH
|
||||
#ifndef _WIN32
|
||||
(pf == AF_UNIX && isc_net_probeunix() != ISC_R_SUCCESS) ||
|
||||
#endif /* ifdef ISC_PLATFORM_HAVESYSUNH */
|
||||
#endif
|
||||
(pf == AF_INET6 && isc_net_probeipv6() != ISC_R_SUCCESS))
|
||||
{
|
||||
result = ISC_R_FAMILYNOSUPPORT;
|
||||
|
@ -1,51 +0,0 @@
|
||||
#!/usr/bin/env perl
|
||||
#
|
||||
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
# See the COPYRIGHT file distributed with this work for additional
|
||||
# information regarding copyright ownership.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $rev = '$Id: convertxsl.pl,v 1.14 2008/07/17 23:43:26 jinmei Exp $';
|
||||
$rev =~ s/\$//g;
|
||||
$rev =~ s/,v//g;
|
||||
$rev =~ s/Id: //;
|
||||
|
||||
my $xsl = "unknown";
|
||||
my $lines = '';
|
||||
|
||||
while (<>) {
|
||||
chomp;
|
||||
# pickout the id for comment.
|
||||
$xsl = $_ if (/<!-- .Id:.* -->/);
|
||||
# convert Id string to a form not recognisable by cvs.
|
||||
$_ =~ s/<!-- .Id:(.*). -->/<!-- \\045Id: $1\\045 -->/;
|
||||
s/[\ \t]+/ /g;
|
||||
s/\>\ \</\>\</g;
|
||||
s/\"/\\\"/g;
|
||||
s/^/\t\"/;
|
||||
s/[\ \t]+$//g;
|
||||
s/$/\\n\"/;
|
||||
if ($lines eq "") {
|
||||
$lines .= $_;
|
||||
} else {
|
||||
$lines .= "\n" . $_;
|
||||
}
|
||||
}
|
||||
|
||||
$xsl =~ s/\$//g;
|
||||
$xsl =~ s/<!-- Id: //;
|
||||
$xsl =~ s/ -->.*//;
|
||||
$xsl =~ s/,v//;
|
||||
|
||||
print "/*\n * Generated by $rev \n * From $xsl\n */\n";
|
||||
print 'static char xslmsg[] =',"\n";
|
||||
print $lines;
|
||||
|
||||
print ';', "\n";
|
@ -65,12 +65,12 @@ EXTERN isc_socketmgr_t *named_g_socketmgr INIT(NULL);
|
||||
EXTERN isc_nm_t *named_g_nm INIT(NULL);
|
||||
EXTERN cfg_parser_t *named_g_parser INIT(NULL);
|
||||
EXTERN cfg_parser_t *named_g_addparser INIT(NULL);
|
||||
EXTERN const char *named_g_version INIT(VERSION);
|
||||
EXTERN const char *named_g_product INIT(PRODUCT);
|
||||
EXTERN const char *named_g_description INIT(DESCRIPTION);
|
||||
EXTERN const char *named_g_srcid INIT(SRCID);
|
||||
EXTERN const char *named_g_configargs INIT(CONFIGARGS);
|
||||
EXTERN const char *named_g_builder INIT(BUILDER);
|
||||
EXTERN const char *named_g_version INIT(PACKAGE_VERSION);
|
||||
EXTERN const char *named_g_product INIT(PACKAGE_NAME);
|
||||
EXTERN const char *named_g_description INIT(PACKAGE_DESCRIPTION);
|
||||
EXTERN const char *named_g_srcid INIT(PACKAGE_SRCID);
|
||||
EXTERN const char *named_g_configargs INIT(PACKAGE_CONFIGARGS);
|
||||
EXTERN const char *named_g_builder INIT(PACKAGE_BUILDER);
|
||||
EXTERN in_port_t named_g_port INIT(0);
|
||||
EXTERN isc_dscp_t named_g_dscp INIT(-1);
|
||||
|
||||
|
@ -9,8 +9,9 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#ifndef NAMED_MAIN_H
|
||||
#define NAMED_MAIN_H 1
|
||||
#pragma once
|
||||
|
||||
#include <isc/attributes.h>
|
||||
|
||||
/*! \file */
|
||||
|
||||
@ -23,14 +24,11 @@
|
||||
*/
|
||||
#define NAMED_MAIN_ARGS "46A:c:d:D:E:fFgL:M:m:n:N:p:sS:t:T:U:u:vVx:X:"
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE void
|
||||
named_main_earlyfatal(const char *format, ...)
|
||||
ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_NORETURN void
|
||||
named_main_earlyfatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
|
||||
|
||||
void
|
||||
named_main_earlywarning(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
|
||||
|
||||
void
|
||||
named_main_setmemstats(const char *);
|
||||
|
||||
#endif /* NAMED_MAIN_H */
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <isc/app.h>
|
||||
#include <isc/attributes.h>
|
||||
#include <isc/backtrace.h>
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/dir.h>
|
||||
@ -189,9 +190,9 @@ named_main_earlyfatal(const char *format, ...) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
ISC_NORETURN static void
|
||||
assertion_failed(const char *file, int line, isc_assertiontype_t type,
|
||||
const char *cond) ISC_PLATFORM_NORETURN_POST;
|
||||
const char *cond);
|
||||
|
||||
static void
|
||||
assertion_failed(const char *file, int line, isc_assertiontype_t type,
|
||||
@ -254,10 +255,9 @@ assertion_failed(const char *file, int line, isc_assertiontype_t type,
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
ISC_NORETURN static void
|
||||
library_fatal_error(const char *file, int line, const char *format,
|
||||
va_list args)
|
||||
ISC_FORMAT_PRINTF(3, 0) ISC_PLATFORM_NORETURN_POST;
|
||||
va_list args) ISC_FORMAT_PRINTF(3, 0);
|
||||
|
||||
static void
|
||||
library_fatal_error(const char *file, int line, const char *format,
|
||||
@ -487,16 +487,15 @@ printversion(bool verbose) {
|
||||
const cfg_obj_t *defaults = NULL, *obj = NULL;
|
||||
#endif /* if defined(HAVE_GEOIP2) */
|
||||
|
||||
printf("%s %s%s%s <id:%s>\n", named_g_product, named_g_version,
|
||||
(*named_g_description != '\0') ? " " : "", named_g_description,
|
||||
named_g_srcid);
|
||||
printf("%s%s <id:%s>\n", PACKAGE_STRING, PACKAGE_DESCRIPTION,
|
||||
PACKAGE_SRCID);
|
||||
|
||||
if (!verbose) {
|
||||
return;
|
||||
}
|
||||
|
||||
printf("running on %s\n", named_os_uname());
|
||||
printf("built by %s with %s\n", named_g_builder, named_g_configargs);
|
||||
printf("built by %s with %s\n", PACKAGE_BUILDER, PACKAGE_CONFIGARGS);
|
||||
#ifdef __clang__
|
||||
printf("compiled by CLANG %s\n", __VERSION__);
|
||||
#else /* ifdef __clang__ */
|
||||
@ -1049,9 +1048,8 @@ setup(void) {
|
||||
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
|
||||
"starting %s %s%s%s <id:%s>", named_g_product,
|
||||
named_g_version, *named_g_description ? " " : "",
|
||||
named_g_description, named_g_srcid);
|
||||
"starting %s%s <id:%s>", PACKAGE_STRING,
|
||||
PACKAGE_DESCRIPTION, PACKAGE_SRCID);
|
||||
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE, "running on %s",
|
||||
@ -1059,7 +1057,7 @@ setup(void) {
|
||||
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE, "built with %s",
|
||||
named_g_configargs);
|
||||
PACKAGE_CONFIGARGS);
|
||||
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
|
||||
@ -1228,7 +1226,6 @@ setup(void) {
|
||||
*/
|
||||
/* xxdb_init(); */
|
||||
|
||||
#ifdef ISC_DLZ_DLOPEN
|
||||
/*
|
||||
* Register the DLZ "dlopen" driver.
|
||||
*/
|
||||
@ -1237,7 +1234,6 @@ setup(void) {
|
||||
named_main_earlyfatal("dlz_dlopen_init() failed: %s",
|
||||
isc_result_totext(result));
|
||||
}
|
||||
#endif /* ifdef ISC_DLZ_DLOPEN */
|
||||
|
||||
#if CONTRIB_DLZ
|
||||
/*
|
||||
@ -1321,12 +1317,10 @@ cleanup(void) {
|
||||
*/
|
||||
dlz_drivers_clear();
|
||||
#endif /* ifdef CONTRIB_DLZ */
|
||||
#ifdef ISC_DLZ_DLOPEN
|
||||
/*
|
||||
* Unregister "dlopen" DLZ driver.
|
||||
*/
|
||||
dlz_dlopen_clear();
|
||||
#endif /* ifdef ISC_DLZ_DLOPEN */
|
||||
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE, "exiting");
|
||||
@ -1454,10 +1448,11 @@ main(int argc, char *argv[]) {
|
||||
*/
|
||||
strlcat(version,
|
||||
#if defined(NO_VERSION_DATE) || !defined(__DATE__)
|
||||
"named version: BIND " VERSION " <" SRCID ">",
|
||||
#else /* if defined(NO_VERSION_DATE) || !defined(__DATE__) */
|
||||
"named version: BIND " VERSION " <" SRCID "> (" __DATE__ ")",
|
||||
#endif /* if defined(NO_VERSION_DATE) || !defined(__DATE__) */
|
||||
"named version: BIND " PACKAGE_VERSION " <" PACKAGE_SRCID ">",
|
||||
#else
|
||||
"named version: BIND " PACKAGE_VERSION " <" PACKAGE_SRCID
|
||||
"> (" __DATE__ ")",
|
||||
#endif
|
||||
sizeof(version));
|
||||
result = isc_file_progname(*argv, program_name, sizeof(program_name));
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include <isc/aes.h>
|
||||
#include <isc/app.h>
|
||||
#include <isc/attributes.h>
|
||||
#include <isc/base64.h>
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/dir.h>
|
||||
@ -381,9 +382,8 @@ const char *empty_zones[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
fatal(named_server_t *server, const char *msg,
|
||||
isc_result_t result) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_NORETURN static void
|
||||
fatal(named_server_t *server, const char *msg, isc_result_t result);
|
||||
|
||||
static void
|
||||
named_server_reload(isc_task_t *task, isc_event_t *event);
|
||||
@ -1633,7 +1633,6 @@ cleanup:
|
||||
return (result);
|
||||
}
|
||||
|
||||
#ifdef HAVE_DLOPEN
|
||||
static isc_result_t
|
||||
configure_dyndb(const cfg_obj_t *dyndb, isc_mem_t *mctx,
|
||||
const dns_dyndbctx_t *dctx) {
|
||||
@ -1660,7 +1659,6 @@ configure_dyndb(const cfg_obj_t *dyndb, isc_mem_t *mctx,
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
#endif /* ifdef HAVE_DLOPEN */
|
||||
|
||||
static isc_result_t
|
||||
disable_algorithms(const cfg_obj_t *disabled, dns_resolver_t *resolver) {
|
||||
@ -3760,7 +3758,7 @@ configure_dnstap(const cfg_obj_t **maps, dns_view_t *view) {
|
||||
result = named_config_get(maps, "dnstap-version", &obj);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
/* not specified; use the product and version */
|
||||
dns_dt_setversion(named_g_server->dtenv, PRODUCT " " VERSION);
|
||||
dns_dt_setversion(named_g_server->dtenv, PACKAGE_STRING);
|
||||
} else if (result == ISC_R_SUCCESS && !cfg_obj_isvoid(obj)) {
|
||||
/* Quoted string */
|
||||
dns_dt_setversion(named_g_server->dtenv, cfg_obj_asstring(obj));
|
||||
@ -3817,7 +3815,6 @@ create_mapped_acl(void) {
|
||||
return (result);
|
||||
}
|
||||
|
||||
#ifdef HAVE_DLOPEN
|
||||
/*%
|
||||
* A callback for the cfg_pluginlist_foreach() call in configure_view() below.
|
||||
* If registering any plugin fails, registering subsequent ones is not
|
||||
@ -3855,11 +3852,10 @@ register_one_plugin(const cfg_obj_t *config, const cfg_obj_t *obj,
|
||||
|
||||
return (result);
|
||||
}
|
||||
#endif /* ifdef HAVE_DLOPEN */
|
||||
|
||||
/*
|
||||
* Configure 'view' according to 'vconfig', taking defaults from 'config'
|
||||
* where values are missing in 'vconfig'.
|
||||
* Configure 'view' according to 'vconfig', taking defaults from
|
||||
* 'config' where values are missing in 'vconfig'.
|
||||
*
|
||||
* When configuring the default view, 'vconfig' will be NULL and the
|
||||
* global defaults in 'config' used exclusively.
|
||||
@ -5412,7 +5408,6 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
|
||||
(void)cfg_map_get(config, "dyndb", &dyndb_list);
|
||||
}
|
||||
|
||||
#ifdef HAVE_DLOPEN
|
||||
for (element = cfg_list_first(dyndb_list); element != NULL;
|
||||
element = cfg_list_next(element))
|
||||
{
|
||||
@ -5428,7 +5423,6 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
|
||||
|
||||
CHECK(configure_dyndb(dyndb, mctx, dctx));
|
||||
}
|
||||
#endif /* ifdef HAVE_DLOPEN */
|
||||
|
||||
/*
|
||||
* Load plugins.
|
||||
@ -5440,7 +5434,6 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
|
||||
(void)cfg_map_get(config, "plugin", &plugin_list);
|
||||
}
|
||||
|
||||
#ifdef HAVE_DLOPEN
|
||||
if (plugin_list != NULL) {
|
||||
INSIST(view->hooktable == NULL);
|
||||
CHECK(ns_hooktable_create(view->mctx,
|
||||
@ -5453,7 +5446,6 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
|
||||
CHECK(cfg_pluginlist_foreach(config, plugin_list, named_g_lctx,
|
||||
register_one_plugin, view));
|
||||
}
|
||||
#endif /* ifdef HAVE_DLOPEN */
|
||||
|
||||
/*
|
||||
* Setup automatic empty zones. If recursion is off then
|
||||
@ -11744,10 +11736,9 @@ named_server_status(named_server_t *server, isc_buffer_t **text) {
|
||||
isc_time_formathttptimestamp(&named_g_configtime, configtime,
|
||||
sizeof(configtime));
|
||||
|
||||
snprintf(line, sizeof(line), "version: %s %s%s%s <id:%s>%s%s%s\n",
|
||||
named_g_product, named_g_version,
|
||||
(*named_g_description != '\0') ? " " : "", named_g_description,
|
||||
named_g_srcid, ob, alt, cb);
|
||||
snprintf(line, sizeof(line), "version: %s%s <id:%s>%s%s%s\n",
|
||||
PACKAGE_STRING, PACKAGE_DESCRIPTION, PACKAGE_SRCID, ob, alt,
|
||||
cb);
|
||||
CHECK(putstr(text, line));
|
||||
|
||||
result = named_os_gethostname(hostname, sizeof(hostname));
|
||||
|
@ -52,7 +52,7 @@
|
||||
#define ISC_XMLCHAR (const xmlChar *)
|
||||
#endif /* HAVE_LIBXML2 */
|
||||
|
||||
#include "bind9.xsl.h"
|
||||
#include "xsl_p.h"
|
||||
|
||||
struct named_statschannel {
|
||||
/* Unlocked */
|
||||
@ -1988,7 +1988,7 @@ generatexml(named_server_t *server, uint32_t flags, int *buflen,
|
||||
TRY0(xmlTextWriterWriteString(writer, ISC_XMLCHAR nowstr));
|
||||
TRY0(xmlTextWriterEndElement(writer)); /* current-time */
|
||||
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "version"));
|
||||
TRY0(xmlTextWriterWriteString(writer, ISC_XMLCHAR named_g_version));
|
||||
TRY0(xmlTextWriterWriteString(writer, ISC_XMLCHAR PACKAGE_VERSION));
|
||||
TRY0(xmlTextWriterEndElement(writer)); /* version */
|
||||
|
||||
if ((flags & STATS_XML_SERVER) != 0) {
|
||||
@ -2825,7 +2825,7 @@ generatejson(named_server_t *server, size_t *msglen, const char **msg,
|
||||
obj = json_object_new_string(nowstr);
|
||||
CHECKMEM(obj);
|
||||
json_object_object_add(bindstats, "current-time", obj);
|
||||
obj = json_object_new_string(named_g_version);
|
||||
obj = json_object_new_string(PACKAGE_VERSION);
|
||||
CHECKMEM(obj);
|
||||
json_object_object_add(bindstats, "version", obj);
|
||||
|
||||
@ -3472,6 +3472,7 @@ render_xsl(const char *url, isc_httpdurl_t *urlinfo, const char *querystring,
|
||||
isc_httpdfree_t **freecb, void **freecb_args) {
|
||||
isc_result_t result;
|
||||
char *_headers = NULL;
|
||||
char *p;
|
||||
|
||||
UNUSED(url);
|
||||
UNUSED(querystring);
|
||||
@ -3530,7 +3531,8 @@ render_xsl(const char *url, isc_httpdurl_t *urlinfo, const char *querystring,
|
||||
send:
|
||||
*retcode = 200;
|
||||
*retmsg = "OK";
|
||||
isc_buffer_reinit(b, xslmsg, strlen(xslmsg));
|
||||
DE_CONST(xslmsg, p);
|
||||
isc_buffer_reinit(b, p, strlen(xslmsg));
|
||||
isc_buffer_add(b, strlen(xslmsg));
|
||||
end:
|
||||
free(_headers);
|
||||
|
@ -10,13 +10,11 @@
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <ltdl.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#if HAVE_DLFCN_H
|
||||
#include <dlfcn.h>
|
||||
#endif /* if HAVE_DLFCN_H */
|
||||
|
||||
#include <isc/mem.h>
|
||||
#include <isc/print.h>
|
||||
@ -30,7 +28,6 @@
|
||||
#include <dlz/dlz_dlopen_driver.h>
|
||||
#include <named/globals.h>
|
||||
|
||||
#ifdef ISC_DLZ_DLOPEN
|
||||
static dns_sdlzimplementation_t *dlz_dlopen = NULL;
|
||||
|
||||
typedef struct dlopen_data {
|
||||
@ -183,13 +180,21 @@ dlopen_dlz_lookup(const char *zone, const char *name, void *driverarg,
|
||||
*/
|
||||
static void *
|
||||
dl_load_symbol(dlopen_data_t *cd, const char *symbol, bool mandatory) {
|
||||
void *ptr = dlsym(cd->dl_handle, symbol);
|
||||
if (ptr == NULL && mandatory) {
|
||||
dlopen_log(ISC_LOG_ERROR,
|
||||
"dlz_dlopen: library '%s' is missing "
|
||||
"required symbol '%s'",
|
||||
cd->dl_path, symbol);
|
||||
void *ptr = lt_dlsym((lt_dlhandle)cd->dl_handle, symbol);
|
||||
if (ptr == NULL) {
|
||||
const char *errmsg = lt_dlerror();
|
||||
if (errmsg == NULL) {
|
||||
errmsg = "returned function pointer is NULL";
|
||||
}
|
||||
if (mandatory) {
|
||||
dlopen_log(ISC_LOG_ERROR,
|
||||
"dlz_dlopen: library '%s' is missing "
|
||||
"required symbol '%s': %s",
|
||||
cd->dl_path, symbol, errmsg);
|
||||
}
|
||||
}
|
||||
/* Cleanup any errors */
|
||||
(void)lt_dlerror();
|
||||
return (ptr);
|
||||
}
|
||||
|
||||
@ -202,7 +207,6 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
|
||||
dlopen_data_t *cd;
|
||||
isc_mem_t *mctx = NULL;
|
||||
isc_result_t result = ISC_R_FAILURE;
|
||||
int dlopen_flags = 0;
|
||||
|
||||
UNUSED(driverarg);
|
||||
|
||||
@ -214,45 +218,33 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
isc_mem_create(&mctx);
|
||||
if (lt_dlinit() != 0) {
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
isc_mem_create(&mctx);
|
||||
cd = isc_mem_get(mctx, sizeof(*cd));
|
||||
memset(cd, 0, sizeof(*cd));
|
||||
|
||||
cd->mctx = mctx;
|
||||
|
||||
cd->dl_path = isc_mem_strdup(cd->mctx, argv[1]);
|
||||
|
||||
cd->dlzname = isc_mem_strdup(cd->mctx, dlzname);
|
||||
|
||||
/* Initialize the lock */
|
||||
isc_mutex_init(&cd->lock);
|
||||
|
||||
/* Open the library */
|
||||
dlopen_flags = RTLD_NOW | RTLD_GLOBAL;
|
||||
|
||||
#if defined(RTLD_DEEPBIND) && !__SANITIZE_ADDRESS__
|
||||
/*
|
||||
* If RTLD_DEEPBIND is available then use it. This can avoid
|
||||
* issues with a module using a different version of a system
|
||||
* library than one that bind9 uses. For example, bind9 may link
|
||||
* to MIT kerberos, but the module may use Heimdal. If we don't
|
||||
* use RTLD_DEEPBIND then we could end up with Heimdal functions
|
||||
* calling MIT functions, which leads to bizarre results (usually
|
||||
* a segfault).
|
||||
*/
|
||||
dlopen_flags |= RTLD_DEEPBIND;
|
||||
#endif /* if defined(RTLD_DEEPBIND) && !__SANITIZE_ADDRESS__ */
|
||||
|
||||
cd->dl_handle = dlopen(cd->dl_path, dlopen_flags);
|
||||
cd->dl_handle = lt_dlopenext(cd->dl_path);
|
||||
if (cd->dl_handle == NULL) {
|
||||
dlopen_log(ISC_LOG_ERROR,
|
||||
"dlz_dlopen failed to open library '%s' - %s",
|
||||
cd->dl_path, dlerror());
|
||||
"dlz_dlopen failed to open library '%s': %s",
|
||||
cd->dl_path, lt_dlerror());
|
||||
result = ISC_R_FAILURE;
|
||||
goto failed;
|
||||
}
|
||||
|
||||
(void)lt_dlerror();
|
||||
|
||||
/* Find the symbols */
|
||||
cd->dlz_version =
|
||||
(dlz_dlopen_version_t *)dl_load_symbol(cd, "dlz_version", true);
|
||||
@ -330,20 +322,14 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
|
||||
|
||||
failed:
|
||||
dlopen_log(ISC_LOG_ERROR, "dlz_dlopen of '%s' failed", dlzname);
|
||||
if (cd->dl_path != NULL) {
|
||||
isc_mem_free(mctx, cd->dl_path);
|
||||
}
|
||||
if (cd->dlzname != NULL) {
|
||||
isc_mem_free(mctx, cd->dlzname);
|
||||
}
|
||||
if (dlopen_flags != 0) {
|
||||
isc_mutex_destroy(&cd->lock);
|
||||
}
|
||||
#ifdef HAVE_DLCLOSE
|
||||
|
||||
isc_mem_free(mctx, cd->dl_path);
|
||||
isc_mem_free(mctx, cd->dlzname);
|
||||
|
||||
isc_mutex_destroy(&cd->lock);
|
||||
if (cd->dl_handle) {
|
||||
dlclose(cd->dl_handle);
|
||||
(void)lt_dlclose(cd->dl_handle);
|
||||
}
|
||||
#endif /* ifdef HAVE_DLCLOSE */
|
||||
isc_mem_put(mctx, cd, sizeof(*cd));
|
||||
isc_mem_destroy(&mctx);
|
||||
return (result);
|
||||
@ -372,11 +358,9 @@ dlopen_dlz_destroy(void *driverarg, void *dbdata) {
|
||||
isc_mem_free(cd->mctx, cd->dlzname);
|
||||
}
|
||||
|
||||
#ifdef HAVE_DLCLOSE
|
||||
if (cd->dl_handle) {
|
||||
dlclose(cd->dl_handle);
|
||||
lt_dlclose(cd->dl_handle);
|
||||
}
|
||||
#endif /* ifdef HAVE_DLCLOSE */
|
||||
|
||||
isc_mutex_destroy(&cd->lock);
|
||||
|
||||
@ -547,17 +531,12 @@ static dns_sdlzmethods_t dlz_dlopen_methods = {
|
||||
dlopen_dlz_configure, dlopen_dlz_ssumatch, dlopen_dlz_addrdataset,
|
||||
dlopen_dlz_subrdataset, dlopen_dlz_delrdataset
|
||||
};
|
||||
#endif /* ifdef ISC_DLZ_DLOPEN */
|
||||
|
||||
/*
|
||||
* Register driver with BIND
|
||||
*/
|
||||
isc_result_t
|
||||
dlz_dlopen_init(isc_mem_t *mctx) {
|
||||
#ifndef ISC_DLZ_DLOPEN
|
||||
UNUSED(mctx);
|
||||
return (ISC_R_NOTIMPLEMENTED);
|
||||
#else /* ifndef ISC_DLZ_DLOPEN */
|
||||
isc_result_t result;
|
||||
|
||||
dlopen_log(2, "Registering DLZ_dlopen driver");
|
||||
@ -576,7 +555,6 @@ dlz_dlopen_init(isc_mem_t *mctx) {
|
||||
}
|
||||
|
||||
return (result);
|
||||
#endif /* ifndef ISC_DLZ_DLOPEN */
|
||||
}
|
||||
|
||||
/*
|
||||
@ -584,10 +562,8 @@ dlz_dlopen_init(isc_mem_t *mctx) {
|
||||
*/
|
||||
void
|
||||
dlz_dlopen_clear(void) {
|
||||
#ifdef ISC_DLZ_DLOPEN
|
||||
dlopen_log(2, "Unregistering DLZ_dlopen driver");
|
||||
if (dlz_dlopen != NULL) {
|
||||
dns_sdlzunregister(&dlz_dlopen);
|
||||
}
|
||||
#endif /* ifdef ISC_DLZ_DLOPEN */
|
||||
}
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include <dlz/dlz_dlopen_driver.h>
|
||||
#include <named/globals.h>
|
||||
|
||||
#ifdef ISC_DLZ_DLOPEN
|
||||
static dns_sdlzimplementation_t *dlz_dlopen = NULL;
|
||||
|
||||
typedef struct dlopen_data {
|
||||
@ -530,17 +529,12 @@ static dns_sdlzmethods_t dlz_dlopen_methods = {
|
||||
dlopen_dlz_configure, dlopen_dlz_ssumatch, dlopen_dlz_addrdataset,
|
||||
dlopen_dlz_subrdataset, dlopen_dlz_delrdataset
|
||||
};
|
||||
#endif /* ifdef ISC_DLZ_DLOPEN */
|
||||
|
||||
/*
|
||||
* Register driver with BIND
|
||||
*/
|
||||
isc_result_t
|
||||
dlz_dlopen_init(isc_mem_t *mctx) {
|
||||
#ifndef ISC_DLZ_DLOPEN
|
||||
UNUSED(mctx);
|
||||
return (ISC_R_NOTIMPLEMENTED);
|
||||
#else /* ifndef ISC_DLZ_DLOPEN */
|
||||
isc_result_t result;
|
||||
|
||||
dlopen_log(2, "Registering DLZ_dlopen driver");
|
||||
@ -559,7 +553,6 @@ dlz_dlopen_init(isc_mem_t *mctx) {
|
||||
}
|
||||
|
||||
return (result);
|
||||
#endif /* ifndef ISC_DLZ_DLOPEN */
|
||||
}
|
||||
|
||||
/*
|
||||
@ -567,10 +560,8 @@ dlz_dlopen_init(isc_mem_t *mctx) {
|
||||
*/
|
||||
void
|
||||
dlz_dlopen_clear(void) {
|
||||
#ifdef ISC_DLZ_DLOPEN
|
||||
dlopen_log(2, "Unregistering DLZ_dlopen driver");
|
||||
if (dlz_dlopen != NULL) {
|
||||
dns_sdlzunregister(&dlz_dlopen);
|
||||
}
|
||||
#endif /* ifdef ISC_DLZ_DLOPEN */
|
||||
}
|
||||
|
@ -18,12 +18,12 @@
|
||||
#define BIND_SERVICE_NAME "named"
|
||||
|
||||
void
|
||||
ntservice_init();
|
||||
ntservice_init(void);
|
||||
void UpdateSCM(DWORD);
|
||||
void
|
||||
ServiceControl(DWORD dwCtrlCode);
|
||||
void
|
||||
ntservice_shutdown();
|
||||
ntservice_shutdown(void);
|
||||
BOOL
|
||||
ntservice_isservice();
|
||||
ntservice_isservice(void);
|
||||
#endif /* ifndef NTSERVICE_H */
|
||||
|
@ -50,8 +50,8 @@ ntservice_init(void) {
|
||||
}
|
||||
UpdateSCM(SERVICE_RUNNING);
|
||||
} else {
|
||||
strlcpy(ConsoleTitle, "BIND Version ", sizeof(ConsoleTitle));
|
||||
strlcat(ConsoleTitle, VERSION, sizeof(ConsoleTitle));
|
||||
snprintf(ConsoleTitle, sizeof(ConsoleTitle), "%s Version %s",
|
||||
PACKAGE_NAME, PACKAGE_VERSION);
|
||||
SetConsoleTitle(ConsoleTitle);
|
||||
}
|
||||
}
|
||||
|
@ -9,12 +9,6 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
#pragma once
|
||||
|
||||
#include <ns/version.h>
|
||||
|
||||
const char ns_version[] = VERSION;
|
||||
|
||||
const unsigned int ns_libinterface = LIBINTERFACE;
|
||||
const unsigned int ns_librevision = LIBREVISION;
|
||||
const unsigned int ns_libage = LIBAGE;
|
||||
extern const char xslmsg[];
|
25
bin/nsupdate/Makefile.am
Normal file
25
bin/nsupdate/Makefile.am
Normal file
@ -0,0 +1,25 @@
|
||||
include $(top_srcdir)/Makefile.top
|
||||
|
||||
AM_CPPFLAGS += \
|
||||
$(LIBISC_CFLAGS) \
|
||||
$(LIBDNS_CFLAGS) \
|
||||
$(LIBISCCFG_CFLAGS) \
|
||||
$(LIBIRS_CFLAGS) \
|
||||
$(LIBBIND9_CFLAGS) \
|
||||
$(GSSAPI_CFLAGS) \
|
||||
$(KRB5_CFLAGS)
|
||||
|
||||
AM_CPPFLAGS += \
|
||||
-DSESSION_KEYFILE=\"${localstatedir}/run/named/session.key\"
|
||||
|
||||
LDADD = \
|
||||
$(LIBISC_LIBS) \
|
||||
$(LIBDNS_LIBS) \
|
||||
$(LIBISCCFG_LIBS) \
|
||||
$(LIBIRS_LIBS) \
|
||||
$(LIBBIND9_LIBS) \
|
||||
$(READLINE_LIB) \
|
||||
$(GSSAPI_LIBS) \
|
||||
$(KRB5_LIBS)
|
||||
|
||||
bin_PROGRAMS = nsupdate
|
@ -20,6 +20,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include <isc/app.h>
|
||||
#include <isc/attributes.h>
|
||||
#include <isc/base64.h>
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/commandline.h>
|
||||
@ -74,14 +75,23 @@
|
||||
|
||||
#include <irs/resconf.h>
|
||||
|
||||
#ifdef GSSAPI
|
||||
#if HAVE_GSSAPI
|
||||
#include <dst/gssapi.h>
|
||||
#ifdef WIN32
|
||||
|
||||
#if HAVE_KRB5_KRB5_H
|
||||
#include <krb5/krb5.h>
|
||||
#else /* ifdef WIN32 */
|
||||
#include ISC_PLATFORM_KRB5HEADER
|
||||
#endif /* ifdef WIN32 */
|
||||
#endif /* ifdef GSSAPI */
|
||||
#elif HAVE_KRB5_H
|
||||
#include <krb5.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_GSSAPI_GSSAPI_H
|
||||
#include <gssapi/gssapi.h>
|
||||
#elif HAVE_GSSAPI_H
|
||||
#include <gssapi.h>
|
||||
#endif
|
||||
|
||||
#endif /* HAVE_GSSAPI */
|
||||
|
||||
#include <bind9/getaddresses.h>
|
||||
|
||||
#if defined(HAVE_READLINE)
|
||||
@ -189,9 +199,8 @@ sendrequest(isc_sockaddr_t *destaddr, dns_message_t *msg,
|
||||
static void
|
||||
send_update(dns_name_t *zonename, isc_sockaddr_t *master);
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
fatal(const char *format, ...)
|
||||
ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_NORETURN static void
|
||||
fatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
|
||||
|
||||
static void
|
||||
debug(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
|
||||
@ -199,7 +208,7 @@ debug(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
|
||||
static void
|
||||
ddebug(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
|
||||
|
||||
#ifdef GSSAPI
|
||||
#if HAVE_GSSAPI
|
||||
static dns_fixedname_t fkname;
|
||||
static isc_sockaddr_t *kserver = NULL;
|
||||
static char *realm = NULL;
|
||||
@ -212,7 +221,7 @@ typedef struct nsu_gssinfo {
|
||||
} nsu_gssinfo_t;
|
||||
|
||||
static void
|
||||
failed_gssrequest();
|
||||
failed_gssrequest(void);
|
||||
static void
|
||||
start_gssrequest(dns_name_t *master);
|
||||
static void
|
||||
@ -220,7 +229,7 @@ send_gssrequest(isc_sockaddr_t *destaddr, dns_message_t *msg,
|
||||
dns_request_t **request, gss_ctx_id_t context);
|
||||
static void
|
||||
recvgss(isc_task_t *task, isc_event_t *event);
|
||||
#endif /* GSSAPI */
|
||||
#endif /* HAVE_GSSAPI */
|
||||
|
||||
static void
|
||||
error(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
|
||||
@ -1005,7 +1014,7 @@ get_addresses(char *host, in_port_t port, isc_sockaddr_t *sockaddr,
|
||||
|
||||
static void
|
||||
version(void) {
|
||||
fputs("nsupdate " VERSION "\n", stderr);
|
||||
fprintf(stderr, "nsupdate %s\n", PACKAGE_VERSION);
|
||||
}
|
||||
|
||||
#define PARSE_ARGS_FMT "46dDML:y:ghilovk:p:Pr:R::t:Tu:V"
|
||||
@ -1228,13 +1237,13 @@ parse_args(int argc, char **argv) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#ifdef GSSAPI
|
||||
#if HAVE_GSSAPI
|
||||
if (usegsstsig && (keyfile != NULL || keystr != NULL)) {
|
||||
fprintf(stderr, "%s: cannot specify -g with -k or -y\n",
|
||||
argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
#else /* ifdef GSSAPI */
|
||||
#else /* HAVE_GSSAPI */
|
||||
if (usegsstsig) {
|
||||
fprintf(stderr,
|
||||
"%s: cannot specify -g or -o, "
|
||||
@ -1242,7 +1251,7 @@ parse_args(int argc, char **argv) {
|
||||
argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
#endif /* ifdef GSSAPI */
|
||||
#endif /* HAVE_GSSAPI */
|
||||
|
||||
if (argv[isc_commandline_index] != NULL) {
|
||||
if (strcmp(argv[isc_commandline_index], "-") == 0) {
|
||||
@ -1698,7 +1707,7 @@ evaluate_zone(char *cmdline) {
|
||||
|
||||
static uint16_t
|
||||
evaluate_realm(char *cmdline) {
|
||||
#ifdef GSSAPI
|
||||
#if HAVE_GSSAPI
|
||||
char *word;
|
||||
char buf[1024];
|
||||
int n;
|
||||
@ -1720,10 +1729,10 @@ evaluate_realm(char *cmdline) {
|
||||
}
|
||||
realm = isc_mem_strdup(gmctx, buf);
|
||||
return (STATUS_MORE);
|
||||
#else /* ifdef GSSAPI */
|
||||
#else /* HAVE_GSSAPI */
|
||||
UNUSED(cmdline);
|
||||
return (STATUS_SYNTAX);
|
||||
#endif /* ifdef GSSAPI */
|
||||
#endif /* HAVE_GSSAPI */
|
||||
}
|
||||
|
||||
static uint16_t
|
||||
@ -2201,25 +2210,25 @@ do_next_command(char *cmdline) {
|
||||
return (evaluate_checknames(cmdline));
|
||||
}
|
||||
if (strcasecmp(word, "gsstsig") == 0) {
|
||||
#ifdef GSSAPI
|
||||
#if HAVE_GSSAPI
|
||||
usegsstsig = true;
|
||||
use_win2k_gsstsig = false;
|
||||
#else /* ifdef GSSAPI */
|
||||
#else /* HAVE_GSSAPI */
|
||||
fprintf(stderr, "gsstsig not supported\n");
|
||||
#endif /* ifdef GSSAPI */
|
||||
#endif /* HAVE_GSSAPI */
|
||||
return (STATUS_MORE);
|
||||
}
|
||||
if (strcasecmp(word, "oldgsstsig") == 0) {
|
||||
#ifdef GSSAPI
|
||||
#if HAVE_GSSAPI
|
||||
usegsstsig = true;
|
||||
use_win2k_gsstsig = true;
|
||||
#else /* ifdef GSSAPI */
|
||||
#else /* HAVE_GSSAPI */
|
||||
fprintf(stderr, "gsstsig not supported\n");
|
||||
#endif /* ifdef GSSAPI */
|
||||
#endif /* HAVE_GSSAPI */
|
||||
return (STATUS_MORE);
|
||||
}
|
||||
if (strcasecmp(word, "help") == 0) {
|
||||
fprintf(stdout, "nsupdate " VERSION ":\n"
|
||||
fprintf(stdout, "nsupdate " PACKAGE_VERSION ":\n"
|
||||
"local address [port] (set local "
|
||||
"resolver)\n"
|
||||
"server address [port] (set master server "
|
||||
@ -2261,7 +2270,7 @@ do_next_command(char *cmdline) {
|
||||
return (STATUS_MORE);
|
||||
}
|
||||
if (strcasecmp(word, "version") == 0) {
|
||||
fprintf(stdout, "nsupdate " VERSION "\n");
|
||||
fprintf(stdout, "nsupdate " PACKAGE_VERSION "\n");
|
||||
return (STATUS_MORE);
|
||||
}
|
||||
fprintf(stderr, "incorrect section name: %s\n", word);
|
||||
@ -2770,7 +2779,7 @@ lookforsoa:
|
||||
}
|
||||
dns_rdata_freestruct(&soa);
|
||||
|
||||
#ifdef GSSAPI
|
||||
#if HAVE_GSSAPI
|
||||
if (usegsstsig) {
|
||||
dns_name_init(&tmpzonename, NULL);
|
||||
dns_name_dup(zname, gmctx, &tmpzonename);
|
||||
@ -2781,10 +2790,10 @@ lookforsoa:
|
||||
send_update(zname, &master_servers[master_inuse]);
|
||||
setzoneclass(dns_rdataclass_none);
|
||||
}
|
||||
#else /* ifdef GSSAPI */
|
||||
#else /* HAVE_GSSAPI */
|
||||
send_update(zname, &master_servers[master_inuse]);
|
||||
setzoneclass(dns_rdataclass_none);
|
||||
#endif /* ifdef GSSAPI */
|
||||
#endif /* HAVE_GSSAPI */
|
||||
|
||||
dns_message_destroy(&soaquery);
|
||||
dns_request_destroy(&request);
|
||||
@ -2838,7 +2847,7 @@ sendrequest(isc_sockaddr_t *destaddr, dns_message_t *msg,
|
||||
requests++;
|
||||
}
|
||||
|
||||
#ifdef GSSAPI
|
||||
#if HAVE_GSSAPI
|
||||
|
||||
/*
|
||||
* Get the realm from the users kerberos ticket if possible
|
||||
@ -2893,7 +2902,7 @@ get_ticket_realm(isc_mem_t *mctx) {
|
||||
}
|
||||
|
||||
static void
|
||||
failed_gssrequest() {
|
||||
failed_gssrequest(void) {
|
||||
seenerror = true;
|
||||
|
||||
dns_name_free(&tmpzonename, gmctx);
|
||||
@ -3199,7 +3208,7 @@ done:
|
||||
dns_message_destroy(&rcvmsg);
|
||||
ddebug("Out of recvgss");
|
||||
}
|
||||
#endif /* ifdef GSSAPI */
|
||||
#endif /* HAVE_GSSAPI */
|
||||
|
||||
static void
|
||||
start_update(void) {
|
||||
@ -3298,7 +3307,7 @@ cleanup(void) {
|
||||
dns_message_destroy(&answer);
|
||||
}
|
||||
|
||||
#ifdef GSSAPI
|
||||
#if HAVE_GSSAPI
|
||||
if (tsigkey != NULL) {
|
||||
ddebug("detach tsigkey x%p", tsigkey);
|
||||
dns_tsigkey_detach(&tsigkey);
|
||||
@ -3321,7 +3330,7 @@ cleanup(void) {
|
||||
if (dns_name_dynamic(&restart_master)) {
|
||||
dns_name_free(&restart_master, gmctx);
|
||||
}
|
||||
#endif /* ifdef GSSAPI */
|
||||
#endif /* HAVE_GSSAPI */
|
||||
|
||||
if (sig0key != NULL) {
|
||||
dst_key_free(&sig0key);
|
||||
|
13
bin/pkcs11/Makefile.am
Normal file
13
bin/pkcs11/Makefile.am
Normal file
@ -0,0 +1,13 @@
|
||||
include $(top_srcdir)/Makefile.top
|
||||
|
||||
AM_CPPFLAGS += \
|
||||
$(LIBISC_CFLAGS)
|
||||
|
||||
LDADD = \
|
||||
$(LIBISC_LIBS)
|
||||
|
||||
bin_PROGRAMS = \
|
||||
pkcs11-list \
|
||||
pkcs11-destroy \
|
||||
pkcs11-keygen \
|
||||
pkcs11-tokens
|
12
bin/plugins/Makefile.am
Normal file
12
bin/plugins/Makefile.am
Normal file
@ -0,0 +1,12 @@
|
||||
include $(top_srcdir)/Makefile.top
|
||||
|
||||
AM_CPPFLAGS += \
|
||||
$(LIBISC_CFLAGS) \
|
||||
$(LIBDNS_CFLAGS) \
|
||||
$(LIBNS_CFLAGS) \
|
||||
$(LIBISCCFG_CFLAGS)
|
||||
|
||||
pkglib_LTLIBRARIES = filter-aaaa.la
|
||||
|
||||
filter_aaaa_la_SOURCES = filter-aaaa.c
|
||||
filter_aaaa_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
|
@ -11,6 +11,13 @@
|
||||
|
||||
/*! \file */
|
||||
|
||||
/* aliases for the exported symbols */
|
||||
|
||||
#define plugin_destroy filter_aaaa_LTX_plugin_destroy
|
||||
#define plugin_register filter_aaaa_LTX_plugin_register
|
||||
#define plugin_version filter_aaaa_LTX_plugin_version
|
||||
#define plugin_check filter_aaaa_LTX_plugin_check
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
26
bin/rndc/Makefile.am
Normal file
26
bin/rndc/Makefile.am
Normal file
@ -0,0 +1,26 @@
|
||||
include $(top_srcdir)/Makefile.top
|
||||
|
||||
AM_CPPFLAGS += \
|
||||
$(LIBISC_CFLAGS) \
|
||||
$(LIBDNS_CFLAGS) \
|
||||
$(LIBISCCFG_CFLAGS) \
|
||||
$(LIBISCCC_CFLAGS) \
|
||||
$(LIBBIND9_CFLAGS)
|
||||
|
||||
AM_CPPFLAGS += \
|
||||
-DRNDC_CONFFILE=\"${sysconfdir}/rndc.conf\" \
|
||||
-DRNDC_KEYFILE=\"${sysconfdir}/rndc.key\"
|
||||
|
||||
sbin_PROGRAMS = rndc
|
||||
|
||||
rndc_SOURCES = \
|
||||
rndc.c \
|
||||
util.c \
|
||||
util.h
|
||||
|
||||
rndc_LDADD = \
|
||||
$(LIBISC_LIBS) \
|
||||
$(LIBDNS_LIBS) \
|
||||
$(LIBISCCC_LIBS) \
|
||||
$(LIBISCCFG_LIBS) \
|
||||
$(LIBBIND9_LIBS)
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include <isc/app.h>
|
||||
#include <isc/atomic.h>
|
||||
#include <isc/attributes.h>
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/file.h>
|
||||
@ -59,7 +60,7 @@ bool verbose;
|
||||
|
||||
static const char *admin_conffile;
|
||||
static const char *admin_keyfile;
|
||||
static const char *version = VERSION;
|
||||
static const char *version = PACKAGE_VERSION;
|
||||
static const char *servername = NULL;
|
||||
static isc_sockaddr_t serveraddrs[SERVERADDRS];
|
||||
static isc_sockaddr_t local4, local6;
|
||||
@ -89,8 +90,8 @@ static bool showresult = false;
|
||||
static void
|
||||
rndc_startconnect(isc_sockaddr_t *addr, isc_task_t *task);
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
usage(int status) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_NORETURN static void
|
||||
usage(int status);
|
||||
|
||||
static void
|
||||
usage(int status) {
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include <isc/attributes.h>
|
||||
#include <isc/formatcheck.h>
|
||||
#include <isc/lang.h>
|
||||
#include <isc/platform.h>
|
||||
@ -35,9 +36,8 @@ ISC_LANG_BEGINDECLS
|
||||
void
|
||||
notify(const char *fmt, ...) ISC_FORMAT_PRINTF(1, 2);
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE void
|
||||
fatal(const char *format, ...)
|
||||
ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST;
|
||||
ISC_NORETURN void
|
||||
fatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
|
||||
|
||||
ISC_LANG_ENDDECLS
|
||||
|
||||
|
1
bin/tests/.gitignore
vendored
1
bin/tests/.gitignore
vendored
@ -9,4 +9,3 @@ dlopen
|
||||
keycreate
|
||||
keydelete
|
||||
gssapi_krb
|
||||
makejournal
|
||||
|
1
bin/tests/Makefile.am
Normal file
1
bin/tests/Makefile.am
Normal file
@ -0,0 +1 @@
|
||||
SUBDIRS = system
|
@ -1,18 +0,0 @@
|
||||
Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
|
||||
See COPYRIGHT in the source root or http://isc.org/copyright.html for terms.
|
||||
|
||||
bash buildzones.sh < zones # creates setup, run, servers/* master/*
|
||||
# named.conf
|
||||
sudo sh setup # configure interfaces
|
||||
sh run # setup
|
||||
|
||||
../named/named [-g] -c named.conf
|
||||
|
||||
sh tests.sh < zones
|
||||
|
||||
sudo sh teardown # teardown interfaces
|
||||
|
||||
The test server can controlled with
|
||||
|
||||
rndc -k rndc.key -s 127.127.0.0 -p 5300
|
@ -1,267 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
# See the COPYRIGHT file distributed with this work for additional
|
||||
# information regarding copyright ownership.
|
||||
|
||||
SYSTEMTESTTOP=..
|
||||
. ../conf.sh
|
||||
|
||||
addr=127.127.0.0
|
||||
ttl=300
|
||||
named=${NAMED}
|
||||
keygen=${KEYGEN}
|
||||
dsfromkey=${DSFROMKEY}
|
||||
|
||||
nextaddr() {
|
||||
OLDIF="$IFS"
|
||||
IFS="${IFS}."
|
||||
set $1
|
||||
IFS="$OLDIFS"
|
||||
_a=$1 _b=$2 _c=$3 _d=$4
|
||||
_d=$(($_d + 1))
|
||||
case $_d in
|
||||
256) _c=$(($_c + 1)); _d=0;;
|
||||
esac
|
||||
case $_c in
|
||||
256) _b=$(($_b + 1)); _c=0;;
|
||||
esac
|
||||
echo $_a.$_b.$_c.$_d
|
||||
}
|
||||
|
||||
parent() {
|
||||
OLDIF="$IFS"
|
||||
IFS="${IFS}."
|
||||
set $1
|
||||
IFS="$OLDIFS"
|
||||
shift
|
||||
while [ $# -ne 0 ]
|
||||
do
|
||||
printf %s ${1}
|
||||
shift
|
||||
printf %s ${1:+.}
|
||||
|
||||
done
|
||||
}
|
||||
|
||||
blackhole() {
|
||||
echo 'options {'
|
||||
echo ' port 5300;'
|
||||
echo " listen-on { $1; };"
|
||||
echo " query-source $1;"
|
||||
echo " notify-source $1;"
|
||||
echo " transfer-source $1;"
|
||||
echo ' key-directory "keys";'
|
||||
echo " recursion ${2:-no};"
|
||||
echo ' pid-file "pids/'"${addr}"'.pid";'
|
||||
echo ' blackhole { 127.127.0.0; };'
|
||||
echo '};'
|
||||
}
|
||||
|
||||
refuse() {
|
||||
echo 'options {'
|
||||
echo ' port 5300;'
|
||||
echo " listen-on { $1; };"
|
||||
echo " query-source $1;"
|
||||
echo " notify-source $1;"
|
||||
echo " transfer-source $1;"
|
||||
echo ' key-directory "keys";'
|
||||
echo " recursion ${2:-no};"
|
||||
echo ' pid-file "pids/'"${addr}"'.pid";'
|
||||
echo ' allow-query { !127.127.0.0; any; };'
|
||||
echo '};'
|
||||
}
|
||||
|
||||
options() {
|
||||
echo 'options {'
|
||||
echo ' port 5300;'
|
||||
echo " listen-on { $1; };"
|
||||
echo " query-source $1;"
|
||||
echo " notify-source $1;"
|
||||
echo " transfer-source $1;"
|
||||
echo ' key-directory "keys";'
|
||||
echo " recursion ${2:-no};"
|
||||
echo ' pid-file "pids/'"${addr}"'.pid";'
|
||||
echo '};'
|
||||
}
|
||||
|
||||
controls() {
|
||||
echo 'include "rndc.key";'
|
||||
echo "controls { inet $addr port 9953 allow { any; } keys { "rndc-key"; }; };"
|
||||
}
|
||||
|
||||
delay() {
|
||||
_s=$1
|
||||
OLDIF="$IFS"
|
||||
IFS="${IFS}/"
|
||||
set ${2:-.}
|
||||
IFS="$OLDIFS"
|
||||
|
||||
case $1 in
|
||||
.) _d=;;
|
||||
*) _d=$1;;
|
||||
esac
|
||||
case $_s in
|
||||
1) echo -T delay=${_d:-100};;
|
||||
2) echo -T delay=${2:-50};;
|
||||
3) echo -T delay=${3:-150};;
|
||||
4) echo -T delay=${4:-250};;
|
||||
5) echo -T delay=${5:-125};;
|
||||
6) echo -T delay=${6:-25};;
|
||||
7) echo -T delay=${7:-75};;
|
||||
8) echo -T delay=${8:-125};;
|
||||
9) echo -T delay=${9:-10};;
|
||||
10) echo -T delay=${10:-40};;
|
||||
11) echo -T delay=${11:-80};;
|
||||
12) echo -T delay=${12:-90};;
|
||||
*) echo -T delay=50;;
|
||||
esac
|
||||
}
|
||||
|
||||
trusted-keys () {
|
||||
awk '$3 == "DNSKEY" {
|
||||
b = ""; for (i=7; i <= NF; i++) { b = b $i; };
|
||||
print "trusted-keys { \""$1"\"",$4,$5,$6,"\""b"\"; };" };'
|
||||
}
|
||||
|
||||
signed-zone () {
|
||||
echo "zone "'"'"${1:-.}"'"'" {"
|
||||
echo " type master;"
|
||||
echo " file "'"'"master/${2}.db"'"'";"
|
||||
echo " auto-dnssec maintain;"
|
||||
echo " allow-update { any; };"
|
||||
echo "};"
|
||||
}
|
||||
|
||||
unsigned-zone () {
|
||||
echo "zone "'"'"${1:-.}"'"'" {"
|
||||
echo " type master;"
|
||||
echo " file "'"'"master/${2}.db"'"'";"
|
||||
echo "};"
|
||||
}
|
||||
|
||||
slave-zone () {
|
||||
echo "zone "'"'"${zone:-.}"'"'" {"
|
||||
echo " type slave;"
|
||||
echo " masters { ${master}; };"
|
||||
echo "};"
|
||||
}
|
||||
|
||||
rm -rf servers master keys setup teardown run
|
||||
mkdir -p servers
|
||||
mkdir -p master
|
||||
mkdir -p keys
|
||||
|
||||
echo "ifconfig lo0 $addr netmask 0xffffffff alias" >> setup
|
||||
echo "ifconfig lo0 $addr -alias" >> teardown
|
||||
controls $addr > named.conf
|
||||
options $addr yes >> named.conf
|
||||
echo 'zone "." { type hint; file "master/hint.db"; };' >> named.conf
|
||||
|
||||
while read zone servers nsfmt signed delay blackhole refuse flags
|
||||
do
|
||||
i=1
|
||||
case "${zone}" in
|
||||
.) file=root zone=;;
|
||||
*) file="$zone";;
|
||||
esac
|
||||
if [ "${zone}" != "" ] ; then
|
||||
p=$(parent $zone)
|
||||
case "${p}" in
|
||||
"") p=root;;
|
||||
esac
|
||||
else
|
||||
p=hint
|
||||
fi
|
||||
#echo "zone='${zone}' parent='${p}'"
|
||||
addr=$(nextaddr $addr)
|
||||
ns=$(printf "$nsfmt" ${i} "${zone}")
|
||||
d=$(delay $i ${delay:-.})
|
||||
|
||||
echo "${zone}. ${ttl} soa ${ns}. hostmaster.${zone}${zone:+.} 1 3600 1200 604800 1200" >> master/${file}.db
|
||||
echo "${zone}. ${ttl} ns ${ns}." >> master/${file}.db
|
||||
echo "${ns}. ${ttl} a ${addr}" >> master/${file}.db
|
||||
echo "${zone}. ${ttl} ns ${ns}." >> master/${p}.db
|
||||
echo "${ns}. ${ttl} a ${addr}" >> master/${p}.db
|
||||
if [ $signed = "S" ]; then
|
||||
kskkey=`${keygen} -K keys -f KSK ${zone:-.}`
|
||||
zskkey=`${keygen} -K keys ${zone:-.}`
|
||||
if [ "${zone}" != "" ] ; then
|
||||
${dsfromkey} -T ${ttl} keys/${kskkey}.key >> master/${p}.db
|
||||
else
|
||||
trusted-keys < keys/${kskkey}.key >> named.conf
|
||||
fi
|
||||
fi
|
||||
echo "ifconfig lo0 $addr netmask 0xffffffff alias" >> setup
|
||||
echo "ifconfig lo0 $addr -alias" >> teardown
|
||||
echo "${named} -D bigtest -c servers/${addr}.conf $d $flags" >> run
|
||||
options ${addr} > servers/${addr}.conf
|
||||
case ${signed} in
|
||||
S) signed-zone ${zone:-.} ${file} >> servers/${addr}.conf;;
|
||||
P) unsigned-zone ${zone:-.} ${file} >> servers/${addr}.conf;;
|
||||
*) echo ${signed}; exit 1;;
|
||||
esac
|
||||
|
||||
# slave servers
|
||||
while [ $i -lt $servers ]
|
||||
do
|
||||
master=$addr
|
||||
i=$(($i + 1))
|
||||
ns=$(printf "$nsfmt" ${i} "${zone}")
|
||||
d=$(delay $i ${delay:-.})
|
||||
addr=$(nextaddr $addr)
|
||||
echo "${zone}. ${ttl} ns ${ns}." >> master/${file}.db
|
||||
echo "${ns}. ${ttl} a ${addr}" >> master/${file}.db
|
||||
echo "${zone}. ${ttl} ns ${ns}." >> master/${p}.db
|
||||
echo "${ns}. ${ttl} a ${addr}" >> master/${p}.db
|
||||
echo "ifconfig lo0 $addr netmask 0xffffffff alias" >> setup
|
||||
echo "ifconfig lo0 $addr -alias" >> teardown
|
||||
echo "${named} -D bigtest -c servers/${addr}.conf $d $flags" >> run
|
||||
if [ $i = ${refuse:-.} ]
|
||||
then
|
||||
refuse $addr > servers/${addr}.conf
|
||||
elif [ $i = ${blackhole:-.} ]
|
||||
then
|
||||
blackhole $addr > servers/${addr}.conf
|
||||
else
|
||||
options $addr > servers/${addr}.conf
|
||||
fi
|
||||
slave-zone ${zone:-.} ${master} >> servers/${addr}.conf
|
||||
done
|
||||
if [ "${zone}" != "" ] ; then
|
||||
echo "www.${zone}. ${ttl} a 127.0.0.1" >> master/${file}.db
|
||||
echo "www.${zone}. ${ttl} aaaa ::1" >> master/${file}.db
|
||||
echo "${zone}. ${ttl} mx 10 mail.${zone}." >> master/${file}.db
|
||||
echo "mail.${zone}. ${ttl} a 127.0.0.1" >> master/${file}.db
|
||||
echo "mail.${zone}. ${ttl} aaaa ::1" >> master/${file}.db
|
||||
echo "*.big.${zone}. ${ttl} txt (" >> master/${file}.db
|
||||
i=0
|
||||
while [ $i -lt 150 ]
|
||||
do
|
||||
echo "1234567890" >> master/${file}.db
|
||||
i=$(($i + 1))
|
||||
done
|
||||
echo ")" >> master/${file}.db
|
||||
echo "*.medium.${zone}. ${ttl} txt (" >> master/${file}.db
|
||||
i=0
|
||||
while [ $i -lt 120 ]
|
||||
do
|
||||
echo "1234567890" >> master/${file}.db
|
||||
i=$(($i + 1))
|
||||
done
|
||||
echo ")" >> master/${file}.db
|
||||
echo "*.medium.${zone}. ${ttl} txt (" >> master/${file}.db
|
||||
i=0
|
||||
while [ $i -lt 120 ]
|
||||
do
|
||||
echo "1234567890" >> master/${file}.db
|
||||
i=$(($i + 1))
|
||||
done
|
||||
echo ")" >> master/${file}.db
|
||||
fi
|
||||
done
|
@ -1,5 +0,0 @@
|
||||
key "rndc-key" {
|
||||
algorithm hmac-md5;
|
||||
secret "xxxxxxxxxxxxxxxxxxxxHg==";
|
||||
};
|
||||
|
@ -1,76 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
# See the COPYRIGHT file distributed with this work for additional
|
||||
# information regarding copyright ownership.
|
||||
|
||||
TOP=$( (cd ../../.. && pwd) )
|
||||
dig=${TOP}/bin/dig/dig
|
||||
|
||||
cmd="${dig} -p 5300 @127.127.0.0 txt"
|
||||
inner() {
|
||||
zone=$1 i=$2 to=$3
|
||||
x=$i
|
||||
dout=dig$x.out
|
||||
tout=time$x.out
|
||||
while [ $i -lt $to ]
|
||||
do
|
||||
case $zone in
|
||||
.) zone=;;
|
||||
esac
|
||||
|
||||
(time -p $cmd $i.${sub}$zone > $dout ) 2> $tout
|
||||
s=`sed -n '/real/s/[^0-9]*\([0-9]*\)\..*/\1/p' $tout`
|
||||
case $s in
|
||||
0);;
|
||||
1) t1=`expr ${t1:-0} + 1`;;
|
||||
2) t2=`expr ${t2:-0} + 1`;;
|
||||
3) t3=`expr ${t3:-0} + 1`;;
|
||||
*) echo $i `grep real $tout`;;
|
||||
esac
|
||||
|
||||
grep "status: \(NXDOMAIN\|NOERROR\)" $dout > /dev/null || {
|
||||
echo $cmd $i.${sub}$zone
|
||||
cat $dout
|
||||
}
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
if test ${t1:-0} -ne 0 -o ${t2:-0} -ne 0 -o ${t3:-0} -ne 0
|
||||
then
|
||||
echo "$x timeouts: t1=${t1:-0} t2=${t2:-0} t3=${t3:-0}"
|
||||
fi
|
||||
}
|
||||
|
||||
while read zone rest
|
||||
do
|
||||
for sub in "" medium. big.
|
||||
do
|
||||
case $zone in
|
||||
.) echo doing ${sub:-.};;
|
||||
*) echo doing $sub$zone;;
|
||||
esac
|
||||
( inner $zone 1 100) &
|
||||
( inner $zone 101 200) &
|
||||
( inner $zone 201 300) &
|
||||
( inner $zone 301 400) &
|
||||
( inner $zone 401 500) &
|
||||
( inner $zone 501 600) &
|
||||
( inner $zone 601 700) &
|
||||
( inner $zone 701 800) &
|
||||
( inner $zone 801 900) &
|
||||
( inner $zone 901 1000) &
|
||||
( inner $zone 1001 1100) &
|
||||
( inner $zone 1101 1200) &
|
||||
( inner $zone 1201 1300) &
|
||||
( inner $zone 1301 1400) &
|
||||
( inner $zone 1401 1500) &
|
||||
( inner $zone 1501 1600) &
|
||||
( inner $zone 1601 1700) &
|
||||
wait
|
||||
done
|
||||
done
|
@ -1,18 +0,0 @@
|
||||
noedns-1.tld 1 ns%u.%s P . x x -T noedns
|
||||
dropedns-1.tld 1 ns%u.%s P . x x -T dropedns
|
||||
maxudp512-1.tld 1 ns%u.%s S . x x -T maxudp=512
|
||||
maxudp1460-1.tld 1 ns%u.%s S . x x -T maxudp=1460
|
||||
plain-1.tld 1 ns%u.%s S . x x
|
||||
noedns-3.tld 3 ns%u.%s P . 2 x -T noedns
|
||||
dropedns-3.tld 3 ns%u.%s P . 2 x -T dropedns
|
||||
maxudp512-3.tld 3 ns%u.%s S . x x -T maxudp=512
|
||||
maxudp1460-3.tld 3 ns%u.%s S . x x -T maxudp=1460
|
||||
plain-3.tld 3 ns%u.%s S . x 3
|
||||
noedns-5.tld 5 ns%u.%s P . 3 x -T noedns
|
||||
dropedns-5.tld 5 ns%u.%s P . x x -T dropedns
|
||||
maxudp512-5.tld 5 ns%u.%s S . x x -T maxudp=512
|
||||
maxudp1460-5.tld 5 ns%u.%s S . x x -T maxudp=1460
|
||||
400ms-1.tld 5 ns%u.%s S 400/400/400/400/400 2 x
|
||||
plain-5.tld 5 ns%u.%s S . x x
|
||||
tld 12 ns%u.%s S . 5 8
|
||||
. 12 ns%u.root-servers.nil%s S . x x
|
3
bin/tests/optional/.gitignore
vendored
3
bin/tests/optional/.gitignore
vendored
@ -1,3 +0,0 @@
|
||||
/backtrace_test.dSYM/
|
||||
/backtrace_test0.dSYM/
|
||||
/nsecify
|
@ -1,5 +0,0 @@
|
||||
; This is a zone-signing key, keyid 33180, for child.example.
|
||||
; Created: 20181025104746 (Thu Oct 25 12:47:46 2018)
|
||||
; Publish: 20181025104746 (Thu Oct 25 12:47:46 2018)
|
||||
; Activate: 20181025104746 (Thu Oct 25 12:47:46 2018)
|
||||
child.example. IN DNSKEY 256 3 5 AwEAAb9eatC8ASzDnRApcZuxyBrvJRANRQjCXQ1FWK+8vEyXV5NIE9Km hKIV2wbq2tLBPfjNQz4BTJ9RmDINf1RayDlt6L+IQV1JCaDaMjd1zU3n SQK18Y7fMu0ww4AMKOnoVRbkIxa3zlA0chImXcfPE0q2AvKBYLzPfkPO cfplAuRkLcGUxdADCipNzCOakpcd5gfm9Sa2HlaXcw3gyI1WcE8=
|
@ -1,13 +0,0 @@
|
||||
Private-key-format: v1.3
|
||||
Algorithm: 5 (RSASHA1)
|
||||
Modulus: v15q0LwBLMOdEClxm7HIGu8lEA1FCMJdDUVYr7y8TJdXk0gT0qaEohXbBura0sE9+M1DPgFMn1GYMg1/VFrIOW3ov4hBXUkJoNoyN3XNTedJArXxjt8y7TDDgAwo6ehVFuQjFrfOUDRyEiZdx88TSrYC8oFgvM9+Q85x+mUC5GQtwZTF0AMKKk3MI5qSlx3mB+b1JrYeVpdzDeDIjVZwTw==
|
||||
PublicExponent: AQAB
|
||||
PrivateExponent: WDsn9GU6BXGLENCK2MX3BLQN2oDDu24hiOTYJu5VwtpkPjuVKCIuNKzu9xmBGnqOIBBDWGsw8KOmEC247yOL/S53iRdBS8lI7yiqznc52RhlmrdPKXbNpVnPwil8wocw+oQYa7uvdPYxI2Yy3B/tRgUxlxSlc/LW/dr0BX2L7qr/aeOBeGSRUlCpc7tYU9a2RUaLpVxF6SlqicCpC91MAQ==
|
||||
Prime1: 466f+JL66Bl4qYnkj0s9+1N3pYmdcM9Ja1AN66X4VLslA9Cm1JEaC5V9HOptfcXUk0XYEVnKeKM2lIQnvcLG0yuQHIa+pGi7P8vgQfdaRUE=
|
||||
Prime2: 1yuUkTVRSbUWeUreEcHgeeBBJ61UshX7t07gnGgIr3artGdo2CVEb5//+2Mvj5bgjCQBvjBbmHNZrR0jKDRBTIGtqbBerOuhEN4AXdAEgY8=
|
||||
Exponent1: KzUXbJ/P973ltR7S/hKEV66WVRbRhvf/cdsGWULs5n+BXcD59/r1W19qF9OxJZ4mYjBt+ZT1pIEsuXB+7jcJbkelGJTFlwO9DTVOgJZFTkE=
|
||||
Exponent2: FTPsLertGbBIiKdB/sn2Dsx0Xy6LXAkihsu1AnSV9oRhIyPVhwcVGVLQ7Lq3YxThB648pbsqK3miapamcj3D+YAF1uTUT4Hgm0LlEll/OC0=
|
||||
Coefficient: Vulw9kmmjKc+wmOukLdzheoA2hNPDVtgiynfzHybyXdqvapCoK+ZVmNFzjO0M41ATcpvya3iX0bekMQqYnBhLURNZUIyqz2nGskOjV8I5Jg=
|
||||
Created: 20181025104746
|
||||
Publish: 20181025104746
|
||||
Activate: 20181025104746
|
@ -1,413 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <isc/app.h>
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/hash.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/socket.h>
|
||||
#include <isc/task.h>
|
||||
#include <isc/timer.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
#include <dns/adb.h>
|
||||
#include <dns/cache.h>
|
||||
#include <dns/db.h>
|
||||
#include <dns/dispatch.h>
|
||||
#include <dns/log.h>
|
||||
#include <dns/result.h>
|
||||
#include <dns/rootns.h>
|
||||
|
||||
typedef struct client client_t;
|
||||
struct client {
|
||||
dns_name_t name;
|
||||
const char *target;
|
||||
ISC_LINK(client_t) link;
|
||||
dns_adbfind_t *find;
|
||||
};
|
||||
|
||||
static isc_mem_t *mctx = NULL;
|
||||
static isc_mempool_t *cmp;
|
||||
static isc_log_t *lctx;
|
||||
static isc_logconfig_t *lcfg;
|
||||
static isc_taskmgr_t *taskmgr;
|
||||
static isc_socketmgr_t *socketmgr;
|
||||
static isc_timermgr_t *timermgr;
|
||||
static dns_dispatchmgr_t *dispatchmgr;
|
||||
static isc_task_t *t1, *t2;
|
||||
static dns_view_t *view;
|
||||
static dns_db_t *rootdb;
|
||||
static ISC_LIST(client_t) clients;
|
||||
static isc_mutex_t client_lock;
|
||||
static isc_stdtime_t now;
|
||||
static dns_adb_t *adb;
|
||||
|
||||
static void
|
||||
check_result(isc_result_t result, const char *format, ...)
|
||||
ISC_FORMAT_PRINTF(2, 3);
|
||||
|
||||
static void
|
||||
check_result(isc_result_t result, const char *format, ...) {
|
||||
va_list args;
|
||||
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
va_start(args, format);
|
||||
vfprintf(stderr, format, args);
|
||||
va_end(args);
|
||||
fprintf(stderr, ": %s\n", isc_result_totext(result));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static client_t *
|
||||
new_client(void) {
|
||||
client_t *client;
|
||||
|
||||
client = isc_mempool_get(cmp);
|
||||
INSIST(client != NULL);
|
||||
dns_name_init(&client->name, NULL);
|
||||
ISC_LINK_INIT(client, link);
|
||||
client->find = NULL;
|
||||
|
||||
return (client);
|
||||
}
|
||||
|
||||
static void
|
||||
free_client(client_t **c) {
|
||||
client_t *client;
|
||||
|
||||
INSIST(c != NULL);
|
||||
client = *c;
|
||||
*c = NULL;
|
||||
INSIST(client != NULL);
|
||||
dns_name_free(&client->name, mctx);
|
||||
INSIST(!ISC_LINK_LINKED(client, link));
|
||||
INSIST(client->find == NULL);
|
||||
|
||||
isc_mempool_put(cmp, client);
|
||||
}
|
||||
|
||||
static inline void
|
||||
CLOCK(void) {
|
||||
RUNTIME_CHECK(isc_mutex_lock(&client_lock) == ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static inline void
|
||||
CUNLOCK(void) {
|
||||
RUNTIME_CHECK(isc_mutex_unlock(&client_lock) == ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static void
|
||||
lookup_callback(isc_task_t *task, isc_event_t *ev) {
|
||||
client_t *client;
|
||||
|
||||
client = ev->ev_arg;
|
||||
INSIST(client->find == ev->ev_sender);
|
||||
|
||||
printf("NAME %s:\n\tTask %p got event %p type %08x from %p, client "
|
||||
"%p\n\terr4: %s err6: %s\n",
|
||||
client->target, task, ev, ev->ev_type, client->find, client,
|
||||
isc_result_totext(client->find->result_v4),
|
||||
isc_result_totext(client->find->result_v6));
|
||||
|
||||
isc_event_free(&ev);
|
||||
ev = NULL;
|
||||
|
||||
CLOCK();
|
||||
|
||||
dns_adb_dumpfind(client->find, stderr);
|
||||
dns_adb_destroyfind(&client->find);
|
||||
|
||||
ISC_LIST_UNLINK(clients, client, link);
|
||||
free_client(&client);
|
||||
|
||||
CUNLOCK();
|
||||
}
|
||||
|
||||
static void
|
||||
create_managers(void) {
|
||||
isc_result_t result;
|
||||
|
||||
taskmgr = NULL;
|
||||
result = isc_taskmgr_create(mctx, 5, 0, NULL, &taskmgr);
|
||||
check_result(result, "isc_taskmgr_create");
|
||||
|
||||
timermgr = NULL;
|
||||
result = isc_timermgr_create(mctx, &timermgr);
|
||||
check_result(result, "isc_timermgr_create");
|
||||
|
||||
socketmgr = NULL;
|
||||
result = isc_socketmgr_create(mctx, &socketmgr);
|
||||
check_result(result, "isc_socketmgr_create");
|
||||
|
||||
dispatchmgr = NULL;
|
||||
result = dns_dispatchmgr_create(mctx, &dispatchmgr);
|
||||
check_result(result, "dns_dispatchmgr_create");
|
||||
}
|
||||
|
||||
static void
|
||||
create_view(void) {
|
||||
dns_cache_t *cache;
|
||||
isc_result_t result;
|
||||
|
||||
/*
|
||||
* View.
|
||||
*/
|
||||
view = NULL;
|
||||
result = dns_view_create(mctx, dns_rdataclass_in, "_default", &view);
|
||||
check_result(result, "dns_view_create");
|
||||
|
||||
/*
|
||||
* Cache.
|
||||
*/
|
||||
cache = NULL;
|
||||
result = dns_cache_create(mctx, mctx, taskmgr, timermgr,
|
||||
dns_rdataclass_in, "", "rbt", 0, NULL,
|
||||
&cache);
|
||||
check_result(result, "dns_cache_create");
|
||||
dns_view_setcache(view, cache, false);
|
||||
dns_cache_detach(&cache);
|
||||
|
||||
{
|
||||
unsigned int attrs;
|
||||
isc_sockaddr_t any4, any6;
|
||||
dns_dispatch_t *disp4 = NULL;
|
||||
dns_dispatch_t *disp6 = NULL;
|
||||
|
||||
isc_sockaddr_any(&any4);
|
||||
isc_sockaddr_any6(&any6);
|
||||
|
||||
attrs = DNS_DISPATCHATTR_IPV4 | DNS_DISPATCHATTR_UDP;
|
||||
RUNTIME_CHECK(dns_dispatch_getudp(dispatchmgr, socketmgr,
|
||||
taskmgr, &any4, 512, 6, 1024,
|
||||
17, 19, attrs, attrs,
|
||||
&disp4) == ISC_R_SUCCESS);
|
||||
INSIST(disp4 != NULL);
|
||||
|
||||
attrs = DNS_DISPATCHATTR_IPV6 | DNS_DISPATCHATTR_UDP;
|
||||
RUNTIME_CHECK(dns_dispatch_getudp(dispatchmgr, socketmgr,
|
||||
taskmgr, &any6, 512, 6, 1024,
|
||||
17, 19, attrs, attrs,
|
||||
&disp6) == ISC_R_SUCCESS);
|
||||
INSIST(disp6 != NULL);
|
||||
|
||||
RUNTIME_CHECK(dns_view_createresolver(view, taskmgr, 10, 1,
|
||||
socketmgr, timermgr, 0,
|
||||
dispatchmgr, disp4,
|
||||
disp6) == ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
rootdb = NULL;
|
||||
result = dns_rootns_create(mctx, dns_rdataclass_in, NULL, &rootdb);
|
||||
check_result(result, "dns_rootns_create()");
|
||||
dns_view_sethints(view, rootdb);
|
||||
dns_db_detach(&rootdb);
|
||||
|
||||
dns_view_freeze(view);
|
||||
}
|
||||
|
||||
static void
|
||||
lookup(const char *target) {
|
||||
dns_name_t name;
|
||||
unsigned char namedata[256];
|
||||
client_t *client;
|
||||
isc_buffer_t t, namebuf;
|
||||
isc_result_t result;
|
||||
unsigned int options;
|
||||
|
||||
INSIST(target != NULL);
|
||||
|
||||
client = new_client();
|
||||
isc_buffer_constinit(&t, target, strlen(target));
|
||||
isc_buffer_add(&t, strlen(target));
|
||||
isc_buffer_init(&namebuf, namedata, sizeof(namedata));
|
||||
dns_name_init(&name, NULL);
|
||||
result = dns_name_fromtext(&name, &t, dns_rootname, 0, &namebuf);
|
||||
check_result(result, "dns_name_fromtext %s", target);
|
||||
|
||||
dns_name_dup(&name, mctx, &client->name);
|
||||
|
||||
options = 0;
|
||||
options |= DNS_ADBFIND_INET;
|
||||
options |= DNS_ADBFIND_INET6;
|
||||
options |= DNS_ADBFIND_WANTEVENT;
|
||||
options |= DNS_ADBFIND_HINTOK;
|
||||
options |= DNS_ADBFIND_GLUEOK;
|
||||
result = dns_adb_createfind(
|
||||
adb, t2, lookup_callback, client, &client->name, dns_rootname,
|
||||
0, options, now, NULL, view->dstport, 0, NULL, &client->find);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
printf("DNS_ADB_CREATEFIND -> %s\n", dns_result_totext(result));
|
||||
}
|
||||
dns_adb_dumpfind(client->find, stderr);
|
||||
|
||||
if ((client->find->options & DNS_ADBFIND_WANTEVENT) != 0) {
|
||||
client->target = target;
|
||||
ISC_LIST_APPEND(clients, client, link);
|
||||
} else {
|
||||
printf("NAME %s: err4 %s, err6 %s\n", target,
|
||||
isc_result_totext(client->find->result_v4),
|
||||
isc_result_totext(client->find->result_v6));
|
||||
|
||||
dns_adb_destroyfind(&client->find);
|
||||
free_client(&client);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv) {
|
||||
isc_result_t result;
|
||||
isc_logdestination_t destination;
|
||||
|
||||
UNUSED(argc);
|
||||
UNUSED(argv);
|
||||
|
||||
dns_result_register();
|
||||
result = isc_app_start();
|
||||
check_result(result, "isc_app_start()");
|
||||
|
||||
isc_stdtime_get(&now);
|
||||
|
||||
isc_mutex_init(&client_lock);
|
||||
|
||||
ISC_LIST_INIT(clients);
|
||||
|
||||
/*
|
||||
* EVERYTHING needs a memory context.
|
||||
*/
|
||||
isc_mem_create(&mctx);
|
||||
|
||||
cmp = NULL;
|
||||
isc_mempool_create(mctx, sizeof(client_t), &cmp);
|
||||
isc_mempool_setname(cmp, "adb test clients");
|
||||
|
||||
isc_log_create(mctx, &lctx, &lcfg);
|
||||
isc_log_setcontext(lctx);
|
||||
dns_log_init(lctx);
|
||||
dns_log_setcontext(lctx);
|
||||
|
||||
/*
|
||||
* Create and install the default channel.
|
||||
*/
|
||||
destination.file.stream = stderr;
|
||||
destination.file.name = NULL;
|
||||
destination.file.versions = ISC_LOG_ROLLNEVER;
|
||||
destination.file.maximum_size = 0;
|
||||
isc_log_createchannel(lcfg, "_default", ISC_LOG_TOFILEDESC,
|
||||
ISC_LOG_DYNAMIC, &destination, ISC_LOG_PRINTTIME);
|
||||
|
||||
result = isc_log_usechannel(lcfg, "_default", NULL, NULL);
|
||||
check_result(result, "isc_log_usechannel()");
|
||||
|
||||
/*
|
||||
* Set the initial debug level.
|
||||
*/
|
||||
isc_log_setdebuglevel(lctx, 2);
|
||||
|
||||
create_managers();
|
||||
|
||||
t1 = NULL;
|
||||
result = isc_task_create(taskmgr, 0, &t1);
|
||||
check_result(result, "isc_task_create t1");
|
||||
t2 = NULL;
|
||||
result = isc_task_create(taskmgr, 0, &t2);
|
||||
check_result(result, "isc_task_create t2");
|
||||
|
||||
printf("task 1 = %p\n", t1);
|
||||
printf("task 2 = %p\n", t2);
|
||||
|
||||
create_view();
|
||||
|
||||
adb = view->adb;
|
||||
|
||||
/*
|
||||
* Lock the entire client list here. This will cause all events
|
||||
* for found names to block as well.
|
||||
*/
|
||||
CLOCK();
|
||||
lookup("f.root-servers.net."); /* Should be in hints */
|
||||
lookup("www.iengines.com"); /* should fetch */
|
||||
lookup("www.isc.org"); /* should fetch */
|
||||
lookup("www.flame.org"); /* should fetch */
|
||||
lookup("kechara.flame.org."); /* should fetch */
|
||||
lookup("moghedien.flame.org."); /* should fetch */
|
||||
lookup("mailrelay.flame.org."); /* should fetch */
|
||||
lookup("ipv4v6.flame.org."); /* should fetch */
|
||||
lookup("nonexistent.flame.org."); /* should fail to be found */
|
||||
lookup("foobar.badns.flame.org."); /* should fail utterly (NS) */
|
||||
lookup("i.root-servers.net."); /* Should be in hints */
|
||||
lookup("www.firstcard.com.");
|
||||
lookup("dns04.flame.org.");
|
||||
CUNLOCK();
|
||||
|
||||
sleep(10);
|
||||
|
||||
dns_adb_dump(adb, stderr);
|
||||
|
||||
sleep(10);
|
||||
|
||||
CLOCK();
|
||||
lookup("f.root-servers.net."); /* Should be in hints */
|
||||
lookup("www.iengines.com"); /* should fetch */
|
||||
lookup("www.isc.org"); /* should fetch */
|
||||
lookup("www.flame.org"); /* should fetch */
|
||||
lookup("kechara.flame.org."); /* should fetch */
|
||||
lookup("moghedien.flame.org."); /* should fetch */
|
||||
lookup("mailrelay.flame.org."); /* should fetch */
|
||||
lookup("ipv4v6.flame.org."); /* should fetch */
|
||||
lookup("nonexistent.flame.org."); /* should fail to be found */
|
||||
lookup("foobar.badns.flame.org."); /* should fail utterly (NS) */
|
||||
lookup("i.root-servers.net."); /* Should be in hints */
|
||||
CUNLOCK();
|
||||
|
||||
sleep(20);
|
||||
|
||||
dns_adb_dump(adb, stderr);
|
||||
|
||||
isc_task_detach(&t1);
|
||||
isc_task_detach(&t2);
|
||||
|
||||
isc_mem_stats(mctx, stdout);
|
||||
dns_adb_dump(adb, stderr);
|
||||
|
||||
isc_app_run();
|
||||
|
||||
dns_adb_dump(adb, stderr);
|
||||
|
||||
dns_view_detach(&view);
|
||||
adb = NULL;
|
||||
|
||||
fprintf(stderr, "Destroying socket manager\n");
|
||||
isc_socketmgr_destroy(&socketmgr);
|
||||
fprintf(stderr, "Destroying timer manager\n");
|
||||
isc_timermgr_destroy(&timermgr);
|
||||
|
||||
fprintf(stderr, "Destroying task manager\n");
|
||||
isc_taskmgr_destroy(&taskmgr);
|
||||
|
||||
isc_log_destroy(&lctx);
|
||||
|
||||
isc_mempool_destroy(&cmp);
|
||||
isc_mem_stats(mctx, stdout);
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
isc_app_finish();
|
||||
|
||||
return (0);
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <isc/backtrace.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/result.h>
|
||||
|
||||
static int
|
||||
func3() {
|
||||
void *tracebuf[16];
|
||||
int nframes;
|
||||
isc_result_t result;
|
||||
|
||||
result = isc_backtrace_gettrace(tracebuf, 16, &nframes);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
printf("isc_backtrace_gettrace failed: %s\n",
|
||||
isc_result_totext(result));
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (nframes < 4) {
|
||||
printf("Unexpected result:\n");
|
||||
printf(" # of frames: %d (expected: at least 4)\n", nframes);
|
||||
return (1);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
func2() {
|
||||
return (func3());
|
||||
}
|
||||
|
||||
static int
|
||||
func1() {
|
||||
return (func2());
|
||||
}
|
||||
|
||||
int
|
||||
main() {
|
||||
return (func1());
|
||||
}
|
@ -1,252 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
/*! \file
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <isc/app.h>
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/netaddr.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/task.h>
|
||||
#include <isc/timer.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
#include <dns/byaddr.h>
|
||||
#include <dns/cache.h>
|
||||
#include <dns/dispatch.h>
|
||||
#include <dns/events.h>
|
||||
#include <dns/forward.h>
|
||||
#include <dns/resolver.h>
|
||||
#include <dns/result.h>
|
||||
#include <dns/view.h>
|
||||
|
||||
static void
|
||||
done(isc_task_t *task, isc_event_t *event) {
|
||||
dns_byaddrevent_t *bevent;
|
||||
dns_byaddr_t *byaddr;
|
||||
dns_name_t *name;
|
||||
|
||||
REQUIRE(event->ev_type == DNS_EVENT_BYADDRDONE);
|
||||
bevent = (dns_byaddrevent_t *)event;
|
||||
|
||||
UNUSED(task);
|
||||
|
||||
printf("byaddr event result = %s\n", isc_result_totext(bevent->result));
|
||||
|
||||
if (bevent->result == ISC_R_SUCCESS) {
|
||||
for (name = ISC_LIST_HEAD(bevent->names); name != NULL;
|
||||
name = ISC_LIST_NEXT(name, link))
|
||||
{
|
||||
char text[DNS_NAME_FORMATSIZE];
|
||||
dns_name_format(name, text, sizeof(text));
|
||||
printf("%s\n", text);
|
||||
}
|
||||
}
|
||||
|
||||
byaddr = event->ev_sender;
|
||||
dns_byaddr_destroy(&byaddr);
|
||||
isc_event_free(&event);
|
||||
|
||||
isc_app_shutdown();
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[]) {
|
||||
isc_mem_t *mctx;
|
||||
bool verbose = false;
|
||||
unsigned int workers = 2;
|
||||
isc_taskmgr_t *taskmgr;
|
||||
isc_task_t *task;
|
||||
isc_timermgr_t *timermgr;
|
||||
dns_view_t *view;
|
||||
int ch;
|
||||
isc_socketmgr_t *socketmgr;
|
||||
dns_dispatchmgr_t *dispatchmgr;
|
||||
isc_netaddr_t na;
|
||||
dns_byaddr_t *byaddr;
|
||||
isc_result_t result;
|
||||
unsigned int options = 0;
|
||||
dns_cache_t *cache;
|
||||
|
||||
RUNTIME_CHECK(isc_app_start() == ISC_R_SUCCESS);
|
||||
|
||||
dns_result_register();
|
||||
|
||||
mctx = NULL;
|
||||
isc_mem_create(&mctx);
|
||||
|
||||
while ((ch = isc_commandline_parse(argc, argv, "nvw:")) != -1) {
|
||||
switch (ch) {
|
||||
case 'n':
|
||||
/*
|
||||
* We only try nibbles, so do nothing for this option.
|
||||
*/
|
||||
break;
|
||||
case 'v':
|
||||
verbose = true;
|
||||
break;
|
||||
case 'w':
|
||||
workers = (unsigned int)atoi(isc_commandline_argument);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (verbose) {
|
||||
printf("%u workers\n", workers);
|
||||
printf("IPv4: %s\n", isc_result_totext(isc_net_probeipv4()));
|
||||
printf("IPv6: %s\n", isc_result_totext(isc_net_probeipv6()));
|
||||
}
|
||||
|
||||
taskmgr = NULL;
|
||||
RUNTIME_CHECK(isc_taskmgr_create(mctx, workers, 0, NULL, &taskmgr) ==
|
||||
ISC_R_SUCCESS);
|
||||
task = NULL;
|
||||
RUNTIME_CHECK(isc_task_create(taskmgr, 0, &task) == ISC_R_SUCCESS);
|
||||
isc_task_setname(task, "byaddr", NULL);
|
||||
|
||||
dispatchmgr = NULL;
|
||||
RUNTIME_CHECK(dns_dispatchmgr_create(mctx, &dispatchmgr) ==
|
||||
ISC_R_SUCCESS);
|
||||
|
||||
timermgr = NULL;
|
||||
RUNTIME_CHECK(isc_timermgr_create(mctx, &timermgr) == ISC_R_SUCCESS);
|
||||
socketmgr = NULL;
|
||||
RUNTIME_CHECK(isc_socketmgr_create(mctx, &socketmgr) == ISC_R_SUCCESS);
|
||||
|
||||
cache = NULL;
|
||||
RUNTIME_CHECK(dns_cache_create(mctx, mctx, taskmgr, timermgr,
|
||||
dns_rdataclass_in, "", "rbt", 0, NULL,
|
||||
&cache) == ISC_R_SUCCESS);
|
||||
|
||||
view = NULL;
|
||||
RUNTIME_CHECK(dns_view_create(mctx, dns_rdataclass_in, "default",
|
||||
&view) == ISC_R_SUCCESS);
|
||||
|
||||
{
|
||||
unsigned int attrs;
|
||||
dns_dispatch_t *disp4 = NULL;
|
||||
dns_dispatch_t *disp6 = NULL;
|
||||
|
||||
if (isc_net_probeipv4() == ISC_R_SUCCESS) {
|
||||
isc_sockaddr_t any4;
|
||||
|
||||
isc_sockaddr_any(&any4);
|
||||
|
||||
attrs = DNS_DISPATCHATTR_IPV4 | DNS_DISPATCHATTR_UDP;
|
||||
RUNTIME_CHECK(
|
||||
dns_dispatch_getudp(dispatchmgr, socketmgr,
|
||||
taskmgr, &any4, 512, 6,
|
||||
1024, 17, 19, attrs, attrs,
|
||||
&disp4) == ISC_R_SUCCESS);
|
||||
INSIST(disp4 != NULL);
|
||||
}
|
||||
|
||||
if (isc_net_probeipv6() == ISC_R_SUCCESS) {
|
||||
isc_sockaddr_t any6;
|
||||
|
||||
isc_sockaddr_any6(&any6);
|
||||
|
||||
attrs = DNS_DISPATCHATTR_IPV6 | DNS_DISPATCHATTR_UDP;
|
||||
RUNTIME_CHECK(
|
||||
dns_dispatch_getudp(dispatchmgr, socketmgr,
|
||||
taskmgr, &any6, 512, 6,
|
||||
1024, 17, 19, attrs, attrs,
|
||||
&disp6) == ISC_R_SUCCESS);
|
||||
INSIST(disp6 != NULL);
|
||||
}
|
||||
|
||||
RUNTIME_CHECK(dns_view_createresolver(view, taskmgr, 10, 1,
|
||||
socketmgr, timermgr, 0,
|
||||
dispatchmgr, disp4,
|
||||
disp6) == ISC_R_SUCCESS);
|
||||
|
||||
if (disp4 != NULL) {
|
||||
dns_dispatch_detach(&disp4);
|
||||
}
|
||||
if (disp6 != NULL) {
|
||||
dns_dispatch_detach(&disp6);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
struct in_addr ina;
|
||||
isc_sockaddr_t sa;
|
||||
isc_sockaddrlist_t sal;
|
||||
|
||||
ISC_LIST_INIT(sal);
|
||||
ina.s_addr = inet_addr("127.0.0.1");
|
||||
isc_sockaddr_fromin(&sa, &ina, 53);
|
||||
ISC_LIST_APPEND(sal, &sa, link);
|
||||
|
||||
RUNTIME_CHECK(dns_fwdtable_add(view->fwdtable, dns_rootname,
|
||||
&sal, dns_fwdpolicy_only) ==
|
||||
ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
dns_view_setcache(view, cache, false);
|
||||
dns_view_freeze(view);
|
||||
|
||||
dns_cache_detach(&cache);
|
||||
|
||||
printf("address = %s\n", argv[isc_commandline_index]);
|
||||
na.family = AF_INET;
|
||||
if (inet_pton(AF_INET, argv[isc_commandline_index],
|
||||
(char *)&na.type.in) != 1) {
|
||||
na.family = AF_INET6;
|
||||
if (inet_pton(AF_INET6, argv[isc_commandline_index],
|
||||
(char *)&na.type.in6) != 1) {
|
||||
printf("unknown address format\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
result = dns_byaddr_create(mctx, &na, view, options, task, done, NULL,
|
||||
&byaddr);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
printf("dns_byaddr_create() returned %s\n",
|
||||
isc_result_totext(result));
|
||||
RUNTIME_CHECK(0);
|
||||
}
|
||||
|
||||
(void)isc_app_run();
|
||||
|
||||
/*
|
||||
* XXXRTH if we get a control-C before we get to isc_app_run(),
|
||||
* we're in trouble (because we might try to destroy things before
|
||||
* they've been created.
|
||||
*/
|
||||
|
||||
dns_view_detach(&view);
|
||||
|
||||
isc_task_shutdown(task);
|
||||
isc_task_detach(&task);
|
||||
|
||||
dns_dispatchmgr_destroy(&dispatchmgr);
|
||||
|
||||
isc_taskmgr_destroy(&taskmgr);
|
||||
|
||||
isc_socketmgr_destroy(&socketmgr);
|
||||
isc_timermgr_destroy(&timermgr);
|
||||
|
||||
if (verbose) {
|
||||
isc_mem_stats(mctx, stdout);
|
||||
}
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
isc_app_finish();
|
||||
|
||||
return (0);
|
||||
}
|
@ -1,354 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
/*! \file
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <isc/app.h>
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/hash.h>
|
||||
#include <isc/netaddr.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/task.h>
|
||||
#include <isc/timer.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
#include <dns/adb.h>
|
||||
#include <dns/cache.h>
|
||||
#include <dns/dispatch.h>
|
||||
#include <dns/events.h>
|
||||
#include <dns/forward.h>
|
||||
#include <dns/log.h>
|
||||
#include <dns/resolver.h>
|
||||
#include <dns/result.h>
|
||||
|
||||
static isc_mem_t *mctx = NULL;
|
||||
static isc_taskmgr_t *taskmgr;
|
||||
static dns_view_t *view = NULL;
|
||||
static dns_adbfind_t *find = NULL;
|
||||
static isc_task_t *task = NULL;
|
||||
static dns_fixedname_t fixed;
|
||||
static dns_fixedname_t target;
|
||||
static isc_log_t *lctx;
|
||||
static isc_logconfig_t *lcfg;
|
||||
static unsigned int level = 0;
|
||||
|
||||
static void
|
||||
adb_callback(isc_task_t *task, isc_event_t *event);
|
||||
|
||||
static void
|
||||
log_init(void) {
|
||||
isc_logdestination_t destination;
|
||||
unsigned int flags;
|
||||
|
||||
/*
|
||||
* Setup a logging context.
|
||||
*/
|
||||
isc_log_create(mctx, &lctx, &lcfg);
|
||||
isc_log_setcontext(lctx);
|
||||
dns_log_init(lctx);
|
||||
dns_log_setcontext(lctx);
|
||||
|
||||
/*
|
||||
* Create and install the default channel.
|
||||
*/
|
||||
destination.file.stream = stderr;
|
||||
destination.file.name = NULL;
|
||||
destination.file.versions = ISC_LOG_ROLLNEVER;
|
||||
destination.file.maximum_size = 0;
|
||||
flags = ISC_LOG_PRINTTIME;
|
||||
isc_log_createchannel(lcfg, "_default", ISC_LOG_TOFILEDESC,
|
||||
ISC_LOG_DYNAMIC, &destination, flags);
|
||||
|
||||
RUNTIME_CHECK(isc_log_usechannel(lcfg, "_default", NULL, NULL) ==
|
||||
ISC_R_SUCCESS);
|
||||
isc_log_setdebuglevel(lctx, level);
|
||||
}
|
||||
|
||||
static void
|
||||
print_addresses(dns_adbfind_t *adbfind) {
|
||||
dns_adbaddrinfo_t *address;
|
||||
|
||||
for (address = ISC_LIST_HEAD(adbfind->list); address != NULL;
|
||||
address = ISC_LIST_NEXT(address, publink))
|
||||
{
|
||||
isc_netaddr_t netaddr;
|
||||
char text[ISC_NETADDR_FORMATSIZE];
|
||||
isc_netaddr_fromsockaddr(&netaddr, &address->sockaddr);
|
||||
isc_netaddr_format(&netaddr, text, sizeof(text));
|
||||
printf("%s\n", text);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
print_name(dns_name_t *name) {
|
||||
char text[DNS_NAME_FORMATSIZE];
|
||||
|
||||
dns_name_format(name, text, sizeof(text));
|
||||
printf("%s\n", text);
|
||||
}
|
||||
|
||||
static void
|
||||
do_find(bool want_event) {
|
||||
isc_result_t result;
|
||||
bool done = false;
|
||||
unsigned int options;
|
||||
|
||||
options = DNS_ADBFIND_INET | DNS_ADBFIND_INET6;
|
||||
if (want_event) {
|
||||
options |= DNS_ADBFIND_WANTEVENT | DNS_ADBFIND_EMPTYEVENT;
|
||||
}
|
||||
dns_fixedname_init(&target);
|
||||
result = dns_adb_createfind(view->adb, task, adb_callback, NULL,
|
||||
dns_fixedname_name(&fixed), dns_rootname, 0,
|
||||
options, 0, dns_fixedname_name(&target), 0,
|
||||
0, NULL, &find);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
if (!ISC_LIST_EMPTY(find->list)) {
|
||||
/*
|
||||
* We have at least some of the addresses for the
|
||||
* name.
|
||||
*/
|
||||
INSIST((find->options & DNS_ADBFIND_WANTEVENT) == 0);
|
||||
print_addresses(find);
|
||||
done = true;
|
||||
} else {
|
||||
/*
|
||||
* We don't know any of the addresses for this
|
||||
* name.
|
||||
*/
|
||||
if ((find->options & DNS_ADBFIND_WANTEVENT) == 0) {
|
||||
/*
|
||||
* And ADB isn't going to send us any events
|
||||
* either. This query loses.
|
||||
*/
|
||||
done = true;
|
||||
}
|
||||
/*
|
||||
* If the DNS_ADBFIND_WANTEVENT flag was set, we'll
|
||||
* get an event when something happens.
|
||||
*/
|
||||
}
|
||||
} else if (result == DNS_R_ALIAS) {
|
||||
print_name(dns_fixedname_name(&target));
|
||||
done = true;
|
||||
} else {
|
||||
printf("dns_adb_createfind() returned %s\n",
|
||||
isc_result_totext(result));
|
||||
done = true;
|
||||
}
|
||||
|
||||
if (done) {
|
||||
if (find != NULL) {
|
||||
dns_adb_destroyfind(&find);
|
||||
}
|
||||
isc_app_shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
adb_callback(isc_task_t *etask, isc_event_t *event) {
|
||||
unsigned int type = event->ev_type;
|
||||
|
||||
REQUIRE(etask == task);
|
||||
|
||||
isc_event_free(&event);
|
||||
dns_adb_destroyfind(&find);
|
||||
|
||||
if (type == DNS_EVENT_ADBMOREADDRESSES) {
|
||||
do_find(false);
|
||||
} else if (type == DNS_EVENT_ADBNOMOREADDRESSES) {
|
||||
printf("no more addresses\n");
|
||||
isc_app_shutdown();
|
||||
} else {
|
||||
printf("unexpected ADB event type %u\n", type);
|
||||
isc_app_shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
run(isc_task_t *xtask, isc_event_t *event) {
|
||||
UNUSED(xtask);
|
||||
do_find(true);
|
||||
isc_event_free(&event);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[]) {
|
||||
bool verbose = false;
|
||||
unsigned int workers = 2;
|
||||
isc_timermgr_t *timermgr;
|
||||
int ch;
|
||||
isc_socketmgr_t *socketmgr;
|
||||
dns_dispatchmgr_t *dispatchmgr;
|
||||
dns_cache_t *cache;
|
||||
isc_buffer_t b;
|
||||
|
||||
RUNTIME_CHECK(isc_app_start() == ISC_R_SUCCESS);
|
||||
|
||||
dns_result_register();
|
||||
|
||||
mctx = NULL;
|
||||
isc_mem_create(&mctx);
|
||||
|
||||
while ((ch = isc_commandline_parse(argc, argv, "d:vw:")) != -1) {
|
||||
switch (ch) {
|
||||
case 'd':
|
||||
level = (unsigned int)atoi(isc_commandline_argument);
|
||||
break;
|
||||
case 'v':
|
||||
verbose = true;
|
||||
break;
|
||||
case 'w':
|
||||
workers = (unsigned int)atoi(isc_commandline_argument);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
log_init();
|
||||
|
||||
if (verbose) {
|
||||
printf("%u workers\n", workers);
|
||||
printf("IPv4: %s\n", isc_result_totext(isc_net_probeipv4()));
|
||||
printf("IPv6: %s\n", isc_result_totext(isc_net_probeipv6()));
|
||||
}
|
||||
|
||||
taskmgr = NULL;
|
||||
RUNTIME_CHECK(isc_taskmgr_create(mctx, workers, 0, NULL, &taskmgr) ==
|
||||
ISC_R_SUCCESS);
|
||||
task = NULL;
|
||||
RUNTIME_CHECK(isc_task_create(taskmgr, 0, &task) == ISC_R_SUCCESS);
|
||||
isc_task_setname(task, "byname", NULL);
|
||||
|
||||
dispatchmgr = NULL;
|
||||
RUNTIME_CHECK(dns_dispatchmgr_create(mctx, &dispatchmgr) ==
|
||||
ISC_R_SUCCESS);
|
||||
|
||||
timermgr = NULL;
|
||||
RUNTIME_CHECK(isc_timermgr_create(mctx, &timermgr) == ISC_R_SUCCESS);
|
||||
socketmgr = NULL;
|
||||
RUNTIME_CHECK(isc_socketmgr_create(mctx, &socketmgr) == ISC_R_SUCCESS);
|
||||
|
||||
cache = NULL;
|
||||
RUNTIME_CHECK(dns_cache_create(mctx, mctx, taskmgr, timermgr,
|
||||
dns_rdataclass_in, "", "rbt", 0, NULL,
|
||||
&cache) == ISC_R_SUCCESS);
|
||||
|
||||
view = NULL;
|
||||
RUNTIME_CHECK(dns_view_create(mctx, dns_rdataclass_in, "default",
|
||||
&view) == ISC_R_SUCCESS);
|
||||
|
||||
{
|
||||
unsigned int attrs;
|
||||
dns_dispatch_t *disp4 = NULL;
|
||||
dns_dispatch_t *disp6 = NULL;
|
||||
|
||||
if (isc_net_probeipv4() == ISC_R_SUCCESS) {
|
||||
isc_sockaddr_t any4;
|
||||
isc_sockaddr_any(&any4);
|
||||
|
||||
attrs = DNS_DISPATCHATTR_IPV4 | DNS_DISPATCHATTR_UDP;
|
||||
RUNTIME_CHECK(
|
||||
dns_dispatch_getudp(dispatchmgr, socketmgr,
|
||||
taskmgr, &any4, 512, 6,
|
||||
1024, 17, 19, attrs, attrs,
|
||||
&disp4) == ISC_R_SUCCESS);
|
||||
INSIST(disp4 != NULL);
|
||||
}
|
||||
|
||||
if (isc_net_probeipv6() == ISC_R_SUCCESS) {
|
||||
isc_sockaddr_t any6;
|
||||
|
||||
isc_sockaddr_any6(&any6);
|
||||
|
||||
attrs = DNS_DISPATCHATTR_IPV6 | DNS_DISPATCHATTR_UDP;
|
||||
RUNTIME_CHECK(
|
||||
dns_dispatch_getudp(dispatchmgr, socketmgr,
|
||||
taskmgr, &any6, 512, 6,
|
||||
1024, 17, 19, attrs, attrs,
|
||||
&disp6) == ISC_R_SUCCESS);
|
||||
INSIST(disp6 != NULL);
|
||||
}
|
||||
|
||||
RUNTIME_CHECK(dns_view_createresolver(view, taskmgr, 10, 1,
|
||||
socketmgr, timermgr, 0,
|
||||
dispatchmgr, disp4,
|
||||
disp6) == ISC_R_SUCCESS);
|
||||
|
||||
if (disp4 != NULL) {
|
||||
dns_dispatch_detach(&disp4);
|
||||
}
|
||||
if (disp6 != NULL) {
|
||||
dns_dispatch_detach(&disp6);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
struct in_addr ina;
|
||||
isc_sockaddr_t sa;
|
||||
isc_sockaddrlist_t sal;
|
||||
|
||||
ISC_LIST_INIT(sal);
|
||||
ina.s_addr = inet_addr("127.0.0.1");
|
||||
isc_sockaddr_fromin(&sa, &ina, 53);
|
||||
ISC_LIST_APPEND(sal, &sa, link);
|
||||
|
||||
REQUIRE(DNS_VIEW_VALID(view));
|
||||
RUNTIME_CHECK(dns_fwdtable_add(view->fwdtable, dns_rootname,
|
||||
&sal, dns_fwdpolicy_only) ==
|
||||
ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
dns_view_setcache(view, cache, false);
|
||||
dns_view_freeze(view);
|
||||
|
||||
dns_cache_detach(&cache);
|
||||
|
||||
printf("name = %s\n", argv[isc_commandline_index]);
|
||||
isc_buffer_init(&b, argv[isc_commandline_index],
|
||||
strlen(argv[isc_commandline_index]));
|
||||
isc_buffer_add(&b, strlen(argv[isc_commandline_index]));
|
||||
dns_fixedname_init(&fixed);
|
||||
dns_fixedname_init(&target);
|
||||
RUNTIME_CHECK(dns_name_fromtext(dns_fixedname_name(&fixed), &b,
|
||||
dns_rootname, 0,
|
||||
NULL) == ISC_R_SUCCESS);
|
||||
|
||||
RUNTIME_CHECK(isc_app_onrun(mctx, task, run, NULL) == ISC_R_SUCCESS);
|
||||
|
||||
(void)isc_app_run();
|
||||
|
||||
dns_view_detach(&view);
|
||||
isc_task_shutdown(task);
|
||||
isc_task_detach(&task);
|
||||
|
||||
dns_dispatchmgr_destroy(&dispatchmgr);
|
||||
|
||||
isc_taskmgr_destroy(&taskmgr);
|
||||
|
||||
isc_socketmgr_destroy(&socketmgr);
|
||||
isc_timermgr_destroy(&timermgr);
|
||||
|
||||
isc_log_destroy(&lctx);
|
||||
|
||||
if (verbose) {
|
||||
isc_mem_stats(mctx, stdout);
|
||||
}
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
isc_app_finish();
|
||||
|
||||
return (0);
|
||||
}
|
@ -1,978 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
/*! \file
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/log.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/string.h>
|
||||
#include <isc/time.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
#include <dns/db.h>
|
||||
#include <dns/dbiterator.h>
|
||||
#include <dns/dbtable.h>
|
||||
#include <dns/fixedname.h>
|
||||
#include <dns/log.h>
|
||||
#include <dns/rdataset.h>
|
||||
#include <dns/rdatasetiter.h>
|
||||
#include <dns/result.h>
|
||||
|
||||
#define MAXHOLD 100
|
||||
#define MAXVERSIONS 100
|
||||
|
||||
typedef struct dbinfo {
|
||||
dns_db_t *db;
|
||||
dns_dbversion_t *version;
|
||||
dns_dbversion_t *wversion;
|
||||
dns_dbversion_t *rversions[MAXVERSIONS];
|
||||
int rcount;
|
||||
dns_dbnode_t *hold_nodes[MAXHOLD];
|
||||
int hold_count;
|
||||
dns_dbiterator_t *dbiterator;
|
||||
dns_dbversion_t *iversion;
|
||||
int pause_every;
|
||||
bool ascending;
|
||||
ISC_LINK(struct dbinfo) link;
|
||||
} dbinfo;
|
||||
|
||||
static isc_mem_t *mctx = NULL;
|
||||
static char dbtype[128];
|
||||
static dns_dbtable_t *dbtable;
|
||||
static ISC_LIST(dbinfo) dbs;
|
||||
static dbinfo *cache_dbi = NULL;
|
||||
static int pause_every = 0;
|
||||
static bool ascending = true;
|
||||
|
||||
static void
|
||||
print_result(const char *message, isc_result_t result) {
|
||||
if (message == NULL) {
|
||||
message = "";
|
||||
}
|
||||
printf("%s%sresult %08x: %s\n", message, (*message == '\0') ? "" : " ",
|
||||
result, isc_result_totext(result));
|
||||
}
|
||||
|
||||
static void
|
||||
print_rdataset(dns_name_t *name, dns_rdataset_t *rdataset) {
|
||||
isc_buffer_t text;
|
||||
char t[1000];
|
||||
isc_result_t result;
|
||||
isc_region_t r;
|
||||
|
||||
isc_buffer_init(&text, t, sizeof(t));
|
||||
result = dns_rdataset_totext(rdataset, name, false, false, &text);
|
||||
isc_buffer_usedregion(&text, &r);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
printf("%.*s", (int)r.length, (char *)r.base);
|
||||
} else {
|
||||
print_result("", result);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
print_rdatasets(dns_name_t *name, dns_rdatasetiter_t *rdsiter) {
|
||||
isc_result_t result;
|
||||
dns_rdataset_t rdataset;
|
||||
|
||||
dns_rdataset_init(&rdataset);
|
||||
result = dns_rdatasetiter_first(rdsiter);
|
||||
while (result == ISC_R_SUCCESS) {
|
||||
dns_rdatasetiter_current(rdsiter, &rdataset);
|
||||
print_rdataset(name, &rdataset);
|
||||
dns_rdataset_disassociate(&rdataset);
|
||||
result = dns_rdatasetiter_next(rdsiter);
|
||||
}
|
||||
if (result != ISC_R_NOMORE) {
|
||||
print_result("", result);
|
||||
}
|
||||
}
|
||||
|
||||
static dbinfo *
|
||||
select_db(char *origintext) {
|
||||
dns_fixedname_t forigin;
|
||||
dns_name_t *origin;
|
||||
isc_buffer_t source;
|
||||
size_t len;
|
||||
dbinfo *dbi;
|
||||
isc_result_t result;
|
||||
|
||||
if (strcasecmp(origintext, "cache") == 0) {
|
||||
if (cache_dbi == NULL) {
|
||||
printf("the cache does not exist\n");
|
||||
}
|
||||
return (cache_dbi);
|
||||
}
|
||||
len = strlen(origintext);
|
||||
isc_buffer_init(&source, origintext, len);
|
||||
isc_buffer_add(&source, len);
|
||||
origin = dns_fixedname_initname(&forigin);
|
||||
result = dns_name_fromtext(origin, &source, dns_rootname, 0, NULL);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
print_result("bad name", result);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
for (dbi = ISC_LIST_HEAD(dbs); dbi != NULL;
|
||||
dbi = ISC_LIST_NEXT(dbi, link)) {
|
||||
if (dns_name_compare(dns_db_origin(dbi->db), origin) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return (dbi);
|
||||
}
|
||||
|
||||
static void
|
||||
list(dbinfo *dbi, char *seektext) {
|
||||
dns_fixedname_t fname;
|
||||
dns_name_t *name;
|
||||
dns_dbnode_t *node;
|
||||
dns_rdatasetiter_t *rdsiter;
|
||||
isc_result_t result;
|
||||
int i;
|
||||
size_t len;
|
||||
dns_fixedname_t fseekname;
|
||||
dns_name_t *seekname;
|
||||
isc_buffer_t source;
|
||||
|
||||
name = dns_fixedname_initname(&fname);
|
||||
|
||||
if (dbi->dbiterator == NULL) {
|
||||
INSIST(dbi->iversion == NULL);
|
||||
if (dns_db_iszone(dbi->db)) {
|
||||
if (dbi->version != NULL) {
|
||||
dns_db_attachversion(dbi->db, dbi->version,
|
||||
&dbi->iversion);
|
||||
} else {
|
||||
dns_db_currentversion(dbi->db, &dbi->iversion);
|
||||
}
|
||||
}
|
||||
|
||||
result = dns_db_createiterator(dbi->db, 0, &dbi->dbiterator);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
if (seektext != NULL) {
|
||||
len = strlen(seektext);
|
||||
isc_buffer_init(&source, seektext, len);
|
||||
isc_buffer_add(&source, len);
|
||||
seekname = dns_fixedname_initname(&fseekname);
|
||||
result = dns_name_fromtext(
|
||||
seekname, &source,
|
||||
dns_db_origin(dbi->db), 0, NULL);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
result = dns_dbiterator_seek(
|
||||
dbi->dbiterator, seekname);
|
||||
}
|
||||
} else if (dbi->ascending) {
|
||||
result = dns_dbiterator_first(dbi->dbiterator);
|
||||
} else {
|
||||
result = dns_dbiterator_last(dbi->dbiterator);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
result = ISC_R_SUCCESS;
|
||||
}
|
||||
|
||||
node = NULL;
|
||||
rdsiter = NULL;
|
||||
i = 0;
|
||||
while (result == ISC_R_SUCCESS) {
|
||||
result = dns_dbiterator_current(dbi->dbiterator, &node, name);
|
||||
if (result != ISC_R_SUCCESS && result != DNS_R_NEWORIGIN) {
|
||||
break;
|
||||
}
|
||||
result = dns_db_allrdatasets(dbi->db, node, dbi->iversion, 0,
|
||||
&rdsiter);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
dns_db_detachnode(dbi->db, &node);
|
||||
break;
|
||||
}
|
||||
print_rdatasets(name, rdsiter);
|
||||
dns_rdatasetiter_destroy(&rdsiter);
|
||||
dns_db_detachnode(dbi->db, &node);
|
||||
if (dbi->ascending) {
|
||||
result = dns_dbiterator_next(dbi->dbiterator);
|
||||
} else {
|
||||
result = dns_dbiterator_prev(dbi->dbiterator);
|
||||
}
|
||||
i++;
|
||||
if (result == ISC_R_SUCCESS && i == dbi->pause_every) {
|
||||
printf("[more...]\n");
|
||||
result = dns_dbiterator_pause(dbi->dbiterator);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (result != ISC_R_NOMORE) {
|
||||
print_result("", result);
|
||||
}
|
||||
|
||||
dns_dbiterator_destroy(&dbi->dbiterator);
|
||||
if (dbi->iversion != NULL) {
|
||||
dns_db_closeversion(dbi->db, &dbi->iversion, false);
|
||||
}
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
load(const char *filename, const char *origintext, bool cache) {
|
||||
dns_fixedname_t forigin;
|
||||
dns_name_t *origin;
|
||||
isc_result_t result;
|
||||
isc_buffer_t source;
|
||||
size_t len;
|
||||
dbinfo *dbi;
|
||||
unsigned int i;
|
||||
|
||||
dbi = isc_mem_get(mctx, sizeof(*dbi));
|
||||
|
||||
dbi->db = NULL;
|
||||
dbi->version = NULL;
|
||||
dbi->wversion = NULL;
|
||||
for (i = 0; i < MAXVERSIONS; i++) {
|
||||
dbi->rversions[i] = NULL;
|
||||
}
|
||||
dbi->hold_count = 0;
|
||||
for (i = 0; i < MAXHOLD; i++) {
|
||||
dbi->hold_nodes[i] = NULL;
|
||||
}
|
||||
dbi->dbiterator = NULL;
|
||||
dbi->iversion = NULL;
|
||||
dbi->pause_every = pause_every;
|
||||
dbi->ascending = ascending;
|
||||
ISC_LINK_INIT(dbi, link);
|
||||
|
||||
len = strlen(origintext);
|
||||
isc_buffer_constinit(&source, origintext, len);
|
||||
isc_buffer_add(&source, len);
|
||||
origin = dns_fixedname_initname(&forigin);
|
||||
result = dns_name_fromtext(origin, &source, dns_rootname, 0, NULL);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
isc_mem_put(mctx, dbi, sizeof(*dbi));
|
||||
return (result);
|
||||
}
|
||||
|
||||
result = dns_db_create(mctx, dbtype, origin,
|
||||
cache ? dns_dbtype_cache : dns_dbtype_zone,
|
||||
dns_rdataclass_in, 0, NULL, &dbi->db);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
isc_mem_put(mctx, dbi, sizeof(*dbi));
|
||||
return (result);
|
||||
}
|
||||
|
||||
printf("loading %s (%s)\n", filename, origintext);
|
||||
result = dns_db_load(dbi->db, filename, dns_masterformat_text, 0);
|
||||
if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE) {
|
||||
dns_db_detach(&dbi->db);
|
||||
isc_mem_put(mctx, dbi, sizeof(*dbi));
|
||||
return (result);
|
||||
}
|
||||
printf("loaded\n");
|
||||
|
||||
if (cache) {
|
||||
INSIST(cache_dbi == NULL);
|
||||
dns_dbtable_adddefault(dbtable, dbi->db);
|
||||
cache_dbi = dbi;
|
||||
} else {
|
||||
result = dns_dbtable_add(dbtable, dbi->db);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
dns_db_detach(&dbi->db);
|
||||
isc_mem_put(mctx, dbi, sizeof(*dbi));
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
ISC_LIST_APPEND(dbs, dbi, link);
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static void
|
||||
unload_all(void) {
|
||||
dbinfo *dbi, *dbi_next;
|
||||
|
||||
for (dbi = ISC_LIST_HEAD(dbs); dbi != NULL; dbi = dbi_next) {
|
||||
dbi_next = ISC_LIST_NEXT(dbi, link);
|
||||
if (dns_db_iszone(dbi->db)) {
|
||||
dns_dbtable_remove(dbtable, dbi->db);
|
||||
} else {
|
||||
INSIST(dbi == cache_dbi);
|
||||
dns_dbtable_removedefault(dbtable);
|
||||
cache_dbi = NULL;
|
||||
}
|
||||
dns_db_detach(&dbi->db);
|
||||
ISC_LIST_UNLINK(dbs, dbi, link);
|
||||
isc_mem_put(mctx, dbi, sizeof(*dbi));
|
||||
}
|
||||
}
|
||||
|
||||
#define DBI_CHECK(dbi) \
|
||||
if ((dbi) == NULL) { \
|
||||
printf("You must first select a database with !DB\n"); \
|
||||
continue; \
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[]) {
|
||||
dns_db_t *db;
|
||||
dns_dbnode_t *node;
|
||||
isc_result_t result;
|
||||
dns_name_t name;
|
||||
dns_offsets_t offsets;
|
||||
size_t len;
|
||||
isc_buffer_t source, target;
|
||||
char s[1000];
|
||||
char b[255];
|
||||
dns_rdataset_t rdataset, sigrdataset;
|
||||
int ch;
|
||||
dns_rdatatype_t type = 1;
|
||||
bool printnode = false;
|
||||
bool addmode = false;
|
||||
bool delmode = false;
|
||||
bool holdmode = false;
|
||||
bool verbose = false;
|
||||
bool done = false;
|
||||
bool quiet = false;
|
||||
bool time_lookups = false;
|
||||
bool found_as;
|
||||
bool find_zonecut = false;
|
||||
bool noexact_zonecut = false;
|
||||
int i, v;
|
||||
dns_rdatasetiter_t *rdsiter;
|
||||
char t1[256];
|
||||
char t2[256];
|
||||
isc_buffer_t tb1, tb2;
|
||||
isc_region_t r1, r2;
|
||||
dns_fixedname_t foundname;
|
||||
dns_name_t *fname;
|
||||
unsigned int options = 0, zcoptions;
|
||||
isc_time_t start, finish;
|
||||
const char *origintext;
|
||||
dbinfo *dbi;
|
||||
dns_dbversion_t *version;
|
||||
const dns_name_t *origin;
|
||||
dns_trust_t trust = 0;
|
||||
unsigned int addopts;
|
||||
isc_log_t *lctx = NULL;
|
||||
size_t n;
|
||||
|
||||
dns_result_register();
|
||||
|
||||
isc_mem_create(&mctx);
|
||||
RUNTIME_CHECK(dns_dbtable_create(mctx, dns_rdataclass_in, &dbtable) ==
|
||||
ISC_R_SUCCESS);
|
||||
|
||||
snprintf(dbtype, sizeof(dbtype), "rbt");
|
||||
while ((ch = isc_commandline_parse(argc, argv, "c:d:t:z:P:Q:glpqvT")) !=
|
||||
-1) {
|
||||
switch (ch) {
|
||||
case 'c':
|
||||
result = load(isc_commandline_argument, ".", true);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
printf("cache load(%s) %08x: %s\n",
|
||||
isc_commandline_argument, result,
|
||||
isc_result_totext(result));
|
||||
}
|
||||
break;
|
||||
case 'd':
|
||||
n = strlcpy(dbtype, isc_commandline_argument,
|
||||
sizeof(dbtype));
|
||||
if (n >= sizeof(dbtype)) {
|
||||
fprintf(stderr, "bad db type '%s'\n",
|
||||
isc_commandline_argument);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
case 'g':
|
||||
options |= (DNS_DBFIND_GLUEOK |
|
||||
DNS_DBFIND_VALIDATEGLUE);
|
||||
break;
|
||||
case 'l':
|
||||
isc_log_create(mctx, &lctx, NULL);
|
||||
isc_log_setcontext(lctx);
|
||||
dns_log_init(lctx);
|
||||
dns_log_setcontext(lctx);
|
||||
break;
|
||||
case 'q':
|
||||
quiet = true;
|
||||
verbose = false;
|
||||
break;
|
||||
case 'p':
|
||||
printnode = true;
|
||||
break;
|
||||
case 'P':
|
||||
pause_every = atoi(isc_commandline_argument);
|
||||
break;
|
||||
case 't':
|
||||
type = atoi(isc_commandline_argument);
|
||||
break;
|
||||
case 'T':
|
||||
time_lookups = true;
|
||||
break;
|
||||
case 'v':
|
||||
verbose = true;
|
||||
break;
|
||||
case 'z':
|
||||
origintext = strrchr(isc_commandline_argument, '/');
|
||||
if (origintext == NULL) {
|
||||
origintext = isc_commandline_argument;
|
||||
} else {
|
||||
origintext++; /* Skip '/'. */
|
||||
}
|
||||
result = load(isc_commandline_argument, origintext,
|
||||
false);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
printf("zone load(%s) %08x: %s\n",
|
||||
isc_commandline_argument, result,
|
||||
isc_result_totext(result));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
argc -= isc_commandline_index;
|
||||
argv += isc_commandline_index;
|
||||
POST(argv);
|
||||
|
||||
if (argc != 0) {
|
||||
printf("ignoring trailing arguments\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Some final initialization...
|
||||
*/
|
||||
fname = dns_fixedname_initname(&foundname);
|
||||
dbi = NULL;
|
||||
origin = dns_rootname;
|
||||
version = NULL;
|
||||
|
||||
if (time_lookups) {
|
||||
TIME_NOW(&start);
|
||||
}
|
||||
|
||||
while (!done) {
|
||||
if (!quiet) {
|
||||
printf("\n");
|
||||
}
|
||||
if (fgets(s, sizeof(s), stdin) == NULL) {
|
||||
done = true;
|
||||
continue;
|
||||
}
|
||||
len = strlen(s);
|
||||
if (len > 0U && s[len - 1] == '\n') {
|
||||
s[len - 1] = '\0';
|
||||
len--;
|
||||
}
|
||||
if (verbose && dbi != NULL) {
|
||||
if (dbi->wversion != NULL) {
|
||||
printf("future version (%p)\n", dbi->wversion);
|
||||
}
|
||||
for (i = 0; i < dbi->rcount; i++) {
|
||||
if (dbi->rversions[i] != NULL) {
|
||||
printf("open version %d (%p)\n", i,
|
||||
dbi->rversions[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
dns_name_init(&name, offsets);
|
||||
if (strcmp(s, "!R") == 0) {
|
||||
DBI_CHECK(dbi);
|
||||
if (dbi->rcount == MAXVERSIONS) {
|
||||
printf("too many open versions\n");
|
||||
continue;
|
||||
}
|
||||
dns_db_currentversion(dbi->db,
|
||||
&dbi->rversions[dbi->rcount]);
|
||||
printf("opened version %d\n", dbi->rcount);
|
||||
dbi->version = dbi->rversions[dbi->rcount];
|
||||
version = dbi->version;
|
||||
dbi->rcount++;
|
||||
continue;
|
||||
} else if (strcmp(s, "!W") == 0) {
|
||||
DBI_CHECK(dbi);
|
||||
if (dbi->wversion != NULL) {
|
||||
printf("using existing future version\n");
|
||||
dbi->version = dbi->wversion;
|
||||
version = dbi->version;
|
||||
continue;
|
||||
}
|
||||
result = dns_db_newversion(dbi->db, &dbi->wversion);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
print_result("", result);
|
||||
} else {
|
||||
printf("newversion\n");
|
||||
}
|
||||
dbi->version = dbi->wversion;
|
||||
version = dbi->version;
|
||||
continue;
|
||||
} else if (strcmp(s, "!C") == 0) {
|
||||
DBI_CHECK(dbi);
|
||||
addmode = false;
|
||||
delmode = false;
|
||||
if (dbi->version == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (dbi->version == dbi->wversion) {
|
||||
printf("closing future version\n");
|
||||
dbi->wversion = NULL;
|
||||
} else {
|
||||
for (i = 0; i < dbi->rcount; i++) {
|
||||
if (dbi->version == dbi->rversions[i]) {
|
||||
dbi->rversions[i] = NULL;
|
||||
printf("closing open version "
|
||||
"%d\n",
|
||||
i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
dns_db_closeversion(dbi->db, &dbi->version, true);
|
||||
version = NULL;
|
||||
continue;
|
||||
} else if (strcmp(s, "!X") == 0) {
|
||||
DBI_CHECK(dbi);
|
||||
addmode = false;
|
||||
delmode = false;
|
||||
if (dbi->version == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (dbi->version == dbi->wversion) {
|
||||
printf("aborting future version\n");
|
||||
dbi->wversion = NULL;
|
||||
} else {
|
||||
for (i = 0; i < dbi->rcount; i++) {
|
||||
if (dbi->version == dbi->rversions[i]) {
|
||||
dbi->rversions[i] = NULL;
|
||||
printf("closing open version "
|
||||
"%d\n",
|
||||
i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
dns_db_closeversion(dbi->db, &dbi->version, false);
|
||||
version = NULL;
|
||||
continue;
|
||||
} else if (strcmp(s, "!A") == 0) {
|
||||
DBI_CHECK(dbi);
|
||||
delmode = false;
|
||||
if (addmode) {
|
||||
addmode = false;
|
||||
} else {
|
||||
addmode = true;
|
||||
}
|
||||
printf("addmode = %s\n", addmode ? "TRUE" : "FALSE");
|
||||
continue;
|
||||
} else if (strcmp(s, "!D") == 0) {
|
||||
DBI_CHECK(dbi);
|
||||
addmode = false;
|
||||
if (delmode) {
|
||||
delmode = false;
|
||||
} else {
|
||||
delmode = true;
|
||||
}
|
||||
printf("delmode = %s\n", delmode ? "TRUE" : "FALSE");
|
||||
continue;
|
||||
} else if (strcmp(s, "!H") == 0) {
|
||||
DBI_CHECK(dbi);
|
||||
if (holdmode) {
|
||||
holdmode = false;
|
||||
} else {
|
||||
holdmode = true;
|
||||
}
|
||||
printf("holdmode = %s\n", holdmode ? "TRUE" : "FALSE");
|
||||
continue;
|
||||
} else if (strcmp(s, "!HR") == 0) {
|
||||
DBI_CHECK(dbi);
|
||||
for (i = 0; i < dbi->hold_count; i++) {
|
||||
dns_db_detachnode(dbi->db, &dbi->hold_nodes[i]);
|
||||
}
|
||||
dbi->hold_count = 0;
|
||||
holdmode = false;
|
||||
printf("held nodes have been detached\n");
|
||||
continue;
|
||||
} else if (strcmp(s, "!VC") == 0) {
|
||||
DBI_CHECK(dbi);
|
||||
printf("switching to current version\n");
|
||||
dbi->version = NULL;
|
||||
version = NULL;
|
||||
continue;
|
||||
} else if (strstr(s, "!V") == s) {
|
||||
DBI_CHECK(dbi);
|
||||
v = atoi(&s[2]);
|
||||
if (v >= dbi->rcount || v < 0) {
|
||||
printf("unknown open version %d\n", v);
|
||||
continue;
|
||||
}
|
||||
if (dbi->rversions[v] == NULL) {
|
||||
printf("version %d is not open\n", v);
|
||||
continue;
|
||||
}
|
||||
printf("switching to open version %d\n", v);
|
||||
dbi->version = dbi->rversions[v];
|
||||
version = dbi->version;
|
||||
continue;
|
||||
} else if (strstr(s, "!TR") == s) {
|
||||
trust = (unsigned int)atoi(&s[3]);
|
||||
printf("trust level is now %u\n", (unsigned int)trust);
|
||||
continue;
|
||||
} else if (strstr(s, "!T") == s) {
|
||||
type = (unsigned int)atoi(&s[2]);
|
||||
printf("now searching for type %u\n", type);
|
||||
continue;
|
||||
} else if (strcmp(s, "!G") == 0) {
|
||||
if ((options & DNS_DBFIND_GLUEOK) != 0) {
|
||||
options &= ~DNS_DBFIND_GLUEOK;
|
||||
} else {
|
||||
options |= DNS_DBFIND_GLUEOK;
|
||||
}
|
||||
printf("glue ok = %s\n",
|
||||
((options & DNS_DBFIND_GLUEOK) != 0) ? "TRUE"
|
||||
: "FALSE");
|
||||
continue;
|
||||
} else if (strcmp(s, "!GV") == 0) {
|
||||
if ((options & DNS_DBFIND_VALIDATEGLUE) != 0) {
|
||||
options &= ~DNS_DBFIND_VALIDATEGLUE;
|
||||
} else {
|
||||
options |= DNS_DBFIND_VALIDATEGLUE;
|
||||
}
|
||||
printf("validate glue = %s\n",
|
||||
((options & DNS_DBFIND_VALIDATEGLUE) != 0)
|
||||
? "TRUE"
|
||||
: "FALSE");
|
||||
continue;
|
||||
} else if (strcmp(s, "!WC") == 0) {
|
||||
if ((options & DNS_DBFIND_NOWILD) != 0) {
|
||||
options &= ~DNS_DBFIND_NOWILD;
|
||||
} else {
|
||||
options |= DNS_DBFIND_NOWILD;
|
||||
}
|
||||
printf("wildcard matching = %s\n",
|
||||
((options & DNS_DBFIND_NOWILD) == 0) ? "TRUE"
|
||||
: "FALSE");
|
||||
continue;
|
||||
} else if (strstr(s, "!LS ") == s) {
|
||||
DBI_CHECK(dbi);
|
||||
list(dbi, &s[4]);
|
||||
continue;
|
||||
} else if (strcmp(s, "!LS") == 0) {
|
||||
DBI_CHECK(dbi);
|
||||
list(dbi, NULL);
|
||||
continue;
|
||||
} else if (strstr(s, "!DU ") == s) {
|
||||
DBI_CHECK(dbi);
|
||||
result = dns_db_dump(dbi->db, dbi->version, s + 4);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
printf("\n");
|
||||
print_result("", result);
|
||||
}
|
||||
continue;
|
||||
} else if (strcmp(s, "!PN") == 0) {
|
||||
if (printnode) {
|
||||
printnode = false;
|
||||
} else {
|
||||
printnode = true;
|
||||
}
|
||||
printf("printnode = %s\n",
|
||||
printnode ? "TRUE" : "FALSE");
|
||||
continue;
|
||||
} else if (strstr(s, "!P") == s) {
|
||||
DBI_CHECK(dbi);
|
||||
v = atoi(&s[2]);
|
||||
dbi->pause_every = v;
|
||||
continue;
|
||||
} else if (strcmp(s, "!+") == 0) {
|
||||
DBI_CHECK(dbi);
|
||||
dbi->ascending = true;
|
||||
continue;
|
||||
} else if (strcmp(s, "!-") == 0) {
|
||||
DBI_CHECK(dbi);
|
||||
dbi->ascending = false;
|
||||
continue;
|
||||
} else if (strcmp(s, "!DB") == 0) {
|
||||
dbi = NULL;
|
||||
origin = dns_rootname;
|
||||
version = NULL;
|
||||
printf("now searching all databases\n");
|
||||
continue;
|
||||
} else if (strncmp(s, "!DB ", 4) == 0) {
|
||||
dbi = select_db(s + 4);
|
||||
if (dbi != NULL) {
|
||||
db = dbi->db;
|
||||
origin = dns_db_origin(dbi->db);
|
||||
version = dbi->version;
|
||||
addmode = false;
|
||||
delmode = false;
|
||||
holdmode = false;
|
||||
} else {
|
||||
db = NULL;
|
||||
version = NULL;
|
||||
origin = dns_rootname;
|
||||
printf("database not found; "
|
||||
"now searching all databases\n");
|
||||
}
|
||||
continue;
|
||||
} else if (strcmp(s, "!ZC") == 0) {
|
||||
if (find_zonecut) {
|
||||
find_zonecut = false;
|
||||
} else {
|
||||
find_zonecut = true;
|
||||
}
|
||||
printf("find_zonecut = %s\n",
|
||||
find_zonecut ? "TRUE" : "FALSE");
|
||||
continue;
|
||||
} else if (strcmp(s, "!NZ") == 0) {
|
||||
if (noexact_zonecut) {
|
||||
noexact_zonecut = false;
|
||||
} else {
|
||||
noexact_zonecut = true;
|
||||
}
|
||||
printf("noexact_zonecut = %s\n",
|
||||
noexact_zonecut ? "TRUE" : "FALSE");
|
||||
continue;
|
||||
}
|
||||
|
||||
isc_buffer_init(&source, s, len);
|
||||
isc_buffer_add(&source, len);
|
||||
isc_buffer_init(&target, b, sizeof(b));
|
||||
result = dns_name_fromtext(&name, &source, origin, 0, &target);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
print_result("bad name: ", result);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (dbi == NULL) {
|
||||
zcoptions = 0;
|
||||
if (noexact_zonecut) {
|
||||
zcoptions |= DNS_DBTABLEFIND_NOEXACT;
|
||||
}
|
||||
db = NULL;
|
||||
result = dns_dbtable_find(dbtable, &name, zcoptions,
|
||||
&db);
|
||||
if (result != ISC_R_SUCCESS &&
|
||||
result != DNS_R_PARTIALMATCH) {
|
||||
if (!quiet) {
|
||||
printf("\n");
|
||||
print_result("", result);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
isc_buffer_init(&tb1, t1, sizeof(t1));
|
||||
result = dns_name_totext(dns_db_origin(db), false,
|
||||
&tb1);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
printf("\n");
|
||||
print_result("", result);
|
||||
dns_db_detach(&db);
|
||||
continue;
|
||||
}
|
||||
isc_buffer_usedregion(&tb1, &r1);
|
||||
printf("\ndatabase = %.*s (%s)\n", (int)r1.length,
|
||||
r1.base, (dns_db_iszone(db)) ? "zone" : "cache");
|
||||
}
|
||||
node = NULL;
|
||||
dns_rdataset_init(&rdataset);
|
||||
dns_rdataset_init(&sigrdataset);
|
||||
|
||||
if (find_zonecut && dns_db_iscache(db)) {
|
||||
zcoptions = options;
|
||||
if (noexact_zonecut) {
|
||||
zcoptions |= DNS_DBFIND_NOEXACT;
|
||||
}
|
||||
result = dns_db_findzonecut(db, &name, zcoptions, 0,
|
||||
&node, fname, NULL,
|
||||
&rdataset, &sigrdataset);
|
||||
} else {
|
||||
result = dns_db_find(db, &name, version, type, options,
|
||||
0, &node, fname, &rdataset,
|
||||
&sigrdataset);
|
||||
}
|
||||
|
||||
if (!quiet) {
|
||||
if (dbi != NULL) {
|
||||
printf("\n");
|
||||
}
|
||||
print_result("", result);
|
||||
}
|
||||
|
||||
found_as = false;
|
||||
switch (result) {
|
||||
case ISC_R_SUCCESS:
|
||||
case DNS_R_GLUE:
|
||||
case DNS_R_CNAME:
|
||||
case DNS_R_ZONECUT:
|
||||
break;
|
||||
case DNS_R_DNAME:
|
||||
case DNS_R_DELEGATION:
|
||||
found_as = true;
|
||||
break;
|
||||
case DNS_R_NXRRSET:
|
||||
if (dns_rdataset_isassociated(&rdataset)) {
|
||||
break;
|
||||
}
|
||||
if (dbi != NULL) {
|
||||
if (holdmode) {
|
||||
RUNTIME_CHECK(dbi->hold_count <
|
||||
MAXHOLD);
|
||||
dbi->hold_nodes[dbi->hold_count++] =
|
||||
node;
|
||||
node = NULL;
|
||||
} else {
|
||||
dns_db_detachnode(db, &node);
|
||||
}
|
||||
} else {
|
||||
dns_db_detachnode(db, &node);
|
||||
dns_db_detach(&db);
|
||||
}
|
||||
continue;
|
||||
case DNS_R_NXDOMAIN:
|
||||
if (dns_rdataset_isassociated(&rdataset)) {
|
||||
break;
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
if (dbi == NULL) {
|
||||
dns_db_detach(&db);
|
||||
}
|
||||
if (quiet) {
|
||||
print_result("", result);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (found_as && !quiet) {
|
||||
isc_buffer_init(&tb1, t1, sizeof(t1));
|
||||
isc_buffer_init(&tb2, t2, sizeof(t2));
|
||||
result = dns_name_totext(&name, false, &tb1);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
print_result("", result);
|
||||
dns_db_detachnode(db, &node);
|
||||
if (dbi == NULL) {
|
||||
dns_db_detach(&db);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
result = dns_name_totext(fname, false, &tb2);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
print_result("", result);
|
||||
dns_db_detachnode(db, &node);
|
||||
if (dbi == NULL) {
|
||||
dns_db_detach(&db);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
isc_buffer_usedregion(&tb1, &r1);
|
||||
isc_buffer_usedregion(&tb2, &r2);
|
||||
printf("found %.*s as %.*s\n", (int)r1.length, r1.base,
|
||||
(int)r2.length, r2.base);
|
||||
}
|
||||
|
||||
if (printnode) {
|
||||
dns_db_printnode(db, node, stdout);
|
||||
}
|
||||
|
||||
if (!found_as && type == dns_rdatatype_any) {
|
||||
rdsiter = NULL;
|
||||
result = dns_db_allrdatasets(db, node, version, 0,
|
||||
&rdsiter);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
if (!quiet) {
|
||||
print_rdatasets(fname, rdsiter);
|
||||
}
|
||||
dns_rdatasetiter_destroy(&rdsiter);
|
||||
} else {
|
||||
print_result("", result);
|
||||
}
|
||||
} else {
|
||||
if (!quiet) {
|
||||
print_rdataset(fname, &rdataset);
|
||||
}
|
||||
if (dns_rdataset_isassociated(&sigrdataset)) {
|
||||
if (!quiet) {
|
||||
print_rdataset(fname, &sigrdataset);
|
||||
}
|
||||
dns_rdataset_disassociate(&sigrdataset);
|
||||
}
|
||||
if (dbi != NULL && addmode && !found_as) {
|
||||
rdataset.ttl++;
|
||||
rdataset.trust = trust;
|
||||
if (dns_db_iszone(db)) {
|
||||
addopts = DNS_DBADD_MERGE;
|
||||
} else {
|
||||
addopts = 0;
|
||||
}
|
||||
result = dns_db_addrdataset(db, node, version,
|
||||
0, &rdataset,
|
||||
addopts, NULL);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
print_result("", result);
|
||||
}
|
||||
if (printnode) {
|
||||
dns_db_printnode(db, node, stdout);
|
||||
}
|
||||
} else if (dbi != NULL && delmode && !found_as) {
|
||||
result = dns_db_deleterdataset(
|
||||
db, node, version, type, 0);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
print_result("", result);
|
||||
}
|
||||
if (printnode) {
|
||||
dns_db_printnode(db, node, stdout);
|
||||
}
|
||||
}
|
||||
dns_rdataset_disassociate(&rdataset);
|
||||
}
|
||||
|
||||
if (dbi != NULL) {
|
||||
if (holdmode) {
|
||||
RUNTIME_CHECK(dbi->hold_count < MAXHOLD);
|
||||
dbi->hold_nodes[dbi->hold_count++] = node;
|
||||
node = NULL;
|
||||
} else {
|
||||
dns_db_detachnode(db, &node);
|
||||
}
|
||||
} else {
|
||||
dns_db_detachnode(db, &node);
|
||||
dns_db_detach(&db);
|
||||
}
|
||||
}
|
||||
|
||||
if (time_lookups) {
|
||||
uint64_t usec;
|
||||
|
||||
TIME_NOW(&finish);
|
||||
|
||||
usec = isc_time_microdiff(&finish, &start);
|
||||
|
||||
printf("elapsed time: %lu.%06lu seconds\n",
|
||||
(unsigned long)(usec / 1000000),
|
||||
(unsigned long)(usec % 1000000));
|
||||
}
|
||||
|
||||
unload_all();
|
||||
|
||||
dns_dbtable_detach(&dbtable);
|
||||
|
||||
if (lctx != NULL) {
|
||||
isc_log_destroy(&lctx);
|
||||
}
|
||||
|
||||
if (!quiet) {
|
||||
isc_mem_stats(mctx, stdout);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h> /* Non-portable. */
|
||||
#include <sys/types.h> /* Non-portable. */
|
||||
|
||||
#include <isc/fsaccess.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/result.h>
|
||||
|
||||
#define PATH "/tmp/fsaccess"
|
||||
|
||||
int
|
||||
main(void) {
|
||||
isc_fsaccess_t access;
|
||||
isc_result_t result;
|
||||
FILE *fp;
|
||||
int n;
|
||||
|
||||
n = remove(PATH);
|
||||
if (n != 0 && errno != ENOENT) {
|
||||
fprintf(stderr, "unable to remove(%s)\n", PATH);
|
||||
exit(1);
|
||||
}
|
||||
fp = fopen(PATH, "w");
|
||||
if (fp == NULL) {
|
||||
fprintf(stderr, "unable to fopen(%s)\n", PATH);
|
||||
exit(1);
|
||||
}
|
||||
n = chmod(PATH, 0);
|
||||
if (n != 0) {
|
||||
fprintf(stderr, "unable chmod(%s, 0)\n", PATH);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
access = 0;
|
||||
|
||||
isc_fsaccess_add(ISC_FSACCESS_OWNER | ISC_FSACCESS_GROUP,
|
||||
ISC_FSACCESS_READ | ISC_FSACCESS_WRITE, &access);
|
||||
|
||||
printf("fsaccess=%u\n", access);
|
||||
|
||||
isc_fsaccess_add(ISC_FSACCESS_OTHER, ISC_FSACCESS_READ, &access);
|
||||
|
||||
printf("fsaccess=%u\n", access);
|
||||
|
||||
result = isc_fsaccess_set(PATH, access);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fprintf(stderr, "result = %s\n", isc_result_totext(result));
|
||||
}
|
||||
(void)fclose(fp);
|
||||
|
||||
return (0);
|
||||
}
|
@ -1,562 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <isc/app.h>
|
||||
#include <isc/base64.h>
|
||||
#include <isc/log.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/sockaddr.h>
|
||||
#include <isc/socket.h>
|
||||
#include <isc/task.h>
|
||||
#include <isc/timer.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
#include <dns/dispatch.h>
|
||||
#include <dns/dnssec.h>
|
||||
#include <dns/events.h>
|
||||
#include <dns/fixedname.h>
|
||||
#include <dns/keyvalues.h>
|
||||
#include <dns/log.h>
|
||||
#include <dns/masterdump.h>
|
||||
#include <dns/message.h>
|
||||
#include <dns/name.h>
|
||||
#include <dns/rdataset.h>
|
||||
#include <dns/request.h>
|
||||
#include <dns/resolver.h>
|
||||
#include <dns/result.h>
|
||||
#include <dns/tkey.h>
|
||||
#include <dns/tsig.h>
|
||||
#include <dns/types.h>
|
||||
#include <dns/view.h>
|
||||
|
||||
#include <dst/result.h>
|
||||
|
||||
#ifdef GSSAPI
|
||||
#include ISC_PLATFORM_GSSAPIHEADER
|
||||
|
||||
#define CHECK(str, x) \
|
||||
{ \
|
||||
if ((x) != ISC_R_SUCCESS) { \
|
||||
fprintf(stderr, "I:%d:%s: %s\n", __LINE__, (str), \
|
||||
isc_result_totext(x)); \
|
||||
goto end; \
|
||||
} \
|
||||
}
|
||||
|
||||
static dns_fixedname_t servername, gssname;
|
||||
|
||||
static isc_mem_t *mctx;
|
||||
static dns_requestmgr_t *requestmgr;
|
||||
static isc_sockaddr_t address;
|
||||
|
||||
static dns_tsig_keyring_t *ring;
|
||||
static dns_tsigkey_t *tsigkey = NULL;
|
||||
static gss_ctx_id_t gssctx;
|
||||
static gss_ctx_id_t *gssctxp = &gssctx;
|
||||
|
||||
#define RUNCHECK(x) RUNTIME_CHECK((x) == ISC_R_SUCCESS)
|
||||
|
||||
#define PORT 53
|
||||
#define TIMEOUT 30
|
||||
|
||||
static void
|
||||
initctx1(isc_task_t *task, isc_event_t *event);
|
||||
static void
|
||||
sendquery(isc_task_t *task, isc_event_t *event);
|
||||
static void
|
||||
setup();
|
||||
|
||||
static void
|
||||
console(isc_task_t *task, isc_event_t *event) {
|
||||
char buf[32];
|
||||
int c;
|
||||
|
||||
isc_event_t *ev = NULL;
|
||||
|
||||
isc_event_free(&event);
|
||||
|
||||
for (;;) {
|
||||
printf("\nCommand => ");
|
||||
c = scanf("%31s", buf);
|
||||
|
||||
if (c == EOF || strcmp(buf, "quit") == 0) {
|
||||
isc_app_shutdown();
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(buf, "initctx") == 0) {
|
||||
ev = isc_event_allocate(mctx, (void *)1, 1, initctx1,
|
||||
NULL, sizeof(*event));
|
||||
isc_task_send(task, &ev);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(buf, "query") == 0) {
|
||||
ev = isc_event_allocate(mctx, (void *)1, 1, sendquery,
|
||||
NULL, sizeof(*event));
|
||||
isc_task_send(task, &ev);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("Unknown command\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
recvresponse(isc_task_t *task, isc_event_t *event) {
|
||||
dns_requestevent_t *reqev = (dns_requestevent_t *)event;
|
||||
isc_result_t result, result2;
|
||||
dns_message_t *query = NULL, *response = NULL;
|
||||
isc_buffer_t outtoken;
|
||||
isc_buffer_t outbuf;
|
||||
char output[10 * 1024];
|
||||
|
||||
unsigned char array[DNS_NAME_MAXTEXT + 1];
|
||||
isc_buffer_init(&outtoken, array, sizeof(array));
|
||||
|
||||
UNUSED(task);
|
||||
|
||||
REQUIRE(reqev != NULL);
|
||||
|
||||
query = reqev->ev_arg;
|
||||
|
||||
if (reqev->result != ISC_R_SUCCESS) {
|
||||
fprintf(stderr, "I:request event result: %s\n",
|
||||
isc_result_totext(reqev->result));
|
||||
goto end;
|
||||
}
|
||||
|
||||
response = NULL;
|
||||
result = dns_message_create(mctx, DNS_MESSAGE_INTENTPARSE, &response);
|
||||
CHECK("dns_message_create", result);
|
||||
|
||||
printf("\nReceived Response:\n");
|
||||
|
||||
result2 = dns_request_getresponse(reqev->request, response,
|
||||
DNS_MESSAGEPARSE_PRESERVEORDER);
|
||||
isc_buffer_init(&outbuf, output, sizeof(output));
|
||||
result = dns_message_totext(response, &dns_master_style_debug, 0,
|
||||
&outbuf);
|
||||
CHECK("dns_message_totext", result);
|
||||
printf("%.*s\n", (int)isc_buffer_usedlength(&outbuf),
|
||||
(char *)isc_buffer_base(&outbuf));
|
||||
|
||||
CHECK("dns_request_getresponse", result2);
|
||||
|
||||
if (response != NULL) {
|
||||
dns_message_destroy(&response);
|
||||
}
|
||||
|
||||
end:
|
||||
if (query != NULL) {
|
||||
dns_message_destroy(&query);
|
||||
}
|
||||
|
||||
if (reqev->request != NULL) {
|
||||
dns_request_destroy(&reqev->request);
|
||||
}
|
||||
|
||||
isc_event_free(&event);
|
||||
|
||||
event = isc_event_allocate(mctx, (void *)1, 1, console, NULL,
|
||||
sizeof(*event));
|
||||
isc_task_send(task, &event);
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
sendquery(isc_task_t *task, isc_event_t *event) {
|
||||
dns_request_t *request = NULL;
|
||||
dns_message_t *message = NULL;
|
||||
dns_name_t *qname = NULL;
|
||||
dns_rdataset_t *qrdataset = NULL;
|
||||
isc_result_t result;
|
||||
dns_fixedname_t queryname;
|
||||
isc_buffer_t buf;
|
||||
isc_buffer_t outbuf;
|
||||
char output[10 * 1024];
|
||||
static char host[256];
|
||||
int c;
|
||||
|
||||
isc_event_free(&event);
|
||||
|
||||
printf("Query => ");
|
||||
c = scanf("%255s", host);
|
||||
if (c == EOF) {
|
||||
return;
|
||||
}
|
||||
|
||||
dns_fixedname_init(&queryname);
|
||||
isc_buffer_init(&buf, host, strlen(host));
|
||||
isc_buffer_add(&buf, strlen(host));
|
||||
result = dns_name_fromtext(dns_fixedname_name(&queryname), &buf,
|
||||
dns_rootname, 0, NULL);
|
||||
CHECK("dns_name_fromtext", result);
|
||||
|
||||
result = dns_message_create(mctx, DNS_MESSAGE_INTENTRENDER, &message);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
message->opcode = dns_opcode_query;
|
||||
message->rdclass = dns_rdataclass_in;
|
||||
message->id = (unsigned short)(random() & 0xFFFF);
|
||||
|
||||
result = dns_message_gettempname(message, &qname);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
result = dns_message_gettemprdataset(message, &qrdataset);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
dns_name_init(qname, NULL);
|
||||
dns_name_clone(dns_fixedname_name(&queryname), qname);
|
||||
dns_rdataset_makequestion(qrdataset, dns_rdataclass_in,
|
||||
dns_rdatatype_a);
|
||||
ISC_LIST_APPEND(qname->list, qrdataset, link);
|
||||
dns_message_addname(message, qname, DNS_SECTION_QUESTION);
|
||||
|
||||
result = dns_request_create(requestmgr, message, &address, 0, tsigkey,
|
||||
TIMEOUT, task, recvresponse, message,
|
||||
&request);
|
||||
CHECK("dns_request_create", result);
|
||||
|
||||
printf("Submitting query:\n");
|
||||
isc_buffer_init(&outbuf, output, sizeof(output));
|
||||
result = dns_message_totext(message, &dns_master_style_debug, 0,
|
||||
&outbuf);
|
||||
CHECK("dns_message_totext", result);
|
||||
printf("%.*s\n", (int)isc_buffer_usedlength(&outbuf),
|
||||
(char *)isc_buffer_base(&outbuf));
|
||||
|
||||
return;
|
||||
|
||||
end:
|
||||
if (qname != NULL) {
|
||||
dns_message_puttempname(message, &qname);
|
||||
}
|
||||
if (qrdataset != NULL) {
|
||||
dns_message_puttemprdataset(message, &qrdataset);
|
||||
}
|
||||
if (message != NULL) {
|
||||
dns_message_destroy(&message);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
initctx2(isc_task_t *task, isc_event_t *event) {
|
||||
dns_requestevent_t *reqev = (dns_requestevent_t *)event;
|
||||
isc_result_t result;
|
||||
dns_message_t *query = NULL, *response = NULL;
|
||||
isc_buffer_t outtoken;
|
||||
unsigned char array[DNS_NAME_MAXTEXT + 1];
|
||||
dns_rdataset_t *rdataset;
|
||||
dns_rdatatype_t qtype;
|
||||
dns_name_t *question_name;
|
||||
|
||||
UNUSED(task);
|
||||
|
||||
REQUIRE(reqev != NULL);
|
||||
|
||||
query = reqev->ev_arg;
|
||||
|
||||
if (reqev->result != ISC_R_SUCCESS) {
|
||||
fprintf(stderr, "I:request event result: %s\n",
|
||||
isc_result_totext(reqev->result));
|
||||
goto end;
|
||||
}
|
||||
|
||||
response = NULL;
|
||||
result = dns_message_create(mctx, DNS_MESSAGE_INTENTPARSE, &response);
|
||||
CHECK("dns_message_create", result);
|
||||
|
||||
result = dns_request_getresponse(reqev->request, response,
|
||||
DNS_MESSAGEPARSE_PRESERVEORDER);
|
||||
CHECK("dns_request_getresponse", result);
|
||||
|
||||
if (response->rcode != dns_rcode_noerror) {
|
||||
result = ISC_RESULTCLASS_DNSRCODE + response->rcode;
|
||||
fprintf(stderr, "I:response rcode: %s\n",
|
||||
isc_result_totext(result));
|
||||
goto end;
|
||||
}
|
||||
|
||||
printf("Received token from server, calling gss_init_sec_context()\n");
|
||||
isc_buffer_init(&outtoken, array, DNS_NAME_MAXTEXT + 1);
|
||||
result = dns_tkey_processgssresponse(
|
||||
query, response, dns_fixedname_name(&gssname), &gssctx,
|
||||
&outtoken, &tsigkey, ring, NULL);
|
||||
gssctx = *gssctxp;
|
||||
CHECK("dns_tkey_processgssresponse", result);
|
||||
printf("Context accepted\n");
|
||||
|
||||
question_name = NULL;
|
||||
dns_message_currentname(response, DNS_SECTION_ANSWER, &question_name);
|
||||
rdataset = ISC_LIST_HEAD(question_name->list);
|
||||
INSIST(rdataset != NULL);
|
||||
qtype = rdataset->type;
|
||||
if (qtype == dns_rdatatype_tkey) {
|
||||
printf("Received TKEY response from server\n");
|
||||
printf("Context completed\n");
|
||||
} else {
|
||||
printf("Did not receive TKEY response from server\n");
|
||||
printf("Context not completed\n");
|
||||
dns_tsigkey_detach(&tsigkey);
|
||||
tsigkey = NULL;
|
||||
}
|
||||
|
||||
dns_message_destroy(&response);
|
||||
|
||||
end:
|
||||
if (query != NULL) {
|
||||
dns_message_destroy(&query);
|
||||
}
|
||||
|
||||
if (reqev->request != NULL) {
|
||||
dns_request_destroy(&reqev->request);
|
||||
}
|
||||
|
||||
isc_event_free(&event);
|
||||
|
||||
event = isc_event_allocate(mctx, (void *)1, 1, console, NULL,
|
||||
sizeof(*event));
|
||||
isc_task_send(task, &event);
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
initctx1(isc_task_t *task, isc_event_t *event) {
|
||||
char gssid[512];
|
||||
char contextname[512];
|
||||
isc_result_t result;
|
||||
isc_buffer_t buf;
|
||||
dns_message_t *query;
|
||||
dns_request_t *request;
|
||||
int c;
|
||||
|
||||
isc_event_free(&event);
|
||||
|
||||
printf("Initctx - GSS name => ");
|
||||
c = scanf("%511s", gssid);
|
||||
if (c == EOF) {
|
||||
return;
|
||||
}
|
||||
|
||||
snprintf(contextname, sizeof(contextname), "gsstest.context.%d.",
|
||||
(int)time(NULL));
|
||||
|
||||
printf("Initctx - context name we're using: %s\n", contextname);
|
||||
|
||||
printf("Negotiating GSSAPI context: ");
|
||||
printf("%s", gssid);
|
||||
printf("\n");
|
||||
|
||||
/*
|
||||
* Setup a GSSAPI context with the server
|
||||
*/
|
||||
dns_fixedname_init(&servername);
|
||||
isc_buffer_init(&buf, contextname, strlen(contextname));
|
||||
isc_buffer_add(&buf, strlen(contextname));
|
||||
result = dns_name_fromtext(dns_fixedname_name(&servername), &buf,
|
||||
dns_rootname, 0, NULL);
|
||||
CHECK("dns_name_fromtext", result);
|
||||
|
||||
/* Make name happen */
|
||||
dns_fixedname_init(&gssname);
|
||||
isc_buffer_init(&buf, gssid, strlen(gssid));
|
||||
isc_buffer_add(&buf, strlen(gssid));
|
||||
result = dns_name_fromtext(dns_fixedname_name(&gssname), &buf,
|
||||
dns_rootname, 0, NULL);
|
||||
CHECK("dns_name_fromtext", result);
|
||||
|
||||
query = NULL;
|
||||
result = dns_message_create(mctx, DNS_MESSAGE_INTENTRENDER, &query);
|
||||
CHECK("dns_message_create", result);
|
||||
|
||||
printf("Calling gss_init_sec_context()\n");
|
||||
gssctx = GSS_C_NO_CONTEXT;
|
||||
result = dns_tkey_buildgssquery(query, dns_fixedname_name(&servername),
|
||||
dns_fixedname_name(&gssname), NULL,
|
||||
36000, &gssctx, true, mctx, NULL);
|
||||
CHECK("dns_tkey_buildgssquery", result);
|
||||
|
||||
printf("Sending context token to server\n");
|
||||
request = NULL;
|
||||
result = dns_request_create(requestmgr, query, &address, 0, NULL,
|
||||
TIMEOUT, task, initctx2, query, &request);
|
||||
CHECK("dns_request_create", result);
|
||||
|
||||
return;
|
||||
end:
|
||||
event = isc_event_allocate(mctx, (void *)1, 1, console, NULL,
|
||||
sizeof(*event));
|
||||
isc_task_send(task, &event);
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
setup(void) {
|
||||
for (;;) {
|
||||
char serveraddress[512];
|
||||
struct in_addr inaddr;
|
||||
int c;
|
||||
|
||||
printf("Server IP => ");
|
||||
c = scanf("%511s", serveraddress);
|
||||
|
||||
if (c == EOF || strcmp(serveraddress, "quit") == 0) {
|
||||
isc_app_shutdown();
|
||||
return;
|
||||
}
|
||||
|
||||
if (inet_pton(AF_INET, serveraddress, &inaddr) == 1) {
|
||||
isc_sockaddr_fromin(&address, &inaddr, PORT);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[]) {
|
||||
isc_taskmgr_t *taskmgr;
|
||||
isc_timermgr_t *timermgr;
|
||||
isc_socketmgr_t *socketmgr;
|
||||
isc_socket_t *sock;
|
||||
unsigned int attrs, attrmask;
|
||||
isc_sockaddr_t bind_any;
|
||||
dns_dispatchmgr_t *dispatchmgr;
|
||||
dns_dispatch_t *dispatchv4;
|
||||
dns_view_t *view;
|
||||
isc_task_t *task;
|
||||
isc_log_t *lctx = NULL;
|
||||
isc_logconfig_t *lcfg = NULL;
|
||||
isc_logdestination_t destination;
|
||||
|
||||
UNUSED(argv);
|
||||
UNUSED(argc);
|
||||
|
||||
RUNCHECK(isc_app_start());
|
||||
|
||||
dns_result_register();
|
||||
|
||||
mctx = NULL;
|
||||
isc_mem_create(&mctx);
|
||||
|
||||
isc_log_create(mctx, &lctx, &lcfg);
|
||||
isc_log_setcontext(lctx);
|
||||
dns_log_init(lctx);
|
||||
dns_log_setcontext(lctx);
|
||||
|
||||
/*
|
||||
* Create and install the default channel.
|
||||
*/
|
||||
destination.file.stream = stderr;
|
||||
destination.file.name = NULL;
|
||||
destination.file.versions = ISC_LOG_ROLLNEVER;
|
||||
destination.file.maximum_size = 0;
|
||||
isc_log_createchannel(lcfg, "_default", ISC_LOG_TOFILEDESC,
|
||||
ISC_LOG_DYNAMIC, &destination, ISC_LOG_PRINTTIME);
|
||||
|
||||
RUNCHECK(isc_log_usechannel(lcfg, "_default", NULL, NULL));
|
||||
|
||||
isc_log_setdebuglevel(lctx, 9);
|
||||
|
||||
RUNCHECK(dst_lib_init(mctx, NULL));
|
||||
|
||||
taskmgr = NULL;
|
||||
RUNCHECK(isc_taskmgr_create(mctx, 1, 0, NULL, &taskmgr));
|
||||
task = NULL;
|
||||
RUNCHECK(isc_task_create(taskmgr, 0, &task));
|
||||
timermgr = NULL;
|
||||
RUNCHECK(isc_timermgr_create(mctx, &timermgr));
|
||||
socketmgr = NULL;
|
||||
RUNCHECK(isc_socketmgr_create(mctx, &socketmgr));
|
||||
dispatchmgr = NULL;
|
||||
RUNCHECK(dns_dispatchmgr_create(mctx, &dispatchmgr));
|
||||
isc_sockaddr_any(&bind_any);
|
||||
attrs = DNS_DISPATCHATTR_UDP | DNS_DISPATCHATTR_MAKEQUERY |
|
||||
DNS_DISPATCHATTR_IPV4;
|
||||
attrmask = DNS_DISPATCHATTR_UDP | DNS_DISPATCHATTR_TCP |
|
||||
DNS_DISPATCHATTR_IPV4 | DNS_DISPATCHATTR_IPV6;
|
||||
dispatchv4 = NULL;
|
||||
RUNCHECK(dns_dispatch_getudp(dispatchmgr, socketmgr, taskmgr, &bind_any,
|
||||
4096, 4, 2, 3, 5, attrs, attrmask,
|
||||
&dispatchv4));
|
||||
requestmgr = NULL;
|
||||
RUNCHECK(dns_requestmgr_create(mctx, timermgr, socketmgr, taskmgr,
|
||||
dispatchmgr, dispatchv4, NULL,
|
||||
&requestmgr));
|
||||
|
||||
ring = NULL;
|
||||
RUNCHECK(dns_tsigkeyring_create(mctx, &ring));
|
||||
|
||||
view = NULL;
|
||||
RUNCHECK(dns_view_create(mctx, 0, "_test", &view));
|
||||
dns_view_setkeyring(view, ring);
|
||||
|
||||
sock = NULL;
|
||||
RUNCHECK(isc_socket_create(socketmgr, PF_INET, isc_sockettype_udp,
|
||||
&sock));
|
||||
|
||||
setup();
|
||||
|
||||
RUNCHECK(isc_app_onrun(mctx, task, console, NULL));
|
||||
|
||||
(void)isc_app_run();
|
||||
|
||||
if (tsigkey) {
|
||||
dns_tsigkey_detach(&tsigkey);
|
||||
}
|
||||
|
||||
dns_requestmgr_shutdown(requestmgr);
|
||||
dns_requestmgr_detach(&requestmgr);
|
||||
|
||||
dns_dispatch_detach(&dispatchv4);
|
||||
dns_dispatchmgr_destroy(&dispatchmgr);
|
||||
|
||||
isc_timermgr_destroy(&timermgr);
|
||||
|
||||
isc_task_detach(&task);
|
||||
isc_taskmgr_destroy(&taskmgr);
|
||||
|
||||
isc_socket_detach(&sock);
|
||||
isc_socketmgr_destroy(&socketmgr);
|
||||
|
||||
isc_mem_stats(mctx, stdout);
|
||||
|
||||
dns_view_detach(&view);
|
||||
|
||||
dst_lib_destroy();
|
||||
|
||||
isc_mem_stats(mctx, stdout);
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
isc_app_finish();
|
||||
|
||||
return (0);
|
||||
}
|
||||
#else /* ifdef GSSAPI */
|
||||
int
|
||||
main(int argc, char *argv[]) {
|
||||
UNUSED(argc);
|
||||
UNUSED(argv);
|
||||
fprintf(stderr, "R:GSSAPIONLY\n");
|
||||
return (0);
|
||||
}
|
||||
#endif /* ifdef GSSAPI */
|
@ -1,131 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <isc/interfaceiter.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
int
|
||||
main(int argc, char **argv) {
|
||||
isc_mem_t *mctx = NULL;
|
||||
isc_interfaceiter_t *iter = NULL;
|
||||
isc_interface_t ifdata;
|
||||
isc_result_t result;
|
||||
const char *res;
|
||||
char buf[128];
|
||||
|
||||
UNUSED(argc);
|
||||
UNUSED(argv);
|
||||
|
||||
isc_mem_create(&mctx);
|
||||
result = isc_interfaceiter_create(mctx, &iter);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto cleanup;
|
||||
}
|
||||
result = isc_interfaceiter_first(iter);
|
||||
while (result == ISC_R_SUCCESS) {
|
||||
result = isc_interfaceiter_current(iter, &ifdata);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fprintf(stdout, "isc_interfaceiter_current: %s",
|
||||
isc_result_totext(result));
|
||||
continue;
|
||||
}
|
||||
fprintf(stdout, "%s %u %x\n", ifdata.name, ifdata.af,
|
||||
ifdata.flags);
|
||||
INSIST(ifdata.af == AF_INET || ifdata.af == AF_INET6);
|
||||
res = inet_ntop(ifdata.af, &ifdata.address.type, buf,
|
||||
sizeof(buf));
|
||||
if (ifdata.address.zone != 0) {
|
||||
fprintf(stdout, "address = %s (zone %u)\n",
|
||||
res == NULL ? "BAD" : res, ifdata.address.zone);
|
||||
} else {
|
||||
fprintf(stdout, "address = %s\n",
|
||||
res == NULL ? "BAD" : res);
|
||||
}
|
||||
INSIST(ifdata.address.family == ifdata.af);
|
||||
res = inet_ntop(ifdata.af, &ifdata.netmask.type, buf,
|
||||
sizeof(buf));
|
||||
fprintf(stdout, "netmask = %s\n", res == NULL ? "BAD" : res);
|
||||
INSIST(ifdata.netmask.family == ifdata.af);
|
||||
if ((ifdata.flags & INTERFACE_F_POINTTOPOINT) != 0) {
|
||||
res = inet_ntop(ifdata.af, &ifdata.dstaddress.type, buf,
|
||||
sizeof(buf));
|
||||
fprintf(stdout, "dstaddress = %s\n",
|
||||
res == NULL ? "BAD" : res);
|
||||
|
||||
INSIST(ifdata.dstaddress.family == ifdata.af);
|
||||
}
|
||||
result = isc_interfaceiter_next(iter);
|
||||
if (result != ISC_R_SUCCESS && result != ISC_R_NOMORE) {
|
||||
fprintf(stdout, "isc_interfaceiter_next: %s",
|
||||
isc_result_totext(result));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
isc_interfaceiter_destroy(&iter);
|
||||
|
||||
fprintf(stdout, "\nPass 2\n\n");
|
||||
|
||||
result = isc_interfaceiter_create(mctx, &iter);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto cleanup;
|
||||
}
|
||||
result = isc_interfaceiter_first(iter);
|
||||
while (result == ISC_R_SUCCESS) {
|
||||
result = isc_interfaceiter_current(iter, &ifdata);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fprintf(stdout, "isc_interfaceiter_current: %s",
|
||||
isc_result_totext(result));
|
||||
continue;
|
||||
}
|
||||
fprintf(stdout, "%s %u %x\n", ifdata.name, ifdata.af,
|
||||
ifdata.flags);
|
||||
INSIST(ifdata.af == AF_INET || ifdata.af == AF_INET6);
|
||||
res = inet_ntop(ifdata.af, &ifdata.address.type, buf,
|
||||
sizeof(buf));
|
||||
if (ifdata.address.zone != 0) {
|
||||
fprintf(stdout, "address = %s (zone %u)\n",
|
||||
res == NULL ? "BAD" : res, ifdata.address.zone);
|
||||
} else {
|
||||
fprintf(stdout, "address = %s\n",
|
||||
res == NULL ? "BAD" : res);
|
||||
}
|
||||
INSIST(ifdata.address.family == ifdata.af);
|
||||
res = inet_ntop(ifdata.af, &ifdata.netmask.type, buf,
|
||||
sizeof(buf));
|
||||
fprintf(stdout, "netmask = %s\n", res == NULL ? "BAD" : res);
|
||||
INSIST(ifdata.netmask.family == ifdata.af);
|
||||
if ((ifdata.flags & INTERFACE_F_POINTTOPOINT) != 0) {
|
||||
res = inet_ntop(ifdata.af, &ifdata.dstaddress.type, buf,
|
||||
sizeof(buf));
|
||||
fprintf(stdout, "dstaddress = %s\n",
|
||||
res == NULL ? "BAD" : res);
|
||||
|
||||
INSIST(ifdata.dstaddress.family == ifdata.af);
|
||||
}
|
||||
result = isc_interfaceiter_next(iter);
|
||||
if (result != ISC_R_SUCCESS && result != ISC_R_NOMORE) {
|
||||
fprintf(stdout, "isc_interfaceiter_next: %s",
|
||||
isc_result_totext(result));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
isc_interfaceiter_destroy(&iter);
|
||||
cleanup:
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
return (0);
|
||||
}
|
@ -1,157 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/lex.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
isc_mem_t *mctx;
|
||||
isc_lex_t *lex;
|
||||
|
||||
isc_lexspecials_t specials;
|
||||
|
||||
static void
|
||||
print_token(isc_token_t *tokenp, FILE *stream) {
|
||||
switch (tokenp->type) {
|
||||
case isc_tokentype_unknown:
|
||||
fprintf(stream, "UNKNOWN");
|
||||
break;
|
||||
case isc_tokentype_string:
|
||||
fprintf(stream, "STRING %.*s",
|
||||
(int)tokenp->value.as_region.length,
|
||||
tokenp->value.as_region.base);
|
||||
break;
|
||||
case isc_tokentype_number:
|
||||
fprintf(stream, "NUMBER %lu", tokenp->value.as_ulong);
|
||||
break;
|
||||
case isc_tokentype_qstring:
|
||||
fprintf(stream, "QSTRING \"%.*s\"",
|
||||
(int)tokenp->value.as_region.length,
|
||||
tokenp->value.as_region.base);
|
||||
break;
|
||||
case isc_tokentype_eol:
|
||||
fprintf(stream, "EOL");
|
||||
break;
|
||||
case isc_tokentype_eof:
|
||||
fprintf(stream, "EOF");
|
||||
break;
|
||||
case isc_tokentype_initialws:
|
||||
fprintf(stream, "INITIALWS");
|
||||
break;
|
||||
case isc_tokentype_special:
|
||||
fprintf(stream, "SPECIAL %c", tokenp->value.as_char);
|
||||
break;
|
||||
case isc_tokentype_nomore:
|
||||
fprintf(stream, "NOMORE");
|
||||
break;
|
||||
default:
|
||||
FATAL_ERROR(__FILE__, __LINE__, "Unexpected type %d",
|
||||
tokenp->type);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[]) {
|
||||
isc_token_t token;
|
||||
isc_result_t result;
|
||||
int quiet = 0;
|
||||
int c;
|
||||
int masterfile = 1;
|
||||
int stats = 0;
|
||||
unsigned int options = 0;
|
||||
int done = 0;
|
||||
|
||||
while ((c = isc_commandline_parse(argc, argv, "qmcs")) != -1) {
|
||||
switch (c) {
|
||||
case 'q':
|
||||
quiet = 1;
|
||||
break;
|
||||
case 'm':
|
||||
masterfile = 1;
|
||||
break;
|
||||
case 'c':
|
||||
masterfile = 0;
|
||||
break;
|
||||
case 's':
|
||||
stats = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
isc_mem_create(&mctx);
|
||||
RUNTIME_CHECK(isc_lex_create(mctx, 256, &lex) == ISC_R_SUCCESS);
|
||||
|
||||
if (masterfile) {
|
||||
/* Set up to lex DNS master file. */
|
||||
|
||||
specials['('] = 1;
|
||||
specials[')'] = 1;
|
||||
specials['"'] = 1;
|
||||
isc_lex_setspecials(lex, specials);
|
||||
options = ISC_LEXOPT_DNSMULTILINE | ISC_LEXOPT_ESCAPE |
|
||||
ISC_LEXOPT_EOF | ISC_LEXOPT_QSTRING |
|
||||
ISC_LEXOPT_NOMORE;
|
||||
isc_lex_setcomments(lex, ISC_LEXCOMMENT_DNSMASTERFILE);
|
||||
} else {
|
||||
/* Set up to lex DNS config file. */
|
||||
|
||||
specials['{'] = 1;
|
||||
specials['}'] = 1;
|
||||
specials[';'] = 1;
|
||||
specials['/'] = 1;
|
||||
specials['"'] = 1;
|
||||
specials['!'] = 1;
|
||||
specials['*'] = 1;
|
||||
isc_lex_setspecials(lex, specials);
|
||||
options = ISC_LEXOPT_EOF | ISC_LEXOPT_QSTRING |
|
||||
ISC_LEXOPT_NUMBER | ISC_LEXOPT_NOMORE;
|
||||
isc_lex_setcomments(lex, (ISC_LEXCOMMENT_C |
|
||||
ISC_LEXCOMMENT_CPLUSPLUS |
|
||||
ISC_LEXCOMMENT_SHELL));
|
||||
}
|
||||
|
||||
RUNTIME_CHECK(isc_lex_openstream(lex, stdin) == ISC_R_SUCCESS);
|
||||
|
||||
while ((result = isc_lex_gettoken(lex, options, &token)) ==
|
||||
ISC_R_SUCCESS &&
|
||||
!done)
|
||||
{
|
||||
if (!quiet) {
|
||||
char *name = isc_lex_getsourcename(lex);
|
||||
print_token(&token, stdout);
|
||||
printf(" line = %lu file = %s\n",
|
||||
isc_lex_getsourceline(lex),
|
||||
(name == NULL) ? "<none>" : name);
|
||||
}
|
||||
if (token.type == isc_tokentype_eof) {
|
||||
isc_lex_close(lex);
|
||||
}
|
||||
if (token.type == isc_tokentype_nomore) {
|
||||
done = 1;
|
||||
}
|
||||
}
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
printf("Result: %s\n", isc_result_totext(result));
|
||||
}
|
||||
|
||||
isc_lex_close(lex);
|
||||
isc_lex_destroy(&lex);
|
||||
if (!quiet && stats) {
|
||||
isc_mem_stats(mctx, stdout);
|
||||
}
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
return (0);
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <isc/lfsr.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
uint32_t state[1024 * 64];
|
||||
|
||||
int
|
||||
main(int argc, char **argv) {
|
||||
isc_lfsr_t lfsr1, lfsr2;
|
||||
int i;
|
||||
uint32_t temp;
|
||||
|
||||
UNUSED(argc);
|
||||
UNUSED(argv);
|
||||
|
||||
/*
|
||||
* Verify that returned values are reproducible.
|
||||
*/
|
||||
isc_lfsr_init(&lfsr1, 0, 32, 0x80000057U, 0, NULL, NULL);
|
||||
for (i = 0; i < 32; i++) {
|
||||
isc_lfsr_generate(&lfsr1, &state[i], 4);
|
||||
printf("lfsr1: state[%2d] = %08x\n", i, state[i]);
|
||||
}
|
||||
isc_lfsr_init(&lfsr1, 0, 32, 0x80000057U, 0, NULL, NULL);
|
||||
for (i = 0; i < 32; i++) {
|
||||
isc_lfsr_generate(&lfsr1, &temp, 4);
|
||||
if (state[i] != temp) {
|
||||
printf("lfsr1: state[%2d] = %08x, "
|
||||
"but new state is %08x\n",
|
||||
i, state[i], temp);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Now do the same with skipping.
|
||||
*/
|
||||
isc_lfsr_init(&lfsr1, 0, 32, 0x80000057U, 0, NULL, NULL);
|
||||
for (i = 0; i < 32; i++) {
|
||||
isc_lfsr_generate(&lfsr1, &state[i], 4);
|
||||
isc_lfsr_skip(&lfsr1, 32);
|
||||
printf("lfsr1: state[%2d] = %08x\n", i, state[i]);
|
||||
}
|
||||
isc_lfsr_init(&lfsr1, 0, 32, 0x80000057U, 0, NULL, NULL);
|
||||
for (i = 0; i < 32; i++) {
|
||||
isc_lfsr_generate(&lfsr1, &temp, 4);
|
||||
isc_lfsr_skip(&lfsr1, 32);
|
||||
if (state[i] != temp) {
|
||||
printf("lfsr1: state[%2d] = %08x, "
|
||||
"but new state is %08x\n",
|
||||
i, state[i], temp);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Try to find the period of the LFSR.
|
||||
*
|
||||
* x^16 + x^5 + x^3 + x^2 + 1
|
||||
*/
|
||||
isc_lfsr_init(&lfsr2, 0, 16, 0x00008016U, 0, NULL, NULL);
|
||||
for (i = 0; i < 32; i++) {
|
||||
isc_lfsr_generate(&lfsr2, &state[i], 4);
|
||||
printf("lfsr2: state[%2d] = %08x\n", i, state[i]);
|
||||
}
|
||||
isc_lfsr_init(&lfsr2, 0, 16, 0x00008016U, 0, NULL, NULL);
|
||||
for (i = 0; i < 32; i++) {
|
||||
isc_lfsr_generate(&lfsr2, &temp, 4);
|
||||
if (state[i] != temp) {
|
||||
printf("lfsr2: state[%2d] = %08x, "
|
||||
"but new state is %08x\n",
|
||||
i, state[i], temp);
|
||||
}
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
@ -1,343 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/string.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
#include <dns/log.h>
|
||||
|
||||
#define TEST_FILE "/tmp/test_log"
|
||||
#define SYSLOG_FILE "/var/log/daemon.log"
|
||||
#define FILE_VERSIONS 10
|
||||
|
||||
char usage[] = "Usage: %s [-m] [-s syslog_logfile] [-r file_versions]\n";
|
||||
|
||||
#define CHECK(expr) \
|
||||
result = expr; \
|
||||
if (result != ISC_R_SUCCESS) { \
|
||||
fprintf(stderr, "%s: " #expr "%s: exiting\n", progname, \
|
||||
isc_result_totext(result)); \
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv) {
|
||||
const char *progname, *syslog_file, *message;
|
||||
int ch, i, file_versions, stderr_line;
|
||||
bool show_final_mem = false;
|
||||
isc_log_t *lctx;
|
||||
isc_logconfig_t *lcfg;
|
||||
isc_mem_t *mctx;
|
||||
isc_result_t result;
|
||||
isc_logdestination_t destination;
|
||||
const isc_logcategory_t *category;
|
||||
const isc_logmodule_t *module;
|
||||
|
||||
progname = strrchr(*argv, '/');
|
||||
if (progname != NULL) {
|
||||
progname++;
|
||||
} else {
|
||||
progname = *argv;
|
||||
}
|
||||
|
||||
syslog_file = SYSLOG_FILE;
|
||||
file_versions = FILE_VERSIONS;
|
||||
|
||||
while ((ch = isc_commandline_parse(argc, argv, "ms:r:")) != -1) {
|
||||
switch (ch) {
|
||||
case 'm':
|
||||
show_final_mem = true;
|
||||
break;
|
||||
case 's':
|
||||
syslog_file = isc_commandline_argument;
|
||||
break;
|
||||
case 'r':
|
||||
file_versions = atoi(isc_commandline_argument);
|
||||
if (file_versions < 0 &&
|
||||
file_versions != ISC_LOG_ROLLNEVER &&
|
||||
file_versions != ISC_LOG_ROLLINFINITE)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s: file rotations must be "
|
||||
"%d (ISC_LOG_ROLLNEVER),\n\t"
|
||||
"%d (ISC_LOG_ROLLINFINITE) "
|
||||
"or > 0\n",
|
||||
progname, ISC_LOG_ROLLNEVER,
|
||||
ISC_LOG_ROLLINFINITE);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
case '?':
|
||||
fprintf(stderr, usage, progname);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
argc -= isc_commandline_index;
|
||||
argv += isc_commandline_index;
|
||||
POST(argv);
|
||||
|
||||
if (argc > 0) {
|
||||
fprintf(stderr, usage, progname);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fprintf(stderr, "EXPECT:\n%s%d%s%s%s",
|
||||
"8 lines to stderr (first 4 numbered, #3 repeated)\n",
|
||||
file_versions == 0 || file_versions == ISC_LOG_ROLLNEVER
|
||||
? 1
|
||||
: file_versions > 0 ? file_versions + 1
|
||||
: FILE_VERSIONS + 1,
|
||||
" " TEST_FILE " files, and\n", "2 lines to syslog\n",
|
||||
"lines ending with exclamation marks are errors\n\n");
|
||||
|
||||
isc_log_opensyslog(progname, LOG_PID, LOG_DAEMON);
|
||||
|
||||
mctx = NULL;
|
||||
lctx = NULL;
|
||||
lcfg = NULL;
|
||||
|
||||
isc_mem_create(&mctx);
|
||||
isc_log_create(mctx, &lctx, &lcfg);
|
||||
|
||||
isc_log_settag(lcfg, progname);
|
||||
|
||||
isc_log_setcontext(lctx);
|
||||
dns_log_init(lctx);
|
||||
dns_log_setcontext(lctx);
|
||||
|
||||
/*
|
||||
* Test isc_log_categorybyname and isc_log_modulebyname.
|
||||
*/
|
||||
category = isc_log_categorybyname(lctx, "notify");
|
||||
if (category != NULL) {
|
||||
fprintf(stderr, "%s category found. (expected)\n",
|
||||
category->name);
|
||||
} else {
|
||||
fprintf(stderr, "notify category not found!\n");
|
||||
}
|
||||
|
||||
module = isc_log_modulebyname(lctx, "xyzzy");
|
||||
if (module != NULL) {
|
||||
fprintf(stderr, "%s module found!\n", module->name);
|
||||
} else {
|
||||
fprintf(stderr, "xyzzy module not found. (expected)\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a file channel to test file opening, size limiting and
|
||||
* version rolling.
|
||||
*/
|
||||
|
||||
destination.file.name = TEST_FILE;
|
||||
destination.file.maximum_size = 1;
|
||||
destination.file.versions = file_versions;
|
||||
|
||||
isc_log_createchannel(
|
||||
lcfg, "file_test", ISC_LOG_TOFILE, ISC_LOG_INFO, &destination,
|
||||
ISC_LOG_PRINTTIME | ISC_LOG_PRINTTAG | ISC_LOG_PRINTLEVEL |
|
||||
ISC_LOG_PRINTCATEGORY | ISC_LOG_PRINTMODULE);
|
||||
|
||||
/*
|
||||
* Create a dynamic debugging channel to a file descriptor.
|
||||
*/
|
||||
destination.file.stream = stderr;
|
||||
|
||||
isc_log_createchannel(lcfg, "debug_test", ISC_LOG_TOFILEDESC,
|
||||
ISC_LOG_DYNAMIC, &destination,
|
||||
ISC_LOG_PRINTTIME | ISC_LOG_PRINTLEVEL |
|
||||
ISC_LOG_DEBUGONLY);
|
||||
|
||||
/*
|
||||
* Test the usability of the four predefined logging channels.
|
||||
*/
|
||||
CHECK(isc_log_usechannel(lcfg, "default_syslog",
|
||||
DNS_LOGCATEGORY_DATABASE,
|
||||
DNS_LOGMODULE_CACHE));
|
||||
CHECK(isc_log_usechannel(lcfg, "default_stderr",
|
||||
DNS_LOGCATEGORY_DATABASE,
|
||||
DNS_LOGMODULE_CACHE));
|
||||
CHECK(isc_log_usechannel(lcfg, "default_debug",
|
||||
DNS_LOGCATEGORY_DATABASE,
|
||||
DNS_LOGMODULE_CACHE));
|
||||
CHECK(isc_log_usechannel(lcfg, "null", DNS_LOGCATEGORY_DATABASE, NULL));
|
||||
|
||||
/*
|
||||
* Use the custom channels.
|
||||
*/
|
||||
CHECK(isc_log_usechannel(lcfg, "file_test", DNS_LOGCATEGORY_GENERAL,
|
||||
DNS_LOGMODULE_DB));
|
||||
|
||||
CHECK(isc_log_usechannel(lcfg, "debug_test", DNS_LOGCATEGORY_GENERAL,
|
||||
DNS_LOGMODULE_RBTDB));
|
||||
|
||||
fprintf(stderr, "\n==> stderr begin\n");
|
||||
|
||||
/*
|
||||
* Write to the internal default by testing both a category for which
|
||||
* no channel has been specified and a category which was specified
|
||||
* but not with the named module.
|
||||
*/
|
||||
stderr_line = 1;
|
||||
|
||||
isc_log_write(lctx, DNS_LOGCATEGORY_SECURITY, DNS_LOGMODULE_RBT,
|
||||
ISC_LOG_CRITICAL, "%s (%d)",
|
||||
"Unspecified category and unspecified module to stderr",
|
||||
stderr_line++);
|
||||
isc_log_write(lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_RBT,
|
||||
ISC_LOG_CRITICAL, "%s (%d)",
|
||||
"Specified category and unspecified module to stderr",
|
||||
stderr_line++);
|
||||
|
||||
/*
|
||||
* Write to default_syslog, default_stderr and default_debug.
|
||||
*/
|
||||
isc_log_write(lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_CACHE,
|
||||
ISC_LOG_WARNING, "%s (%d twice)",
|
||||
"Using the predefined channels to syslog+stderr",
|
||||
stderr_line++);
|
||||
|
||||
/*
|
||||
* Write to predefined null channel.
|
||||
*/
|
||||
isc_log_write(lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_RBTDB,
|
||||
ISC_LOG_INFO, "This is to null and should not appear!");
|
||||
|
||||
/*
|
||||
* Reset the internal default to use syslog instead of stderr,
|
||||
* and test it.
|
||||
*/
|
||||
CHECK(isc_log_usechannel(lcfg, "default_syslog",
|
||||
ISC_LOGCATEGORY_DEFAULT, NULL));
|
||||
isc_log_write(lctx, DNS_LOGCATEGORY_SECURITY, DNS_LOGMODULE_RBT,
|
||||
ISC_LOG_ERROR, "%s%s",
|
||||
"This message to the redefined default category should ",
|
||||
"be second in syslog");
|
||||
/*
|
||||
* Write to the file channel.
|
||||
*/
|
||||
if (file_versions >= 0 || file_versions == ISC_LOG_ROLLINFINITE) {
|
||||
/*
|
||||
* If file_versions is 0 or ISC_LOG_ROLLINFINITE, write
|
||||
* the "should not appear" and "should be in file" messages
|
||||
* to ensure they get rolled.
|
||||
*/
|
||||
if (file_versions <= 0) {
|
||||
file_versions = FILE_VERSIONS;
|
||||
} else {
|
||||
isc_log_write(lctx, DNS_LOGCATEGORY_GENERAL,
|
||||
DNS_LOGMODULE_DB, ISC_LOG_NOTICE,
|
||||
"This should be rolled over "
|
||||
"and not appear!");
|
||||
}
|
||||
|
||||
for (i = file_versions - 1; i >= 0; i--) {
|
||||
isc_log_write(lctx, DNS_LOGCATEGORY_GENERAL,
|
||||
DNS_LOGMODULE_DB, ISC_LOG_NOTICE,
|
||||
"should be in file %d/%d", i,
|
||||
file_versions - 1);
|
||||
}
|
||||
|
||||
isc_log_write(lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_DB,
|
||||
ISC_LOG_NOTICE, "should be in base file");
|
||||
} else {
|
||||
file_versions = FILE_VERSIONS;
|
||||
for (i = 1; i <= file_versions; i++) {
|
||||
isc_log_write(lctx, DNS_LOGCATEGORY_GENERAL,
|
||||
DNS_LOGMODULE_DB, ISC_LOG_NOTICE,
|
||||
"This is message %d in the log file", i);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Write a debugging message to a category that has no
|
||||
* debugging channels for the named module.
|
||||
*/
|
||||
isc_log_write(lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_DB,
|
||||
ISC_LOG_DEBUG(1),
|
||||
"This debug message should not appear!");
|
||||
|
||||
/*
|
||||
* Write debugging messages to a dynamic debugging channel.
|
||||
*/
|
||||
isc_log_write(lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_RBTDB,
|
||||
ISC_LOG_CRITICAL,
|
||||
"This critical message should "
|
||||
"not appear because the debug level is 0!");
|
||||
|
||||
isc_log_setdebuglevel(lctx, 3);
|
||||
|
||||
isc_log_write(lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_RBTDB,
|
||||
ISC_LOG_DEBUG(1), "%s (%d)",
|
||||
"Dynamic debugging to stderr", stderr_line++);
|
||||
isc_log_write(lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_RBTDB,
|
||||
ISC_LOG_DEBUG(5),
|
||||
"This debug level is too high and should not appear!");
|
||||
|
||||
/*
|
||||
* Test out the duplicate filtering using the debug_test channel.
|
||||
*/
|
||||
isc_log_setduplicateinterval(lcfg, 10);
|
||||
message = "This message should appear only once on stderr";
|
||||
|
||||
isc_log_write1(lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_RBTDB,
|
||||
ISC_LOG_CRITICAL, "%s", message);
|
||||
isc_log_write1(lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_RBTDB,
|
||||
ISC_LOG_CRITICAL, "%s", message);
|
||||
|
||||
isc_log_setduplicateinterval(lcfg, 1);
|
||||
message = "This message should appear twice on stderr";
|
||||
|
||||
isc_log_write1(lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_RBTDB,
|
||||
ISC_LOG_CRITICAL, "%s", message);
|
||||
sleep(2);
|
||||
isc_log_write1(lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_RBTDB,
|
||||
ISC_LOG_CRITICAL, "%s", message);
|
||||
|
||||
/*
|
||||
* Review where everything went.
|
||||
* XXXDCL NT
|
||||
*/
|
||||
fputc('\n', stderr);
|
||||
if (system("head " TEST_FILE "*; rm -f " TEST_FILE "*") != 0) {
|
||||
fprintf(stderr, "system(\"head " TEST_FILE "*; rm -f " TEST_FILE
|
||||
"*\") failed\n");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* This is highly system specific. */
|
||||
if (freopen(syslog_file, "r", stdin) == NULL) {
|
||||
fprintf(stderr, "freopen(%s, \"r\", stdin) failed\n",
|
||||
syslog_file);
|
||||
goto cleanup;
|
||||
}
|
||||
fprintf(stderr, "\n==> %s <==\n", syslog_file);
|
||||
if (system("tail -2") != 0) {
|
||||
fprintf(stderr, "system(\"tail -2\") failed\n");
|
||||
goto cleanup;
|
||||
}
|
||||
fputc('\n', stderr);
|
||||
|
||||
cleanup:
|
||||
isc_log_destroy(&lctx);
|
||||
|
||||
if (show_final_mem) {
|
||||
isc_mem_stats(mctx, stderr);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
@ -1,86 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
#include <dns/callbacks.h>
|
||||
#include <dns/master.h>
|
||||
#include <dns/name.h>
|
||||
#include <dns/rdataset.h>
|
||||
#include <dns/result.h>
|
||||
|
||||
isc_mem_t *mctx;
|
||||
|
||||
static isc_result_t
|
||||
print_dataset(void *arg, const dns_name_t *owner, dns_rdataset_t *dataset) {
|
||||
char buf[64 * 1024];
|
||||
isc_buffer_t target;
|
||||
isc_result_t result;
|
||||
|
||||
UNUSED(arg);
|
||||
|
||||
isc_buffer_init(&target, buf, 64 * 1024);
|
||||
result = dns_rdataset_totext(dataset, owner, false, false, &target);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
fprintf(stdout, "%.*s\n", (int)target.used,
|
||||
(char *)target.base);
|
||||
} else {
|
||||
fprintf(stdout, "dns_rdataset_totext: %s\n",
|
||||
dns_result_totext(result));
|
||||
}
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[]) {
|
||||
isc_result_t result;
|
||||
dns_name_t origin;
|
||||
isc_buffer_t source;
|
||||
isc_buffer_t target;
|
||||
unsigned char name_buf[255];
|
||||
dns_rdatacallbacks_t callbacks;
|
||||
|
||||
UNUSED(argc);
|
||||
|
||||
isc_mem_create(&mctx);
|
||||
|
||||
if (argv[1]) {
|
||||
isc_buffer_init(&source, argv[1], strlen(argv[1]));
|
||||
isc_buffer_add(&source, strlen(argv[1]));
|
||||
isc_buffer_setactive(&source, strlen(argv[1]));
|
||||
isc_buffer_init(&target, name_buf, 255);
|
||||
dns_name_init(&origin, NULL);
|
||||
result = dns_name_fromtext(&origin, &source, dns_rootname, 0,
|
||||
&target);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fprintf(stdout, "dns_name_fromtext: %s\n",
|
||||
dns_result_totext(result));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
dns_rdatacallbacks_init_stdio(&callbacks);
|
||||
callbacks.add = print_dataset;
|
||||
|
||||
result = dns_master_loadfile(
|
||||
argv[1], &origin, &origin, dns_rdataclass_in, 0, 0,
|
||||
&callbacks, NULL, NULL, mctx, dns_masterformat_text, 0);
|
||||
fprintf(stdout, "dns_master_loadfile: %s\n",
|
||||
dns_result_totext(result));
|
||||
}
|
||||
return (0);
|
||||
}
|
@ -1,118 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#include <isc/mem.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
isc_mem_t *mctx;
|
||||
|
||||
int
|
||||
main(int argc, char *argv[]) {
|
||||
void *items1[50];
|
||||
void *items2[50];
|
||||
void *tmp;
|
||||
isc_mempool_t *mp1, *mp2;
|
||||
unsigned int i, j;
|
||||
isc_mutex_t lock;
|
||||
|
||||
UNUSED(argc);
|
||||
UNUSED(argv);
|
||||
|
||||
isc_mem_debugging = ISC_MEM_DEBUGRECORD;
|
||||
|
||||
isc_mutex_init(&lock);
|
||||
|
||||
mctx = NULL;
|
||||
isc_mem_create(&mctx);
|
||||
|
||||
mp1 = NULL;
|
||||
isc_mempool_create(mctx, 24, &mp1);
|
||||
|
||||
mp2 = NULL;
|
||||
isc_mempool_create(mctx, 31, &mp2);
|
||||
|
||||
isc_mempool_associatelock(mp1, &lock);
|
||||
isc_mempool_associatelock(mp2, &lock);
|
||||
|
||||
isc_mem_stats(mctx, stderr);
|
||||
|
||||
isc_mempool_setfreemax(mp1, 10);
|
||||
isc_mempool_setfillcount(mp1, 10);
|
||||
isc_mempool_setmaxalloc(mp1, 30);
|
||||
|
||||
/*
|
||||
* Allocate 30 items from the pool. This is our max.
|
||||
*/
|
||||
for (i = 0; i < 30; i++) {
|
||||
items1[i] = isc_mempool_get(mp1);
|
||||
RUNTIME_CHECK(items1[i] != NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Try to allocate one more. This should fail.
|
||||
*/
|
||||
tmp = isc_mempool_get(mp1);
|
||||
RUNTIME_CHECK(tmp == NULL);
|
||||
|
||||
/*
|
||||
* Free the first 11 items. Verify that there are 10 free items on
|
||||
* the free list (which is our max).
|
||||
*/
|
||||
|
||||
for (i = 0; i < 11; i++) {
|
||||
isc_mempool_put(mp1, items1[i]);
|
||||
items1[i] = NULL;
|
||||
}
|
||||
|
||||
RUNTIME_CHECK(isc_mempool_getfreecount(mp1) == 10);
|
||||
RUNTIME_CHECK(isc_mempool_getallocated(mp1) == 19);
|
||||
|
||||
isc_mem_stats(mctx, stderr);
|
||||
|
||||
/*
|
||||
* Now, beat up on mp2 for a while. Allocate 50 items, then free
|
||||
* them, then allocate 50 more, etc.
|
||||
*/
|
||||
isc_mempool_setfreemax(mp2, 25);
|
||||
isc_mempool_setfillcount(mp2, 25);
|
||||
for (j = 0; j < 5000; j++) {
|
||||
for (i = 0; i < 50; i++) {
|
||||
items2[i] = isc_mempool_get(mp2);
|
||||
RUNTIME_CHECK(items2[i] != NULL);
|
||||
}
|
||||
for (i = 0; i < 50; i++) {
|
||||
isc_mempool_put(mp2, items2[i]);
|
||||
items2[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Free all the other items and blow away this pool.
|
||||
*/
|
||||
for (i = 11; i < 30; i++) {
|
||||
isc_mempool_put(mp1, items1[i]);
|
||||
items1[i] = NULL;
|
||||
}
|
||||
|
||||
isc_mempool_destroy(&mp1);
|
||||
|
||||
isc_mem_stats(mctx, stderr);
|
||||
|
||||
isc_mempool_destroy(&mp2);
|
||||
|
||||
isc_mem_stats(mctx, stderr);
|
||||
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
isc_mutex_destroy(&lock);
|
||||
|
||||
return (0);
|
||||
}
|
@ -1,360 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/string.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
#include <dns/fixedname.h>
|
||||
#include <dns/result.h>
|
||||
|
||||
static void
|
||||
print_wirename(isc_region_t *name) {
|
||||
unsigned char *ccurr, *cend;
|
||||
|
||||
if (name->length == 0) {
|
||||
printf("<empty wire name>\n");
|
||||
return;
|
||||
}
|
||||
ccurr = name->base;
|
||||
cend = ccurr + name->length;
|
||||
while (ccurr != cend) {
|
||||
printf("%02x ", *ccurr++);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
static void
|
||||
print_name(dns_name_t *name) {
|
||||
isc_result_t result;
|
||||
isc_buffer_t source;
|
||||
isc_region_t r;
|
||||
char s[1000];
|
||||
|
||||
isc_buffer_init(&source, s, sizeof(s));
|
||||
if (dns_name_countlabels(name) > 0) {
|
||||
result = dns_name_totext(name, false, &source);
|
||||
} else {
|
||||
result = ISC_R_SUCCESS;
|
||||
}
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
isc_buffer_usedregion(&source, &r);
|
||||
if (r.length > 0) {
|
||||
printf("%.*s\n", (int)r.length, r.base);
|
||||
} else {
|
||||
printf("<empty text name>\n");
|
||||
}
|
||||
} else {
|
||||
printf("error: %s\n", dns_result_totext(result));
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[]) {
|
||||
char s[1000];
|
||||
isc_result_t result;
|
||||
dns_fixedname_t wname, wname2, oname, compname, downname;
|
||||
isc_buffer_t source;
|
||||
isc_region_t r;
|
||||
dns_name_t *name, *comp, *down;
|
||||
const dns_name_t *origin;
|
||||
unsigned int downcase = 0;
|
||||
size_t len;
|
||||
bool quiet = false;
|
||||
bool concatenate = false;
|
||||
bool got_name = false;
|
||||
bool check_absolute = false;
|
||||
bool check_wildcard = false;
|
||||
bool test_downcase = false;
|
||||
bool inplace = false;
|
||||
bool want_split = false;
|
||||
unsigned int labels, split_label = 0;
|
||||
dns_fixedname_t fprefix, fsuffix;
|
||||
dns_name_t *prefix, *suffix;
|
||||
int ch;
|
||||
|
||||
while ((ch = isc_commandline_parse(argc, argv, "acdiqs:w")) != -1) {
|
||||
switch (ch) {
|
||||
case 'a':
|
||||
check_absolute = true;
|
||||
break;
|
||||
case 'c':
|
||||
concatenate = true;
|
||||
break;
|
||||
case 'd':
|
||||
test_downcase = true;
|
||||
break;
|
||||
case 'i':
|
||||
inplace = true;
|
||||
break;
|
||||
case 'q':
|
||||
quiet = true;
|
||||
break;
|
||||
case 's':
|
||||
want_split = true;
|
||||
split_label = atoi(isc_commandline_argument);
|
||||
break;
|
||||
case 'w':
|
||||
check_wildcard = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
argc -= isc_commandline_index;
|
||||
argv += isc_commandline_index;
|
||||
|
||||
if (argc > 0) {
|
||||
if (strcasecmp("none", argv[0]) == 0) {
|
||||
origin = NULL;
|
||||
} else {
|
||||
len = strlen(argv[0]);
|
||||
isc_buffer_init(&source, argv[0], len);
|
||||
isc_buffer_add(&source, len);
|
||||
dns_fixedname_init(&oname);
|
||||
result = dns_name_fromtext(dns_fixedname_name(&oname),
|
||||
&source, dns_rootname, 0,
|
||||
NULL);
|
||||
if (result != 0) {
|
||||
fprintf(stderr,
|
||||
"dns_name_fromtext() failed: %s\n",
|
||||
dns_result_totext(result));
|
||||
exit(1);
|
||||
}
|
||||
origin = dns_fixedname_name(&oname);
|
||||
}
|
||||
} else if (concatenate) {
|
||||
origin = NULL;
|
||||
} else {
|
||||
origin = dns_rootname;
|
||||
}
|
||||
|
||||
if (argc >= 1) {
|
||||
if (strcasecmp("none", argv[1]) == 0) {
|
||||
comp = NULL;
|
||||
} else {
|
||||
len = strlen(argv[1]);
|
||||
isc_buffer_init(&source, argv[1], len);
|
||||
isc_buffer_add(&source, len);
|
||||
comp = dns_fixedname_initname(&compname);
|
||||
result = dns_name_fromtext(comp, &source, origin, 0,
|
||||
NULL);
|
||||
if (result != 0) {
|
||||
fprintf(stderr,
|
||||
"dns_name_fromtext() failed: %s\n",
|
||||
dns_result_totext(result));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
comp = NULL;
|
||||
}
|
||||
|
||||
name = dns_fixedname_initname(&wname);
|
||||
dns_fixedname_init(&wname2);
|
||||
while (fgets(s, sizeof(s), stdin) != NULL) {
|
||||
len = strlen(s);
|
||||
if (len > 0U && s[len - 1] == '\n') {
|
||||
s[len - 1] = '\0';
|
||||
len--;
|
||||
}
|
||||
isc_buffer_init(&source, s, len);
|
||||
isc_buffer_add(&source, len);
|
||||
|
||||
if (len > 0U) {
|
||||
result = dns_name_fromtext(name, &source, origin,
|
||||
downcase, NULL);
|
||||
} else {
|
||||
if (name == dns_fixedname_name(&wname)) {
|
||||
dns_fixedname_init(&wname);
|
||||
} else {
|
||||
dns_fixedname_init(&wname2);
|
||||
}
|
||||
result = ISC_R_SUCCESS;
|
||||
}
|
||||
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
printf("%s\n", dns_result_totext(result));
|
||||
if (name == dns_fixedname_name(&wname)) {
|
||||
dns_fixedname_init(&wname);
|
||||
} else {
|
||||
dns_fixedname_init(&wname2);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (check_absolute && dns_name_countlabels(name) > 0) {
|
||||
if (dns_name_isabsolute(name)) {
|
||||
printf("absolute\n");
|
||||
} else {
|
||||
printf("relative\n");
|
||||
}
|
||||
}
|
||||
if (check_wildcard && dns_name_countlabels(name) > 0) {
|
||||
if (dns_name_iswildcard(name)) {
|
||||
printf("wildcard\n");
|
||||
} else {
|
||||
printf("not wildcard\n");
|
||||
}
|
||||
}
|
||||
dns_name_toregion(name, &r);
|
||||
if (!quiet) {
|
||||
print_wirename(&r);
|
||||
printf("%u labels, %u bytes.\n",
|
||||
dns_name_countlabels(name), r.length);
|
||||
}
|
||||
|
||||
if (concatenate) {
|
||||
if (got_name) {
|
||||
printf("Concatenating.\n");
|
||||
result = dns_name_concatenate(
|
||||
dns_fixedname_name(&wname),
|
||||
dns_fixedname_name(&wname2),
|
||||
dns_fixedname_name(&wname2), NULL);
|
||||
name = dns_fixedname_name(&wname2);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
if (check_absolute &&
|
||||
dns_name_countlabels(name) > 0) {
|
||||
if (dns_name_isabsolute(name)) {
|
||||
printf("absolute\n");
|
||||
} else {
|
||||
printf("relative\n");
|
||||
}
|
||||
}
|
||||
if (check_wildcard &&
|
||||
dns_name_countlabels(name) > 0) {
|
||||
if (dns_name_iswildcard(name)) {
|
||||
printf("wildcard\n");
|
||||
} else {
|
||||
printf("not "
|
||||
"wildcard\n");
|
||||
}
|
||||
}
|
||||
dns_name_toregion(name, &r);
|
||||
if (!quiet) {
|
||||
print_wirename(&r);
|
||||
printf("%u labels, "
|
||||
"%u bytes.\n",
|
||||
dns_name_countlabels(
|
||||
name),
|
||||
r.length);
|
||||
}
|
||||
} else {
|
||||
printf("%s\n",
|
||||
dns_result_totext(result));
|
||||
}
|
||||
got_name = false;
|
||||
} else {
|
||||
got_name = true;
|
||||
}
|
||||
}
|
||||
isc_buffer_init(&source, s, sizeof(s));
|
||||
if (dns_name_countlabels(name) > 0) {
|
||||
result = dns_name_totext(name, false, &source);
|
||||
} else {
|
||||
result = ISC_R_SUCCESS;
|
||||
}
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
isc_buffer_usedregion(&source, &r);
|
||||
if (r.length > 0) {
|
||||
printf("%.*s\n", (int)r.length, r.base);
|
||||
} else {
|
||||
printf("<empty text name>\n");
|
||||
}
|
||||
if (!quiet) {
|
||||
printf("%u bytes.\n", source.used);
|
||||
}
|
||||
} else {
|
||||
printf("%s\n", dns_result_totext(result));
|
||||
}
|
||||
|
||||
if (test_downcase) {
|
||||
if (inplace) {
|
||||
down = name;
|
||||
} else {
|
||||
down = dns_fixedname_initname(&downname);
|
||||
}
|
||||
result = dns_name_downcase(name, down, NULL);
|
||||
INSIST(result == ISC_R_SUCCESS);
|
||||
if (!quiet) {
|
||||
dns_name_toregion(down, &r);
|
||||
print_wirename(&r);
|
||||
printf("%u labels, %u bytes.\n",
|
||||
dns_name_countlabels(down), r.length);
|
||||
}
|
||||
isc_buffer_init(&source, s, sizeof(s));
|
||||
print_name(down);
|
||||
}
|
||||
|
||||
if (comp != NULL && dns_name_countlabels(name) > 0) {
|
||||
int order;
|
||||
unsigned int nlabels;
|
||||
dns_namereln_t namereln;
|
||||
|
||||
namereln = dns_name_fullcompare(name, comp, &order,
|
||||
&nlabels);
|
||||
if (!quiet) {
|
||||
if (order < 0) {
|
||||
printf("<");
|
||||
} else if (order > 0) {
|
||||
printf(">");
|
||||
} else {
|
||||
printf("=");
|
||||
}
|
||||
switch (namereln) {
|
||||
case dns_namereln_contains:
|
||||
printf(", contains");
|
||||
break;
|
||||
case dns_namereln_subdomain:
|
||||
printf(", subdomain");
|
||||
break;
|
||||
case dns_namereln_commonancestor:
|
||||
printf(", common ancestor");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (namereln != dns_namereln_none &&
|
||||
namereln != dns_namereln_equal) {
|
||||
printf(", nlabels = %u", nlabels);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
printf("dns_name_equal() returns %s\n",
|
||||
dns_name_equal(name, comp) ? "TRUE" : "FALSE");
|
||||
}
|
||||
|
||||
labels = dns_name_countlabels(name);
|
||||
if (want_split && split_label < labels) {
|
||||
prefix = dns_fixedname_initname(&fprefix);
|
||||
suffix = dns_fixedname_initname(&fsuffix);
|
||||
printf("splitting at label %u: ", split_label);
|
||||
dns_name_split(name, split_label, prefix, suffix);
|
||||
printf("\n prefix = ");
|
||||
print_name(prefix);
|
||||
printf(" suffix = ");
|
||||
print_name(suffix);
|
||||
}
|
||||
|
||||
if (concatenate) {
|
||||
if (got_name) {
|
||||
name = dns_fixedname_name(&wname2);
|
||||
} else {
|
||||
name = dns_fixedname_name(&wname);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
@ -1,215 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <isc/mem.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/string.h>
|
||||
|
||||
#include <dns/db.h>
|
||||
#include <dns/dbiterator.h>
|
||||
#include <dns/fixedname.h>
|
||||
#include <dns/nsec.h>
|
||||
#include <dns/rdataset.h>
|
||||
#include <dns/rdatasetiter.h>
|
||||
#include <dns/result.h>
|
||||
|
||||
static isc_mem_t *mctx = NULL;
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static inline void
|
||||
fatal(const char *message) ISC_PLATFORM_NORETURN_POST;
|
||||
|
||||
static inline void
|
||||
fatal(const char *message) {
|
||||
fprintf(stderr, "%s\n", message);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static inline void
|
||||
check_result(isc_result_t result, const char *message) {
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fprintf(stderr, "%s: %s\n", message, isc_result_totext(result));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
static inline bool
|
||||
active_node(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node) {
|
||||
dns_rdatasetiter_t *rdsiter;
|
||||
bool active = false;
|
||||
isc_result_t result;
|
||||
dns_rdataset_t rdataset;
|
||||
|
||||
dns_rdataset_init(&rdataset);
|
||||
rdsiter = NULL;
|
||||
result = dns_db_allrdatasets(db, node, version, 0, &rdsiter);
|
||||
check_result(result, "dns_db_allrdatasets()");
|
||||
result = dns_rdatasetiter_first(rdsiter);
|
||||
while (result == ISC_R_SUCCESS) {
|
||||
dns_rdatasetiter_current(rdsiter, &rdataset);
|
||||
if (rdataset.type != dns_rdatatype_nsec) {
|
||||
active = true;
|
||||
}
|
||||
dns_rdataset_disassociate(&rdataset);
|
||||
if (!active) {
|
||||
result = dns_rdatasetiter_next(rdsiter);
|
||||
} else {
|
||||
result = ISC_R_NOMORE;
|
||||
}
|
||||
}
|
||||
if (result != ISC_R_NOMORE) {
|
||||
fatal("rdataset iteration failed");
|
||||
}
|
||||
dns_rdatasetiter_destroy(&rdsiter);
|
||||
|
||||
if (!active) {
|
||||
/*
|
||||
* Make sure there is no NSEC record for this node.
|
||||
*/
|
||||
result = dns_db_deleterdataset(db, node, version,
|
||||
dns_rdatatype_nsec, 0);
|
||||
if (result == DNS_R_UNCHANGED) {
|
||||
result = ISC_R_SUCCESS;
|
||||
}
|
||||
check_result(result, "dns_db_deleterdataset");
|
||||
}
|
||||
|
||||
return (active);
|
||||
}
|
||||
|
||||
static inline isc_result_t
|
||||
next_active(dns_db_t *db, dns_dbversion_t *version, dns_dbiterator_t *dbiter,
|
||||
dns_name_t *name, dns_dbnode_t **nodep) {
|
||||
isc_result_t result;
|
||||
bool active;
|
||||
|
||||
do {
|
||||
active = false;
|
||||
result = dns_dbiterator_current(dbiter, nodep, name);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
active = active_node(db, version, *nodep);
|
||||
if (!active) {
|
||||
dns_db_detachnode(db, nodep);
|
||||
result = dns_dbiterator_next(dbiter);
|
||||
}
|
||||
}
|
||||
} while (result == ISC_R_SUCCESS && !active);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
static void
|
||||
nsecify(char *filename) {
|
||||
isc_result_t result;
|
||||
dns_db_t *db;
|
||||
dns_dbversion_t *wversion;
|
||||
dns_dbnode_t *node, *nextnode;
|
||||
const char *origintext;
|
||||
dns_fixedname_t fname, fnextname;
|
||||
dns_name_t *name, *nextname, *target;
|
||||
isc_buffer_t b;
|
||||
size_t len;
|
||||
dns_dbiterator_t *dbiter;
|
||||
char newfilename[1024];
|
||||
|
||||
name = dns_fixedname_initname(&fname);
|
||||
nextname = dns_fixedname_initname(&fnextname);
|
||||
|
||||
origintext = strrchr(filename, '/');
|
||||
if (origintext == NULL) {
|
||||
origintext = filename;
|
||||
} else {
|
||||
origintext++; /* Skip '/'. */
|
||||
}
|
||||
len = strlen(origintext);
|
||||
isc_buffer_constinit(&b, origintext, len);
|
||||
isc_buffer_add(&b, len);
|
||||
result = dns_name_fromtext(name, &b, dns_rootname, 0, NULL);
|
||||
check_result(result, "dns_name_fromtext()");
|
||||
|
||||
db = NULL;
|
||||
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone,
|
||||
dns_rdataclass_in, 0, NULL, &db);
|
||||
check_result(result, "dns_db_create()");
|
||||
result = dns_db_load(db, filename, dns_masterformat_text, 0);
|
||||
if (result == DNS_R_SEENINCLUDE) {
|
||||
result = ISC_R_SUCCESS;
|
||||
}
|
||||
check_result(result, "dns_db_load()");
|
||||
wversion = NULL;
|
||||
result = dns_db_newversion(db, &wversion);
|
||||
check_result(result, "dns_db_newversion()");
|
||||
dbiter = NULL;
|
||||
result = dns_db_createiterator(db, 0, &dbiter);
|
||||
check_result(result, "dns_db_createiterator()");
|
||||
result = dns_dbiterator_first(dbiter);
|
||||
check_result(result, "dns_dbiterator_first()");
|
||||
node = NULL;
|
||||
result = next_active(db, wversion, dbiter, name, &node);
|
||||
while (result == ISC_R_SUCCESS) {
|
||||
nextnode = NULL;
|
||||
result = dns_dbiterator_next(dbiter);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
result = next_active(db, wversion, dbiter, nextname,
|
||||
&nextnode);
|
||||
}
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
target = nextname;
|
||||
} else if (result == ISC_R_NOMORE) {
|
||||
target = dns_db_origin(db);
|
||||
} else {
|
||||
target = NULL; /* Make compiler happy. */
|
||||
fatal("db iteration failed");
|
||||
}
|
||||
dns_nsec_build(db, wversion, node, target, 3600); /* XXX BEW */
|
||||
dns_db_detachnode(db, &node);
|
||||
node = nextnode;
|
||||
}
|
||||
if (result != ISC_R_NOMORE) {
|
||||
fatal("db iteration failed");
|
||||
}
|
||||
dns_dbiterator_destroy(&dbiter);
|
||||
/*
|
||||
* XXXRTH For now, we don't increment the SOA serial.
|
||||
*/
|
||||
dns_db_closeversion(db, &wversion, true);
|
||||
len = strlen(filename);
|
||||
if (len + 4 + 1 > sizeof(newfilename)) {
|
||||
fatal("filename too long");
|
||||
}
|
||||
snprintf(newfilename, sizeof(newfilename), "%s.new", filename);
|
||||
result = dns_db_dump(db, NULL, newfilename);
|
||||
check_result(result, "dns_db_dump");
|
||||
dns_db_detach(&db);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[]) {
|
||||
int i;
|
||||
|
||||
dns_result_register();
|
||||
|
||||
isc_mem_create(&mctx);
|
||||
|
||||
argc--;
|
||||
argv++;
|
||||
|
||||
for (i = 0; i < argc; i++) {
|
||||
nsecify(argv[i]);
|
||||
}
|
||||
|
||||
/* isc_mem_stats(mctx, stdout); */
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
return (0);
|
||||
}
|
@ -1,138 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#include <isc/app.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/ratelimiter.h>
|
||||
#include <isc/task.h>
|
||||
#include <isc/time.h>
|
||||
#include <isc/timer.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
isc_ratelimiter_t *rlim = NULL;
|
||||
isc_taskmgr_t *taskmgr = NULL;
|
||||
isc_timermgr_t *timermgr = NULL;
|
||||
isc_task_t *g_task = NULL;
|
||||
isc_mem_t *mctx = NULL;
|
||||
|
||||
static void
|
||||
utick(isc_task_t *task, isc_event_t *event);
|
||||
static void
|
||||
shutdown_rl(isc_task_t *task, isc_event_t *event);
|
||||
static void
|
||||
shutdown_all(isc_task_t *task, isc_event_t *event);
|
||||
|
||||
typedef struct {
|
||||
int milliseconds;
|
||||
void (*fun)(isc_task_t *, isc_event_t *);
|
||||
} schedule_t;
|
||||
|
||||
schedule_t schedule[] = { { 100, utick }, { 200, utick },
|
||||
{ 300, utick }, { 3000, utick },
|
||||
{ 3100, utick }, { 3200, utick },
|
||||
{ 3300, shutdown_rl }, { 5000, utick },
|
||||
{ 6000, shutdown_all } };
|
||||
|
||||
#define NEVENTS (int)(sizeof(schedule) / sizeof(schedule[0]))
|
||||
|
||||
isc_timer_t *timers[NEVENTS];
|
||||
|
||||
static void
|
||||
ltick(isc_task_t *task, isc_event_t *event) {
|
||||
UNUSED(task);
|
||||
printf("** ltick%s **\n",
|
||||
(event->ev_attributes & ISC_EVENTATTR_CANCELED) != 0 ? " ("
|
||||
"canceled"
|
||||
")"
|
||||
: "");
|
||||
isc_event_free(&event);
|
||||
}
|
||||
|
||||
static void
|
||||
utick(isc_task_t *task, isc_event_t *event) {
|
||||
isc_result_t result;
|
||||
UNUSED(task);
|
||||
event->ev_action = ltick;
|
||||
event->ev_sender = NULL;
|
||||
result = isc_ratelimiter_enqueue(rlim, g_task, &event);
|
||||
printf("enqueue: %s\n", result == ISC_R_SUCCESS ? "ok" : "failed");
|
||||
}
|
||||
|
||||
static void
|
||||
shutdown_rl(isc_task_t *task, isc_event_t *event) {
|
||||
UNUSED(task);
|
||||
UNUSED(event);
|
||||
printf("shutdown ratelimiter\n");
|
||||
isc_ratelimiter_shutdown(rlim);
|
||||
}
|
||||
|
||||
static void
|
||||
shutdown_all(isc_task_t *task, isc_event_t *event) {
|
||||
int i;
|
||||
UNUSED(task);
|
||||
UNUSED(event);
|
||||
printf("shutdown all\n");
|
||||
for (i = 0; i < NEVENTS; i++) {
|
||||
isc_timer_detach(&timers[i]);
|
||||
}
|
||||
|
||||
isc_app_shutdown();
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[]) {
|
||||
isc_interval_t linterval;
|
||||
int i;
|
||||
|
||||
UNUSED(argc);
|
||||
UNUSED(argv);
|
||||
|
||||
isc_app_start();
|
||||
isc_interval_set(&linterval, 1, 0);
|
||||
|
||||
isc_mem_create(&mctx);
|
||||
RUNTIME_CHECK(isc_taskmgr_create(mctx, 3, 0, NULL, &taskmgr) ==
|
||||
ISC_R_SUCCESS);
|
||||
RUNTIME_CHECK(isc_timermgr_create(mctx, &timermgr) == ISC_R_SUCCESS);
|
||||
RUNTIME_CHECK(isc_task_create(taskmgr, 0, &g_task) == ISC_R_SUCCESS);
|
||||
|
||||
RUNTIME_CHECK(isc_ratelimiter_create(mctx, timermgr, g_task, &rlim) ==
|
||||
ISC_R_SUCCESS);
|
||||
|
||||
RUNTIME_CHECK(isc_ratelimiter_setinterval(rlim, &linterval) ==
|
||||
ISC_R_SUCCESS);
|
||||
|
||||
for (i = 0; i < NEVENTS; i++) {
|
||||
isc_interval_t uinterval;
|
||||
int ms = schedule[i].milliseconds;
|
||||
isc_interval_set(&uinterval, ms / 1000, (ms % 1000) * 1000000);
|
||||
timers[i] = NULL;
|
||||
RUNTIME_CHECK(isc_timer_create(timermgr, isc_timertype_once,
|
||||
NULL, &uinterval, g_task,
|
||||
schedule[i].fun, NULL,
|
||||
&timers[i]) == ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
isc_app_run();
|
||||
|
||||
isc_task_destroy(&g_task);
|
||||
|
||||
isc_ratelimiter_detach(&rlim);
|
||||
|
||||
isc_timermgr_destroy(&timermgr);
|
||||
isc_taskmgr_destroy(&taskmgr);
|
||||
|
||||
isc_mem_stats(mctx, stdout);
|
||||
|
||||
isc_app_finish();
|
||||
return (0);
|
||||
}
|
@ -1,429 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/string.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
#include <dns/fixedname.h>
|
||||
#include <dns/rbt.h>
|
||||
#include <dns/result.h>
|
||||
|
||||
const char *progname;
|
||||
isc_mem_t *mctx;
|
||||
|
||||
#define DNSNAMELEN 255
|
||||
|
||||
static dns_name_t *
|
||||
create_name(char *s) {
|
||||
int length;
|
||||
isc_result_t result;
|
||||
isc_buffer_t source, target;
|
||||
static dns_name_t *name;
|
||||
|
||||
if (s == NULL || *s == '\0') {
|
||||
printf("missing name argument\n");
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
length = strlen(s);
|
||||
|
||||
isc_buffer_init(&source, s, length);
|
||||
isc_buffer_add(&source, length);
|
||||
|
||||
/*
|
||||
* It isn't really necessary in this program to create individual
|
||||
* memory spaces for each name structure and its associated character
|
||||
* string. It is done here to provide a relatively easy way to test
|
||||
* the callback from dns_rbt_deletename that is supposed to free the
|
||||
* data associated with a node.
|
||||
*
|
||||
* The buffer for the actual name will immediately follow the
|
||||
* name structure.
|
||||
*/
|
||||
name = isc_mem_get(mctx, sizeof(*name) + DNSNAMELEN);
|
||||
|
||||
dns_name_init(name, NULL);
|
||||
isc_buffer_init(&target, name + 1, DNSNAMELEN);
|
||||
|
||||
result = dns_name_fromtext(name, &source, dns_rootname, 0, &target);
|
||||
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
printf("dns_name_fromtext(%s) failed: %s\n", s,
|
||||
dns_result_totext(result));
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
return (name);
|
||||
}
|
||||
|
||||
static void
|
||||
delete_name(void *data, void *arg) {
|
||||
dns_name_t *name;
|
||||
|
||||
UNUSED(arg);
|
||||
name = data;
|
||||
isc_mem_put(mctx, name, sizeof(*name) + DNSNAMELEN);
|
||||
}
|
||||
|
||||
static void
|
||||
print_name(dns_name_t *name) {
|
||||
isc_buffer_t target;
|
||||
char buffer[1024];
|
||||
|
||||
isc_buffer_init(&target, buffer, sizeof(buffer));
|
||||
|
||||
/*
|
||||
* false means absolute names have the final dot added.
|
||||
*/
|
||||
dns_name_totext(name, false, &target);
|
||||
|
||||
printf("%.*s", (int)target.used, (char *)target.base);
|
||||
}
|
||||
|
||||
static void
|
||||
detail(dns_rbt_t *rbt, dns_name_t *name) {
|
||||
dns_name_t *foundname, *origin, *fullname;
|
||||
dns_fixedname_t fixedfoundname, fixedorigin, fixedfullname;
|
||||
dns_rbtnode_t *node1, *node2;
|
||||
dns_rbtnodechain_t chain;
|
||||
isc_result_t result;
|
||||
bool nodes_should_match = false;
|
||||
|
||||
dns_rbtnodechain_init(&chain);
|
||||
|
||||
origin = dns_fixedname_initname(&fixedorigin);
|
||||
fullname = dns_fixedname_initname(&fixedfullname);
|
||||
foundname = dns_fixedname_initname(&fixedfoundname);
|
||||
|
||||
node1 = node2 = NULL;
|
||||
|
||||
printf("checking chain information for ");
|
||||
print_name(name);
|
||||
printf("\n");
|
||||
|
||||
result = dns_rbt_findnode(rbt, name, foundname, &node1, &chain,
|
||||
DNS_RBTFIND_EMPTYDATA, NULL, NULL);
|
||||
|
||||
switch (result) {
|
||||
case ISC_R_SUCCESS:
|
||||
printf(" found exact.");
|
||||
nodes_should_match = true;
|
||||
break;
|
||||
case DNS_R_PARTIALMATCH:
|
||||
printf(" found parent.");
|
||||
break;
|
||||
case ISC_R_NOTFOUND:
|
||||
printf(" name not found.");
|
||||
break;
|
||||
default:
|
||||
printf(" unexpected result: %s\n", dns_result_totext(result));
|
||||
return;
|
||||
}
|
||||
|
||||
if (node1 != NULL && node1->data != NULL) {
|
||||
printf(" data at node: ");
|
||||
print_name(node1->data);
|
||||
} else {
|
||||
printf(" no data at node.");
|
||||
}
|
||||
|
||||
if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) {
|
||||
printf("\n name from dns_rbt_findnode: ");
|
||||
print_name(foundname);
|
||||
}
|
||||
|
||||
result = dns_rbtnodechain_current(&chain, foundname, origin, &node2);
|
||||
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
printf("\n name from dns_rbtnodechain_current: ");
|
||||
|
||||
result = dns_name_concatenate(foundname, origin, fullname,
|
||||
NULL);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
print_name(fullname);
|
||||
} else {
|
||||
printf("%s\n", dns_result_totext(result));
|
||||
}
|
||||
printf("\n (foundname = ");
|
||||
print_name(foundname);
|
||||
printf(", origin = ");
|
||||
print_name(origin);
|
||||
printf(")\n");
|
||||
if (nodes_should_match && node1 != node2) {
|
||||
printf(" nodes returned from each function "
|
||||
"DO NOT match!\n");
|
||||
}
|
||||
} else {
|
||||
printf("\n result from dns_rbtnodechain_current: %s\n",
|
||||
dns_result_totext(result));
|
||||
}
|
||||
|
||||
printf(" level_matches = %u, level_count = %u\n", chain.level_matches,
|
||||
chain.level_count);
|
||||
}
|
||||
|
||||
static void
|
||||
iterate(dns_rbt_t *rbt, bool forward) {
|
||||
dns_name_t foundname, *origin;
|
||||
dns_rbtnodechain_t chain;
|
||||
dns_fixedname_t fixedorigin;
|
||||
isc_result_t result;
|
||||
isc_result_t (*move)(dns_rbtnodechain_t * chain, dns_name_t * name,
|
||||
dns_name_t * origin);
|
||||
|
||||
dns_rbtnodechain_init(&chain);
|
||||
|
||||
dns_name_init(&foundname, NULL);
|
||||
origin = dns_fixedname_initname(&fixedorigin);
|
||||
|
||||
if (forward) {
|
||||
printf("iterating forward\n");
|
||||
move = dns_rbtnodechain_next;
|
||||
|
||||
result = dns_rbtnodechain_first(&chain, rbt, &foundname,
|
||||
origin);
|
||||
} else {
|
||||
printf("iterating backward\n");
|
||||
move = dns_rbtnodechain_prev;
|
||||
|
||||
result = dns_rbtnodechain_last(&chain, rbt, &foundname, origin);
|
||||
}
|
||||
|
||||
if (result != ISC_R_SUCCESS && result != DNS_R_NEWORIGIN) {
|
||||
printf("start not found!\n");
|
||||
} else {
|
||||
for (;;) {
|
||||
if (result == DNS_R_NEWORIGIN) {
|
||||
printf(" new origin: ");
|
||||
print_name(origin);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
if (result == ISC_R_SUCCESS ||
|
||||
result == DNS_R_NEWORIGIN) {
|
||||
print_name(&foundname);
|
||||
printf("\n");
|
||||
} else {
|
||||
if (result != ISC_R_NOMORE) {
|
||||
printf("UNEXPECTED ITERATION ERROR: %s",
|
||||
dns_result_totext(result));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
result = move(&chain, &foundname, origin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define CMDCHECK(s) (strncasecmp(command, (s), length) == 0)
|
||||
#define PRINTERR(r) \
|
||||
if (r != ISC_R_SUCCESS) \
|
||||
printf("... %s\n", dns_result_totext(r));
|
||||
|
||||
int
|
||||
main(int argc, char **argv) {
|
||||
char *command, *arg, buffer[1024];
|
||||
const char *whitespace;
|
||||
dns_name_t *name, *foundname;
|
||||
dns_fixedname_t fixedname;
|
||||
dns_rbt_t *rbt = NULL;
|
||||
int length, ch;
|
||||
bool show_final_mem = false;
|
||||
isc_result_t result;
|
||||
void *data;
|
||||
|
||||
progname = strrchr(*argv, '/');
|
||||
if (progname != NULL) {
|
||||
progname++;
|
||||
} else {
|
||||
progname = *argv;
|
||||
}
|
||||
|
||||
while ((ch = isc_commandline_parse(argc, argv, "m")) != -1) {
|
||||
switch (ch) {
|
||||
case 'm':
|
||||
show_final_mem = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
argc -= isc_commandline_index;
|
||||
argv += isc_commandline_index;
|
||||
POST(argv);
|
||||
|
||||
if (argc > 1) {
|
||||
printf("Usage: %s [-m]\n", progname);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
setbuf(stdout, NULL);
|
||||
|
||||
/*
|
||||
* So isc_mem_stats() can report any allocation leaks.
|
||||
*/
|
||||
isc_mem_debugging = ISC_MEM_DEBUGRECORD;
|
||||
|
||||
isc_mem_create(&mctx);
|
||||
|
||||
result = dns_rbt_create(mctx, delete_name, NULL, &rbt);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
printf("dns_rbt_create: %s: exiting\n",
|
||||
dns_result_totext(result));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
whitespace = " \t";
|
||||
|
||||
while (fgets(buffer, sizeof(buffer), stdin) != NULL) {
|
||||
length = strlen(buffer);
|
||||
|
||||
if (buffer[length - 1] != '\n') {
|
||||
printf("line to long (%lu max), ignored\n",
|
||||
(unsigned long)sizeof(buffer) - 2);
|
||||
continue;
|
||||
}
|
||||
|
||||
buffer[length - 1] = '\0';
|
||||
|
||||
command = buffer + strspn(buffer, whitespace);
|
||||
|
||||
if (*command == '#') {
|
||||
continue;
|
||||
}
|
||||
|
||||
arg = strpbrk(command, whitespace);
|
||||
if (arg != NULL) {
|
||||
*arg++ = '\0';
|
||||
arg += strspn(arg, whitespace);
|
||||
}
|
||||
|
||||
length = strlen(command);
|
||||
if (*command != '\0') {
|
||||
if (CMDCHECK("add")) {
|
||||
name = create_name(arg);
|
||||
if (name != NULL) {
|
||||
printf("adding name %s\n", arg);
|
||||
result = dns_rbt_addname(rbt, name,
|
||||
name);
|
||||
PRINTERR(result);
|
||||
}
|
||||
} else if (CMDCHECK("delete")) {
|
||||
name = create_name(arg);
|
||||
if (name != NULL) {
|
||||
printf("deleting name %s\n", arg);
|
||||
result = dns_rbt_deletename(rbt, name,
|
||||
false);
|
||||
PRINTERR(result);
|
||||
delete_name(name, NULL);
|
||||
}
|
||||
} else if (CMDCHECK("nuke")) {
|
||||
name = create_name(arg);
|
||||
if (name != NULL) {
|
||||
printf("nuking name %s "
|
||||
"and its descendants\n",
|
||||
arg);
|
||||
result = dns_rbt_deletename(rbt, name,
|
||||
true);
|
||||
PRINTERR(result);
|
||||
delete_name(name, NULL);
|
||||
}
|
||||
} else if (CMDCHECK("search")) {
|
||||
name = create_name(arg);
|
||||
if (name != NULL) {
|
||||
printf("searching for name %s ... ",
|
||||
arg);
|
||||
|
||||
foundname = dns_fixedname_initname(
|
||||
&fixedname);
|
||||
data = NULL;
|
||||
|
||||
result = dns_rbt_findname(
|
||||
rbt, name, 0, foundname, &data);
|
||||
switch (result) {
|
||||
case ISC_R_SUCCESS:
|
||||
printf("found exact: ");
|
||||
print_name(data);
|
||||
putchar('\n');
|
||||
break;
|
||||
case DNS_R_PARTIALMATCH:
|
||||
printf("found parent: ");
|
||||
print_name(data);
|
||||
printf("\n\t(foundname: ");
|
||||
print_name(foundname);
|
||||
printf(")\n");
|
||||
break;
|
||||
case ISC_R_NOTFOUND:
|
||||
printf("NOT FOUND!\n");
|
||||
break;
|
||||
case ISC_R_NOMEMORY:
|
||||
printf("OUT OF MEMORY!\n");
|
||||
break;
|
||||
default:
|
||||
printf("UNEXPECTED RESULT\n");
|
||||
}
|
||||
|
||||
delete_name(name, NULL);
|
||||
}
|
||||
} else if (CMDCHECK("check")) {
|
||||
/*
|
||||
* Or "chain". I know, I know. Lame name.
|
||||
* I was having a hard time thinking of a
|
||||
* name (especially one that did not have
|
||||
* a conflicting first letter with another
|
||||
* command) that would differentiate this
|
||||
* from the search command.
|
||||
*
|
||||
* But it is just a test program, eh?
|
||||
*/
|
||||
name = create_name(arg);
|
||||
if (name != NULL) {
|
||||
detail(rbt, name);
|
||||
|
||||
delete_name(name, NULL);
|
||||
}
|
||||
} else if (CMDCHECK("forward")) {
|
||||
iterate(rbt, true);
|
||||
} else if (CMDCHECK("backward")) {
|
||||
iterate(rbt, false);
|
||||
} else if (CMDCHECK("print")) {
|
||||
if (arg == NULL || *arg == '\0') {
|
||||
dns_rbt_printtext(rbt, NULL, stdout);
|
||||
} else {
|
||||
printf("usage: print\n");
|
||||
}
|
||||
} else if (CMDCHECK("quit")) {
|
||||
if (arg == NULL || *arg == '\0') {
|
||||
break;
|
||||
} else {
|
||||
printf("usage: quit\n");
|
||||
}
|
||||
} else {
|
||||
printf("a(dd) NAME, d(elete) NAME, "
|
||||
"s(earch) NAME, p(rint), or q(uit)\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dns_rbt_destroy(&rbt);
|
||||
|
||||
if (show_final_mem) {
|
||||
isc_mem_stats(mctx, stderr);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
@ -1,395 +0,0 @@
|
||||
adding name a.vix.com
|
||||
adding name b.vix.com
|
||||
adding name c.vix.com
|
||||
vix.com. (black)
|
||||
++ BEG down from vix.com.
|
||||
b (black)
|
||||
a (RED from b)
|
||||
NULL
|
||||
NULL
|
||||
c (RED from b)
|
||||
NULL
|
||||
NULL
|
||||
-- END down from vix.com.
|
||||
NULL
|
||||
NULL
|
||||
adding name a.b.c.d.e.f.vix.com
|
||||
adding name b.b.c.d.e.f.vix.com
|
||||
adding name c.b.c.d.e.f.vix.com
|
||||
vix.com. (black)
|
||||
++ BEG down from vix.com.
|
||||
b (black)
|
||||
a (black from b)
|
||||
NULL
|
||||
NULL
|
||||
c (black from b)
|
||||
NULL
|
||||
b.c.d.e.f (RED from c)
|
||||
++ BEG down from b.c.d.e.f
|
||||
b (black)
|
||||
a (RED from b)
|
||||
NULL
|
||||
NULL
|
||||
c (RED from b)
|
||||
NULL
|
||||
NULL
|
||||
-- END down from b.c.d.e.f
|
||||
NULL
|
||||
NULL
|
||||
-- END down from vix.com.
|
||||
NULL
|
||||
NULL
|
||||
adding name a.d.e.f.vix.com
|
||||
adding name q.d.e.f.vix.com
|
||||
adding name d.e.f.vix.com
|
||||
vix.com. (black)
|
||||
++ BEG down from vix.com.
|
||||
b (black)
|
||||
a (black from b)
|
||||
NULL
|
||||
NULL
|
||||
c (black from b)
|
||||
NULL
|
||||
d.e.f (RED from c)
|
||||
++ BEG down from d.e.f
|
||||
b.c (black)
|
||||
++ BEG down from b.c
|
||||
b (black)
|
||||
a (RED from b)
|
||||
NULL
|
||||
NULL
|
||||
c (RED from b)
|
||||
NULL
|
||||
NULL
|
||||
-- END down from b.c
|
||||
a (RED from b.c)
|
||||
NULL
|
||||
NULL
|
||||
q (RED from b.c)
|
||||
NULL
|
||||
NULL
|
||||
-- END down from d.e.f
|
||||
NULL
|
||||
NULL
|
||||
-- END down from vix.com.
|
||||
NULL
|
||||
NULL
|
||||
adding name g.h.vix.com
|
||||
vix.com. (black)
|
||||
++ BEG down from vix.com.
|
||||
b (black)
|
||||
a (black from b)
|
||||
NULL
|
||||
NULL
|
||||
d.e.f (black from b)
|
||||
++ BEG down from d.e.f
|
||||
b.c (black)
|
||||
++ BEG down from b.c
|
||||
b (black)
|
||||
a (RED from b)
|
||||
NULL
|
||||
NULL
|
||||
c (RED from b)
|
||||
NULL
|
||||
NULL
|
||||
-- END down from b.c
|
||||
a (RED from b.c)
|
||||
NULL
|
||||
NULL
|
||||
q (RED from b.c)
|
||||
NULL
|
||||
NULL
|
||||
-- END down from d.e.f
|
||||
c (RED from d.e.f)
|
||||
NULL
|
||||
NULL
|
||||
g.h (RED from d.e.f)
|
||||
NULL
|
||||
NULL
|
||||
-- END down from vix.com.
|
||||
NULL
|
||||
NULL
|
||||
searching for name q.d.e.f.vix.com ... found exact: q.d.e.f.vix.com.
|
||||
searching for name just-parent.a.vix.com ... found parent: a.vix.com.
|
||||
(foundname: a.vix.com.)
|
||||
searching for name no-real-parent.vix.com ... NOT FOUND!
|
||||
searching for name does.not.exist.at.all ... NOT FOUND!
|
||||
iterating forward
|
||||
new origin: .
|
||||
vix.com
|
||||
new origin: vix.com.
|
||||
a
|
||||
b
|
||||
c
|
||||
d.e.f
|
||||
new origin: d.e.f.vix.com.
|
||||
a
|
||||
b.c
|
||||
new origin: b.c.d.e.f.vix.com.
|
||||
a
|
||||
b
|
||||
c
|
||||
new origin: d.e.f.vix.com.
|
||||
q
|
||||
new origin: vix.com.
|
||||
g.h
|
||||
iterating backward
|
||||
new origin: vix.com.
|
||||
g.h
|
||||
new origin: d.e.f.vix.com.
|
||||
q
|
||||
new origin: b.c.d.e.f.vix.com.
|
||||
c
|
||||
b
|
||||
a
|
||||
new origin: d.e.f.vix.com.
|
||||
b.c
|
||||
a
|
||||
new origin: vix.com.
|
||||
d.e.f
|
||||
c
|
||||
b
|
||||
a
|
||||
new origin: .
|
||||
vix.com
|
||||
checking chain information for vix.com.
|
||||
found exact. no data at node.
|
||||
name from dns_rbt_findnode: vix.com.
|
||||
name from dns_rbtnodechain_current: vix.com.
|
||||
(foundname = vix.com, origin = .)
|
||||
level_matches = 0, level_count = 0
|
||||
checking chain information for zzz.com.
|
||||
name not found. no data at node.
|
||||
name from dns_rbtnodechain_current: g.h.vix.com.
|
||||
(foundname = g.h, origin = vix.com.)
|
||||
level_matches = 0, level_count = 1
|
||||
checking chain information for 0.vix.com.
|
||||
found parent. no data at node.
|
||||
name from dns_rbt_findnode: vix.com.
|
||||
name from dns_rbtnodechain_current: vix.com.
|
||||
(foundname = vix.com, origin = .)
|
||||
level_matches = 0, level_count = 0
|
||||
checking chain information for d.vix.com.
|
||||
found parent. no data at node.
|
||||
name from dns_rbt_findnode: vix.com.
|
||||
name from dns_rbtnodechain_current: c.vix.com.
|
||||
(foundname = c, origin = vix.com.)
|
||||
level_matches = 0, level_count = 1
|
||||
checking chain information for f.vix.com.
|
||||
found parent. no data at node.
|
||||
name from dns_rbt_findnode: vix.com.
|
||||
name from dns_rbtnodechain_current: c.vix.com.
|
||||
(foundname = c, origin = vix.com.)
|
||||
level_matches = 0, level_count = 1
|
||||
checking chain information for a.e.f.vix.com.
|
||||
found parent. no data at node.
|
||||
name from dns_rbt_findnode: vix.com.
|
||||
name from dns_rbtnodechain_current: c.vix.com.
|
||||
(foundname = c, origin = vix.com.)
|
||||
level_matches = 0, level_count = 1
|
||||
checking chain information for z.e.f.vix.com.
|
||||
found parent. no data at node.
|
||||
name from dns_rbt_findnode: vix.com.
|
||||
name from dns_rbtnodechain_current: q.d.e.f.vix.com.
|
||||
(foundname = q, origin = d.e.f.vix.com.)
|
||||
level_matches = 0, level_count = 2
|
||||
checking chain information for g.vix.com.
|
||||
found parent. no data at node.
|
||||
name from dns_rbt_findnode: vix.com.
|
||||
name from dns_rbtnodechain_current: q.d.e.f.vix.com.
|
||||
(foundname = q, origin = d.e.f.vix.com.)
|
||||
level_matches = 0, level_count = 2
|
||||
checking chain information for i.vix.com.
|
||||
found parent. no data at node.
|
||||
name from dns_rbt_findnode: vix.com.
|
||||
name from dns_rbtnodechain_current: g.h.vix.com.
|
||||
(foundname = g.h, origin = vix.com.)
|
||||
level_matches = 0, level_count = 1
|
||||
checking chain information for b.c.vix.com.
|
||||
found parent. data at node: c.vix.com.
|
||||
name from dns_rbt_findnode: c.vix.com.
|
||||
name from dns_rbtnodechain_current: c.vix.com.
|
||||
(foundname = c, origin = vix.com.)
|
||||
level_matches = 1, level_count = 1
|
||||
nuking name d.e.f.vix.com and its descendants
|
||||
vix.com. (black)
|
||||
++ BEG down from vix.com.
|
||||
b (black)
|
||||
a (black from b)
|
||||
NULL
|
||||
NULL
|
||||
g.h (black from b)
|
||||
c (RED from g.h)
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
-- END down from vix.com.
|
||||
NULL
|
||||
NULL
|
||||
adding name x.a.vix.com
|
||||
adding name y.x.a.vix.com
|
||||
vix.com. (black)
|
||||
++ BEG down from vix.com.
|
||||
b (black)
|
||||
a (black from b)
|
||||
++ BEG down from a
|
||||
x (black)
|
||||
++ BEG down from x
|
||||
y (black)
|
||||
NULL
|
||||
NULL
|
||||
-- END down from x
|
||||
NULL
|
||||
NULL
|
||||
-- END down from a
|
||||
NULL
|
||||
NULL
|
||||
g.h (black from b)
|
||||
c (RED from g.h)
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
-- END down from vix.com.
|
||||
NULL
|
||||
NULL
|
||||
deleting name a.vix.com
|
||||
deleting name x.a.vix.com
|
||||
vix.com. (black)
|
||||
++ BEG down from vix.com.
|
||||
b (black)
|
||||
a (black from b)
|
||||
++ BEG down from a
|
||||
x (black)
|
||||
++ BEG down from x
|
||||
y (black)
|
||||
NULL
|
||||
NULL
|
||||
-- END down from x
|
||||
NULL
|
||||
NULL
|
||||
-- END down from a
|
||||
NULL
|
||||
NULL
|
||||
g.h (black from b)
|
||||
c (RED from g.h)
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
-- END down from vix.com.
|
||||
NULL
|
||||
NULL
|
||||
deleting name b.vix.com
|
||||
deleting name c.vix.com
|
||||
vix.com. (black)
|
||||
++ BEG down from vix.com.
|
||||
g.h (black)
|
||||
a (RED from g.h)
|
||||
++ BEG down from a
|
||||
x (black)
|
||||
++ BEG down from x
|
||||
y (black)
|
||||
NULL
|
||||
NULL
|
||||
-- END down from x
|
||||
NULL
|
||||
NULL
|
||||
-- END down from a
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
-- END down from vix.com.
|
||||
NULL
|
||||
NULL
|
||||
deleting name y.x.a.vix.com
|
||||
vix.com. (black)
|
||||
++ BEG down from vix.com.
|
||||
g.h (black)
|
||||
a (RED from g.h)
|
||||
++ BEG down from a
|
||||
x (black)
|
||||
NULL
|
||||
NULL
|
||||
-- END down from a
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
-- END down from vix.com.
|
||||
NULL
|
||||
NULL
|
||||
deleting name g.h.vix.com.
|
||||
adding name \[b100000].vix.com.
|
||||
adding name \[b010000].vix.com.
|
||||
adding name \[b001000].vix.com.
|
||||
adding name \[b000100].vix.com.
|
||||
adding name \[b000010].vix.com.
|
||||
adding name \[b000001].vix.com.
|
||||
vix.com. (black)
|
||||
++ BEG down from vix.com.
|
||||
\[x80/6] (black)
|
||||
\[x0/1] (RED from \[x80/6])
|
||||
++ BEG down from \[x0/1]
|
||||
\[x80/5] (black)
|
||||
\[x0/1] (RED from \[x80/5])
|
||||
++ BEG down from \[x0/1]
|
||||
\[x8/4] (black)
|
||||
\[x0/1] (RED from \[x8/4])
|
||||
++ BEG down from \[x0/1]
|
||||
\[x8/3] (black)
|
||||
\[x0/1] (RED from \[x8/3])
|
||||
++ BEG down from \[x0/1]
|
||||
\[x8/2] (black)
|
||||
\[x4/2] (RED from \[x8/2])
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
-- END down from \[x0/1]
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
-- END down from \[x0/1]
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
-- END down from \[x0/1]
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
-- END down from \[x0/1]
|
||||
NULL
|
||||
NULL
|
||||
a (RED from \[x80/6])
|
||||
++ BEG down from a
|
||||
x (black)
|
||||
NULL
|
||||
NULL
|
||||
-- END down from a
|
||||
NULL
|
||||
NULL
|
||||
-- END down from vix.com.
|
||||
NULL
|
||||
NULL
|
||||
searching for name \[b000100].vix.com. ... found exact: \[x10/6].vix.com.
|
||||
adding name vix.com.
|
||||
nuking name vix.com. and its descendants
|
||||
adding name a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.
|
||||
adding name b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.
|
||||
b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w. (black)
|
||||
++ BEG down from b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.
|
||||
a (black)
|
||||
NULL
|
||||
NULL
|
||||
-- END down from b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.
|
||||
NULL
|
||||
NULL
|
||||
adding name .
|
||||
nuking name . and its descendants
|
||||
adding name \[xFFFF/16].\[xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF/256].com
|
||||
adding name \[xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF/128].com
|
||||
\[xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF/128].com. (black)
|
||||
++ BEG down from \[xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF/128].com.
|
||||
\[xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF/144] (black)
|
||||
NULL
|
||||
NULL
|
||||
-- END down from \[xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF/128].com.
|
||||
NULL
|
||||
NULL
|
@ -1,85 +0,0 @@
|
||||
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
# See the COPYRIGHT file distributed with this work for additional
|
||||
# information regarding copyright ownership.
|
||||
|
||||
add a.vix.com
|
||||
add b.vix.com
|
||||
add c.vix.com
|
||||
print
|
||||
add a.b.c.d.e.f.vix.com
|
||||
add b.b.c.d.e.f.vix.com
|
||||
add c.b.c.d.e.f.vix.com
|
||||
print
|
||||
add a.d.e.f.vix.com
|
||||
add q.d.e.f.vix.com
|
||||
add d.e.f.vix.com
|
||||
print
|
||||
add g.h.vix.com
|
||||
print
|
||||
search q.d.e.f.vix.com
|
||||
search just-parent.a.vix.com
|
||||
search no-real-parent.vix.com
|
||||
search does.not.exist.at.all
|
||||
forward
|
||||
backward
|
||||
# existing name
|
||||
check vix.com.
|
||||
# greater than stop node, which has down pointer
|
||||
check zzz.com.
|
||||
# less than lowest in level (would be left link from stop node)
|
||||
check 0.vix.com
|
||||
# greater than stop node, no down pointer
|
||||
check d.vix.com
|
||||
# superdomain stored in existing node
|
||||
check f.vix.com
|
||||
# common ancestor stored in existing node; existing is successor
|
||||
check a.e.f.vix.com
|
||||
# common ancestor stored in existing node; existing is less but not predecessor
|
||||
check z.e.f.vix.com
|
||||
#
|
||||
check g.vix.com
|
||||
#
|
||||
check i.vix.com
|
||||
#
|
||||
check b.c.vix.com
|
||||
nuke d.e.f.vix.com
|
||||
print
|
||||
add x.a.vix.com
|
||||
add y.x.a.vix.com
|
||||
print
|
||||
delete a.vix.com
|
||||
delete x.a.vix.com
|
||||
print
|
||||
delete b.vix.com
|
||||
delete c.vix.com
|
||||
print
|
||||
delete y.x.a.vix.com
|
||||
print
|
||||
delete g.h.vix.com.
|
||||
add \[b100000].vix.com.
|
||||
add \[b010000].vix.com.
|
||||
add \[b001000].vix.com.
|
||||
add \[b000100].vix.com.
|
||||
add \[b000010].vix.com.
|
||||
add \[b000001].vix.com.
|
||||
p
|
||||
search \[b000100].vix.com.
|
||||
# zap the entire tree
|
||||
add vix.com.
|
||||
nuke vix.com.
|
||||
add a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.
|
||||
add b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.
|
||||
print
|
||||
add .
|
||||
# zap it again
|
||||
nuke .
|
||||
# test splitting of maximal bitstring
|
||||
add \[xFFFF/16].\[xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF/256].com
|
||||
add \[xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF/128].com
|
||||
print
|
||||
quit
|
@ -1,128 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <isc/print.h>
|
||||
#include <isc/rwlock.h>
|
||||
#include <isc/string.h>
|
||||
#include <isc/thread.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#define sleep(x) Sleep(1000 * x)
|
||||
#endif /* ifdef WIN32 */
|
||||
|
||||
isc_rwlock_t lock;
|
||||
|
||||
static isc_threadresult_t
|
||||
#ifdef WIN32
|
||||
WINAPI
|
||||
#endif /* ifdef WIN32 */
|
||||
run1(void *arg) {
|
||||
char *message = arg;
|
||||
|
||||
RUNTIME_CHECK(isc_rwlock_lock(&lock, isc_rwlocktype_read) ==
|
||||
ISC_R_SUCCESS);
|
||||
printf("%s got READ lock\n", message);
|
||||
sleep(1);
|
||||
printf("%s giving up READ lock\n", message);
|
||||
RUNTIME_CHECK(isc_rwlock_unlock(&lock, isc_rwlocktype_read) ==
|
||||
ISC_R_SUCCESS);
|
||||
RUNTIME_CHECK(isc_rwlock_lock(&lock, isc_rwlocktype_read) ==
|
||||
ISC_R_SUCCESS);
|
||||
printf("%s got READ lock\n", message);
|
||||
sleep(1);
|
||||
printf("%s giving up READ lock\n", message);
|
||||
RUNTIME_CHECK(isc_rwlock_unlock(&lock, isc_rwlocktype_read) ==
|
||||
ISC_R_SUCCESS);
|
||||
RUNTIME_CHECK(isc_rwlock_lock(&lock, isc_rwlocktype_write) ==
|
||||
ISC_R_SUCCESS);
|
||||
printf("%s got WRITE lock\n", message);
|
||||
sleep(1);
|
||||
printf("%s giving up WRITE lock\n", message);
|
||||
RUNTIME_CHECK(isc_rwlock_unlock(&lock, isc_rwlocktype_write) ==
|
||||
ISC_R_SUCCESS);
|
||||
return ((isc_threadresult_t)0);
|
||||
}
|
||||
|
||||
static isc_threadresult_t
|
||||
#ifdef WIN32
|
||||
WINAPI
|
||||
#endif /* ifdef WIN32 */
|
||||
run2(void *arg) {
|
||||
char *message = arg;
|
||||
|
||||
RUNTIME_CHECK(isc_rwlock_lock(&lock, isc_rwlocktype_write) ==
|
||||
ISC_R_SUCCESS);
|
||||
printf("%s got WRITE lock\n", message);
|
||||
sleep(1);
|
||||
printf("%s giving up WRITE lock\n", message);
|
||||
RUNTIME_CHECK(isc_rwlock_unlock(&lock, isc_rwlocktype_write) ==
|
||||
ISC_R_SUCCESS);
|
||||
RUNTIME_CHECK(isc_rwlock_lock(&lock, isc_rwlocktype_write) ==
|
||||
ISC_R_SUCCESS);
|
||||
printf("%s got WRITE lock\n", message);
|
||||
sleep(1);
|
||||
printf("%s giving up WRITE lock\n", message);
|
||||
RUNTIME_CHECK(isc_rwlock_unlock(&lock, isc_rwlocktype_write) ==
|
||||
ISC_R_SUCCESS);
|
||||
RUNTIME_CHECK(isc_rwlock_lock(&lock, isc_rwlocktype_read) ==
|
||||
ISC_R_SUCCESS);
|
||||
printf("%s got READ lock\n", message);
|
||||
sleep(1);
|
||||
printf("%s giving up READ lock\n", message);
|
||||
RUNTIME_CHECK(isc_rwlock_unlock(&lock, isc_rwlocktype_read) ==
|
||||
ISC_R_SUCCESS);
|
||||
return ((isc_threadresult_t)0);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[]) {
|
||||
unsigned int nworkers;
|
||||
unsigned int i;
|
||||
isc_thread_t workers[100];
|
||||
char name[100];
|
||||
void *dupname;
|
||||
|
||||
if (argc > 1) {
|
||||
nworkers = atoi(argv[1]);
|
||||
} else {
|
||||
nworkers = 2;
|
||||
}
|
||||
if (nworkers > 100) {
|
||||
nworkers = 100;
|
||||
}
|
||||
printf("%u workers\n", nworkers);
|
||||
|
||||
RUNTIME_CHECK(isc_rwlock_init(&lock, 5, 10) == ISC_R_SUCCESS);
|
||||
|
||||
for (i = 0; i < nworkers; i++) {
|
||||
snprintf(name, sizeof(name), "%02u", i);
|
||||
dupname = strdup(name);
|
||||
RUNTIME_CHECK(dupname != NULL);
|
||||
if (i != 0 && i % 3 == 0) {
|
||||
isc_thread_create(run1, dupname, &workers[i]);
|
||||
} else {
|
||||
isc_thread_create(run2, dupname, &workers[i]);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < nworkers; i++) {
|
||||
isc_thread_join(workers[i], NULL);
|
||||
}
|
||||
|
||||
isc_rwlock_destroy(&lock);
|
||||
|
||||
return (0);
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <isc/print.h>
|
||||
#include <isc/serial.h>
|
||||
|
||||
int
|
||||
main() {
|
||||
uint32_t a, b;
|
||||
char buf[1024];
|
||||
char *s, *e;
|
||||
|
||||
while (fgets(buf, sizeof(buf), stdin) != NULL) {
|
||||
buf[sizeof(buf) - 1] = '\0';
|
||||
s = buf;
|
||||
a = strtoul(s, &e, 0);
|
||||
if (s == e) {
|
||||
continue;
|
||||
}
|
||||
s = e;
|
||||
b = strtoul(s, &e, 0);
|
||||
if (s == e) {
|
||||
continue;
|
||||
}
|
||||
fprintf(stdout, "%u %u gt:%d lt:%d ge:%d le:%d eq:%d ne:%d\n",
|
||||
a, b, isc_serial_gt(a, b), isc_serial_lt(a, b),
|
||||
isc_serial_ge(a, b), isc_serial_le(a, b),
|
||||
isc_serial_eq(a, b), isc_serial_ne(a, b));
|
||||
}
|
||||
return (0);
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user