From b576cb34cfb3fc6b0e174809f8f4a33b7685e77b Mon Sep 17 00:00:00 2001 From: christos Date: Sun, 24 Mar 2013 22:50:21 +0000 Subject: [PATCH] updat to 4.2.5 --- external/bsd/dhcp/dist/LICENSE | 2 +- external/bsd/dhcp/dist/Makefile.am | 3 +- external/bsd/dhcp/dist/Makefile.in | 12 +- external/bsd/dhcp/dist/README | 56 +- external/bsd/dhcp/dist/RELNOTES | 257 ++- external/bsd/dhcp/dist/aclocal.m4 | 4 +- external/bsd/dhcp/dist/client/Makefile.am | 2 +- external/bsd/dhcp/dist/client/Makefile.in | 4 +- external/bsd/dhcp/dist/client/clparse.c | 17 +- .../bsd/dhcp/dist/client/dhclient-script.8 | 27 +- external/bsd/dhcp/dist/client/dhclient.8 | 66 +- external/bsd/dhcp/dist/client/dhclient.conf.5 | 143 +- .../dhcp/dist/client/dhclient.conf.example | 36 + .../bsd/dhcp/dist/client/dhclient.leases.5 | 6 +- external/bsd/dhcp/dist/client/scripts/freebsd | 2 +- external/bsd/dhcp/dist/client/scripts/macos | 2 +- external/bsd/dhcp/dist/common/Makefile.am | 6 +- external/bsd/dhcp/dist/common/Makefile.in | 9 +- external/bsd/dhcp/dist/common/alloc.c | 15 +- external/bsd/dhcp/dist/common/comapi.c | 71 +- external/bsd/dhcp/dist/common/dhcp-eval.5 | 166 +- external/bsd/dhcp/dist/common/dhcp-options.5 | 175 +- external/bsd/dhcp/dist/common/execute.c | 139 +- external/bsd/dhcp/dist/common/lpf.c | 9 +- external/bsd/dhcp/dist/common/options.c | 284 ++- external/bsd/dhcp/dist/common/packet.c | 53 +- external/bsd/dhcp/dist/common/parse.c | 239 ++- external/bsd/dhcp/dist/common/print.c | 23 +- external/bsd/dhcp/dist/common/socket.c | 89 +- external/bsd/dhcp/dist/common/tables.c | 14 +- external/bsd/dhcp/dist/common/tests/Atffile | 5 + .../bsd/dhcp/dist/common/tests/Makefile.am | 23 +- .../bsd/dhcp/dist/common/tests/Makefile.in | 313 +-- .../bsd/dhcp/dist/common/tests/test_alloc.c | 790 ++++---- external/bsd/dhcp/dist/common/tree.c | 132 +- external/bsd/dhcp/dist/configure | 227 ++- external/bsd/dhcp/dist/configure.ac | 115 +- .../bsd/dhcp/dist/contrib/3.0b1-lease-convert | 4 +- external/bsd/dhcp/dist/dhcpctl/Makefile.in | 2 + external/bsd/dhcp/dist/dhcpctl/dhcpctl.3 | 4 +- external/bsd/dhcp/dist/dhcpctl/dhcpctl.h | 6 +- external/bsd/dhcp/dist/dhcpctl/omshell.1 | 13 +- external/bsd/dhcp/dist/doc/Makefile | 15 + external/bsd/dhcp/dist/doc/References.html | 12 +- external/bsd/dhcp/dist/doc/References.txt | 190 +- external/bsd/dhcp/dist/doc/References.xml | 11 +- external/bsd/dhcp/dist/doc/devel/doxyfile.in | 1792 +++++++++++++++++ .../dist/doc/ja_JP.eucJP/dhclient-script.8 | 4 +- .../bsd/dhcp/dist/doc/ja_JP.eucJP/dhclient.8 | 4 +- .../dhcp/dist/doc/ja_JP.eucJP/dhclient.conf.5 | 4 +- .../dist/doc/ja_JP.eucJP/dhclient.leases.5 | 4 +- .../bsd/dhcp/dist/doc/ja_JP.eucJP/dhcp-eval.5 | 4 +- .../dhcp/dist/doc/ja_JP.eucJP/dhcp-options.5 | 4 +- external/bsd/dhcp/dist/dst/Makefile.in | 2 + external/bsd/dhcp/dist/dst/dst_api.c | 22 +- external/bsd/dhcp/dist/dst/dst_support.c | 21 +- external/bsd/dhcp/dist/dst/hmac_link.c | 35 +- external/bsd/dhcp/dist/dst/prandom.c | 46 +- external/bsd/dhcp/dist/includes/Makefile.in | 2 + .../bsd/dhcp/dist/includes/arpa/nameser.h | 4 +- .../dhcp/dist/includes/arpa/nameser_compat.h | 4 +- external/bsd/dhcp/dist/includes/cdefs.h | 20 +- external/bsd/dhcp/dist/includes/config.h.in | 6 + external/bsd/dhcp/dist/includes/dhcp.h | 7 +- external/bsd/dhcp/dist/includes/dhctoken.h | 9 +- external/bsd/dhcp/dist/includes/heap.h | 4 +- .../bsd/dhcp/dist/includes/omapip/omapip_p.h | 6 +- external/bsd/dhcp/dist/includes/site.h | 50 +- external/bsd/dhcp/dist/includes/t_api.h | 4 +- external/bsd/dhcp/dist/omapip/Makefile.in | 2 + external/bsd/dhcp/dist/omapip/alloc.c | 10 +- external/bsd/dhcp/dist/omapip/buffer.c | 11 +- external/bsd/dhcp/dist/omapip/connection.c | 35 +- external/bsd/dhcp/dist/omapip/handle.c | 8 +- external/bsd/dhcp/dist/omapip/iscprint.c | 6 +- external/bsd/dhcp/dist/omapip/listener.c | 22 +- external/bsd/dhcp/dist/omapip/protocol.c | 38 +- external/bsd/dhcp/dist/omapip/support.c | 17 +- external/bsd/dhcp/dist/omapip/trace.c | 19 +- external/bsd/dhcp/dist/relay/Makefile.in | 2 + external/bsd/dhcp/dist/relay/dhcrelay.8 | 10 +- external/bsd/dhcp/dist/server/Makefile.am | 8 +- external/bsd/dhcp/dist/server/Makefile.in | 202 +- external/bsd/dhcp/dist/server/bootp.c | 63 +- external/bsd/dhcp/dist/server/class.c | 9 +- external/bsd/dhcp/dist/server/confpars.c | 182 +- external/bsd/dhcp/dist/server/db.c | 34 +- external/bsd/dhcp/dist/server/dhcp.c | 290 ++- external/bsd/dhcp/dist/server/dhcpd.8 | 94 +- external/bsd/dhcp/dist/server/dhcpd.c | 13 +- external/bsd/dhcp/dist/server/dhcpd.conf.5 | 465 +++-- .../bsd/dhcp/dist/server/dhcpd.conf.example | 104 + external/bsd/dhcp/dist/server/dhcpd.leases.5 | 4 +- external/bsd/dhcp/dist/server/failover.c | 84 +- external/bsd/dhcp/dist/server/ldap.c | 4 +- external/bsd/dhcp/dist/server/mdb.c | 88 +- external/bsd/dhcp/dist/server/omapi.c | 68 +- external/bsd/dhcp/dist/server/salloc.c | 51 +- external/bsd/dhcp/dist/server/tests/Atffile | 5 + .../bsd/dhcp/dist/server/tests/Makefile.am | 54 + .../bsd/dhcp/dist/server/tests/Makefile.in | 933 +++++++++ .../dhcp/dist/server/tests/hash_unittest.c | 609 ++++++ .../dist/server/tests/load_bal_unittest.c | 193 ++ .../dhcp/dist/server/tests/mdb6_unittest.c | 959 +++++++++ .../dhcp/dist/server/tests/simple_unittest.c | 79 + external/bsd/dhcp/dist/tests/HOWTO-unit-test | 148 +- external/bsd/dhcp/dist/tests/Makefile.in | 2 + external/bsd/dhcp/dist/tests/t_api.c | 4 +- external/bsd/dhcp/dist/util/bindvar.sh | 2 +- 109 files changed, 8461 insertions(+), 2321 deletions(-) create mode 100644 external/bsd/dhcp/dist/client/dhclient.conf.example create mode 100644 external/bsd/dhcp/dist/common/tests/Atffile create mode 100644 external/bsd/dhcp/dist/doc/devel/doxyfile.in create mode 100644 external/bsd/dhcp/dist/server/dhcpd.conf.example create mode 100644 external/bsd/dhcp/dist/server/tests/Atffile create mode 100644 external/bsd/dhcp/dist/server/tests/Makefile.am create mode 100644 external/bsd/dhcp/dist/server/tests/Makefile.in create mode 100644 external/bsd/dhcp/dist/server/tests/hash_unittest.c create mode 100644 external/bsd/dhcp/dist/server/tests/load_bal_unittest.c create mode 100644 external/bsd/dhcp/dist/server/tests/mdb6_unittest.c create mode 100644 external/bsd/dhcp/dist/server/tests/simple_unittest.c diff --git a/external/bsd/dhcp/dist/LICENSE b/external/bsd/dhcp/dist/LICENSE index e537b29cf81f..2cb8941f4b97 100644 --- a/external/bsd/dhcp/dist/LICENSE +++ b/external/bsd/dhcp/dist/LICENSE @@ -1,4 +1,4 @@ -# Copyright (c) 2004-2011 by Internet Systems Consortium, Inc. ("ISC") +# Copyright (c) 2004-2013 by Internet Systems Consortium, Inc. ("ISC") # Copyright (c) 1995-2003 by Internet Software Consortium # # Permission to use, copy, modify, and distribute this software for any diff --git a/external/bsd/dhcp/dist/Makefile.am b/external/bsd/dhcp/dist/Makefile.am index 928d926c4b37..32407a1156e5 100644 --- a/external/bsd/dhcp/dist/Makefile.am +++ b/external/bsd/dhcp/dist/Makefile.am @@ -19,7 +19,8 @@ EXTRA_DIST = RELNOTES LICENSE \ doc/ja_JP.eucJP/dhcp-eval.5 doc/ja_JP.eucJP/dhcp-options.5 \ doc/examples/dhclient-dhcpv6.conf doc/examples/dhcpd-dhcpv6.conf \ util/bindvar.sh \ - bind/Makefile bind/bind.tar.gz bind/version.tmp + bind/Makefile bind/bind.tar.gz bind/version.tmp \ + common/tests/Atffile server/tests/Atffile SUBDIRS = bind includes tests common dst omapip client dhcpctl relay server diff --git a/external/bsd/dhcp/dist/Makefile.in b/external/bsd/dhcp/dist/Makefile.in index 4268589151e5..43e33a08d267 100644 --- a/external/bsd/dhcp/dist/Makefile.in +++ b/external/bsd/dhcp/dist/Makefile.in @@ -33,7 +33,8 @@ POST_UNINSTALL = : subdir = . DIST_COMMON = README $(am__configure_deps) $(nobase_include_HEADERS) \ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(top_srcdir)/configure depcomp install-sh missing + $(top_srcdir)/configure $(top_srcdir)/doc/devel/doxyfile.in \ + depcomp install-sh missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ @@ -42,7 +43,7 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/includes/config.h -CONFIG_CLEAN_FILES = +CONFIG_CLEAN_FILES = doc/devel/doxyfile SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ @@ -79,6 +80,8 @@ distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ +ATF_CFLAGS = @ATF_CFLAGS@ +ATF_LDFLAGS = @ATF_LDFLAGS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -185,7 +188,8 @@ EXTRA_DIST = RELNOTES LICENSE \ doc/ja_JP.eucJP/dhcp-eval.5 doc/ja_JP.eucJP/dhcp-options.5 \ doc/examples/dhclient-dhcpv6.conf doc/examples/dhcpd-dhcpv6.conf \ util/bindvar.sh \ - bind/Makefile bind/bind.tar.gz bind/version.tmp + bind/Makefile bind/bind.tar.gz bind/version.tmp \ + common/tests/Atffile server/tests/Atffile SUBDIRS = bind includes tests common dst omapip client dhcpctl relay server nobase_include_HEADERS = dhcpctl/dhcpctl.h @@ -216,6 +220,8 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +doc/devel/doxyfile: $(top_builddir)/config.status $(top_srcdir)/doc/devel/doxyfile.in + cd $(top_builddir) && $(SHELL) ./config.status $@ install-nobase_includeHEADERS: $(nobase_include_HEADERS) @$(NORMAL_INSTALL) test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)" diff --git a/external/bsd/dhcp/dist/README b/external/bsd/dhcp/dist/README index f48d8b5af113..ecc3b62e321b 100644 --- a/external/bsd/dhcp/dist/README +++ b/external/bsd/dhcp/dist/README @@ -1,8 +1,8 @@ Internet Systems Consortium DHCP Distribution - Version 4.2.3 - 18 October 2011 + Version 4.2.5 + 8 January 2013 - README FILE + README FILE You should read this file carefully before trying to install or use the ISC DHCP Distribution. @@ -34,7 +34,8 @@ the ISC DHCP Distribution. 5.7 NeXTSTEP 5.8 SOLARIS 5.8.1 Solaris 11 - 5.8.2 Other Solaris Items + 5.8.2 Solaris 11 and ATF + 5.8.3 Other Solaris Items 5.9 AIX 5.10 MacOS X 6 SUPPORT @@ -58,8 +59,8 @@ DHCP server documentation is in the dhcpd man page. Information about the DHCP server lease database is in the dhcpd.leases man page. Server configuration documentation is in the dhcpd.conf man page as well as the dhcp-options man page. A sample DHCP server -configuration is in the file server/dhcpd.conf. The source for the -dhcpd, dhcpd.leases and dhcpd.conf man pages is in the server/ sub- +configuration is in the file server/dhcpd.conf.example. The source for +the dhcpd, dhcpd.leases and dhcpd.conf man pages is in the server/ sub- directory in the distribution. The source for the dhcp-options.5 man page is in the common/ subdirectory. @@ -97,7 +98,7 @@ directory, it may not have up-to-date information). RELEASE STATUS -This is ISC DHCP 4.2.3, a maintenance release containing patches. +This is ISC DHCP 4.2.5, a maintenance release containing patches. In this release, the DHCPv6 server should be fully functional on Linux, Solaris, or any BSD. The DHCPv6 client should be similarly functional @@ -132,12 +133,12 @@ information. On Digital Unix, type ``man pfilt''. To build the DHCP Distribution, unpack the compressed tar file using the tar utility and the gzip command - type something like: - gunzip dhcp-4.2.3.tar.gz - tar xvf dhcp-4.2.3.tar + gunzip dhcp-4.2.5.tar.gz + tar xvf dhcp-4.2.5.tar CONFIGURING IT -Now, cd to the dhcp-4.2.3 subdirectory that you've just created and +Now, cd to the dhcp-4.2.5 subdirectory that you've just created and configure the source tree by typing: ./configure @@ -148,6 +149,11 @@ system; otherwise, it will complain. If it can't figure out what system you are using, that system is not supported - you are on your own. +Several options may be enabled or disabled via the configure command. +You can get a list of these by typing: + + ./configure --help + DYNAMIC DNS UPDATES A fully-featured implementation of dynamic DNS updates is included in @@ -450,6 +456,36 @@ configuration step. The command line would be something like: ./configure --enable-use-sockets --enable-ipv4-pktinfo + Solaris 11 and ATF + +We have reports that ATF 0.15 and 0.16 do not build on Solaris 11. The +following changes to the ATF source code appear to fix this issue: + +diff -ru atf-0.15/atf-c/tp_test.c atf-0.15-patched/atf-c/tp_test.c +--- atf-0.15/atf-c/tp_test.c 2011-12-06 06:31:11.000000000 +0100 ++++ atf-0.15-patched/atf-c/tp_test.c 2012-06-19 15:54:57.000000000 +0200 +@@ -28,6 +28,7 @@ +*/ + +#include ++#include +#include + +#include + +diff -ru atf-0.15/atf-run/requirements.cpp atf-0.15-patched/atf-run/requirements.cpp +--- atf-0.15/atf-run/requirements.cpp 2012-01-13 20:44:25.000000000 +0100 ++++ atf-0.15-patched/atf-run/requirements.cpp 2012-06-19 15:41:51.000000000 +0200 +@@ -29,7 +29,7 @@ + +extern "C" { +#include +-#include ++//#include +} + +#include + Other Solaris Items One problem which has been observed and is not fixed in this diff --git a/external/bsd/dhcp/dist/RELNOTES b/external/bsd/dhcp/dist/RELNOTES index ab5b76b685dd..3c37a0bc17eb 100644 --- a/external/bsd/dhcp/dist/RELNOTES +++ b/external/bsd/dhcp/dist/RELNOTES @@ -1,6 +1,6 @@ Internet Systems Consortium DHCP Distribution - Version 4.2.3 - 18 October 2011 + Version 4.2.5 + 8 January 2013 Release Notes @@ -39,6 +39,259 @@ The system has only been tested on Linux, FreeBSD, and Solaris, and may not work on other platforms. Please report any problems and suggested fixes to . + Changes since 4.2.5rc1 + +- None + Changes since 4.2.5b1 + +- Modify test makefiles to be more similar to standard makefiles + and comment out a currently unused test. + [ISC-Bugs #32098] + + Changes since 4.2.4 + +- Correct code to calculate timing values in client to compare + rebind value to infinity instead of renew value. + Thanks to Chenda Huang from H3C Technologies Co., Limited + for reporting this issue. + [ISC-Bugs #29062] + +- Fix some issues in the code for parsing and printing options. + [ISC-Bugs #22625] - properly print options that have several fields + followed by an array of something for example "fIa" + [ISC-Bugs #27289] - properly parse options in declarations that have + several fields followed by an array of something for example "fIa" + [ISC-Bugs #27296] - properly determine if we parsed a 16 or 32 bit + value in evaluate_numeric_expression (extract-int). + [ISC-Bugs #27314] - properly parse a zero length option from + a lease file. Thanks to Marius Tomaschewski from SUSE for the report + and prototype patch for this ticket as well as ticket 27289. + +! Previously the server code was relaxed to allow packets with zero + length client ids to be processed. Under some situations use of + zero length client ids can cause the server to go into an infinite + loop. As such ids are not valid according to RFC 2132 section 9.14 + the server no longer accepts them. Client ids with a length of 1 + are also invalid but the server still accepts them in order to + minimize disruption. The restriction will likely be tightened in + the future to disallow ids with a length of 1. + Thanks to Markus Hietava of Codenomicon CROSS project for the + finding this issue and CERT-FI for vulnerability coordination. + [ISC-Bugs #29851] + CVE: CVE-2012-3571 + +! When attempting to convert a DUID from a client id option + into a hardware address handle unexpected client ids properly. + Thanks to Markus Hietava of Codenomicon CROSS project for the + finding this issue and CERT-FI for vulnerability coordination. + [ISC-Bugs #29852] + CVE: CVE-2012-3570 + +! A pair of memory leaks were found and fixed. Thanks to + Glen Eustace of Massey University, New Zealand for finding + this issue. + [ISC-Bugs #30024] + CVE: CVE-2012-3954 + +- Existing legacy unit-tests have been migrated to Automated Test + Framework (ATF). Several new tests have been developed. To enable + unit-tests, please use --with-atf in configure script. A Developer's + Guide has been added. To generate it, please use make devel in + the doc directory. It is currently in early stages of development, + but is expected to grow in the near future. [ISC-Bugs 25901] + +! An issue with the use of lease times was found and fixed. Making + certain changes to the end time of an IPv6 lease could cause the + server to abort. Thanks to Glen Eustace of Massey University, + New Zealand for finding this issue. + [ISC-Bugs #30281] + CVE: CVE-2012-3955 + +- Update the memory leakage debug code to work with v6. + [ISC-Bugs #30297] + +- Relax the requirements for deleting an A or AAAA record. + Previously the DDNS removal code required both the A or AAAA + record and the TXT record to exist. This requirement could + cause problems if something interrupted the removal leaving + the TXT record alone. This relaxation was codified in RFC 4703. + [ISC-Bugs #30734] + +- Modify the failover code to handle incorrect peer names + better. Previously the structure holding the name might + have been freed inappropriately in some cases and not + freed in other cases. + [ISC-Bugs #30320] + +- Add a configure option, enable-secs-byteorder, to deal with + clients that do the byte ordering on the secs field incorrectly. + This field should be in network byte order but some clients + get it wrong. When this option is enabled the server will examine + the secs field and if it looks wrong (high byte non zero and low + byte zero) swap the bytes. The default is disabled. This option + is only useful when doing load balancing within failover. + [ISC-Bugs #26108] + +- Fix a set of issues that were discovered via a code inspection + tool. Thanks to Jiri Popelka and Tomas Hozza Red Hat for the logs + and patches. + [ISC-Bugs #23833] + +- Parsing unquoted base64 strings improved. Parser now properly handles + strings that contain reserved names. [ISC-Bugs #23048] + +- Modify the nak_lease function to make some attempts to find a + server-identifier option to use for the NAK. This feature is + enabled by defining SERVER_ID_FOR_NAK in includes/site.h and + currently defaults to disabled. + [ISC-Bugs #25689] + +- The client now passes information about the options it requested + from the server to the script code via environment variables. + These variables are of the form requested_=1 with + the option name being the same as used in the new_* and old_* + variables. + [ISC-Bugs #29068] + +- Add support for a simple check that the server id in a request message + to a failover peer matches the server id of the server. This support + is enabled by editing the file includes/site.h and uncommenting the + definition for SERVER_ID_CHECK. The option has several restrictions + and issues - please read the comment in the site.h file before + enabling it. + [ISC-Bugs #31463] + +- Tidy up some compiler issues in the debug code. + [ISC-Bugs #26460] + +- Move the dhcpd.conf exmample file to dhcpd.conf.example to avoid + overwriting the dhcpd.conf file when installing a new version of + ISC DHCP. The user will now need to manual copy and edit the + dhcpd.conf file as desired. + [ISC-Bugs #19337] + +- Check the status value when trying to read from a connection to + see if it may have been closed. If it appears closed don't try + to read from it again. This avoids a potential busy-wait like + loop when the peer names are mismatched. + [ISC-Bugs #31231] + +- Remove an unused variable to keep compilers happy. + [ISC-Bugs #31983] + + Changes since 4.2.4rc2 + +- None + + Changes since 4.2.4rc1 + +- Rotate the lease file when running in v6 mode. + Thanks to Christoph Moench-Tegeder at Astaro for the + report and the first version of the patch. + [ISC-Bugs #24887] + + Changes since 4.2.4b1 + +- None + + Changes since 4.2.3 + +! Add a check for a null pointer before calling the regexec function. + Without this check we could, under some circumstances, pass + a null pointer to the regexec function causing it to segfault. + Thanks to a report from BlueCat Networks. + [ISC-Bugs #26704]. + CVE: CVE-2011-4539 + +! Modify the DDNS handling code. In a previous patch we added logging + code to the DDNS handling. This code included a bug that caused it + to attempt to dereference a NULL pointer and eventually segfault. + While reviewing the code as we addressed this problem, we determined + that some of the updates to the lease structures would not work as + planned since the structures being updated were in the process of + being freed: these updates were removed. In addition we removed an + incorrect call to the DDNS removal function that could cause a failure + during the removal of DDNS information from the DNS server. + Thanks to Jasper Jongmans for reporting this issue. + [ISC-Bugs #27078] + CVE: CVE-2011-4868 + +- Fixed the code that checks if an address the server is planning + to hand out is in a reserved range. This would appear as + the server being out of addresses in pools with particular ranges. + [ISC-Bugs #26498] + +- In the DDNS code handle error conditions more gracefully and add more + logging code. The major change is to handle unexpected cancel events + from the DNS client code. + [ISC-Bugs #26287] + +- Tidy up the receive calls and eliminate the need for found_pkt. + [ISC-Bugs #25066] + +- Add support for Infiniband over sockets to the server and + relay code. We've tested this on Solaris and hope to expand + support for Infiniband in the future. This patch also corrects + some issues we found in the socket code. + [ISC-Bugs #24245] + +- Add a compile time check for the presence of the noreturn attribute + and use it for log_fatal if it's available. This will help code + checking programs to eliminate false positives. + [ISC-Bugs #27539] + +- Fixed many compilation problems ("set, but not used" warnings) for + gcc 4.6 that may affect Ubuntu 11.10 users. [ISC-Bugs #27588] + +- Modify the code that determines if an outstanding DDNS request + should be cancelled. This patch results in cancelling the + outstanding request less often. It fixes the problem caused + by a client doing a release where the TXT and PTR records + weren't removed from the DNS. + [ISC-BUGS #27858] + +- Use offsetof() instead of sizeof() to get the sizes for dhcpv6_relay_packet + and dhcpv6_packet in several more places. Thanks to a report from + Bruno Verstuyft and Vincent Demaertelaere of Excentis. + [ISC-Bugs #27941] + +- Remove outdated note in the description of the bootp keyword about the + option not satisfying the requirement of failover peers for denying + dynamic bootp clients. + [ISC-bugs #28574] + +- Multiple items to clean up IPv6 address processing. + When processing an IA that we've seen check to see if the + addresses are usable (not in use by somebody else) before + handing it out. + When reading in leases from the file discard expired addresses. + When picking an address for a client include the IA ID in + addition to the client ID to generally pick different addresses + for different IAs. + [ISC-Bugs #23138] [ISC-Bugs #27945] [ISC-Bugs #25586] + [ISC-Bugs #27684] + +- Remove unnecessary checks in the lease query code and clean up + several compiler issues (some dereferences of NULL and treating + an int as a boolean). + [ISC-Bugs #26203] + +- Fix the NA and PD allocation code to handle the case where a client + provides a preference and the server doesn't have any addresses or + prefixes available. Previoulsy the server ignored the request with + this patch it replies with a NoAddrsAvail or NoPrefixAvail response. + By default the code performs according to the errata of August 2010 + for RFC 3315 section 17.2.2; to enable the previous style see the + section on RFC3315_PRE_ERRATA_2010_08 in includes/site.h. This option + may be removed in the future. + Thanks to Jiri Popelka at Red Hat for the patch. + [ISC-Bugs #22676] + +- Fix up some issues found by static analysis. + A potential memory leak and NULL dereference in omapi. + The use of a boolean test instead of a bitwise test in dst. + [ISC-Bugs #28941] + Changes since 4.2.2 - Fix the code that checks for an existing DDNS transaction to cancel diff --git a/external/bsd/dhcp/dist/aclocal.m4 b/external/bsd/dhcp/dist/aclocal.m4 index be41d128b7b5..5bad6191913d 100644 --- a/external/bsd/dhcp/dist/aclocal.m4 +++ b/external/bsd/dhcp/dist/aclocal.m4 @@ -13,8 +13,8 @@ m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(AC_AUTOCONF_VERSION, [2.67],, -[m4_warning([this file was generated for autoconf 2.67. +m4_if(AC_AUTOCONF_VERSION, [2.69],, +[m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) diff --git a/external/bsd/dhcp/dist/client/Makefile.am b/external/bsd/dhcp/dist/client/Makefile.am index 57c6ac931073..39ddf6f65b10 100644 --- a/external/bsd/dhcp/dist/client/Makefile.am +++ b/external/bsd/dhcp/dist/client/Makefile.am @@ -1,4 +1,4 @@ -dist_sysconf_DATA = dhclient.conf +dist_sysconf_DATA = dhclient.conf.example sbin_PROGRAMS = dhclient dhclient_SOURCES = clparse.c dhclient.c dhc6.c \ scripts/bsdos scripts/freebsd scripts/linux scripts/macos \ diff --git a/external/bsd/dhcp/dist/client/Makefile.in b/external/bsd/dhcp/dist/client/Makefile.in index 4ec0e8097d1d..1664f43b23a2 100644 --- a/external/bsd/dhcp/dist/client/Makefile.in +++ b/external/bsd/dhcp/dist/client/Makefile.in @@ -77,6 +77,8 @@ CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ +ATF_CFLAGS = @ATF_CFLAGS@ +ATF_LDFLAGS = @ATF_LDFLAGS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -166,7 +168,7 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -dist_sysconf_DATA = dhclient.conf +dist_sysconf_DATA = dhclient.conf.example dhclient_SOURCES = clparse.c dhclient.c dhc6.c \ scripts/bsdos scripts/freebsd scripts/linux scripts/macos \ scripts/netbsd scripts/nextstep scripts/openbsd \ diff --git a/external/bsd/dhcp/dist/client/clparse.c b/external/bsd/dhcp/dist/client/clparse.c index bdd3307e9c2b..ee889fd840d2 100644 --- a/external/bsd/dhcp/dist/client/clparse.c +++ b/external/bsd/dhcp/dist/client/clparse.c @@ -1,11 +1,11 @@ -/* $NetBSD: clparse.c,v 1.1.1.1 2013/03/24 15:45:58 christos Exp $ */ +/* $NetBSD: clparse.c,v 1.1.1.2 2013/03/24 22:50:27 christos Exp $ */ /* clparse.c Parser for dhclient config and lease files... */ /* - * Copyright (c) 2004-2011 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004-2012 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1996-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -35,7 +35,7 @@ */ #include -__RCSID("$NetBSD: clparse.c,v 1.1.1.1 2013/03/24 15:45:58 christos Exp $"); +__RCSID("$NetBSD: clparse.c,v 1.1.1.2 2013/03/24 22:50:27 christos Exp $"); #include "dhcpd.h" #include @@ -64,10 +64,18 @@ isc_result_t read_client_conf () { struct client_config *config; struct interface_info *ip; - struct parse *parse; isc_result_t status; unsigned code; + /* + * TODO: LATER constant is very undescriptive. We should review it and + * change it to something more descriptive or even better remove it + * completely as it is currently not used. + */ +#ifdef LATER + struct parse *parse = NULL; +#endif + /* Initialize the default request list. */ memset(default_requested_options, 0, sizeof(default_requested_options)); @@ -164,7 +172,6 @@ isc_result_t read_client_conf () (struct interface_info *)0, &top_level_config); - parse = NULL; if (status != ISC_R_SUCCESS) { ; #ifdef LATER diff --git a/external/bsd/dhcp/dist/client/dhclient-script.8 b/external/bsd/dhcp/dist/client/dhclient-script.8 index 2bcd52145e1a..253c242feeeb 100644 --- a/external/bsd/dhcp/dist/client/dhclient-script.8 +++ b/external/bsd/dhcp/dist/client/dhclient-script.8 @@ -1,7 +1,8 @@ -.\" $NetBSD: dhclient-script.8,v 1.1.1.1 2013/03/24 15:45:57 christos Exp $ +.\" $NetBSD: dhclient-script.8,v 1.1.1.2 2013/03/24 22:50:26 christos Exp $ .\" .\" dhclient-script.8 .\" +.\" Copyright (c) 2012 by Internet Systems Consortium, Inc. ("ISC") .\" Copyright (c) 2009-2010 by Internet Systems Consortium, Inc. ("ISC") .\" Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC") .\" Copyright (c) 1996-2003 by Internet Software Consortium @@ -30,7 +31,7 @@ .\" Support and other services are available for ISC products - see .\" https://www.isc.org for more information or to learn more about ISC. .\" -.\" Id: dhclient-script.8,v 1.12.24.2 2010-07-06 19:03:11 sar Exp +.\" Id: dhclient-script.8,v 1.12.24.2 2010/07/06 19:03:11 sar Exp .\" .TH dhclient-script 8 .SH NAME @@ -127,7 +128,13 @@ options acquired from the server are passed using the option name described in \fBdhcp-options\fR, except that dashes (\'-\') are replaced by underscores (\'_\') in order to make valid shell variables, and the variable names start with new_. So for example, the new subnet mask -would be passed in $new_subnet_mask. +would be passed in $new_subnet_mask. The options that the client +explicitly requested via a PRL or ORO option are passed with the same +option name as above but prepended with requested_ and with a value of 1, +or example requested_subnet_mask=1. No such variable is defined for +options not requested by the client or options that don't require a +request option, such as the ip address (*_ip_address) or expiration +time (*_expiry). .PP Before actually configuring the address, dhclient-script should somehow ARP for it and exit with a nonzero status if it receives a @@ -154,13 +161,13 @@ address not be used if it is identical to the bound IP address in this case. .SH RENEW When a binding has been renewed, the script is called as in BOUND, -except that in addition to all the variables starting with $new_, -there is another set of variables starting with $old_. Persistent -settings that may have changed need to be deleted - for example, if a -local route to the bound address is being configured, the old local -route should be deleted. If the default route has changed, the old default -route should be deleted. If the static routes have changed, the old -ones should be deleted. Otherwise, processing can be done as with +except that in addition to all the variables starting with $new_, and +$requested_ there is another set of variables starting with $old_. +Persistent settings that may have changed need to be deleted - for +example, if a local route to the bound address is being configured, +the old local route should be deleted. If the default route has changed, +the old default route should be deleted. If the static routes have changed, +the old ones should be deleted. Otherwise, processing can be done as with BOUND. .SH REBIND The DHCP client has rebound to a new DHCP server. This can be handled diff --git a/external/bsd/dhcp/dist/client/dhclient.8 b/external/bsd/dhcp/dist/client/dhclient.8 index 6b2035805c39..6c743df7368e 100644 --- a/external/bsd/dhcp/dist/client/dhclient.8 +++ b/external/bsd/dhcp/dist/client/dhclient.8 @@ -1,8 +1,8 @@ -.\" $NetBSD: dhclient.8,v 1.1.1.1 2013/03/24 15:45:59 christos Exp $ +.\" $NetBSD: dhclient.8,v 1.1.1.2 2013/03/24 22:50:27 christos Exp $ .\" -.\" Id: dhclient.8,v 1.32.24.4 2011-04-15 22:12:50 sar Exp +.\" Id: dhclient.8,v 1.32.24.4 2011/04/15 22:12:50 sar Exp .\" -.\" Copyright (c) 2004,2007-2011 by Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (c) 2004,2007-2012 by Internet Systems Consortium, Inc. ("ISC") .\" Copyright (c) 1996-2003 by Internet Software Consortium .\" .\" Permission to use, copy, modify, and distribute this software for any @@ -63,7 +63,7 @@ dhclient - Dynamic Host Configuration Protocol Client ] [ .B -p -.I port +.I port-number ] [ .B -d @@ -140,8 +140,8 @@ fail, by statically assigning an address. .PP The DHCP protocol allows a host to contact a central server which maintains a list of IP addresses which may be assigned on one or more -subnets. A DHCP client may request an address from this pool, and -then use it on a temporary basis for communication on network. The +subnets. A DHCP client may request an address from this pool, and +then use it on a temporary basis for communication on network. The DHCP protocol also provides a mechanism whereby a client can learn important details about the network to which it is attached, such as the location of a default router, the location of a name server, and @@ -155,19 +155,19 @@ or options. .PP On startup, \fBdhclient\fR reads the dhclient.conf -for configuration instructions. It then gets a list of all the -network interfaces that are configured in the current system. For +for configuration instructions. It then gets a list of all the +network interfaces that are configured in the current system. For each interface, it attempts to configure the interface using the DHCP protocol. .PP In order to keep track of leases across system reboots and server restarts, \fBdhclient\fR keeps a list of leases it has been assigned in the -dhclient.leases file. On startup, after reading the dhclient.conf +dhclient.leases file. On startup, after reading the dhclient.conf file, \fBdhclient\fR reads the dhclient.leases file to refresh its memory about what leases it has been assigned. .PP When a new lease is acquired, it is appended to the end of the -dhclient.leases file. In order to prevent the file from becoming +dhclient.leases file. In order to prevent the file from becoming arbitrarily large, from time to time \fBdhclient\fR creates a new dhclient.leases file from its in-core lease database. The old version of the dhclient.leases file is retained under the name @@ -176,19 +176,19 @@ until the next time \fBdhclient\fR rewrites the database. .PP Old leases are kept around in case the DHCP server is unavailable when \fBdhclient\fR is first invoked (generally during the initial system boot -process). In that event, old leases from the dhclient.leases file +process). In that event, old leases from the dhclient.leases file which have not yet expired are tested, and if they are determined to be valid, they are used until either they expire or the DHCP server becomes available. .PP A mobile host which may sometimes need to access a network on which no DHCP server exists may be preloaded with a lease for a fixed -address on that network. When all attempts to contact a DHCP server +address on that network. When all attempts to contact a DHCP server have failed, \fBdhclient\fR will try to validate the static lease, and if it succeeds, will use that lease until it is restarted. .PP A mobile host may also travel to some networks on which DHCP is not -available but BOOTP is. In that case, it may be advantageous to +available but BOOTP is. In that case, it may be advantageous to arrange with the network administrator for an entry on the BOOTP database, so that the host can boot quickly on that network rather than cycling through the list of old leases. @@ -201,7 +201,7 @@ network interfaces, eliminating non-broadcast interfaces if possible, and attempt to configure each interface. .PP It is also possible to specify interfaces by name in the dhclient.conf -file. If interfaces are specified in this way, then the client will +file. If interfaces are specified in this way, then the client will only configure interfaces that are either specified in the configuration file or on the command line, and will ignore all other interfaces. @@ -233,9 +233,7 @@ types together or even to share the lease file between them. Try to get a lease once. On failure exit with code 2. In DHCPv6 this sets the maximum duration of the initial exchange to .I timeout -(from -.IR dhclient.conf(5) -with a default of sixty seconds). +(from dhclient.conf with a default of sixty seconds). .TP .BI \-d .\" This is not intuitive. @@ -264,7 +262,7 @@ DHCP client will exit if it isn't able to identify any network interfaces to configure. On laptop computers and other computers with hot-swappable I/O buses, it is possible that a broadcast interface may be added after system startup. This flag can be used to cause the client -not to exit when it doesn't find any such interfaces. The +not to exit when it doesn't find any such interfaces. The .B omshell(1) program can then be used to notify the client when a network interface has been added or removed, so that the client can attempt to configure an IP @@ -276,9 +274,9 @@ combination with the .B -w flag. .TP -.BI \-e \ VAR=val +.BI \-e \ VAR=value Define additional environment variables for the environment where -.B dhclient-script(8) +.B dhclient-script executes. You may specify multiple .B \-e options on the command line. @@ -286,7 +284,7 @@ options on the command line. .BI \-r Release the current lease and stop the running DHCP client as previously recorded in the PID file. When shutdown via this method -.B dhclient-script(8) +.B dhclient-script will be executed with the specific reason for calling the script set. The client normally doesn't release the current lease as this is not required by the DHCP protocol but some cable ISPs require their clients @@ -298,10 +296,10 @@ to notify the server if they wish to release an assigned IP address. Stop the running DHCP client without releasing the current lease. Kills existing \fBdhclient\fR process as previously recorded in the PID file. When shutdown via this method -.B dhclient-script(8) +.B dhclient-script will be executed with the specific reason for calling the script set. .TP -.BI \-p \ port +.BI \-p \ port-number The UDP port number on which the DHCP client should listen and transmit. If unspecified, .B dhclient @@ -379,7 +377,7 @@ is used. See \fBdhclient.conf(5)\fR for a description of this file. .BI \-lf \ lease-file Path to the lease database file. If unspecified, the default .B DBDIR/dhclient.leases -is used. See \fBdhclient.leases(5)\fR for a descriptionof this file. +is used. See \fBdhclient.leases(5)\fR for a description of this file. .TP .BI \-pf \ pid-file Path to the process ID file. If unspecified, the default @@ -411,28 +409,28 @@ client using TCP/IP, authenticate, and can then examine the client's current status and make changes to it. .PP Rather than implementing the underlying OMAPI protocol directly, user -programs should use the dhcpctl API or OMAPI itself. Dhcpctl is a +programs should use the dhcpctl API or OMAPI itself. Dhcpctl is a wrapper that handles some of the housekeeping chores that OMAPI does -not do automatically. Dhcpctl and OMAPI are documented in +not do automatically. Dhcpctl and OMAPI are documented in \fBdhcpctl(3)\fR -and \fBomapi(3)\fR. Most things you'd want to do with the client can +and \fBomapi(3)\fR. Most things you'd want to do with the client can be done directly using the \fBomshell(1)\fR command, rather than having to write a special program. .SH THE CONTROL OBJECT The control object allows you to shut the client down, releasing all leases that it holds and deleting any DNS records it may have added. It also allows you to pause the client - this unconfigures any -interfaces the client is using. You can then restart it, which -causes it to reconfigure those interfaces. You would normally pause +interfaces the client is using. You can then restart it, which +causes it to reconfigure those interfaces. You would normally pause the client prior to going into hibernation or sleep on a laptop -computer. You would then resume it after the power comes back. +computer. You would then resume it after the power comes back. This allows PC cards to be shut down while the computer is hibernating or sleeping, and then reinitialized to their previous state once the computer comes out of hibernation or sleep. .PP -The control object has one attribute - the state attribute. To shut -the client down, set its state attribute to 2. It will automatically -do a DHCPRELEASE. To pause it, set its state attribute to 3. To +The control object has one attribute - the state attribute. To shut +the client down, set its state attribute to 2. It will automatically +do a DHCPRELEASE. To pause it, set its state attribute to 3. To resume it, set its state attribute to 4. .PP .SH ENVIRONMENT VARIABLES @@ -479,7 +477,7 @@ Stanford. The current version owes much to Elliot's Linux enhancements, but was substantially reorganized and partially rewritten by Ted Lemon so as to use the same networking framework that the Internet Systems -Consortium DHCP server uses. Much system-specific configuration code +Consortium DHCP server uses. Much system-specific configuration code was moved into a shell script so that as support for more operating systems is added, it will not be necessary to port and maintain system-specific configuration code to these operating systems - instead, diff --git a/external/bsd/dhcp/dist/client/dhclient.conf.5 b/external/bsd/dhcp/dist/client/dhclient.conf.5 index 5ea96a5feeff..08e428449de2 100644 --- a/external/bsd/dhcp/dist/client/dhclient.conf.5 +++ b/external/bsd/dhcp/dist/client/dhclient.conf.5 @@ -1,8 +1,8 @@ -.\" $NetBSD: dhclient.conf.5,v 1.1.1.1 2013/03/24 15:45:59 christos Exp $ +.\" $NetBSD: dhclient.conf.5,v 1.1.1.2 2013/03/24 22:50:27 christos Exp $ .\" -.\" Id: dhclient.conf.5,v 1.25.24.7 2011-04-21 14:08:14 tomasz Exp +.\" Id: dhclient.conf.5,v 1.25.24.10 2012/04/16 17:17:48 sar Exp .\" -.\" Copyright (c) 2009-2011 by Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (c) 2009-2012 by Internet Systems Consortium, Inc. ("ISC") .\" Copyright (c) 2004,2007 by Internet Systems Consortium, Inc. ("ISC") .\" Copyright (c) 1996-2003 by Internet Software Consortium .\" @@ -38,11 +38,11 @@ The dhclient.conf file contains configuration information for .IR dhclient, the Internet Systems Consortium DHCP Client. .PP -The dhclient.conf file is a free-form ASCII text file. It is parsed by -the recursive-descent parser built into dhclient. The file may contain +The dhclient.conf file is a free-form ASCII text file. It is parsed by +the recursive-descent parser built into dhclient. The file may contain extra tabs and newlines for formatting purposes. Keywords in the file -are case-insensitive. Comments may be placed anywhere within the -file (except within quotes). Comments begin with the # character and +are case-insensitive. Comments may be placed anywhere within the +file (except within quotes). Comments begin with the # character and end at the end of the line. .PP The dhclient.conf file can be used to configure the behaviour of the @@ -76,12 +76,12 @@ The statement determines the amount of time that must pass between the time that the client begins to try to determine its address and the time that it decides that it's not going to be able to contact a -server. By default, this timeout is sixty seconds. After the +server. By default, this timeout is sixty seconds. After the timeout has passed, if there are any static leases defined in the configuration file, or any leases remaining in the lease database that have not yet expired, the client will loop through these leases attempting to validate them, and if it finds one that appears to be -valid, it will use that lease's address. If there are no valid +valid, it will use that lease's address. If there are no valid static leases or unexpired leases in the lease database, the client will restart the protocol after the defined retry interval. .PP @@ -95,7 +95,7 @@ The .I retry statement determines the time that must pass after the client has determined that there is no DHCP server present before it tries again -to contact a DHCP server. By default, this is five minutes. +to contact a DHCP server. By default, this is five minutes. .PP .I The .B select-timeout @@ -104,9 +104,9 @@ to contact a DHCP server. By default, this is five minutes. \fBselect-timeout \fItime\fR\fB;\fR .PP It is possible (some might say desirable) for there to be more than -one DHCP server serving any given network. In this case, it is +one DHCP server serving any given network. In this case, it is possible that a client may be sent more than one offer in response to -its initial lease discovery message. It may be that one of these +its initial lease discovery message. It may be that one of these offers is preferable to the other (e.g., one offer may have the address the client previously used, and the other may not). .PP @@ -114,7 +114,7 @@ The .I select-timeout is the time after the client sends its first lease discovery request at which it stops waiting for offers from servers, assuming that it -has received at least one such offer. If no offers have been +has received at least one such offer. If no offers have been received by the time the .I select-timeout has expired, the client will accept the first offer that arrives. @@ -129,13 +129,13 @@ will take the first offer it sees. \fBreboot \fItime\fR\fB;\fR .PP When the client is restarted, it first tries to reacquire the last -address it had. This is called the INIT-REBOOT state. If it is +address it had. This is called the INIT-REBOOT state. If it is still attached to the same network it was attached to when it last -ran, this is the quickest way to get started. The +ran, this is the quickest way to get started. The .I reboot statement sets the time that must elapse after the client first tries to reacquire its old address before it gives up and tries to discover -a new address. By default, the reboot timeout is ten seconds. +a new address. By default, the reboot timeout is ten seconds. .PP .I The .B backoff-cutoff @@ -145,11 +145,12 @@ a new address. By default, the reboot timeout is ten seconds. .PP The client uses an exponential backoff algorithm with some randomness, so that if many clients try to configure themselves at the same time, -they will not make their requests in lockstep. The +they will not make their requests in lockstep. The .I backoff-cutoff statement determines the maximum amount of time that the client is allowed to back off, the actual value will be evaluated randomly between -1/2 to 1 1/2 times the \fItime\fR specified. It defaults to two minutes. +1/2 to 1 1/2 times the \fItime\fR specified. It defaults to fifteen +seconds. .PP .I The .B initial-interval @@ -183,7 +184,7 @@ to 5. .SH LEASE REQUIREMENTS AND REQUESTS The DHCP protocol allows the client to request that the server send it specific information, and not send it other information that it is not -prepared to accept. The protocol also allows the client to reject +prepared to accept. The protocol also allows the client to reject offers from servers if they don't contain information the client needs, or if the information provided is not satisfactory. .PP @@ -200,8 +201,8 @@ are called \fIDHCP Options\fR. DHCP Options are defined in .PP The request statement causes the client to request that any server responding to the client send the client its values for the specified -options. Only the option names should be specified in the request -statement - not option parameters. By default, the DHCPv4 client +options. Only the option names should be specified in the request +statement - not option parameters. By default, the DHCPv4 client requests the subnet-mask, broadcast-address, time-offset, routers, domain-name, domain-name-servers and host-name options while the DHCPv6 client requests the dhcp6 name-servers and domain-search options. Note @@ -209,7 +210,7 @@ that if you enter a \'request\' statement, you over-ride these defaults and these options will not be requested. .PP In some cases, it may be desirable to send no parameter request list -at all. To do this, simply write the request statement but specify +at all. To do this, simply write the request statement but specify no parameters: .PP .nf @@ -231,7 +232,7 @@ is best to \'also request\' the additional options: \fB[ also ] require [ [ \fIoption-space\fR . ] \fIoption\fR ] [\fB,\fI ... ]\fB;\fR .PP The require statement lists options that must be sent in order for an -offer to be accepted. Offers that do not contain all the listed +offer to be accepted. Offers that do not contain all the listed options will be ignored. There is no default require list. .PP .nf @@ -259,15 +260,15 @@ that will allow it to differentiate between this client and other clients or kinds of clients. .SH DYNAMIC DNS The client now has some very limited support for doing DNS updates -when a lease is acquired. This is prototypical, and probably doesn't -do what you want. It also only works if you happen to have control +when a lease is acquired. This is prototypical, and probably doesn't +do what you want. It also only works if you happen to have control over your DNS server, which isn't very likely. .PP Note that everything in this section is true whether you are using DHCPv4 or DHCPv6. The exact same syntax is used for both. .PP To make it work, you have to declare a key and zone as in the DHCP -server (see \fBdhcpd.conf\fR(5) for details). You also need to +server (see \fBdhcpd.conf\fR(5) for details). You also need to configure the fqdn option on the client, as follows: .PP .nf @@ -278,8 +279,8 @@ configure the fqdn option on the client, as follows: .fi .PP The \fIfqdn.fqdn\fR option \fBMUST\fR be a fully-qualified domain -name. You \fBMUST\fR define a zone statement for the zone to be -updated. The \fIfqdn.encoded\fR option may need to be set to +name. You \fBMUST\fR define a zone statement for the zone to be +updated. The \fIfqdn.encoded\fR option may need to be set to \fIon\fR or \fIoff\fR, depending on the DHCP server you are using. .PP .I The @@ -293,16 +294,16 @@ script (see \fBdhclient-script(8)\fR) rather than having the DHCP client do the update directly (for example, if you want to use SIG(0) authentication, which is not supported directly by the DHCP client, you can instruct the client not to do the update using -the \fBdo-forward-updates\fR statement. \fIFlag\fR should be \fBtrue\fR +the \fBdo-forward-updates\fR statement. \fIFlag\fR should be \fBtrue\fR if you want the DHCP client to do the update, and \fBfalse\fR if -you don't want the DHCP client to do the update. By default, the DHCP +you don't want the DHCP client to do the update. By default, the DHCP client will do the DNS update. .SH OPTION MODIFIERS In some cases, a client may receive option data from the server which is not really appropriate for that client, or may not receive information that it needs, and for which a useful default value -exists. It may also receive information which is useful, but which -needs to be supplemented with local information. To handle these +exists. It may also receive information which is useful, but which +needs to be supplemented with local information. To handle these needs, several option modifiers are available. .PP .I The @@ -339,10 +340,10 @@ If for some set of options the client should use a value you supply, and then use the values supplied by the server, if any, these values can be defined in the .B prepend -statement. The +statement. The .B prepend statement can only be used for options which -allow more than one value to be given. This restriction is not +allow more than one value to be given. This restriction is not enforced - if you ignore it, the behaviour will be unpredictable. .PP .I The @@ -355,10 +356,10 @@ If for some set of options the client should first use the values supplied by the server, if any, and then use values you supply, these values can be defined in the .B append -statement. The +statement. The .B append statement can only be used for options which -allow more than one value to be given. This restriction is not +allow more than one value to be given. This restriction is not enforced - if you ignore it, the behaviour will be unpredictable. .SH LEASE DECLARATIONS .PP @@ -370,12 +371,12 @@ enforced - if you ignore it, the behaviour will be unpredictable. .PP The DHCP client may decide after some period of time (see \fBPROTOCOL TIMING\fR) that it is not going to succeed in contacting a -server. At that time, it consults its own database of old leases and +server. At that time, it consults its own database of old leases and tests each one that has not yet timed out by pinging the listed router -for that lease to see if that lease could work. It is possible to +for that lease to see if that lease could work. It is possible to define one or more \fIfixed\fR leases in the client configuration file for networks where there is no DHCP or BOOTP service, so that the -client can still automatically configure its address. This is done +client can still automatically configure its address. This is done with the .B lease statement. @@ -383,12 +384,12 @@ statement. NOTE: the lease statement is also used in the dhclient.leases file in order to record leases that have been received from DHCP servers. Some of the syntax for leases as described below is only needed in the -dhclient.leases file. Such syntax is documented here for +dhclient.leases file. Such syntax is documented here for completeness. .PP A lease statement consists of the lease keyword, followed by a left curly brace, followed by one or more lease declaration statements, -followed by a right curly brace. The following lease declarations +followed by a right curly brace. The following lease declarations are possible: .PP \fBbootp;\fR @@ -396,8 +397,8 @@ are possible: The .B bootp statement is used to indicate that the lease was acquired using the -BOOTP protocol rather than the DHCP protocol. It is never necessary -to specify this in the client configuration file. The client uses +BOOTP protocol rather than the DHCP protocol. It is never necessary +to specify this in the client configuration file. The client uses this syntax in its lease database file. .PP \fBinterface\fR \fB"\fR\fIstring\fR\fB";\fR @@ -405,8 +406,8 @@ this syntax in its lease database file. The .B interface lease statement is used to indicate the interface on which the lease -is valid. If set, this lease will only be tried on a particular -interface. When the client receives a lease from a server, it always +is valid. If set, this lease will only be tried on a particular +interface. When the client receives a lease from a server, it always records the interface number on which it received that lease. If predefined leases are specified in the dhclient.conf file, the interface should also be specified, although this is not required. @@ -415,15 +416,15 @@ interface should also be specified, although this is not required. .PP The .B fixed-address -statement is used to set the ip address of a particular lease. This -is required for all lease statements. The IP address must be +statement is used to set the ip address of a particular lease. This +is required for all lease statements. The IP address must be specified as a dotted quad (e.g., 12.34.56.78). .PP \fBfilename "\fR\fIstring\fR\fB";\fR .PP The .B filename -statement specifies the name of the boot filename to use. This is +statement specifies the name of the boot filename to use. This is not used by the standard client configuration script, but is included for completeness. .PP @@ -431,7 +432,7 @@ for completeness. .PP The .B server-name -statement specifies the name of the boot server name to use. This is +statement specifies the name of the boot server name to use. This is also not used by the standard client configuration script. .PP \fBoption\fR \fIoption-declaration\fR\fB;\fR @@ -451,9 +452,9 @@ statement is used to specify the pathname of the dhcp client configuration script. This script is used by the dhcp client to set each interface's initial configuration prior to requesting an address, to test the address once it has been offered, and to set the -interface's final configuration once a lease has been acquired. If +interface's final configuration once a lease has been acquired. If no lease is acquired, the script is used to test predefined leases, if -any, and also called once if no valid lease can be identified. For +any, and also called once if no valid lease can be identified. For more information, see .B dhclient-script(8). .PP @@ -464,7 +465,7 @@ The statement is used to specify which option space should be used for decoding the vendor-encapsulate-options option if one is received. The \fIdhcp-vendor-identifier\fR can be used to request a specific -class of vendor options from the server. See +class of vendor options from the server. See .B dhcp-options(5) for details. .PP @@ -495,9 +496,9 @@ interface requires media type configuration. .PP The \fBrenew\fR statement defines the time at which the dhcp client should begin trying to contact its server to renew a lease that it is -using. The \fBrebind\fR statement defines the time at which the dhcp +using. The \fBrebind\fR statement defines the time at which the dhcp client should begin to try to contact \fIany\fR dhcp server in order -to renew its lease. The \fBexpire\fR statement defines the time at +to renew its lease. The \fBexpire\fR statement defines the time at which the dhcp client must stop using a lease if it has not been able to contact a server in order to renew it. .PP @@ -549,7 +550,7 @@ instead of an actual date. Some DHCP clients running TCP/IP roaming protocols may require that in addition to the lease they may acquire via DHCP, their interface also be configured with a predefined IP alias so that they can have a -permanent IP address even while roaming. The Internet Systems +permanent IP address even while roaming. The Internet Systems Consortium DHCP client doesn't support roaming with fixed addresses directly, but in order to facilitate such experimentation, the dhcp client can be set up to configure an IP alias using the @@ -561,7 +562,7 @@ options other than the subnet-mask option are ignored by the standard client configuration script, and expiry times are ignored. A typical alias declaration includes an interface declaration, a fixed-address declaration for the IP alias address, and a subnet-mask option -declaration. A medium statement should never be included in an alias +declaration. A medium statement should never be included in an alias declaration. .SH OTHER DECLARATIONS \fBdb-time-format\fR [ \fIdefault\fR | \fIlocal\fR ] \fB;\fR @@ -598,11 +599,11 @@ single address 10.0.0.5, to be rejected. \fBinterface "\fIname\fB" { \fIdeclarations ... \fB } .PP A client with more than one network interface may require different -behaviour depending on which interface is being configured. All +behaviour depending on which interface is being configured. All timing parameters and declarations other than lease and alias declarations can be enclosed in an interface declaration, and those parameters will then be used only for the interface that matches the -specified name. Interfaces for which there is no interface +specified name. Interfaces for which there is no interface declaration will use the parameters declared outside of any interface declaration, or the default settings. .PP @@ -623,11 +624,11 @@ Each interface that the DHCP client is supporting normally has a DHCP client state machine running on it to acquire and maintain its lease. A pseudo-interface is just another state machine running on the interface named \fIreal-name\fR, with its own lease and its own -state. If you use this feature, you must provide a client identifier +state. If you use this feature, you must provide a client identifier for both the pseudo-interface and the actual interface, and the two -identifiers must be different. You must also provide a separate +identifiers must be different. You must also provide a separate client script for the pseudo-interface to do what you want with the IP -address. For example: +address. For example: .PP .nf interface "ep0" { @@ -642,7 +643,7 @@ address. For example: The client script for the pseudo-interface should not configure the interface up or down - essentially, all it needs to handle are the states where a lease has been acquired or renewed, and the states -where a lease has expired. See \fBdhclient-script(8)\fR for more +where a lease has expired. See \fBdhclient-script(8)\fR for more information. .PP \fBmedia "\fImedia setup\fB"\fI [ \fB, "\fImedia setup\fB", \fI... ]\fB;\fR @@ -650,20 +651,20 @@ information. The .B media statement defines one or more media configuration parameters which may -be tried while attempting to acquire an IP address. The dhcp client +be tried while attempting to acquire an IP address. The dhcp client will cycle through each media setup string on the list, configuring the interface using that setup and attempting to boot, and then trying -the next one. This can be used for network interfaces which aren't +the next one. This can be used for network interfaces which aren't capable of sensing the media type unaided - whichever media type succeeds in getting a request to the server and hearing the reply is probably right (no guarantees). .PP The media setup is only used for the initial phase of address -acquisition (the DHCPDISCOVER and DHCPOFFER packets). Once an +acquisition (the DHCPDISCOVER and DHCPOFFER packets). Once an address has been acquired, the dhcp client will record it in its lease database and will record the media type used to acquire the address. Whenever the client tries to renew the lease, it will use that same -media type. The lease must expire before the client will go back to +media type. The lease must expire before the client will go back to cycling through media types. .PP \fBhardware\fR \fIlink-type mac-address\fR\fB;\fR @@ -691,10 +692,10 @@ in a similar manner to the \fBhardware\fR statement. .PP .SH SAMPLE The following configuration file is used on a laptop running NetBSD -1.3. The laptop has an IP alias of 192.5.5.213, and has one -interface, ep0 (a 3com 3C589C). Booting intervals have been +1.3. The laptop has an IP alias of 192.5.5.213, and has one +interface, ep0 (a 3com 3C589C). Booting intervals have been shortened somewhat from the default, because the client is known to -spend most of its time on networks with little DHCP activity. The +spend most of its time on networks with little DHCP activity. The laptop does roam to multiple networks. .nf @@ -727,7 +728,7 @@ alias { } .fi This is a very complicated dhclient.conf file - in general, yours -should be much simpler. In many cases, it's sufficient to just +should be much simpler. In many cases, it's sufficient to just create an empty dhclient.conf file - the defaults are usually fine. .SH SEE ALSO dhcp-options(5), dhcp-eval(5), dhclient.leases(5), dhcpd(8), dhcpd.conf(5), @@ -735,7 +736,7 @@ RFC2132, RFC2131. .SH AUTHOR .B dhclient(8) was written by Ted Lemon -under a contract with Vixie Labs. Funding +under a contract with Vixie Labs. Funding for this project was provided by Internet Systems Consortium. Information about Internet Systems Consortium can be found at .B https://www.isc.org. diff --git a/external/bsd/dhcp/dist/client/dhclient.conf.example b/external/bsd/dhcp/dist/client/dhclient.conf.example new file mode 100644 index 000000000000..b8354de80cfd --- /dev/null +++ b/external/bsd/dhcp/dist/client/dhclient.conf.example @@ -0,0 +1,36 @@ +send host-name = pick-first-value(gethostname(), "ISC-dhclient"); +send dhcp-client-identifier 1:0:a0:24:ab:fb:9c; +send dhcp-lease-time 3600; +supersede domain-search "fugue.com", "home.vix.com"; +prepend domain-name-servers 127.0.0.1; +request subnet-mask, broadcast-address, time-offset, routers, + domain-name, domain-name-servers, host-name; +require subnet-mask, domain-name-servers; +timeout 60; +retry 60; +reboot 10; +select-timeout 5; +initial-interval 2; +script "/etc/dhclient-script"; +media "-link0 -link1 -link2", "link0 link1"; +reject 192.33.137.209; + +alias { + interface "ep0"; + fixed-address 192.5.5.213; + option subnet-mask 255.255.255.255; +} + +lease { + interface "ep0"; + fixed-address 192.33.137.200; + medium "link0 link1"; + option host-name "andare.swiftmedia.com"; + option subnet-mask 255.255.255.0; + option broadcast-address 192.33.137.255; + option routers 192.33.137.250; + option domain-name-servers 127.0.0.1; + renew 2 2000/1/12 00:00:01; + rebind 2 2000/1/12 00:00:01; + expire 2 2000/1/12 00:00:01; +} diff --git a/external/bsd/dhcp/dist/client/dhclient.leases.5 b/external/bsd/dhcp/dist/client/dhclient.leases.5 index 6940a669c52b..d552fee003ff 100644 --- a/external/bsd/dhcp/dist/client/dhclient.leases.5 +++ b/external/bsd/dhcp/dist/client/dhclient.leases.5 @@ -1,6 +1,6 @@ -.\" $NetBSD: dhclient.leases.5,v 1.1.1.1 2013/03/24 15:45:59 christos Exp $ +.\" $NetBSD: dhclient.leases.5,v 1.1.1.2 2013/03/24 22:50:28 christos Exp $ .\" -.\" Id: dhclient.leases.5,v 1.5.24.3 2011-02-23 23:52:21 sar Exp +.\" Id: dhclient.leases.5,v 1.5.24.3 2011/02/23 23:52:21 sar Exp .\" .\" Copyright (c) 2009-2011 by Internet Systems Consortium, Inc. ("ISC") .\" Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") @@ -30,7 +30,7 @@ .\" Support and other services are available for ISC products - see .\" https://www.isc.org for more information or to learn more about ISC. .\" -.\" Id: dhclient.leases.5,v 1.5.24.3 2011-02-23 23:52:21 sar Exp +.\" Id: dhclient.leases.5,v 1.5.24.3 2011/02/23 23:52:21 sar Exp .\" .TH dhclient.leases 5 .SH NAME diff --git a/external/bsd/dhcp/dist/client/scripts/freebsd b/external/bsd/dhcp/dist/client/scripts/freebsd index f8593cbd7190..b8e5d5fb3377 100644 --- a/external/bsd/dhcp/dist/client/scripts/freebsd +++ b/external/bsd/dhcp/dist/client/scripts/freebsd @@ -1,6 +1,6 @@ #!/bin/sh # -# Id: freebsd,v 1.23.54.1 2011-05-18 20:01:54 sar Exp +# Id: freebsd,v 1.23.54.1 2011/05/18 20:01:54 sar Exp # # $FreeBSD$ diff --git a/external/bsd/dhcp/dist/client/scripts/macos b/external/bsd/dhcp/dist/client/scripts/macos index 8902e661c0e5..f6d8a08ebb31 100644 --- a/external/bsd/dhcp/dist/client/scripts/macos +++ b/external/bsd/dhcp/dist/client/scripts/macos @@ -1,6 +1,6 @@ #!/bin/sh # -# Id: macos,v 1.2.108.2 2011-09-20 17:04:03 sar Exp +# Id: macos,v 1.2.108.2 2011/09/20 17:04:03 sar Exp # # automous run of this script will commit the DNS setting # diff --git a/external/bsd/dhcp/dist/common/Makefile.am b/external/bsd/dhcp/dist/common/Makefile.am index e4d4f9c85ae9..eddef058566d 100644 --- a/external/bsd/dhcp/dist/common/Makefile.am +++ b/external/bsd/dhcp/dist/common/Makefile.am @@ -10,4 +10,8 @@ libdhcp_a_SOURCES = alloc.c bpf.c comapi.c conflex.c ctrace.c discover.c \ man_MANS = dhcp-eval.5 dhcp-options.5 EXTRA_DIST = $(man_MANS) -SUBDIRS = tests +# We want to build this directory first, before descending into tests subdir. +# The reason is that ideally the tests should link existing objects from this +# directory. That eliminates any discrepancies between tested code and +# production code. Sadly, we are not there yet. +SUBDIRS = . tests diff --git a/external/bsd/dhcp/dist/common/Makefile.in b/external/bsd/dhcp/dist/common/Makefile.in index 3c39008fd1c7..3f990a768c72 100644 --- a/external/bsd/dhcp/dist/common/Makefile.in +++ b/external/bsd/dhcp/dist/common/Makefile.in @@ -82,6 +82,8 @@ DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ +ATF_CFLAGS = @ATF_CFLAGS@ +ATF_LDFLAGS = @ATF_LDFLAGS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -182,7 +184,12 @@ libdhcp_a_SOURCES = alloc.c bpf.c comapi.c conflex.c ctrace.c discover.c \ man_MANS = dhcp-eval.5 dhcp-options.5 EXTRA_DIST = $(man_MANS) -SUBDIRS = tests + +# We want to build this directory first, before descending into tests subdir. +# The reason is that ideally the tests should link existing objects from this +# directory. That eliminates any discrepancies between tested code and +# production code. Sadly, we are not there yet. +SUBDIRS = . tests all: all-recursive .SUFFIXES: diff --git a/external/bsd/dhcp/dist/common/alloc.c b/external/bsd/dhcp/dist/common/alloc.c index f3608be6ce8b..3d20d709d9dd 100644 --- a/external/bsd/dhcp/dist/common/alloc.c +++ b/external/bsd/dhcp/dist/common/alloc.c @@ -1,11 +1,12 @@ -/* $NetBSD: alloc.c,v 1.1.1.1 2013/03/24 15:45:52 christos Exp $ */ +/* $NetBSD: alloc.c,v 1.1.1.2 2013/03/24 22:50:29 christos Exp $ */ /* alloc.c Memory allocation... */ /* - * Copyright (c) 2004-2007,2009 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2009,2012 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1996-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -35,7 +36,7 @@ */ #include -__RCSID("$NetBSD: alloc.c,v 1.1.1.1 2013/03/24 15:45:52 christos Exp $"); +__RCSID("$NetBSD: alloc.c,v 1.1.1.2 2013/03/24 22:50:29 christos Exp $"); #include "dhcpd.h" #include @@ -836,11 +837,11 @@ int dns_host_entry_dereference (ptr, file, line) #endif } - (*ptr) -> refcnt--; - rc_register (file, line, ptr, *ptr, (*ptr) -> refcnt, 1, RC_MISC); - if (!(*ptr) -> refcnt) + (*ptr)->refcnt--; + rc_register (file, line, ptr, *ptr, (*ptr)->refcnt, 1, RC_MISC); + if ((*ptr)->refcnt == 0) { dfree ((*ptr), file, line); - if ((*ptr) -> refcnt < 0) { + } else if ((*ptr)->refcnt < 0) { log_error ("%s(%d): negative refcnt!", file, line); #if defined (DEBUG_RC_HISTORY) dump_rc_history (*ptr); diff --git a/external/bsd/dhcp/dist/common/comapi.c b/external/bsd/dhcp/dist/common/comapi.c index 6defefdc4edf..dfb746134279 100644 --- a/external/bsd/dhcp/dist/common/comapi.c +++ b/external/bsd/dhcp/dist/common/comapi.c @@ -1,10 +1,11 @@ -/* $NetBSD: comapi.c,v 1.1.1.1 2013/03/24 15:45:52 christos Exp $ */ +/* $NetBSD: comapi.c,v 1.1.1.2 2013/03/24 22:50:29 christos Exp $ */ /* omapi.c OMAPI object interfaces for the DHCP server. */ /* + * Copyright (c) 2012 Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2007,2009 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1999-2003 by Internet Software Consortium * @@ -35,7 +36,7 @@ */ #include -__RCSID("$NetBSD: comapi.c,v 1.1.1.1 2013/03/24 15:45:52 christos Exp $"); +__RCSID("$NetBSD: comapi.c,v 1.1.1.2 2013/03/24 22:50:29 christos Exp $"); /* Many, many thanks to Brian Murrell and BCtel for this code - BCtel provided the funding that resulted in this code and the entire @@ -440,7 +441,7 @@ isc_result_t dhcp_group_remove (omapi_object_t *lp, status = dhcp_group_destroy ((omapi_object_t *)group, MDL); - return ISC_R_SUCCESS; + return status; } isc_result_t dhcp_control_set_value (omapi_object_t *h, @@ -516,12 +517,12 @@ isc_result_t dhcp_control_destroy (omapi_object_t *h, isc_result_t dhcp_control_signal_handler (omapi_object_t *h, const char *name, va_list ap) { - dhcp_control_object_t *control; + /* In this function h should be a (dhcp_control_object_t *) */ + isc_result_t status; if (h -> type != dhcp_type_control) return DHCP_R_INVALIDARG; - control = (dhcp_control_object_t *)h; /* Try to find some inner object that can take the value. */ if (h -> inner && h -> inner -> type -> get_value) { @@ -577,11 +578,11 @@ isc_result_t dhcp_control_lookup (omapi_object_t **lp, status = omapi_get_value_str (ref, id, "handle", &tv); if (status == ISC_R_SUCCESS) { status = omapi_handle_td_lookup (lp, tv -> value); - + omapi_value_dereference (&tv, MDL); if (status != ISC_R_SUCCESS) return status; - + /* Don't return the object if the type is wrong. */ if ((*lp) -> type != dhcp_type_control) { omapi_object_dereference (lp, MDL); @@ -617,12 +618,12 @@ isc_result_t dhcp_subnet_set_value (omapi_object_t *h, omapi_data_string_t *name, omapi_typed_data_t *value) { - struct subnet *subnet; + /* In this function h should be a (struct subnet *) */ + isc_result_t status; if (h -> type != dhcp_type_subnet) return DHCP_R_INVALIDARG; - subnet = (struct subnet *)h; /* No values to set yet. */ @@ -633,7 +634,7 @@ isc_result_t dhcp_subnet_set_value (omapi_object_t *h, if (status == ISC_R_SUCCESS || status == DHCP_R_UNCHANGED) return status; } - + return ISC_R_NOTFOUND; } @@ -642,12 +643,12 @@ isc_result_t dhcp_subnet_get_value (omapi_object_t *h, omapi_object_t *id, omapi_data_string_t *name, omapi_value_t **value) { - struct subnet *subnet; + /* In this function h should be a (struct subnet *) */ + isc_result_t status; if (h -> type != dhcp_type_subnet) return DHCP_R_INVALIDARG; - subnet = (struct subnet *)h; /* No values to get yet. */ @@ -663,14 +664,17 @@ isc_result_t dhcp_subnet_get_value (omapi_object_t *h, omapi_object_t *id, isc_result_t dhcp_subnet_destroy (omapi_object_t *h, const char *file, int line) { +#if defined (DEBUG_MEMORY_LEAKAGE) || \ + defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) struct subnet *subnet; +#endif if (h -> type != dhcp_type_subnet) return DHCP_R_INVALIDARG; - subnet = (struct subnet *)h; #if defined (DEBUG_MEMORY_LEAKAGE) || \ defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) + subnet = (struct subnet *)h; if (subnet -> next_subnet) subnet_dereference (&subnet -> next_subnet, file, line); if (subnet -> next_sibling) @@ -690,13 +694,12 @@ isc_result_t dhcp_subnet_destroy (omapi_object_t *h, const char *file, int line) isc_result_t dhcp_subnet_signal_handler (omapi_object_t *h, const char *name, va_list ap) { - struct subnet *subnet; + /* In this function h should be a (struct subnet *) */ + isc_result_t status; - int updatep = 0; if (h -> type != dhcp_type_subnet) return DHCP_R_INVALIDARG; - subnet = (struct subnet *)h; /* Can't write subnets yet. */ @@ -707,8 +710,7 @@ isc_result_t dhcp_subnet_signal_handler (omapi_object_t *h, if (status == ISC_R_SUCCESS) return status; } - if (updatep) - return ISC_R_SUCCESS; + return ISC_R_NOTFOUND; } @@ -716,12 +718,12 @@ isc_result_t dhcp_subnet_stuff_values (omapi_object_t *c, omapi_object_t *id, omapi_object_t *h) { - struct subnet *subnet; + /* In this function h should be a (struct subnet *) */ + isc_result_t status; if (h -> type != dhcp_type_subnet) return DHCP_R_INVALIDARG; - subnet = (struct subnet *)h; /* Can't stuff subnet values yet. */ @@ -766,12 +768,12 @@ isc_result_t dhcp_shared_network_set_value (omapi_object_t *h, omapi_data_string_t *name, omapi_typed_data_t *value) { - struct shared_network *shared_network; + /* In this function h should be a (struct shared_network *) */ + isc_result_t status; if (h -> type != dhcp_type_shared_network) return DHCP_R_INVALIDARG; - shared_network = (struct shared_network *)h; /* No values to set yet. */ @@ -782,7 +784,7 @@ isc_result_t dhcp_shared_network_set_value (omapi_object_t *h, if (status == ISC_R_SUCCESS || status == DHCP_R_UNCHANGED) return status; } - + return ISC_R_NOTFOUND; } @@ -792,12 +794,12 @@ isc_result_t dhcp_shared_network_get_value (omapi_object_t *h, omapi_data_string_t *name, omapi_value_t **value) { - struct shared_network *shared_network; + /* In this function h should be a (struct shared_network *) */ + isc_result_t status; if (h -> type != dhcp_type_shared_network) return DHCP_R_INVALIDARG; - shared_network = (struct shared_network *)h; /* No values to get yet. */ @@ -814,14 +816,19 @@ isc_result_t dhcp_shared_network_get_value (omapi_object_t *h, isc_result_t dhcp_shared_network_destroy (omapi_object_t *h, const char *file, int line) { + /* In this function h should be a (struct shared_network *) */ + +#if defined (DEBUG_MEMORY_LEAKAGE) || \ + defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) struct shared_network *shared_network; +#endif if (h -> type != dhcp_type_shared_network) return DHCP_R_INVALIDARG; - shared_network = (struct shared_network *)h; #if defined (DEBUG_MEMORY_LEAKAGE) || \ defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) + shared_network = (struct shared_network *)h; if (shared_network -> next) shared_network_dereference (&shared_network -> next, file, line); @@ -854,13 +861,12 @@ isc_result_t dhcp_shared_network_signal_handler (omapi_object_t *h, const char *name, va_list ap) { - struct shared_network *shared_network; + /* In this function h should be a (struct shared_network *) */ + isc_result_t status; - int updatep = 0; if (h -> type != dhcp_type_shared_network) return DHCP_R_INVALIDARG; - shared_network = (struct shared_network *)h; /* Can't write shared_networks yet. */ @@ -871,8 +877,7 @@ isc_result_t dhcp_shared_network_signal_handler (omapi_object_t *h, if (status == ISC_R_SUCCESS) return status; } - if (updatep) - return ISC_R_SUCCESS; + return ISC_R_NOTFOUND; } @@ -880,12 +885,12 @@ isc_result_t dhcp_shared_network_stuff_values (omapi_object_t *c, omapi_object_t *id, omapi_object_t *h) { - struct shared_network *shared_network; + /* In this function h should be a (struct shared_network *) */ + isc_result_t status; if (h -> type != dhcp_type_shared_network) return DHCP_R_INVALIDARG; - shared_network = (struct shared_network *)h; /* Can't stuff shared_network values yet. */ diff --git a/external/bsd/dhcp/dist/common/dhcp-eval.5 b/external/bsd/dhcp/dist/common/dhcp-eval.5 index f13222708b74..1e33ebb13b56 100644 --- a/external/bsd/dhcp/dist/common/dhcp-eval.5 +++ b/external/bsd/dhcp/dist/common/dhcp-eval.5 @@ -1,8 +1,8 @@ -.\" $NetBSD: dhcp-eval.5,v 1.1.1.1 2013/03/24 15:45:55 christos Exp $ +.\" $NetBSD: dhcp-eval.5,v 1.1.1.2 2013/03/24 22:50:29 christos Exp $ .\" -.\" Id: dhcp-eval.5,v 1.29.24.2 2010-07-06 19:03:11 sar Exp +.\" Id: dhcp-eval.5,v 1.29.24.4 2012/05/17 15:51:20 sar Exp .\" -.\" Copyright (c) 2009-2010 by Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (c) 2009-2012 by Internet Systems Consortium, Inc. ("ISC") .\" Copyright (c) 2004,2007 by Internet Systems Consortium, Inc. ("ISC") .\" Copyright (c) 1996-2003 by Internet Software Consortium .\" @@ -36,35 +36,35 @@ dhcp-eval - ISC DHCP conditional evaluation .SH DESCRIPTION The Internet Systems Consortium DHCP client and server both provide the ability to perform conditional behavior depending on the contents -of packets they receive. The syntax for specifying this conditional +of packets they receive. The syntax for specifying this conditional behaviour is documented here. .SH REFERENCE: CONDITIONAL BEHAVIOUR Conditional behaviour is specified using the if statement and the else -or elsif statements. A conditional statement can appear anywhere +or elsif statements. A conditional statement can appear anywhere that a regular statement (e.g., an option statement) can appear, and -can enclose one or more such statements. A typical conditional +can enclose one or more such statements. A typical conditional statement in a server might be: .PP .nf if option dhcp-user-class = "accounting" { max-lease-time 17600; option domain-name "accounting.example.org"; - option domain-name-servers ns1.accounting.example.org, + option domain-name-servers ns1.accounting.example.org, ns2.accounting.example.org; } elsif option dhcp-user-class = "sales" { max-lease-time 17600; option domain-name "sales.example.org"; - option domain-name-servers ns1.sales.example.org, + option domain-name-servers ns1.sales.example.org, ns2.sales.example.org; } elsif option dhcp-user-class = "engineering" { max-lease-time 17600; option domain-name "engineering.example.org"; - option domain-name-servers ns1.engineering.example.org, + option domain-name-servers ns1.engineering.example.org, ns2.engineering.example.org; } else { max-lease-time 600; option domain-name "misc.example.org"; - option domain-name-servers ns1.misc.example.org, + option domain-name-servers ns1.misc.example.org, ns2.misc.example.org; } .fi @@ -73,36 +73,36 @@ On the client side, an example of conditional evaluation might be: .PP .nf # example.org filters DNS at its firewall, so we have to use their DNS -# servers when we connect to their network. If we are not at +# servers when we connect to their network. If we are not at # example.org, prefer our own DNS server. if not option domain-name = "example.org" { prepend domain-name-servers 127.0.0.1; } -.fi +.fi .PP The .B if statement and the .B elsif continuation statement both take boolean expressions as their -arguments. That is, they take expressions that, when evaluated, -produce a boolean result. If the expression evaluates to true, then -the statements enclosed in braces following the +arguments. That is, they take expressions that, when evaluated, +produce a boolean result. If the expression evaluates to true, then +the statements enclosed in braces following the .B if statement are executed, and all subsequent .B elsif and .B else -clauses are skipped. Otherwise, each subsequent +clauses are skipped. Otherwise, each subsequent .B elsif clause's expression is checked, until an elsif clause is encountered -whose test evaluates to true. If such a clause is found, the +whose test evaluates to true. If such a clause is found, the statements in braces following it are executed, and then any subsequent .B elsif and .B else -clauses are skipped. If all the +clauses are skipped. If all the .B if and .B elsif @@ -111,7 +111,7 @@ of their expressions evaluate true, then if there is an .B else clause, the statements enclosed in braces following the .B else -are evaluated. Boolean expressions that evaluate to null are +are evaluated. Boolean expressions that evaluate to null are treated as false in conditionals. .SH BOOLEAN EXPRESSIONS The following is the current list of boolean expressions that are @@ -121,7 +121,7 @@ supported by the DHCP distribution. .RS 0.25i .PP The \fB=\fR operator compares the values of two data expressions, -returning true if they are the same, false if they are not. If +returning true if they are the same, false if they are not. If either the left-hand side or the right-hand side are null, the result is also null. .RE @@ -134,9 +134,9 @@ The \fB~=\fR and \fB~~\fR operators (not available on all systems) perform extended regex(7) matching of the values of two data expressions, returning true if \fIdata-expression-1\fR matches against the regular expression evaluated by \fIdata-expression-2\fR, or false if it does not match or -encounters some error. If either the left-hand side or the right-hand side -are null, the result is also false. The \fB~~\fR operator differs from the -\fB~=\fR operator in that it is case-insensitive. +encounters some error. If either the left-hand side or the right-hand side +are null or empty strings, the result is also false. The \fB~~\fR operator +differs from the \fB~=\fR operator in that it is case-insensitive. .RE .PP .I boolean-expression-1 \fBand\fR \fIboolean-expression-2\fR @@ -164,7 +164,7 @@ the right-hand side are null, the result is null. .RS 0.25i The \fBnot\fR operator evaluates to true if \fIboolean-expression\fR evaluates to false, and returns false if \fIboolean-expression\fR evaluates -to true. If \fIboolean-expression\fR evaluates to null, the result +to true. If \fIboolean-expression\fR evaluates to null, the result is also null. .RE .PP @@ -190,7 +190,7 @@ address assignment. .RE .SH DATA EXPRESSIONS Several of the boolean expressions above depend on the results of -evaluating data expressions. A list of these expressions is provided +evaluating data expressions. A list of these expressions is provided here. .PP .B substring (\fIdata-expr\fB, \fIoffset\fB, \fIlength\fB)\fR @@ -213,7 +213,7 @@ is returned. .PP .RS 0.25i The \fBsuffix\fR operator evaluates \fIdata-expr\fR and returns the -last \fIlength\fR bytes of the result of that evaluation. \fILength\fR +last \fIlength\fR bytes of the result of that evaluation. \fILength\fR is a numeric expression. If \fIdata-expr\fR or \fIlength\fR evaluate to null, then the result is also null. If \fIsuffix\fR evaluates to a number greater than the length of the evaluated data, then the @@ -224,7 +224,7 @@ evaluated data is returned. .PP .RS 0.25i The \fBlcase\fR function returns the result of evaluating -\fIdata-expr\fR converted to lower case. If \fIdata-expr\fR evaluates +\fIdata-expr\fR converted to lower case. If \fIdata-expr\fR evaluates to null, then the result is also null. .RE .PP @@ -232,7 +232,7 @@ to null, then the result is also null. .PP .RS 0.25i The \fBucase\fR function returns the result of evaluating -\fIdata-expr\fR converted to upper case. If \fIdata-expr\fR evaluates +\fIdata-expr\fR converted to upper case. If \fIdata-expr\fR evaluates to null, then the result is also null. .RE .PP @@ -265,10 +265,10 @@ without knowing the local hostname at the time dhclient.conf is written. .RS 0.25i The \fBhardware\fR operator returns a data string whose first element is the type of network interface indicated in packet being considered, -and whose subsequent elements are client's link-layer address. If +and whose subsequent elements are client's link-layer address. If there is no packet, or if the RFC2131 \fIhlen\fR field is invalid, -then the result is null. Hardware types include ethernet (1), -token-ring (6), and fddi (8). Hardware types are specified by the +then the result is null. Hardware types include ethernet (1), +token-ring (6), and fddi (8). Hardware types are specified by the IETF, and details on how the type numbers are defined can be found in RFC2131 (in the ISC DHCP distribution, this is included in the doc/ subdirectory). @@ -279,7 +279,7 @@ subdirectory). .RS 0.25i The \fBpacket\fR operator returns the specified portion of the packet being considered, or null in contexts where no packet is being -considered. \fIOffset\fR and \fIlength\fR are applied to the +considered. \fIOffset\fR and \fIlength\fR are applied to the contents packet as in the \fBsubstring\fR operator. .RE .PP @@ -287,10 +287,10 @@ contents packet as in the \fBsubstring\fR operator. .PP .RS 0.25i A string, enclosed in quotes, may be specified as a data expression, -and returns the text between the quotes, encoded in ASCII. The +and returns the text between the quotes, encoded in ASCII. The backslash ('\\') character is treated specially, as in C programming: '\\t' means TAB, '\\r' means carriage return, '\\n' means newline, and '\\b' means -bell. Any octal value can be specified with '\\nnn', where nnn is any +bell. Any octal value can be specified with '\\nnn', where nnn is any positive octal number less than 0400. Any hexadecimal value can be specified with '\\xnn', where nn is any positive hexadecimal number less than or equal to 0xff. @@ -306,7 +306,7 @@ specified as a data expression. .B concat (\fIdata-expr1\fB, ..., \fIdata-exprN\fB)\fR .RS 0.25i The expressions are evaluated, and the results of each evaluation are -concatenated in the sequence that the subexpressions are listed. If +concatenated in the sequence that the subexpressions are listed. If any subexpression evaluates to null, the result of the concatenation is null. .RE @@ -315,8 +315,8 @@ is null. .RS 0.25i The two expressions are evaluated, and then the result of evaluating the data expression is reversed in place, using hunks of the size -specified in the numeric expression. For example, if the numeric -expression evaluates to four, and the data expression evaluates to +specified in the numeric expression. For example, if the numeric +expression evaluates to four, and the data expression evaluates to twelve bytes of data, then the reverse expression will evaluate to twelve bytes of data, consisting of the last four bytes of the the input data, followed by the middle four bytes, followed by the first @@ -340,10 +340,10 @@ information). .RS 0.25i Converts the result of evaluating data-expr2 into a text string containing one number for each element of the result of evaluating -data-expr2. Each number is separated from the other by the result of -evaluating data-expr1. The result of evaluating numeric-expr1 +data-expr2. Each number is separated from the other by the result of +evaluating data-expr1. The result of evaluating numeric-expr1 specifies the base (2 through 16) into which the numbers should be -converted. The result of evaluating numeric-expr2 specifies the +converted. The result of evaluating numeric-expr2 specifies the width in bits of each number, which may be either 8, 16 or 32. .PP As an example of the preceding three types of expressions, to produce @@ -370,10 +370,10 @@ also null. .B pick-first-value (\fIdata-expr1\fR [ ... \fIexpr\fRn ] \fB)\fR .RS 0.25i The pick-first-value function takes any number of data expressions as -its arguments. Each expression is evaluated, starting with the first +its arguments. Each expression is evaluated, starting with the first in the list, until an expression is found that does not evaluate to a -null value. That expression is returned, and none of the subsequent -expressions are evaluated. If all expressions evaluate to a null +null value. That expression is returned, and none of the subsequent +expressions are evaluated. If all expressions evaluate to a null value, the null value is returned. .RE .PP @@ -381,10 +381,10 @@ value, the null value is returned. .RS 0.25i The host-decl-name function returns the name of the host declaration that matched the client whose request is currently being processed, if -any. If no host declaration matched, the result is the null value. +any. If no host declaration matched, the result is the null value. .RE .SH NUMERIC EXPRESSIONS -Numeric expressions are expressions that evaluate to an integer. In +Numeric expressions are expressions that evaluate to an integer. In general, the maximum size of such an integer should not be assumed to be representable in fewer than 32 bits, but the precision of such integers may be more than 32 bits. @@ -394,8 +394,8 @@ integers may be more than 32 bits. .RS 0.25i The \fBextract-int\fR operator extracts an integer value in network byte order from the result of evaluating the specified data -expression. Width is the width in bits of the integer to extract. -Currently, the only supported widths are 8, 16 and 32. If the +expression. Width is the width in bits of the integer to extract. +Currently, the only supported widths are 8, 16 and 32. If the evaluation of the data expression doesn't provide sufficient bits to extract an integer of the specified size, the null value is returned. .RE @@ -417,45 +417,45 @@ specified as a numeric expression. .B client-state .PP .RS 0.25i -The current state of the client instance being processed. This is -only useful in DHCP client configuration files. Possible values are: +The current state of the client instance being processed. This is +only useful in DHCP client configuration files. Possible values are: .TP 2 .I \(bu Booting - DHCP client is in the INIT state, and does not yet have an -IP address. The next message transmitted will be a DHCPDISCOVER, +IP address. The next message transmitted will be a DHCPDISCOVER, which will be broadcast. .TP .I \(bu -Reboot - DHCP client is in the INIT-REBOOT state. It has an IP -address, but is not yet using it. The next message to be transmitted -will be a DHCPREQUEST, which will be broadcast. If no response is +Reboot - DHCP client is in the INIT-REBOOT state. It has an IP +address, but is not yet using it. The next message to be transmitted +will be a DHCPREQUEST, which will be broadcast. If no response is heard, the client will bind to its address and move to the BOUND state. .TP .I \(bu Select - DHCP client is in the SELECTING state - it has received at least one DHCPOFFER message, but is waiting to see if it may receive -other DHCPOFFER messages from other servers. No messages are sent in +other DHCPOFFER messages from other servers. No messages are sent in the SELECTING state. .TP .I \(bu Request - DHCP client is in the REQUESTING state - it has received at least one DHCPOFFER message, and has chosen which one it will -request. The next message to be sent will be a DHCPREQUEST message, +request. The next message to be sent will be a DHCPREQUEST message, which will be broadcast. .TP .I \(bu -Bound - DHCP client is in the BOUND state - it has an IP address. No +Bound - DHCP client is in the BOUND state - it has an IP address. No messages are transmitted in this state. .TP .I \(bu Renew - DHCP client is in the RENEWING state - it has an IP address, -and is trying to contact the server to renew it. The next message to +and is trying to contact the server to renew it. The next message to be sent will be a DHCPREQUEST message, which will be unicast directly to the server. .TP .I \(bu Rebind - DHCP client is in the REBINDING state - it has an IP address, -and is trying to contact any server to renew it. The next message to +and is trying to contact any server to renew it. The next message to be sent will be a DHCPREQUEST, which will be broadcast. .RE .SH REFERENCE: ACTION EXPRESSIONS @@ -490,59 +490,17 @@ execution times are suitable for use. Passing user-supplied data to an external application might be dangerous. Make sure the external application checks input buffers for validity. Non-printable ASCII characters will be converted into dhcpd.conf language -octal escapes ("\777"), make sure your external command handles them as +octal escapes ("\\nnn"), make sure your external command handles them as such. .PP It is possible to use the execute statement in any context, not only -on events. If you put it in a regular scope in the configuration file +on events. If you put it in a regular scope in the configuration file you will execute that command every time a scope is evaluated. .RE .SH REFERENCE: DYNAMIC DNS UPDATES .PP -The DHCP client and server have the ability to dynamically update the -Domain Name System. Within the configuration files, you can define -how you want the Domain Name System to be updated. These updates are -RFC 2136 compliant so any DNS server supporting RFC 2136 should be -able to accept updates from the DHCP server. -.SH SECURITY -Support for TSIG and DNSSEC is not yet available. When you set your -DNS server up to allow updates from the DHCP server or client, you may -be exposing it to unauthorized updates. To avoid this, the best you -can do right now is to use IP address-based packet filtering to -prevent unauthorized hosts from submitting update requests. -Obviously, there is currently no way to provide security for client -updates - this will require TSIG or DNSSEC, neither of which is yet -available in the DHCP distribution. -.PP -Dynamic DNS (DDNS) updates are performed by using the \fBdns-update\fR -expression. The \fBdns-update\fR expression is a boolean expression -that takes four parameters. If the update succeeds, the result is -true. If it fails, the result is false. The four parameters that the -are the resource record type (RR), the left hand side of the RR, the -right hand side of the RR and the ttl that should be applied to the -record. The simplest example of the use of the function can be found -in the reference section of the dhcpd.conf file, where events are -described. In this example several statements are being used to make -the arguments to the \fBdns-update\fR. -.PP -In the example, the first argument to the first \f\Bdns-update\fR -expression is a data expression that evaluates to the A RR type. The -second argument is constructed by concatenating the DHCP host-name -option with a text string containing the local domain, in this case -"ssd.example.net". The third argument is constructed by converting -the address the client has been assigned from a 32-bit number into an -ascii string with each byte separated by a ".". The fourth argument, -the TTL, specifies the amount of time remaining in the lease (note -that this isn't really correct, since the DNS server will pass this -TTL out whenever a request comes in, even if that is only a few -seconds before the lease expires). -.PP -If the first \fBdns-update\fR statement succeeds, it is followed up -with a second update to install a PTR RR. The installation of a PTR -record is similar to installing an A RR except that the left hand side -of the record is the leased address, reversed, with ".in-addr.arpa" -concatenated. The right hand side is the fully qualified domain name -of the client to which the address is being leased. +See the dhcpd.conf and dhclient.conf man pages for more information +about DDNS. .SH SEE ALSO dhcpd.conf(5), dhcpd.leases(5), dhclient.conf(5), dhcp-options(5), dhcpd(8), dhclient(8), RFC2132, RFC2131. diff --git a/external/bsd/dhcp/dist/common/dhcp-options.5 b/external/bsd/dhcp/dist/common/dhcp-options.5 index 49473afc5113..d25087c739ef 100644 --- a/external/bsd/dhcp/dist/common/dhcp-options.5 +++ b/external/bsd/dhcp/dist/common/dhcp-options.5 @@ -1,7 +1,8 @@ -.\" $NetBSD: dhcp-options.5,v 1.1.1.1 2013/03/24 15:45:51 christos Exp $ +.\" $NetBSD: dhcp-options.5,v 1.1.1.2 2013/03/24 22:50:30 christos Exp $ .\" -.\" Id: dhcp-options.5,v 1.45.18.6 2011-05-20 14:33:26 tomasz Exp +.\" Id: dhcp-options.5,v 1.45.18.6 2011/05/20 14:33:26 tomasz Exp .\" +.\" Copyright (c) 2012 by Internet Systems Consortium, Inc. ("ISC") .\" Copyright (c) 2004-2010 by Internet Systems Consortium, Inc. ("ISC") .\" Copyright (c) 1996-2003 by Internet Software Consortium .\" @@ -36,18 +37,18 @@ dhcp-options - Dynamic Host Configuration Protocol options The Dynamic Host Configuration protocol allows the client to receive .B options from the DHCP server describing the network configuration and various -services that are available on the network. When configuring +services that are available on the network. When configuring .B dhcpd(8) or .B dhclient(8) , -options must often be declared. The syntax for declaring options, +options must often be declared. The syntax for declaring options, and the names and formats of the options that can be declared, are documented here. .SH REFERENCE: OPTION STATEMENTS .PP DHCP \fIoption\fR statements always start with the \fIoption\fR keyword, followed by an option name, followed by option data. The -option names and data formats are described below. It is not +option names and data formats are described below. It is not necessary to exhaustively specify all DHCP options - only those options which are needed by clients must be specified. .PP @@ -66,13 +67,13 @@ data specifies an IPv6 address, like ::1 or 3ffe:bbbb:aaaa:aaaa::1. .PP The .B int32 -data type specifies a signed 32-bit integer. The +data type specifies a signed 32-bit integer. The .B uint32 -data type specifies an unsigned 32-bit integer. The +data type specifies an unsigned 32-bit integer. The .B int16 and .B uint16 -data types specify signed and unsigned 16-bit integers. The +data types specify signed and unsigned 16-bit integers. The .B int8 and .B uint8 @@ -92,8 +93,8 @@ option root-path "10.0.1.4:/var/tmp/rootfs"; The .B domain-name data type specifies a domain name, which must not be -enclosed in double quotes. This data type is not used for any -existing DHCP options. The domain name is stored just as if it were +enclosed in double quotes. This data type is not used for any +existing DHCP options. The domain name is stored just as if it were a text option. .PP The @@ -103,14 +104,14 @@ separated by commas ("example.com", "foo.example.com"). .PP The .B flag -data type specifies a boolean value. Booleans can be either true or +data type specifies a boolean value. Booleans can be either true or false (or on or off, if that makes more sense to you). .PP The .B string data type specifies either an NVT ASCII string enclosed in double quotes, or a series of octets specified in -hexadecimal, separated by colons. For example: +hexadecimal, separated by colons. For example: .nf .sp 1 option dhcp-client-identifier "CLIENT-FOO"; @@ -119,10 +120,10 @@ or .fi .SH SETTING OPTION VALUES USING EXPRESSIONS Sometimes it's helpful to be able to set the value of a DHCP option -based on some value that the client has sent. To do this, you can -use expression evaluation. The +based on some value that the client has sent. To do this, you can +use expression evaluation. The .B dhcp-eval(5) -manual page describes how to write expressions. To assign the result +manual page describes how to write expressions. To assign the result of an evaluation to an option, define the option as follows: .nf .sp 1 @@ -253,7 +254,7 @@ against the client identifier. .PP Please be aware that some DHCP clients, when configured with client identifiers that are ASCII text, will prepend a zero to the ASCII -text. So you may need to write: +text. So you may need to write: .nf option dhcp-client-identifier "\\0foo"; @@ -270,7 +271,7 @@ rather than: This option is used in a client request (DHCPDISCOVER or DHCPREQUEST) to allow the client to request a lease time for the IP address. In a server reply (DHCPOFFER), a DHCP server uses this option to specify -the lease time it is willing to offer. +the lease time it is willing to offer. .PP This option is not directly user configurable in the server; refer to the \fImax-lease-time\fR and \fIdefault-lease-time\fR server options in @@ -281,9 +282,9 @@ This option is not directly user configurable in the server; refer to the .RS 0.25i .PP This option, when sent by the client, specifies the maximum size of -any response that the server sends to the client. When specified on +any response that the server sends to the client. When specified on the server, if the client did not send a dhcp-max-message-size option, -the size specified on the server is used. This works for BOOTP as +the size specified on the server is used. This works for BOOTP as well as DHCP responses. .RE .PP @@ -313,7 +314,7 @@ RFC2132) are: 5 DHCPACK 6 DHCPNAK 7 DHCPRELEASE - 8 DHCPINFORM + 8 DHCPINFORM .fi .PP This option is not user configurable. @@ -336,7 +337,7 @@ Legal values for this option are: .nf 1 the \'file\' field is used to hold options 2 the \'sname\' field is used to hold options - 3 both fields are used to hold options + 3 both fields are used to hold options .fi .PP This option is not user configurable. @@ -348,12 +349,12 @@ This option is not user configurable. .RS 0.25i .PP This option, when sent by the client, specifies which options the -client wishes the server to return. Normally, in the ISC DHCP -client, this is done using the \fIrequest\fR statement. If this +client wishes the server to return. Normally, in the ISC DHCP +client, this is done using the \fIrequest\fR statement. If this option is not specified by the client, the DHCP server will normally return every option that is valid in scope and that fits into the -reply. When this option is specified on the server, the server -returns the specified options. This can be used to force a client to +reply. When this option is specified on the server, the server +returns the specified options. This can be used to force a client to take options that it hasn't requested, and it can also be used to tailor the response of the DHCP server for clients that may need a more limited set of options than those the server would normally @@ -367,7 +368,7 @@ This option specifies the number of seconds from the time a client gets an address until the client transitions to the REBINDING state. .PP This option is user configurable, but it will be ignored if the value is -greater than the lease time. +greater than or equal to the lease time. .PP To make DHCPv4+DHCPv6 migration easier in the future, any value configured in this option is also used as a DHCPv6 "T1" (renew) time. @@ -381,7 +382,7 @@ This option specifies the number of seconds from the time a client gets an address until the client transitions to the RENEWING state. .PP This option is user configurable, but it will be ignored if the value is -greater than the rebinding time, or lease time. +greater than or equal to the rebinding time, or lease time. .PP To make DHCPv4+DHCPv6 migration easier in the future, any value configured in this option is also used as a DHCPv6 "T2" (rebind) time. @@ -392,7 +393,7 @@ in this option is also used as a DHCPv6 "T2" (rebind) time. .RS 0.25i .PP This option is used by the client in a DHCPDISCOVER to -request that a particular IP address be assigned. +request that a particular IP address be assigned. .PP This option is not user configurable. .PP @@ -412,7 +413,7 @@ this option in a DHCPREQUEST message. .PP The value of this option is the IP address of the server. .PP -This option is not directly user configurable. See the +This option is not directly user configurable. See the \fIserver-identifier\fR server option in .B \fIdhcpd.conf(5). .PP @@ -515,7 +516,7 @@ preference. .B option \fBinterface-mtu\fR \fIuint16\fR\fB;\fR .RS 0.25i .PP -This option specifies the MTU to use on this interface. The minimum +This option specifies the MTU to use on this interface. The minimum legal value for the MTU is 68. .RE .PP @@ -620,8 +621,8 @@ list of RFC 1001/1002 NBDD servers listed in order of preference. .RS 0.25i .PP The NetBIOS name server (NBNS) option specifies a list of RFC -1001/1002 NBNS name servers listed in order of preference. NetBIOS -Name Service is currently more commonly referred to as WINS. WINS +1001/1002 NBNS name servers listed in order of preference. NetBIOS +Name Service is currently more commonly referred to as WINS. WINS servers can be specified using the netbios-name-servers option. .RE .PP @@ -749,7 +750,7 @@ use. .RS 0.25i .PP A sequence of suboptions for NetWare/IP clients - see RFC2242 for -details. Normally this option is set by specifying specific +details. Normally this option is set by specifying specific NetWare/IP suboptions - see the NETWARE/IP SUBOPTIONS section for more information. .RE @@ -853,8 +854,8 @@ client's subnet. Routers should be listed in order of preference. .PP This option specifies two things: the IP addresses of one or more Service Location Protocol Directory Agents, and whether the use of -these addresses is mandatory. If the initial boolean value is true, -the SLP agent should just use the IP addresses given. If the value +these addresses is mandatory. If the initial boolean value is true, +the SLP agent should just use the IP addresses given. If the value is false, the SLP agent may additionally do active or passive multicast discovery of SLP agents (see RFC2165 for details). .PP @@ -879,7 +880,7 @@ otherwise, it may use its own static configuration in preference to the list provided in this option. .PP The text string should be a comma-separated list of scopes that the -SLP agent should use. It may be omitted, in which case the SLP Agent +SLP agent should use. It may be omitted, in which case the SLP Agent will use the aggregated list of scopes of all directory agents known to the SLP agent. .RE @@ -910,8 +911,8 @@ the destination. The default route (0.0.0.0) is an illegal destination for a static route. To specify the default route, use the .B routers -option. Also, please note that this option is not intended for -classless IP routing - it does not include a subnet mask. Since +option. Also, please note that this option is not intended for +classless IP routing - it does not include a subnet mask. Since classless IP routing is now the most widely deployed routing standard, this option is virtually useless, and is not implemented by any of the popular DHCP clients, for example the Microsoft DHCP client. @@ -994,7 +995,7 @@ connections unless specifically requested by an application. .PP This option is used to identify a TFTP server and, if supported by the client, should have the same effect as the \fBserver-name\fR -declaration. BOOTP clients are unlikely to support this option. +declaration. BOOTP clients are unlikely to support this option. Some DHCP clients will support it, and others actually require it. .RE .PP @@ -1033,7 +1034,7 @@ servers can accept either HTTP 1.1 or SSLv3 connections. If the list includes a URL that does not contain a port component, the normal default port is assumed (i.e., port 80 for http and port 443 for https). If the list includes a URL that does not contain a path -component, the path /uap is assumed. If more than one URL is +component, the path /uap is assumed. If more than one URL is specified in this list, the URLs are separated by spaces. .RE .PP @@ -1041,9 +1042,9 @@ specified in this list, the URLs are separated by spaces. .RS 0.25i .PP This option is used by some DHCP clients as a way for users to -specify identifying information to the client. This can be used in a +specify identifying information to the client. This can be used in a similar way to the vendor-class-identifier option, but the value of -the option is specified by the user, not the vendor. Most recent +the option is specified by the user, not the vendor. Most recent DHCP clients have a way in the user interface to specify the value for this identifier, usually as a text string. .RE @@ -1054,7 +1055,7 @@ this identifier, usually as a text string. This option is used by some DHCP clients to identify the vendor type and possibly the configuration of a DHCP client. The information is a string of bytes whose contents are specific to the vendor and are -not specified in a standard. To see what vendor class identifier +not specified in a standard. To see what vendor class identifier clients are sending, you can write the following in your DHCP server configuration file: .nf @@ -1073,7 +1074,7 @@ set vendor-string = "SUNW.Ultra-5_10"; The vendor-class-identifier option is normally used by the DHCP server to determine the options that are returned in the .B vendor-encapsulated-options -option. Please see the VENDOR ENCAPSULATED OPTIONS section later in this +option. Please see the VENDOR ENCAPSULATED OPTIONS section later in this manual page for further information. .RE .PP @@ -1082,7 +1083,7 @@ manual page for further information. .PP The \fBvendor-encapsulated-options\fR option can contain either a single vendor-specific value or one or more vendor-specific -suboptions. This option is not normally specified in the DHCP server +suboptions. This option is not normally specified in the DHCP server configuration file - instead, a vendor class is defined for each vendor, vendor class suboptions are defined, values for those suboptions are defined, and the DHCP server makes up a response on @@ -1125,18 +1126,18 @@ should be listed in order of preference. .SH RELAY AGENT INFORMATION OPTION An IETF draft, draft-ietf-dhc-agent-options-11.txt, defines a series of encapsulated options that a relay agent can add to a DHCP packet -when relaying it to the DHCP server. The server can then make +when relaying it to the DHCP server. The server can then make address allocation decisions (or whatever other decisions it wants) -based on these options. The server also returns these options in any +based on these options. The server also returns these options in any replies it sends through the relay agent, so that the relay agent can use the information in these options for delivery or accounting purposes. .PP -The current draft defines two options. To reference +The current draft defines two options. To reference these options in the dhcp server, specify the option space name, -"agent", followed by a period, followed by the option name. It is +"agent", followed by a period, followed by the option name. It is not normally useful to define values for these options in the server, -although it is permissible. These options are not supported in the +although it is permissible. These options are not supported in the client. .PP .B option \fBagent.circuit-id\fR \fIstring\fR\fB;\fR @@ -1145,7 +1146,7 @@ client. The circuit-id suboption encodes an agent-local identifier of the circuit from which a DHCP client-to-server packet was received. It is intended for use by agents in relaying DHCP responses back to the -proper circuit. The format of this option is currently defined to be +proper circuit. The format of this option is currently defined to be vendor-dependent, and will probably remain that way, although the current draft allows for for the possibility of standardizing the format in the future. @@ -1155,9 +1156,9 @@ format in the future. .RS 0.25i .PP The remote-id suboption encodes information about the remote host end -of a circuit. Examples of what it might contain include caller ID +of a circuit. Examples of what it might contain include caller ID information, username information, remote ATM address, cable modem ID, -and similar things. In principal, the meaning is not well-specified, +and similar things. In principal, the meaning is not well-specified, and it should generally be assumed to be an opaque object that is administratively guaranteed to be unique to a particular remote end of a circuit. @@ -1192,9 +1193,9 @@ appropriate. .SH THE CLIENT FQDN SUBOPTIONS The Client FQDN option, currently defined in the Internet Draft draft-ietf-dhc-fqdn-option-00.txt is not a standard yet, but is in -sufficiently wide use already that we have implemented it. Due to +sufficiently wide use already that we have implemented it. Due to the complexity of the option format, we have implemented it as a -suboption space rather than a single option. In general this +suboption space rather than a single option. In general this option should not be configured by the user - instead it should be used as part of an automatic DNS update system. .PP @@ -1202,7 +1203,7 @@ used as part of an automatic DNS update system. .RS 0.25i .PP When the client sends this, if it is true, it means the client will not -attempt to update its A record. When sent by the server to the client, +attempt to update its A record. When sent by the server to the client, it means that the client \fIshould not\fR update its own A record. .RE .PP @@ -1210,7 +1211,7 @@ it means that the client \fIshould not\fR update its own A record. .RS 0.25i .PP When the client sends this to the server, it is requesting that the server -update its A record. When sent by the server, it means that the server +update its A record. When sent by the server, it means that the server has updated (or is about to update) the client's A record. .RE .PP @@ -1218,10 +1219,10 @@ has updated (or is about to update) the client's A record. .RS 0.25i .PP If true, this indicates that the domain name included in the option is -encoded in DNS wire format, rather than as plain ASCII text. The client +encoded in DNS wire format, rather than as plain ASCII text. The client normally sets this to false if it doesn't support DNS wire format in the -FQDN option. The server should always send back the same value that the -client sent. When this value is set on the configuration side, it controls +FQDN option. The server should always send back the same value that the +client sent. When this value is set on the configuration side, it controls the format in which the \fIfqdn.fqdn\fR suboption is encoded. .RE .PP @@ -1238,8 +1239,8 @@ The values of these fields are those defined in the DNS protocol specification. .B option fqdn.fqdn \fItext\fB; .RS 0.25i .PP -Specifies the domain name that the client wishes to use. This can be a -fully-qualified domain name, or a single label. If there is no trailing +Specifies the domain name that the client wishes to use. This can be a +fully-qualified domain name, or a single label. If there is no trailing \'.\' character in the name, it is not fully-qualified, and the server will generally update that name in some locally-defined domain. .RE @@ -1261,7 +1262,7 @@ This option should never be set, but it can be read back using the \fBoption\fR and \fBconfig-option\fR operators in an expression, in which case it returns all labels after the first label in the \fBfqdn.fqdn\fR suboption - for example, if the value of \fBfqdn.fqdn\fR is "foo.example.com.", -then \fBfqdn.hostname\fR will be "example.com.". If this suboption value +then \fBfqdn.hostname\fR will be "example.com.". If this suboption value is not set, it means that an unqualified name was sent in the fqdn option, or that no fqdn option was sent at all. .RE @@ -1281,7 +1282,7 @@ The following options can be specified: .RS 0.25i .PP If true, the client should use the NetWare Nearest Server Query to -locate a NetWare/IP server. The behaviour of the Novell client if +locate a NetWare/IP server. The behaviour of the Novell client if this suboption is false, or is not present, is not specified. .PP .RE @@ -1320,7 +1321,7 @@ server at startup. .RS 0.25i .PP If true, the NetWare/IP client should support NetWare/IP version 1.1 -compatibility. This is only needed if the client will be contacting +compatibility. This is only needed if the client will be contacting Netware/IP version 1.1 servers. .RE .PP @@ -1328,7 +1329,7 @@ Netware/IP version 1.1 servers. .RS 0.25i .PP Specifies the IP address of the Primary Domain SAP/RIP Service server -(DSS) for this NetWare/IP domain. The NetWare/IP administration +(DSS) for this NetWare/IP domain. The NetWare/IP administration utility uses this value as Primary DSS server when configuring a secondary DSS server. .RE @@ -1717,19 +1718,19 @@ The \fBlq-client-link\fR option is used internally by for lease query. .RE .SH DEFINING NEW OPTIONS The Internet Systems Consortium DHCP client and server provide the -capability to define new options. Each DHCP option has a name, a -code, and a structure. The name is used by you to refer to the -option. The code is a number, used by the DHCP server and client to -refer to an option. The structure describes what the contents of an +capability to define new options. Each DHCP option has a name, a +code, and a structure. The name is used by you to refer to the +option. The code is a number, used by the DHCP server and client to +refer to an option. The structure describes what the contents of an option looks like. .PP To define a new option, you need to choose a name for it that is not in use for some other option - for example, you can't use "host-name" because the DHCP protocol already defines a host-name option, which is -documented earlier in this manual page. If an option name doesn't +documented earlier in this manual page. If an option name doesn't appear in this manual page, you can use it, but it's probably a good idea to put some kind of unique string at the beginning so you can be -sure that future options don't take your name. For example, you +sure that future options don't take your name. For example, you might define an option, "local-host-name", feeling some confidence that no official DHCP option name will ever start with "local". .PP @@ -1745,7 +1746,7 @@ a vendor-documented option code in either the new or old site-local spaces, please contact your vendor and inform them about rfc3942. .PP The structure of an option is simply the format in which the option -data appears. The ISC DHCP server currently supports a few simple +data appears. The ISC DHCP server currently supports a few simple types, like integers, booleans, strings and IP addresses, and it also supports the ability to define arrays of single types or arrays of fixed sequences of types. @@ -1765,7 +1766,7 @@ The values of and .I new-code should be the name you have chosen for the new option and the code you -have chosen. The +have chosen. The .I definition should be the definition of the structure of the option. .PP @@ -1782,7 +1783,7 @@ The following simple option type definitions are supported: .B ; .PP An option of type boolean is a flag with a value of either on or off -(or true or false). So an example use of the boolean type would be: +(or true or false). So an example use of the boolean type would be: .nf option use-zephyr code 180 = boolean; @@ -1802,8 +1803,8 @@ option use-zephyr on; .B ; .PP The \fIsign\fR token should either be blank, \fIunsigned\fR -or \fIsigned\fR. The width can be either 8, 16 or 32, and refers to -the number of bits in the integer. So for example, the following two +or \fIsigned\fR. The width can be either 8, 16 or 32, and refers to +the number of bits in the integer. So for example, the following two lines show a definition of the sql-connection-max option and its use: .nf @@ -1860,7 +1861,7 @@ option dhcp6.some-server 3ffe:bbbb:aaaa:aaaa::1, 3ffe:bbbb:aaaa:aaaa::2; .B text .B ; .PP -An option whose type is text will encode an ASCII text string. For +An option whose type is text will encode an ASCII text string. For example: .nf @@ -1882,7 +1883,7 @@ option sql-default-connection-name "PRODZA"; An option whose type is a data string is essentially just a collection of bytes, and can be specified either as quoted text, like the text type, or as a list of hexadecimal contents separated by colons whose -values must be between 0 and FF. For example: +values must be between 0 and FF. For example: .nf option sql-identification-token code 195 = string; @@ -1934,7 +1935,7 @@ appropriate for direct use in eg /etc/resolv.conf. .B ; .PP An option whose type is \fBencapsulate\fR will encapsulate the -contents of the option space specified in \fIidentifier\fR. Examples +contents of the option space specified in \fIidentifier\fR. Examples of encapsulated options in the DHCP protocol as it currently exists include the vendor-encapsulated-options option, the netware-suboptions option and the relay-agent-information option. @@ -1951,7 +1952,7 @@ option local.demo "demo"; .PP Options can contain arrays of any of the above types except for the text and data string types, which aren't currently supported in -arrays. An example of an array definition is as follows: +arrays. An example of an array definition is as follows: .nf option kerberos-servers code 200 = array of ip-address; @@ -1961,7 +1962,7 @@ option kerberos-servers 10.20.10.1, 10.20.11.1; .B RECORDS .PP Options can also contain data structures consisting of a sequence of -data types, which is sometimes called a record type. For example: +data types, which is sometimes called a record type. For example: .nf option contrived-001 code 201 = { boolean, integer 32, text }; @@ -1994,7 +1995,7 @@ options according to each Vendor's specifications. You will need to refer to your vendor's documentation in order to form options to their specification. .PP -The value of these options can be set in one of two ways. The first +The value of these options can be set in one of two ways. The first way is to simply specify the data directly, using a text string or a colon-separated list of hexadecimal values. For help in forming these strings, please refer to \fBRFC2132\fR for the DHCPv4 \fBVendor Specific @@ -2021,7 +2022,7 @@ option dhcp6.vendor-opts .fi .PP The second way of setting the value of these options is to have the DHCP -server generate a vendor-specific option buffer. To do this, you +server generate a vendor-specific option buffer. To do this, you must do four things: define an option space, define some options in that option space, provide values for them, and specify that that option space should be used to generate the relevant option. @@ -2065,7 +2066,7 @@ space. Previous versions of ISC DHCP (up to and including DHCP 3.0.*), this value was fixed at 9973. .PP The name can then be used in option definitions, as described earlier in -this document. For example: +this document. For example: .nf option space SUNW code width 1 length width 1 hash size 3; @@ -2093,8 +2094,8 @@ option vsio.docsis code 4491 = encapsulate docsis; .fi Once you have defined an option space and the format of some options, you can set up scopes that define values for those options, and you -can say when to use them. For example, suppose you want to handle -two different classes of clients. Using the option space definition +can say when to use them. For example, suppose you want to handle +two different classes of clients. Using the option space definition shown in the previous example, you can send different option values to different clients based on the vendor-class-identifier option that the clients send, as follows: diff --git a/external/bsd/dhcp/dist/common/execute.c b/external/bsd/dhcp/dist/common/execute.c index 65cf43ed7dc3..67010bf09594 100644 --- a/external/bsd/dhcp/dist/common/execute.c +++ b/external/bsd/dhcp/dist/common/execute.c @@ -1,11 +1,12 @@ -/* $NetBSD: execute.c,v 1.1.1.1 2013/03/24 15:45:53 christos Exp $ */ +/* $NetBSD: execute.c,v 1.1.1.2 2013/03/24 22:50:31 christos Exp $ */ /* execute.c Support for executable statements. */ /* - * Copyright (c) 2004-2007,2009 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2009,2012 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1998-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -35,7 +36,7 @@ */ #include -__RCSID("$NetBSD: execute.c,v 1.1.1.1 2013/03/24 15:45:53 christos Exp $"); +__RCSID("$NetBSD: execute.c,v 1.1.1.2 2013/03/24 22:50:31 christos Exp $"); #include "dhcpd.h" #include @@ -331,67 +332,68 @@ int execute_statements (result, packet, lease, client_state, case set_statement: case define_statement: + status = 1; if (!scope) { - log_error ("set %s: no scope", - r -> data.set.name); + log_error("set %s: no scope", + r->data.set.name); status = 0; break; } if (!*scope) { - if (!binding_scope_allocate (scope, MDL)) { - log_error ("set %s: can't allocate scope", - r -> data.set.name); + if (!binding_scope_allocate(scope, MDL)) { + log_error("set %s: can't allocate scope", + r->data.set.name); status = 0; break; } } - binding = find_binding (*scope, r -> data.set.name); + binding = find_binding(*scope, r->data.set.name); #if defined (DEBUG_EXPRESSIONS) - log_debug ("exec: set %s", r -> data.set.name); + log_debug("exec: set %s", r->data.set.name); #endif - if (!binding) { - binding = dmalloc (sizeof *binding, MDL); - if (binding) { - memset (binding, 0, sizeof *binding); - binding -> name = - dmalloc (strlen - (r -> data.set.name) + 1, - MDL); - if (binding -> name) { - strcpy (binding -> name, - r -> data.set.name); - binding -> next = (*scope) -> bindings; - (*scope) -> bindings = binding; + if (binding == NULL) { + binding = dmalloc(sizeof(*binding), MDL); + if (binding != NULL) { + memset(binding, 0, sizeof(*binding)); + binding->name = + dmalloc(strlen + (r->data.set.name) + 1, + MDL); + if (binding->name != NULL) { + strcpy(binding->name, r->data.set.name); + binding->next = (*scope)->bindings; + (*scope)->bindings = binding; } else { - dfree (binding, MDL); - binding = (struct binding *)0; + dfree(binding, MDL); + binding = NULL; } } } - if (binding) { - if (binding -> value) + if (binding != NULL) { + if (binding->value != NULL) binding_value_dereference - (&binding -> value, MDL); - if (r -> op == set_statement) { + (&binding->value, MDL); + if (r->op == set_statement) { status = (evaluate_expression - (&binding -> value, packet, + (&binding->value, packet, lease, client_state, in_options, out_options, - scope, r -> data.set.expr, + scope, r->data.set.expr, MDL)); } else { if (!(binding_value_allocate - (&binding -> value, MDL))) { - dfree (binding, MDL); - binding = (struct binding *)0; + (&binding->value, MDL))) { + dfree(binding, MDL); + binding = NULL; } - if (binding -> value) { - binding -> value -> type = - binding_function; - (fundef_reference - (&binding -> value -> value.fundef, - r -> data.set.expr -> data.func, - MDL)); + if ((binding != NULL) && + (binding->value != NULL)) { + binding->value->type = + binding_function; + (fundef_reference + (&binding->value->value.fundef, + r->data.set.expr->data.func, + MDL)); } } } @@ -422,30 +424,31 @@ int execute_statements (result, packet, lease, client_state, case let_statement: #if defined (DEBUG_EXPRESSIONS) - log_debug ("exec: let %s", r -> data.let.name); + log_debug("exec: let %s", r->data.let.name); #endif - ns = (struct binding_scope *)0; + status = 0; + ns = NULL; binding_scope_allocate (&ns, MDL); e = r; next_let: if (ns) { - binding = dmalloc (sizeof *binding, MDL); - memset (binding, 0, sizeof *binding); + binding = dmalloc(sizeof(*binding), MDL); + memset(binding, 0, sizeof(*binding)); if (!binding) { blb: - binding_scope_dereference (&ns, MDL); + binding_scope_dereference(&ns, MDL); } else { - binding -> name = - dmalloc (strlen - (e -> data.let.name + 1), - MDL); - if (binding -> name) - strcpy (binding -> name, - e -> data.let.name); + binding->name = + dmalloc(strlen + (e->data.let.name + 1), + MDL); + if (binding->name) + strcpy(binding->name, + e->data.let.name); else { - dfree (binding, MDL); - binding = (struct binding *)0; + dfree(binding, MDL); + binding = NULL; goto blb; } } @@ -454,35 +457,35 @@ int execute_statements (result, packet, lease, client_state, if (ns && binding) { status = (evaluate_expression - (&binding -> value, packet, lease, + (&binding->value, packet, lease, client_state, in_options, out_options, - scope, e -> data.set.expr, MDL)); - binding -> next = ns -> bindings; - ns -> bindings = binding; + scope, e->data.set.expr, MDL)); + binding->next = ns->bindings; + ns->bindings = binding; } #if defined (DEBUG_EXPRESSIONS) - log_debug ("exec: let %s%s", e -> data.let.name, - (binding && status ? "" : "failed")); + log_debug("exec: let %s%s", e->data.let.name, + (binding && status ? "" : "failed")); #endif - if (!e -> data.let.statements) { - } else if (e -> data.let.statements -> op == + if (!e->data.let.statements) { + } else if (e->data.let.statements->op == let_statement) { - e = e -> data.let.statements; + e = e->data.let.statements; goto next_let; } else if (ns) { if (scope && *scope) - binding_scope_reference (&ns -> outer, - *scope, MDL); + binding_scope_reference(&ns->outer, + *scope, MDL); execute_statements (result, packet, lease, client_state, in_options, out_options, - &ns, e -> data.let.statements); + &ns, e->data.let.statements); } if (ns) - binding_scope_dereference (&ns, MDL); + binding_scope_dereference(&ns, MDL); break; case log_statement: diff --git a/external/bsd/dhcp/dist/common/lpf.c b/external/bsd/dhcp/dist/common/lpf.c index b62d52f11c7b..a8558fc9a2df 100644 --- a/external/bsd/dhcp/dist/common/lpf.c +++ b/external/bsd/dhcp/dist/common/lpf.c @@ -1,4 +1,4 @@ -/* $NetBSD: lpf.c,v 1.1.1.1 2013/03/24 15:45:53 christos Exp $ */ +/* $NetBSD: lpf.c,v 1.1.1.2 2013/03/24 22:50:31 christos Exp $ */ /* lpf.c @@ -6,7 +6,8 @@ Support Services in Vancouver, B.C. */ /* - * Copyright (c) 2004,2007,2009 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2009,2012 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004,2007 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1996-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -458,9 +459,9 @@ get_hw_addr(const char *name, struct hardware *hw) { memcpy(&hw->hbuf[1], sa->sa_data, 6); break; case ARPHRD_FDDI: - hw->hlen = 17; + hw->hlen = 7; hw->hbuf[0] = HTYPE_FDDI; - memcpy(&hw->hbuf[1], sa->sa_data, 16); + memcpy(&hw->hbuf[1], sa->sa_data, 6); break; default: log_fatal("Unsupported device type %ld for \"%s\"", diff --git a/external/bsd/dhcp/dist/common/options.c b/external/bsd/dhcp/dist/common/options.c index 211a58dcb30f..84b87f95bf25 100644 --- a/external/bsd/dhcp/dist/common/options.c +++ b/external/bsd/dhcp/dist/common/options.c @@ -1,11 +1,11 @@ -/* $NetBSD: options.c,v 1.1.1.1 2013/03/24 15:45:54 christos Exp $ */ +/* $NetBSD: options.c,v 1.1.1.2 2013/03/24 22:50:32 christos Exp $ */ /* options.c DHCP options parsing and reassembly. */ /* - * Copyright (c) 2004-2011 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004-2012 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1995-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -35,7 +35,7 @@ */ #include -__RCSID("$NetBSD: options.c,v 1.1.1.1 2013/03/24 15:45:54 christos Exp $"); +__RCSID("$NetBSD: options.c,v 1.1.1.2 2013/03/24 22:50:32 christos Exp $"); #define DHCP_OPTION_DATA #include "dhcpd.h" @@ -263,9 +263,14 @@ int parse_option_buffer (options, buffer, length, universe) option_cache_reference(&op->next, nop, MDL); option_cache_dereference(&nop, MDL); } else { - save_option_buffer(universe, options, bp, - bp->data + offset, len, - code, 1); + if (save_option_buffer(universe, options, bp, + bp->data + offset, len, + code, 1) == 0) { + log_error("parse_option_buffer: " + "save_option_buffer failed"); + buffer_dereference(&bp, MDL); + return 0; + } } } option_dereference(&option, MDL); @@ -522,6 +527,8 @@ int fqdn_universe_decode (struct option_state *options, * Load all options into a buffer, and then split them out into the three * separate fields in the dhcp packet (options, file, and sname) where * options can be stored. + * + * returns 0 on error, length of packet on success */ int cons_options(struct packet *inpacket, struct dhcp_packet *outpacket, @@ -558,10 +565,10 @@ cons_options(struct packet *inpacket, struct dhcp_packet *outpacket, if (inpacket && (op = lookup_option(&dhcp_universe, inpacket->options, - DHO_DHCP_MAX_MESSAGE_SIZE))) { - evaluate_option_cache(&ds, inpacket, - lease, client_state, in_options, - cfg_options, scope, op, MDL); + DHO_DHCP_MAX_MESSAGE_SIZE)) && + (evaluate_option_cache(&ds, inpacket, lease, + client_state, in_options, + cfg_options, scope, op, MDL) != 0)) { if (ds.len >= sizeof (u_int16_t)) { i = getUShort(ds.data); if(!mms || (i < mms)) @@ -684,7 +691,7 @@ cons_options(struct packet *inpacket, struct dhcp_packet *outpacket, * in the packet if there is space. Note that the option * may only be included if the client supplied one. */ - if ((priority_len < PRIORITY_COUNT) && + if ((inpacket != NULL) && (priority_len < PRIORITY_COUNT) && (lookup_option(&fqdn_universe, inpacket->options, FQDN_ENCODED) != NULL)) priority_list[priority_len++] = DHO_FQDN; @@ -700,7 +707,7 @@ cons_options(struct packet *inpacket, struct dhcp_packet *outpacket, * DHCPINFORM or DHCPLEASEQUERY responses (if the client * didn't request it). */ - if ((priority_len < PRIORITY_COUNT) && + if ((inpacket != NULL) && (priority_len < PRIORITY_COUNT) && ((inpacket->packet_type == DHCPDISCOVER) || (inpacket->packet_type == DHCPREQUEST))) priority_list[priority_len++] = DHO_SUBNET_MASK; @@ -1271,11 +1278,12 @@ store_options(int *ocount, cfg_options, vendor_cfg_option -> code); if (tmp) - evaluate_option_cache (&name, packet, lease, - client_state, - in_options, - cfg_options, - scope, tmp, MDL); + /* No need to check the return as we check name.len below */ + (void) evaluate_option_cache (&name, packet, lease, + client_state, + in_options, + cfg_options, + scope, tmp, MDL); } else if (vuname) { name.data = (unsigned char *)s; name.len = strlen (s); @@ -1313,9 +1321,10 @@ store_options(int *ocount, /* Find the value of the option... */ od.len = 0; if (oc) { - evaluate_option_cache (&od, packet, - lease, client_state, in_options, - cfg_options, scope, oc, MDL); + /* No need to check the return as we check od.len below */ + (void) evaluate_option_cache (&od, packet, + lease, client_state, in_options, + cfg_options, scope, oc, MDL); /* If we have encapsulation for this option, and an oc * lookup succeeded, but the evaluation failed, it is @@ -1688,6 +1697,8 @@ const char *pretty_print_option (option, data, len, emit_commas, emit_quotes) const unsigned char *dp = data; char comma; unsigned long tval; + isc_boolean_t a_array = ISC_FALSE; + int len_used; if (emit_commas) comma = ','; @@ -1712,6 +1723,8 @@ const char *pretty_print_option (option, data, len, emit_commas, emit_quotes) fmtbuf [l] = option -> format [i]; switch (option -> format [i]) { case 'a': + a_array = ISC_TRUE; + /* Fall through */ case 'A': --numelem; fmtbuf [l] = 0; @@ -1740,6 +1753,8 @@ const char *pretty_print_option (option, data, len, emit_commas, emit_quotes) hunksize++; comma = ':'; numhunk = 0; + a_array = ISC_TRUE; + hunkinc = 1; } fmtbuf [l + 1] = 0; break; @@ -1833,13 +1848,34 @@ const char *pretty_print_option (option, data, len, emit_commas, emit_quotes) len - hunksize); /* If this is an array, compute its size. */ - if (!numhunk) - numhunk = len / hunksize; - /* See if we got an exact number of hunks. */ - if (numhunk > 0 && numhunk * hunksize < len) - log_error ("%s: %d extra bytes at end of array\n", - option -> name, - len - numhunk * hunksize); + if (numhunk == 0) { + if (a_array == ISC_TRUE) { + /* + * It is an 'a' type array - we repeat the + * last format type. A binary string for 'X' + * is also like this. hunkinc is the size + * of the last format type and we add 1 to + * cover the entire first record. + */ + numhunk = ((len - hunksize) / hunkinc) + 1; + len_used = hunksize + ((numhunk - 1) * hunkinc); + } else { + /* + * It is an 'A' type array - we repeat the + * entire record + */ + numhunk = len / hunksize; + len_used = numhunk * hunksize; + } + + /* See if we got an exact number of hunks. */ + if (len_used < len) { + log_error ("%s: %d extra bytes at end of array\n", + option -> name, + len - len_used); + } + } + /* A one-hunk array prints the same as a single hunk. */ if (numhunk < 0) @@ -1847,7 +1883,24 @@ const char *pretty_print_option (option, data, len, emit_commas, emit_quotes) /* Cycle through the array (or hunk) printing the data. */ for (i = 0; i < numhunk; i++) { - for (j = 0; j < numelem; j++) { + if ((a_array == ISC_TRUE) && (i != 0) && (numelem > 0)) { + /* + * For 'a' type of arrays we repeat + * only the last format character + * We should never hit the case of numelem == 0 + * but let's include the check to be safe. + */ + j = numelem - 1; + } else { + /* + * for other types of arrays or the first + * time through for 'a' types, we go through + * the entire set of format characters. + */ + j = 0; + } + + for (; j < numelem; j++) { switch (fmtbuf [j]) { case 't': /* endbuf-1 leaves room for NULL. */ @@ -2364,9 +2417,11 @@ prepare_option_buffer(struct universe *universe, struct buffer *bp, /* And let go of our references. */ cleanup: + if (lbp != NULL) + buffer_dereference(&lbp, MDL); option_dereference(&option, MDL); - return 1; + return status; } static void @@ -3102,9 +3157,11 @@ int fqdn_option_space_encapsulate (result, packet, lease, client_state, struct option_cache *oc = (struct option_cache *)(ocp -> car); if (oc -> option -> code > FQDN_SUBOPTION_COUNT) continue; - evaluate_option_cache (&results [oc -> option -> code], - packet, lease, client_state, in_options, - cfg_options, scope, oc, MDL); + /* No need to check the return code, we check the length later */ + (void) evaluate_option_cache (&results[oc->option->code], + packet, lease, client_state, + in_options, cfg_options, scope, + oc, MDL); } /* We add a byte for the flags field. * We add two bytes for the two RCODE fields. @@ -3269,10 +3326,10 @@ fqdn6_option_space_encapsulate(struct data_string *result, oc = (struct option_cache *)(ocp->car); if (oc->option->code > FQDN_SUBOPTION_COUNT) log_fatal("Impossible condition at %s:%d.", MDL); - - evaluate_option_cache(&results[oc->option->code], packet, - lease, client_state, in_options, - cfg_options, scope, oc, MDL); + /* No need to check the return code, we check the length later */ + (void) evaluate_option_cache(&results[oc->option->code], packet, + lease, client_state, in_options, + cfg_options, scope, oc, MDL); } /* We add a byte for the flags field at the start of the option. @@ -3708,77 +3765,73 @@ void do_packet (interface, packet, len, from_port, from, hfrom) #endif #if defined (TRACING) - trace_inpacket_stash (interface, packet, len, from_port, from, hfrom); + trace_inpacket_stash(interface, packet, len, from_port, from, hfrom); #endif - decoded_packet = (struct packet *)0; - if (!packet_allocate (&decoded_packet, MDL)) { - log_error ("do_packet: no memory for incoming packet!"); + decoded_packet = NULL; + if (!packet_allocate(&decoded_packet, MDL)) { + log_error("do_packet: no memory for incoming packet!"); return; } - decoded_packet -> raw = packet; - decoded_packet -> packet_length = len; - decoded_packet -> client_port = from_port; - decoded_packet -> client_addr = from; - interface_reference (&decoded_packet -> interface, interface, MDL); - decoded_packet -> haddr = hfrom; + decoded_packet->raw = packet; + decoded_packet->packet_length = len; + decoded_packet->client_port = from_port; + decoded_packet->client_addr = from; + interface_reference(&decoded_packet->interface, interface, MDL); + decoded_packet->haddr = hfrom; - if (packet -> hlen > sizeof packet -> chaddr) { - packet_dereference (&decoded_packet, MDL); - log_info ("Discarding packet with bogus hlen."); + if (packet->hlen > sizeof packet->chaddr) { + packet_dereference(&decoded_packet, MDL); + log_info("Discarding packet with bogus hlen."); return; } /* If there's an option buffer, try to parse it. */ - if (decoded_packet -> packet_length >= DHCP_FIXED_NON_UDP + 4) { - if (!parse_options (decoded_packet)) { - if (decoded_packet -> options) + if (decoded_packet->packet_length >= DHCP_FIXED_NON_UDP + 4) { + if (!parse_options(decoded_packet)) { + if (decoded_packet->options) option_state_dereference - (&decoded_packet -> options, MDL); + (&decoded_packet->options, MDL); packet_dereference (&decoded_packet, MDL); return; } - if (decoded_packet -> options_valid && - (op = lookup_option (&dhcp_universe, - decoded_packet -> options, - DHO_DHCP_MESSAGE_TYPE))) { + if (decoded_packet->options_valid && + (op = lookup_option(&dhcp_universe, + decoded_packet->options, + DHO_DHCP_MESSAGE_TYPE))) { struct data_string dp; - memset (&dp, 0, sizeof dp); - evaluate_option_cache (&dp, decoded_packet, - (struct lease *)0, - (struct client_state *)0, - decoded_packet -> options, - (struct option_state *)0, - (struct binding_scope **)0, - op, MDL); + memset(&dp, 0, sizeof dp); + evaluate_option_cache(&dp, decoded_packet, NULL, NULL, + decoded_packet->options, NULL, + NULL, op, MDL); if (dp.len > 0) - decoded_packet -> packet_type = dp.data [0]; + decoded_packet->packet_type = dp.data[0]; else - decoded_packet -> packet_type = 0; - data_string_forget (&dp, MDL); + decoded_packet->packet_type = 0; + data_string_forget(&dp, MDL); } } - - if (decoded_packet -> packet_type) - dhcp (decoded_packet); - else - bootp (decoded_packet); + + if (validate_packet(decoded_packet) != 0) { + if (decoded_packet->packet_type) + dhcp(decoded_packet); + else + bootp(decoded_packet); + } /* If the caller kept the packet, they'll have upped the refcnt. */ - packet_dereference (&decoded_packet, MDL); + packet_dereference(&decoded_packet, MDL); #if defined (DEBUG_MEMORY_LEAKAGE) - log_info ("generation %ld: %ld new, %ld outstanding, %ld long-term", - dmalloc_generation, - dmalloc_outstanding - previous_outstanding, - dmalloc_outstanding, dmalloc_longterm); -#endif -#if defined (DEBUG_MEMORY_LEAKAGE) - dmalloc_dump_outstanding (); + log_info("generation %ld: %ld new, %ld outstanding, %ld long-term", + dmalloc_generation, + dmalloc_outstanding - previous_outstanding, + dmalloc_outstanding, dmalloc_longterm); + dmalloc_dump_outstanding(); #endif #if defined (DEBUG_RC_HISTORY_EXHAUSTIVELY) - dump_rc_history (0); + dump_rc_history(0); #endif } @@ -3812,6 +3865,9 @@ do_packet6(struct interface_info *interface, const char *packet, const struct dhcpv6_packet *msg; const struct dhcpv6_relay_packet *relay; struct packet *decoded_packet; +#if defined (DEBUG_MEMORY_LEAKAGE) + unsigned long previous_outstanding = dmalloc_outstanding; +#endif if (!packet6_len_okay(packet, len)) { log_info("do_packet6: " @@ -3839,8 +3895,8 @@ do_packet6(struct interface_info *interface, const char *packet, /* decoded_packet->circuit_id_len = 0; */ /* decoded_packet->remote_id = NULL; */ /* decoded_packet->remote_id_len = 0; */ - decoded_packet->raw = (struct dhcp_packet *) packet; - decoded_packet->packet_length = (unsigned) len; + decoded_packet->raw = (struct dhcp_packet *)packet; + decoded_packet->packet_length = (unsigned)len; decoded_packet->client_port = from_port; decoded_packet->client_addr = *from; interface_reference(&decoded_packet->interface, interface, MDL); @@ -3850,6 +3906,7 @@ do_packet6(struct interface_info *interface, const char *packet, msg_type = packet[0]; if ((msg_type == DHCPV6_RELAY_FORW) || (msg_type == DHCPV6_RELAY_REPL)) { + int relaylen = (int)(offsetof(struct dhcpv6_relay_packet, options)); relay = (const struct dhcpv6_relay_packet *)packet; decoded_packet->dhcpv6_msg_type = relay->msg_type; @@ -3861,7 +3918,7 @@ do_packet6(struct interface_info *interface, const char *packet, relay->peer_address, sizeof(relay->peer_address)); if (!parse_option_buffer(decoded_packet->options, - relay->options, len-sizeof(*relay), + relay->options, len - relaylen, &dhcpv6_universe)) { /* no logging here, as parse_option_buffer() logs all cases where it fails */ @@ -3869,6 +3926,7 @@ do_packet6(struct interface_info *interface, const char *packet, return; } } else { + int msglen = (int)(offsetof(struct dhcpv6_packet, options)); msg = (const struct dhcpv6_packet *)packet; decoded_packet->dhcpv6_msg_type = msg->msg_type; @@ -3878,7 +3936,7 @@ do_packet6(struct interface_info *interface, const char *packet, sizeof(decoded_packet->dhcpv6_transaction_id)); if (!parse_option_buffer(decoded_packet->options, - msg->options, len-sizeof(*msg), + msg->options, len - msglen, &dhcpv6_universe)) { /* no logging here, as parse_option_buffer() logs all cases where it fails */ @@ -3890,6 +3948,17 @@ do_packet6(struct interface_info *interface, const char *packet, dhcpv6(decoded_packet); packet_dereference(&decoded_packet, MDL); + +#if defined (DEBUG_MEMORY_LEAKAGE) + log_info("generation %ld: %ld new, %ld outstanding, %ld long-term", + dmalloc_generation, + dmalloc_outstanding - previous_outstanding, + dmalloc_outstanding, dmalloc_longterm); + dmalloc_dump_outstanding(); +#endif +#if defined (DEBUG_RC_HISTORY_EXHAUSTIVELY) + dump_rc_history(0); +#endif } #endif /* DHCPv6 */ @@ -4081,4 +4150,47 @@ add_option(struct option_state *options, return 1; } +/** + * Checks if received BOOTP/DHCPv4 packet is sane + * + * @param packet received, decoded packet + * + * @return 1 if packet is sane, 0 if it is not + */ +int validate_packet(struct packet *packet) +{ + struct option_cache *oc = NULL; + oc = lookup_option (&dhcp_universe, packet->options, + DHO_DHCP_CLIENT_IDENTIFIER); + if (oc) { + /* Let's check if client-identifier is sane */ + if (oc->data.len == 0) { + log_debug("Dropped DHCPv4 packet with zero-length client-id"); + return (0); + + } else if (oc->data.len == 1) { + /* + * RFC2132, section 9.14 states that minimum length of client-id + * is 2. We will allow single-character client-ids for now (for + * backwards compatibility), but warn the user that support for + * this is against the standard. + */ + log_debug("Accepted DHCPv4 packet with one-character client-id - " + "a future version of ISC DHCP will reject this"); + } + } else { + /* + * If hlen is 0 we don't have any identifier, we warn the user + * but continue processing the packet as we can. + */ + if (packet->raw->hlen == 0) { + log_debug("Received DHCPv4 packet without client-id" + " option and empty hlen field."); + } + } + + /* @todo: Add checks for other received options */ + + return (1); +} diff --git a/external/bsd/dhcp/dist/common/packet.c b/external/bsd/dhcp/dist/common/packet.c index 28d21e1a288b..7b7c276727c7 100644 --- a/external/bsd/dhcp/dist/common/packet.c +++ b/external/bsd/dhcp/dist/common/packet.c @@ -1,11 +1,12 @@ -/* $NetBSD: packet.c,v 1.1.1.1 2013/03/24 15:45:54 christos Exp $ */ +/* $NetBSD: packet.c,v 1.1.1.2 2013/03/24 22:50:32 christos Exp $ */ /* packet.c Packet assembly code, originally contributed by Archie Cobbs. */ /* - * Copyright (c) 2004,2005,2007,2009 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2009,2012 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004,2005,2007 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1996-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -107,18 +108,25 @@ void assemble_hw_header (interface, buf, bufix, to) unsigned *bufix; struct hardware *to; { -#if defined (HAVE_TR_SUPPORT) - if (interface -> hw_address.hbuf [0] == HTYPE_IEEE802) - assemble_tr_header (interface, buf, bufix, to); - else + switch (interface->hw_address.hbuf[0]) { +#if defined(HAVE_TR_SUPPORT) + case HTYPE_IEEE802: + assemble_tr_header(interface, buf, bufix, to); + break; #endif #if defined (DEC_FDDI) - if (interface -> hw_address.hbuf [0] == HTYPE_FDDI) - assemble_fddi_header (interface, buf, bufix, to); - else + case HTYPE_FDDI: + assemble_fddi_header(interface, buf, bufix, to); + break; #endif - assemble_ethernet_header (interface, buf, bufix, to); - + case HTYPE_INFINIBAND: + log_error("Attempt to assemble hw header for infiniband"); + break; + case HTYPE_ETHER: + default: + assemble_ethernet_header(interface, buf, bufix, to); + break; + } } /* UDP header and IP header assembled together for convenience. */ @@ -186,7 +194,9 @@ void assemble_udp_ip_header (interface, buf, bufix, #ifdef PACKET_DECODING /* Decode a hardware header... */ -/* XXX currently only supports ethernet; doesn't check for other types. */ +/* Support for ethernet, TR and FDDI + * Doesn't support infiniband yet as the supported oses shouldn't get here + */ ssize_t decode_hw_header (interface, buf, bufix, from) struct interface_info *interface; @@ -194,17 +204,22 @@ ssize_t decode_hw_header (interface, buf, bufix, from) unsigned bufix; struct hardware *from; { + switch(interface->hw_address.hbuf[0]) { #if defined (HAVE_TR_SUPPORT) - if (interface -> hw_address.hbuf [0] == HTYPE_IEEE802) - return decode_tr_header (interface, buf, bufix, from); - else + case HTYPE_IEEE802: + return (decode_tr_header(interface, buf, bufix, from)); #endif #if defined (DEC_FDDI) - if (interface -> hw_address.hbuf [0] == HTYPE_FDDI) - return decode_fddi_header (interface, buf, bufix, from); - else + case HTYPE_FDDI: + return (decode_fddi_header(interface, buf, bufix, from)); #endif - return decode_ethernet_header (interface, buf, bufix, from); + case HTYPE_INFINIBAND: + log_error("Attempt to decode hw header for infiniband"); + return (0); + case HTYPE_ETHER: + default: + return (decode_ethernet_header(interface, buf, bufix, from)); + } } /* UDP header and IP header decoded together for convenience. */ diff --git a/external/bsd/dhcp/dist/common/parse.c b/external/bsd/dhcp/dist/common/parse.c index eb60bd152371..e891a3f285b5 100644 --- a/external/bsd/dhcp/dist/common/parse.c +++ b/external/bsd/dhcp/dist/common/parse.c @@ -1,11 +1,11 @@ -/* $NetBSD: parse.c,v 1.1.1.1 2013/03/24 15:45:54 christos Exp $ */ +/* $NetBSD: parse.c,v 1.1.1.2 2013/03/24 22:50:30 christos Exp $ */ /* parse.c Common parser code for dhcpd and dhclient. */ /* - * Copyright (c) 2004-2010 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004-2012 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1995-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -35,7 +35,7 @@ */ #include -__RCSID("$NetBSD: parse.c,v 1.1.1.1 2013/03/24 15:45:54 christos Exp $"); +__RCSID("$NetBSD: parse.c,v 1.1.1.2 2013/03/24 22:50:30 christos Exp $"); #include "dhcpd.h" #include @@ -574,7 +574,9 @@ parse_ip_addr_with_subnet(cfile, match) /* * hardware-parameter :== HARDWARE hardware-type colon-separated-hex-list SEMI - * hardware-type :== ETHERNET | TOKEN_RING | TOKEN_FDDI + * hardware-type :== ETHERNET | TOKEN_RING | TOKEN_FDDI | INFINIBAND + * Note that INFINIBAND may not be useful for some items, such as classification + * as the hardware address won't always be available. */ void parse_hardware_param (cfile, hardware) @@ -586,24 +588,27 @@ void parse_hardware_param (cfile, hardware) unsigned hlen; unsigned char *t; - token = next_token (&val, (unsigned *)0, cfile); + token = next_token(&val, NULL, cfile); switch (token) { case ETHERNET: - hardware -> hbuf [0] = HTYPE_ETHER; + hardware->hbuf[0] = HTYPE_ETHER; break; case TOKEN_RING: - hardware -> hbuf [0] = HTYPE_IEEE802; + hardware->hbuf[0] = HTYPE_IEEE802; break; case TOKEN_FDDI: - hardware -> hbuf [0] = HTYPE_FDDI; + hardware->hbuf[0] = HTYPE_FDDI; + break; + case TOKEN_INFINIBAND: + hardware->hbuf[0] = HTYPE_INFINIBAND; break; default: - if (!strncmp (val, "unknown-", 8)) { - hardware -> hbuf [0] = atoi (&val [8]); + if (!strncmp(val, "unknown-", 8)) { + hardware->hbuf[0] = atoi(&val[8]); } else { - parse_warn (cfile, - "expecting a network hardware type"); - skip_to_semi (cfile); + parse_warn(cfile, + "expecting a network hardware type"); + skip_to_semi(cfile); return; } @@ -617,34 +622,33 @@ void parse_hardware_param (cfile, hardware) that data in the lease file rather than simply failing on such clients. Yuck. */ hlen = 0; - token = peek_token (&val, (unsigned *)0, cfile); + token = peek_token(&val, NULL, cfile); if (token == SEMI) { - hardware -> hlen = 1; + hardware->hlen = 1; goto out; } - t = parse_numeric_aggregate (cfile, (unsigned char *)0, &hlen, - COLON, 16, 8); - if (!t) { - hardware -> hlen = 1; + t = parse_numeric_aggregate(cfile, NULL, &hlen, COLON, 16, 8); + if (t == NULL) { + hardware->hlen = 1; return; } - if (hlen + 1 > sizeof hardware -> hbuf) { - dfree (t, MDL); - parse_warn (cfile, "hardware address too long"); + if (hlen + 1 > sizeof(hardware->hbuf)) { + dfree(t, MDL); + parse_warn(cfile, "hardware address too long"); } else { - hardware -> hlen = hlen + 1; - memcpy ((unsigned char *)&hardware -> hbuf [1], t, hlen); - if (hlen + 1 < sizeof hardware -> hbuf) - memset (&hardware -> hbuf [hlen + 1], 0, - (sizeof hardware -> hbuf) - hlen - 1); - dfree (t, MDL); + hardware->hlen = hlen + 1; + memcpy((unsigned char *)&hardware->hbuf[1], t, hlen); + if (hlen + 1 < sizeof(hardware->hbuf)) + memset(&hardware->hbuf[hlen + 1], 0, + (sizeof(hardware->hbuf)) - hlen - 1); + dfree(t, MDL); } out: - token = next_token (&val, (unsigned *)0, cfile); + token = next_token(&val, NULL, cfile); if (token != SEMI) { - parse_warn (cfile, "expecting semicolon."); - skip_to_semi (cfile); + parse_warn(cfile, "expecting semicolon."); + skip_to_semi(cfile); } } @@ -676,7 +680,23 @@ void parse_lease_time (cfile, timep) the token specified in separator. If max is zero, any number of numbers will be parsed; otherwise, exactly max numbers are expected. Base and size tell us how to internalize the numbers - once they've been tokenized. */ + once they've been tokenized. + + buf - A pointer to space to return the parsed value, if it is null + then the function will allocate space for the return. + + max - The maximum number of items to store. If zero there is no + maximum. When buf is null and the function needs to allocate space + it will do an allocation of max size at the beginning if max is non + zero. If max is zero then the allocation will be done later, after + the function has determined the size necessary for the incoming + string. + + returns NULL on errors or a pointer to the value string on success. + The pointer will either be buf if it was non-NULL or newly allocated + space if buf was NULL + */ + unsigned char *parse_numeric_aggregate (cfile, buf, max, separator, base, size) @@ -697,9 +717,8 @@ unsigned char *parse_numeric_aggregate (cfile, buf, bufp = (unsigned char *)dmalloc (*max * size / 8, MDL); if (!bufp) log_fatal ("no space for numeric aggregate"); - s = 0; - } else - s = bufp; + } + s = bufp; do { if (count) { @@ -714,6 +733,9 @@ unsigned char *parse_numeric_aggregate (cfile, buf, parse_warn (cfile, "too few numbers."); if (token != SEMI) skip_to_semi (cfile); + /* free bufp if it was allocated */ + if ((bufp != NULL) && (bufp != buf)) + dfree(bufp, MDL); return (unsigned char *)0; } token = next_token (&val, (unsigned *)0, cfile); @@ -730,7 +752,17 @@ unsigned char *parse_numeric_aggregate (cfile, buf, (base != 16 || token != NUMBER_OR_NAME)) { parse_warn (cfile, "expecting numeric value."); skip_to_semi (cfile); - return (unsigned char *)0; + /* free bufp if it was allocated */ + if ((bufp != NULL) && (bufp != buf)) + dfree(bufp, MDL); + /* free any linked numbers we may have allocated */ + while (c) { + pair cdr = c->cdr; + dfree(c->car, MDL); + dfree(c, MDL); + c = cdr; + } + return (NULL); } /* If we can, convert the number now; otherwise, build a linked list of all the numbers. */ @@ -748,6 +780,10 @@ unsigned char *parse_numeric_aggregate (cfile, buf, /* If we had to cons up a list, convert it now. */ if (c) { + /* + * No need to cleanup bufp, to get here we didn't allocate + * bufp above + */ bufp = (unsigned char *)dmalloc (count * size / 8, MDL); if (!bufp) log_fatal ("no space for numeric aggregate."); @@ -908,7 +944,7 @@ parse_date_core(cfile) struct parse *cfile; { int guess; - int tzoff, wday, year, mon, mday, hour, min, sec; + int tzoff, year, mon, mday, hour, min, sec; const char *val; enum dhcp_token token; static int months[11] = { 31, 59, 90, 120, 151, 181, @@ -946,7 +982,7 @@ parse_date_core(cfile) return((TIME)0); } token = next_token(&val, NULL, cfile); /* consume day of week */ - wday = atoi(val); + /* we are not using this for anything */ /* Year... */ token = peek_token(&val, NULL, cfile); @@ -1819,7 +1855,6 @@ int parse_base64 (data, cfile) struct data_string *data; struct parse *cfile; { - enum dhcp_token token; const char *val; int i, j, k; unsigned acc = 0; @@ -1836,11 +1871,12 @@ int parse_base64 (data, cfile) 33, 34, 35, 36, 37, 38, 39, 40, /* hijklmno */ 41, 42, 43, 44, 45, 46, 47, 48, /* pqrstuvw */ 49, 50, 51, 64, 64, 64, 64, 64}; /* xyz{|}~ */ - struct string_list *bufs = (struct string_list *)0, - *last = (struct string_list *)0, + struct string_list *bufs = NULL, + *last = NULL, *t; int cc = 0; int terminated = 0; + int valid_base64; /* It's possible for a + or a / to cause a base64 quantity to be tokenized into more than one token, so we have to parse them all @@ -1848,55 +1884,64 @@ int parse_base64 (data, cfile) do { unsigned l; - token = next_token (&val, &l, cfile); - t = dmalloc (l + sizeof *t, MDL); - if (!t) - log_fatal ("no memory for base64 buffer."); - memset (t, 0, (sizeof *t) - 1); - memcpy (t -> string, val, l + 1); + (void)next_token(&val, &l, cfile); + t = dmalloc(l + sizeof(*t), MDL); + if (t == NULL) + log_fatal("no memory for base64 buffer."); + memset(t, 0, (sizeof(*t)) - 1); + memcpy(t->string, val, l + 1); cc += l; if (last) - last -> next = t; + last->next = t; else bufs = t; last = t; - token = peek_token (&val, (unsigned *)0, cfile); - } while (token == NUMBER_OR_NAME || token == NAME || token == EQUAL || - token == NUMBER || token == PLUS || token == SLASH || - token == STRING); + (void)peek_token(&val, NULL, cfile); + valid_base64 = 1; + for (i = 0; val[i]; i++) { + /* Check to see if the character is valid. It + may be out of range or within the right range + but not used in the mapping */ + if (((val[i] < ' ') || (val[i] > 'z')) || + ((from64[val[i] - ' '] > 63) && (val[i] != '='))) { + valid_base64 = 0; + break; /* no need to continue for loop */ + } + } + } while (valid_base64); - data -> len = cc; - data -> len = (data -> len * 3) / 4; - if (!buffer_allocate (&data -> buffer, data -> len, MDL)) { + data->len = cc; + data->len = (data->len * 3) / 4; + if (!buffer_allocate(&data->buffer, data->len, MDL)) { parse_warn (cfile, "can't allocate buffer for base64 data."); - data -> len = 0; - data -> data = (unsigned char *)0; - return 0; + data->len = 0; + data->data = NULL; + goto out; } j = k = 0; - for (t = bufs; t; t = t -> next) { - for (i = 0; t -> string [i]; i++) { - unsigned foo = t -> string [i]; + for (t = bufs; t; t = t->next) { + for (i = 0; t->string[i]; i++) { + unsigned foo = t->string[i]; if (terminated && foo != '=') { - parse_warn (cfile, - "stuff after base64 '=' terminator: %s.", - &t -> string [i]); + parse_warn(cfile, + "stuff after base64 '=' terminator: %s.", + &t->string[i]); goto bad; } - if (foo < ' ' || foo > 'z') { + if ((foo < ' ') || (foo > 'z')) { bad64: - parse_warn (cfile, - "invalid base64 character %d.", - t -> string [i]); + parse_warn(cfile, + "invalid base64 character %d.", + t->string[i]); bad: - data_string_forget (data, MDL); + data_string_forget(data, MDL); goto out; } if (foo == '=') terminated = 1; else { - foo = from64 [foo - ' ']; + foo = from64[foo - ' ']; if (foo == 64) goto bad64; acc = (acc << 6) + foo; @@ -1904,16 +1949,16 @@ int parse_base64 (data, cfile) case 0: break; case 1: - data -> buffer -> data [j++] = (acc >> 4); + data->buffer->data[j++] = (acc >> 4); acc = acc & 0x0f; break; case 2: - data -> buffer -> data [j++] = (acc >> 2); + data->buffer->data[j++] = (acc >> 2); acc = acc & 0x03; break; case 3: - data -> buffer -> data [j++] = acc; + data->buffer->data[j++] = acc; acc = 0; break; } @@ -1923,19 +1968,19 @@ int parse_base64 (data, cfile) } if (k % 4) { if (acc) { - parse_warn (cfile, - "partial base64 value left over: %d.", - acc); + parse_warn(cfile, + "partial base64 value left over: %d.", + acc); } } - data -> len = j; - data -> data = data -> buffer -> data; + data->len = j; + data->data = data->buffer->data; out: for (t = bufs; t; t = last) { - last = t -> next; - dfree (t, MDL); + last = t->next; + dfree(t, MDL); } - if (data -> len) + if (data->len) return 1; else return 0; @@ -3391,11 +3436,10 @@ int parse_boolean_expression (expr, cfile, lose) int parse_boolean (cfile) struct parse *cfile; { - enum dhcp_token token; const char *val; int rv; - token = next_token (&val, (unsigned *)0, cfile); + (void)next_token(&val, NULL, cfile); if (!strcasecmp (val, "true") || !strcasecmp (val, "on")) rv = 1; @@ -5260,6 +5304,8 @@ int parse_option_token (rv, cfile, fmt, expr, uniform, lookups) return 0; } *fmt = g; + /* FALL THROUGH */ + /* to get string value for the option */ case 'X': token = peek_token (&val, (unsigned *)0, cfile); if (token == NUMBER_OR_NAME || token == NUMBER) { @@ -5520,11 +5566,26 @@ int parse_option_decl (oc, cfile) if (status != ISC_R_SUCCESS || option == NULL) return 0; + fmt = option->format; + /* Parse the option data... */ do { - for (fmt = option -> format; *fmt; fmt++) { - if (*fmt == 'A') + for (; *fmt; fmt++) { + if (*fmt == 'A') { + /* 'A' is an array of records, start at + * the beginning + */ + fmt = option->format; break; + } + + if (*fmt == 'a') { + /* 'a' is an array of the last field, + * back up one format character + */ + fmt--; + break; + } if (*fmt == 'o' && fmt != option -> format) continue; switch (*fmt) { @@ -5536,6 +5597,8 @@ int parse_option_decl (oc, cfile) "encapsulation format"); goto parse_exit; } + /* FALL THROUGH */ + /* to get string value for the option */ case 'X': len = parse_X (cfile, &hunkbuf [hunkix], sizeof hunkbuf - hunkix); @@ -5720,7 +5783,7 @@ int parse_option_decl (oc, cfile) goto alloc; case 'Z': /* Zero-length option */ - token = next_token(&val, (unsigned *)0, cfile); + token = peek_token(&val, (unsigned *)0, cfile); if (token != SEMI) { parse_warn(cfile, "semicolon expected."); @@ -5737,7 +5800,7 @@ int parse_option_decl (oc, cfile) } } token = next_token (&val, (unsigned *)0, cfile); - } while (*fmt == 'A' && token == COMMA); + } while (*fmt && token == COMMA); if (token != SEMI) { parse_warn (cfile, "semicolon expected."); @@ -5747,8 +5810,6 @@ int parse_option_decl (oc, cfile) bp = (struct buffer *)0; if (!buffer_allocate (&bp, hunkix + nul_term, MDL)) log_fatal ("no memory to store option declaration."); - if (!bp -> data) - log_fatal ("out of memory allocating option data."); memcpy (bp -> data, hunkbuf, hunkix + nul_term); if (!option_cache_allocate (oc, MDL)) diff --git a/external/bsd/dhcp/dist/common/print.c b/external/bsd/dhcp/dist/common/print.c index 8b57b0b1ee03..1cd7909424a1 100644 --- a/external/bsd/dhcp/dist/common/print.c +++ b/external/bsd/dhcp/dist/common/print.c @@ -1,11 +1,11 @@ -/* $NetBSD: print.c,v 1.1.1.1 2013/03/24 15:45:54 christos Exp $ */ +/* $NetBSD: print.c,v 1.1.1.2 2013/03/24 22:50:32 christos Exp $ */ /* print.c Turn data structures into printable text. */ /* - * Copyright (c) 2009-2011 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2009-2012 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1995-2003 by Internet Software Consortium * @@ -36,7 +36,7 @@ */ #include -__RCSID("$NetBSD: print.c,v 1.1.1.1 2013/03/24 15:45:54 christos Exp $"); +__RCSID("$NetBSD: print.c,v 1.1.1.2 2013/03/24 22:50:32 christos Exp $"); #include "dhcpd.h" @@ -484,10 +484,9 @@ char *print_dotted_quads (len, data) { static char dq_buf [DQLEN + 1]; int i; - char *s, *last; + char *s; s = &dq_buf [0]; - last = s; i = 0; @@ -1140,6 +1139,7 @@ static unsigned print_subexpression (expr, buf, len) buf [rv] = 0; return rv; } + break; case expr_gethostname: if (len > 13) { @@ -1251,7 +1251,12 @@ int token_print_indent (FILE *file, int col, int indent, const char *prefix, const char *suffix, const char *buf) { - int len = strlen (buf) + strlen (prefix); + int len = 0; + if (prefix != NULL) + len = strlen (prefix); + if (buf != NULL) + len += strlen (buf); + if (col + len > 79) { if (indent + len < 79) { indent_spaces (file, indent); @@ -1264,8 +1269,10 @@ int token_print_indent (FILE *file, int col, int indent, fputs (prefix, file); col += strlen (prefix); } - fputs (buf, file); - col += len; + if ((buf != NULL) && (*buf != 0)) { + fputs (buf, file); + col += strlen(buf); + } if (suffix && *suffix) { if (col + strlen (suffix) > 79) { indent_spaces (file, indent); diff --git a/external/bsd/dhcp/dist/common/socket.c b/external/bsd/dhcp/dist/common/socket.c index 8de4024a365e..f35850e4f4e8 100644 --- a/external/bsd/dhcp/dist/common/socket.c +++ b/external/bsd/dhcp/dist/common/socket.c @@ -1,11 +1,11 @@ -/* $NetBSD: socket.c,v 1.1.1.1 2013/03/24 15:45:55 christos Exp $ */ +/* $NetBSD: socket.c,v 1.1.1.2 2013/03/24 22:50:32 christos Exp $ */ /* socket.c BSD socket interface code... */ /* - * Copyright (c) 2004-2011 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004-2012 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1995-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -35,7 +35,7 @@ */ #include -__RCSID("$NetBSD: socket.c,v 1.1.1.1 2013/03/24 15:45:55 christos Exp $"); +__RCSID("$NetBSD: socket.c,v 1.1.1.2 2013/03/24 22:50:32 christos Exp $"); /* SO_BINDTODEVICE support added by Elliot Poger (poger@leland.stanford.edu). * This sockopt allows a socket to be bound to a particular interface, @@ -56,6 +56,7 @@ __RCSID("$NetBSD: socket.c,v 1.1.1.1 2013/03/24 15:45:55 christos Exp $"); #include #include #include +#include #endif #ifdef USE_SOCKET_FALLBACK @@ -770,7 +771,7 @@ ssize_t receive_packet (interface, buf, len, from, hfrom) struct sockaddr_in *from; struct hardware *hfrom; { -#if !defined(USE_V4_PKTINFO) +#if !(defined(IP_PKTINFO) && defined(IP_RECVPKTINFO) && defined(USE_V4_PKTINFO)) SOCKLEN_T flen = sizeof *from; #endif int result; @@ -793,7 +794,6 @@ ssize_t receive_packet (interface, buf, len, from, hfrom) struct cmsghdr *cmsg; struct in_pktinfo *pktinfo; unsigned int ifindex; - int found_pktinfo; /* * If necessary allocate space for the control message header. @@ -836,7 +836,7 @@ ssize_t receive_packet (interface, buf, len, from, hfrom) * We set up some space for a "control message". We have * previously asked the kernel to give us packet * information (when we initialized the interface), so we - * should get the destination address from that. + * should get the interface index from that. */ m.msg_control = control_buf; m.msg_controllen = control_buf_len; @@ -847,12 +847,8 @@ ssize_t receive_packet (interface, buf, len, from, hfrom) /* * If we did read successfully, then we need to loop * through the control messages we received and - * find the one with our destination address. - * - * We also keep a flag to see if we found it. If we - * didn't, then we consider this to be an error. + * find the one with our inteface index. */ - found_pktinfo = 0; cmsg = CMSG_FIRSTHDR(&m); while (cmsg != NULL) { if ((cmsg->cmsg_level == IPPROTO_IP) && @@ -866,18 +862,21 @@ ssize_t receive_packet (interface, buf, len, from, hfrom) * the discover code. */ memcpy(hfrom->hbuf, &ifindex, sizeof(ifindex)); - found_pktinfo = 1; + return (result); } cmsg = CMSG_NXTHDR(&m, cmsg); } - if (!found_pktinfo) { - result = -1; - errno = EIO; - } + + /* + * We didn't find the necessary control message + * flag it as an error + */ + result = -1; + errno = EIO; } #else - result = recvfrom (interface -> rfdesc, (char *)buf, len, 0, - (struct sockaddr *)from, &flen); + result = recvfrom(interface -> rfdesc, (char *)buf, len, 0, + (struct sockaddr *)from, &flen); #endif /* IP_PKTINFO ... */ #ifdef IGNORE_HOSTUNREACH } while (result < 0 && @@ -885,7 +884,7 @@ ssize_t receive_packet (interface, buf, len, from, hfrom) errno == ECONNREFUSED) && retry++ < 10); #endif - return result; + return (result); } #endif /* USE_SOCKET_RECEIVE */ @@ -902,7 +901,6 @@ receive_packet6(struct interface_info *interface, int result; struct cmsghdr *cmsg; struct in6_pktinfo *pktinfo; - int found_pktinfo; /* * If necessary allocate space for the control message header. @@ -957,11 +955,7 @@ receive_packet6(struct interface_info *interface, * If we did read successfully, then we need to loop * through the control messages we received and * find the one with our destination address. - * - * We also keep a flag to see if we found it. If we - * didn't, then we consider this to be an error. */ - found_pktinfo = 0; cmsg = CMSG_FIRSTHDR(&m); while (cmsg != NULL) { if ((cmsg->cmsg_level == IPPROTO_IPV6) && @@ -969,17 +963,21 @@ receive_packet6(struct interface_info *interface, pktinfo = (struct in6_pktinfo *)CMSG_DATA(cmsg); *to_addr = pktinfo->ipi6_addr; *if_idx = pktinfo->ipi6_ifindex; - found_pktinfo = 1; + + return (result); } cmsg = CMSG_NXTHDR(&m, cmsg); } - if (!found_pktinfo) { - result = -1; - errno = EIO; - } + + /* + * We didn't find the necessary control message + * flag is as an error + */ + result = -1; + errno = EIO; } - return result; + return (result); } #endif /* DHCPv6 */ @@ -1007,6 +1005,9 @@ isc_result_t fallback_discard (object) log_error ("fallback_discard: %m"); return ISC_R_UNEXPECTED; } +#else + /* ignore the fact that status value is never used */ + IGNORE_UNUSED(status); #endif return ISC_R_SUCCESS; } @@ -1075,7 +1076,7 @@ void maybe_setup_fallback () void get_hw_addr(const char *name, struct hardware *hw) { struct sockaddr_dl *dladdrp; - int rv, sock, i; + int sock, i; struct lifreq lifr; memset(&lifr, 0, sizeof (lifr)); @@ -1109,7 +1110,8 @@ get_hw_addr(const char *name, struct hardware *hw) { hw->hlen = sizeof (hw->hbuf); srandom((long)gethrtime()); - for (i = 0; i < hw->hlen; ++i) { + hw->hbuf[0] = HTYPE_IPMP; + for (i = 1; i < hw->hlen; ++i) { hw->hbuf[i] = random() % 256; } @@ -1122,8 +1124,27 @@ get_hw_addr(const char *name, struct hardware *hw) { log_fatal("Couldn't get interface hardware address for %s: %m", name); dladdrp = (struct sockaddr_dl *)&lifr.lifr_addr; - hw->hlen = dladdrp->sdl_alen; - memcpy(hw->hbuf, LLADDR(dladdrp), hw->hlen); + hw->hlen = dladdrp->sdl_alen+1; + switch (dladdrp->sdl_type) { + case DL_CSMACD: /* IEEE 802.3 */ + case DL_ETHER: + hw->hbuf[0] = HTYPE_ETHER; + break; + case DL_TPR: + hw->hbuf[0] = HTYPE_IEEE802; + break; + case DL_FDDI: + hw->hbuf[0] = HTYPE_FDDI; + break; + case DL_IB: + hw->hbuf[0] = HTYPE_INFINIBAND; + break; + default: + log_fatal("%s: unsupported DLPI MAC type %lu", name, + (unsigned long)dladdrp->sdl_type); + } + + memcpy(hw->hbuf+1, LLADDR(dladdrp), hw->hlen-1); if (sock != -1) (void) close(sock); diff --git a/external/bsd/dhcp/dist/common/tables.c b/external/bsd/dhcp/dist/common/tables.c index e0a3d3d8a4d8..93b6c1275a4d 100644 --- a/external/bsd/dhcp/dist/common/tables.c +++ b/external/bsd/dhcp/dist/common/tables.c @@ -1,10 +1,11 @@ -/* $NetBSD: tables.c,v 1.1.1.1 2013/03/24 15:45:55 christos Exp $ */ +/* $NetBSD: tables.c,v 1.1.1.2 2013/03/24 22:50:32 christos Exp $ */ /* tables.c Tables of information... */ /* + * Copyright (c) 2011-2012 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2009 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1995-2003 by Internet Software Consortium * @@ -35,7 +36,7 @@ */ #include -__RCSID("$NetBSD: tables.c,v 1.1.1.1 2013/03/24 15:45:55 christos Exp $"); +__RCSID("$NetBSD: tables.c,v 1.1.1.2 2013/03/24 22:50:32 christos Exp $"); #include "dhcpd.h" @@ -68,9 +69,10 @@ HASH_FUNCTIONS (option_code, const unsigned *, struct option, some event. The special all-ones value means 'infinite'. May either be printed as a decimal, eg, "3600", or as this name, eg, "infinite". f - flag (true or false) - A - array of whatever precedes (e.g., IA means array of IP addresses) - a - array of the preceding character (e.g., IIa means two or more IP - addresses) + A - array of all that precedes (e.g., fIA means array of records of + a flag and an IP address) + a - array of the preceding character (e.g., fIa means a single flag + followed by an array of IP addresses) U - name of an option space (universe) F - implicit flag - the presence of the option indicates that the flag is true. @@ -606,7 +608,7 @@ const char *hardware_types [] = { "unknown-29", "unknown-30", "unknown-31", - "unknown-32", + "infiniband", "unknown-33", "unknown-34", "unknown-35", diff --git a/external/bsd/dhcp/dist/common/tests/Atffile b/external/bsd/dhcp/dist/common/tests/Atffile new file mode 100644 index 000000000000..10402ce74ca5 --- /dev/null +++ b/external/bsd/dhcp/dist/common/tests/Atffile @@ -0,0 +1,5 @@ +Content-Type: application/X-atf-atffile; version="1" + +prop: test-suite = dhcp4 + +tp-glob: *_unittest diff --git a/external/bsd/dhcp/dist/common/tests/Makefile.am b/external/bsd/dhcp/dist/common/tests/Makefile.am index 70eb50ad82c5..5accf57b2bfb 100644 --- a/external/bsd/dhcp/dist/common/tests/Makefile.am +++ b/external/bsd/dhcp/dist/common/tests/Makefile.am @@ -1,11 +1,24 @@ -AM_CPPFLAGS = -I../.. +SUBDIRS = . -check_PROGRAMS = test_alloc +AM_CPPFLAGS = $(ATF_CFLAGS) -I$(top_srcdir)/includes -TESTS = test_alloc +EXTRA_DIST = Atffile -test_alloc_SOURCES = test_alloc.c -test_alloc_LDADD = ../libdhcp.a ../../tests/libt_api.a \ +ATF_TESTS = + +if HAVE_ATF + +ATF_TESTS += alloc_unittest + +alloc_unittest_SOURCES = test_alloc.c $(top_srcdir)/tests/t_api_dhcp.c +alloc_unittest_LDADD = $(ATF_LDFLAGS) +alloc_unittest_LDADD += ../libdhcp.a \ ../../omapip/libomapi.a ../../bind/lib/libdns.a \ ../../bind/lib/libisc.a +check: $(ATF_TESTS) + atf-run | atf-report + +endif + +check_PROGRAMS = $(ATF_TESTS) diff --git a/external/bsd/dhcp/dist/common/tests/Makefile.in b/external/bsd/dhcp/dist/common/tests/Makefile.in index 43a477ef68f6..7a30033fc807 100644 --- a/external/bsd/dhcp/dist/common/tests/Makefile.in +++ b/external/bsd/dhcp/dist/common/tests/Makefile.in @@ -29,8 +29,8 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -check_PROGRAMS = test_alloc$(EXEEXT) -TESTS = test_alloc$(EXEEXT) +@HAVE_ATF_TRUE@am__append_1 = alloc_unittest +check_PROGRAMS = $(am__EXEEXT_2) subdir = common/tests DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -40,11 +40,17 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/includes/config.h CONFIG_CLEAN_FILES = -am_test_alloc_OBJECTS = test_alloc.$(OBJEXT) -test_alloc_OBJECTS = $(am_test_alloc_OBJECTS) -test_alloc_DEPENDENCIES = ../libdhcp.a ../../tests/libt_api.a \ - ../../omapip/libomapi.a ../../bind/lib/libdns.a \ - ../../bind/lib/libisc.a +@HAVE_ATF_TRUE@am__EXEEXT_1 = alloc_unittest$(EXEEXT) +am__EXEEXT_2 = $(am__EXEEXT_1) +am__alloc_unittest_SOURCES_DIST = test_alloc.c \ + $(top_srcdir)/tests/t_api_dhcp.c +@HAVE_ATF_TRUE@am_alloc_unittest_OBJECTS = test_alloc.$(OBJEXT) \ +@HAVE_ATF_TRUE@ t_api_dhcp.$(OBJEXT) +alloc_unittest_OBJECTS = $(am_alloc_unittest_OBJECTS) +am__DEPENDENCIES_1 = +@HAVE_ATF_TRUE@alloc_unittest_DEPENDENCIES = $(am__DEPENDENCIES_1) \ +@HAVE_ATF_TRUE@ ../libdhcp.a ../../omapip/libomapi.a \ +@HAVE_ATF_TRUE@ ../../bind/lib/libdns.a ../../bind/lib/libisc.a DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/includes depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -52,13 +58,25 @@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(test_alloc_SOURCES) -DIST_SOURCES = $(test_alloc_SOURCES) +SOURCES = $(alloc_unittest_SOURCES) +DIST_SOURCES = $(am__alloc_unittest_SOURCES_DIST) +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive ETAGS = etags CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ +ATF_CFLAGS = @ATF_CFLAGS@ +ATF_LDFLAGS = @ATF_LDFLAGS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -148,13 +166,15 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -AM_CPPFLAGS = -I../.. -test_alloc_SOURCES = test_alloc.c -test_alloc_LDADD = ../libdhcp.a ../../tests/libt_api.a \ - ../../omapip/libomapi.a ../../bind/lib/libdns.a \ - ../../bind/lib/libisc.a - -all: all-am +SUBDIRS = . +AM_CPPFLAGS = $(ATF_CFLAGS) -I$(top_srcdir)/includes +EXTRA_DIST = Atffile +ATF_TESTS = $(am__append_1) +@HAVE_ATF_TRUE@alloc_unittest_SOURCES = test_alloc.c $(top_srcdir)/tests/t_api_dhcp.c +@HAVE_ATF_TRUE@alloc_unittest_LDADD = $(ATF_LDFLAGS) ../libdhcp.a \ +@HAVE_ATF_TRUE@ ../../omapip/libomapi.a ../../bind/lib/libdns.a \ +@HAVE_ATF_TRUE@ ../../bind/lib/libisc.a +all: all-recursive .SUFFIXES: .SUFFIXES: .c .o .obj @@ -190,9 +210,9 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) clean-checkPROGRAMS: -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) -test_alloc$(EXEEXT): $(test_alloc_OBJECTS) $(test_alloc_DEPENDENCIES) - @rm -f test_alloc$(EXEEXT) - $(LINK) $(test_alloc_OBJECTS) $(test_alloc_LDADD) $(LIBS) +alloc_unittest$(EXEEXT): $(alloc_unittest_OBJECTS) $(alloc_unittest_DEPENDENCIES) + @rm -f alloc_unittest$(EXEEXT) + $(LINK) $(alloc_unittest_OBJECTS) $(alloc_unittest_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -200,6 +220,7 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_api_dhcp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_alloc.Po@am__quote@ .c.o: @@ -216,6 +237,90 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` +t_api_dhcp.o: $(top_srcdir)/tests/t_api_dhcp.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT t_api_dhcp.o -MD -MP -MF $(DEPDIR)/t_api_dhcp.Tpo -c -o t_api_dhcp.o `test -f '$(top_srcdir)/tests/t_api_dhcp.c' || echo '$(srcdir)/'`$(top_srcdir)/tests/t_api_dhcp.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/t_api_dhcp.Tpo $(DEPDIR)/t_api_dhcp.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/tests/t_api_dhcp.c' object='t_api_dhcp.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o t_api_dhcp.o `test -f '$(top_srcdir)/tests/t_api_dhcp.c' || echo '$(srcdir)/'`$(top_srcdir)/tests/t_api_dhcp.c + +t_api_dhcp.obj: $(top_srcdir)/tests/t_api_dhcp.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT t_api_dhcp.obj -MD -MP -MF $(DEPDIR)/t_api_dhcp.Tpo -c -o t_api_dhcp.obj `if test -f '$(top_srcdir)/tests/t_api_dhcp.c'; then $(CYGPATH_W) '$(top_srcdir)/tests/t_api_dhcp.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/tests/t_api_dhcp.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/t_api_dhcp.Tpo $(DEPDIR)/t_api_dhcp.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/tests/t_api_dhcp.c' object='t_api_dhcp.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o t_api_dhcp.obj `if test -f '$(top_srcdir)/tests/t_api_dhcp.c'; then $(CYGPATH_W) '$(top_srcdir)/tests/t_api_dhcp.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/tests/t_api_dhcp.c'; fi` + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ @@ -226,10 +331,23 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) mkid -fID $$unique tags: TAGS -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ @@ -242,7 +360,7 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $$tags $$unique; \ fi ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ @@ -263,79 +381,6 @@ GTAGS: distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -check-TESTS: $(TESTS) - @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \ - srcdir=$(srcdir); export srcdir; \ - list=' $(TESTS) '; \ - if test -n "$$list"; then \ - for tst in $$list; do \ - if test -f ./$$tst; then dir=./; \ - elif test -f $$tst; then dir=; \ - else dir="$(srcdir)/"; fi; \ - if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ - all=`expr $$all + 1`; \ - case " $(XFAIL_TESTS) " in \ - *$$ws$$tst$$ws*) \ - xpass=`expr $$xpass + 1`; \ - failed=`expr $$failed + 1`; \ - echo "XPASS: $$tst"; \ - ;; \ - *) \ - echo "PASS: $$tst"; \ - ;; \ - esac; \ - elif test $$? -ne 77; then \ - all=`expr $$all + 1`; \ - case " $(XFAIL_TESTS) " in \ - *$$ws$$tst$$ws*) \ - xfail=`expr $$xfail + 1`; \ - echo "XFAIL: $$tst"; \ - ;; \ - *) \ - failed=`expr $$failed + 1`; \ - echo "FAIL: $$tst"; \ - ;; \ - esac; \ - else \ - skip=`expr $$skip + 1`; \ - echo "SKIP: $$tst"; \ - fi; \ - done; \ - if test "$$failed" -eq 0; then \ - if test "$$xfail" -eq 0; then \ - banner="All $$all tests passed"; \ - else \ - banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ - fi; \ - else \ - if test "$$xpass" -eq 0; then \ - banner="$$failed of $$all tests failed"; \ - else \ - banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ - fi; \ - fi; \ - dashes="$$banner"; \ - skipped=""; \ - if test "$$skip" -ne 0; then \ - skipped="($$skip tests were not run)"; \ - test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ - dashes="$$skipped"; \ - fi; \ - report=""; \ - if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ - report="Please report to $(PACKAGE_BUGREPORT)"; \ - test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ - dashes="$$report"; \ - fi; \ - dashes=`echo "$$dashes" | sed s/./=/g`; \ - echo "$$dashes"; \ - echo "$$banner"; \ - test -z "$$skipped" || echo "$$skipped"; \ - test -z "$$report" || echo "$$report"; \ - echo "$$dashes"; \ - test "$$failed" -eq 0; \ - else :; fi - distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @@ -362,21 +407,38 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + distdir) \ + || exit 1; \ + fi; \ + done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) - $(MAKE) $(AM_MAKEFLAGS) check-TESTS -check: check-am +check: check-recursive all-am: Makefile -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -installcheck: installcheck-am +installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ @@ -392,78 +454,83 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -clean: clean-am +clean: clean-recursive clean-am: clean-checkPROGRAMS clean-generic mostlyclean-am -distclean: distclean-am +distclean: distclean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags -dvi: dvi-am +dvi: dvi-recursive dvi-am: -html: html-am +html: html-recursive -info: info-am +info: info-recursive info-am: install-data-am: -install-dvi: install-dvi-am +install-dvi: install-dvi-recursive install-exec-am: -install-html: install-html-am +install-html: install-html-recursive -install-info: install-info-am +install-info: install-info-recursive install-man: -install-pdf: install-pdf-am +install-pdf: install-pdf-recursive -install-ps: install-ps-am +install-ps: install-ps-recursive installcheck-am: -maintainer-clean: maintainer-clean-am +maintainer-clean: maintainer-clean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic -mostlyclean: mostlyclean-am +mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic -pdf: pdf-am +pdf: pdf-recursive pdf-am: -ps: ps-am +ps: ps-recursive ps-am: uninstall-am: -.MAKE: install-am install-strip +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip -.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ - clean-checkPROGRAMS clean-generic ctags distclean \ +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-checkPROGRAMS \ + clean-generic ctags ctags-recursive distclean \ distclean-compile distclean-generic distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ - uninstall-am + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ + tags tags-recursive uninstall uninstall-am + +@HAVE_ATF_TRUE@check: $(ATF_TESTS) +@HAVE_ATF_TRUE@ atf-run | atf-report # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/external/bsd/dhcp/dist/common/tests/test_alloc.c b/external/bsd/dhcp/dist/common/tests/test_alloc.c index 47fe4b6754d0..c6b51c4b15fd 100644 --- a/external/bsd/dhcp/dist/common/tests/test_alloc.c +++ b/external/bsd/dhcp/dist/common/tests/test_alloc.c @@ -1,7 +1,9 @@ -/* $NetBSD: test_alloc.c,v 1.1.1.1 2013/03/24 15:45:55 christos Exp $ */ +/* $NetBSD: test_alloc.c,v 1.1.1.2 2013/03/24 22:50:33 christos Exp $ */ /* - * We test the functions provided in alloc.c here. These are very + * Copyright (c) 2007,2009,2012 by Internet Systems Consortium, Inc. ("ISC") + * + * We test the functions provided in alloc.c here. These are very * basic functions, and it is very important that they work correctly. * * You can see two different styles of testing: @@ -18,482 +20,384 @@ * tests, and less duplicated and extra code. The advantage of having * a separate test is that each test is simpler. Plus if you need to * allow certain tests to fail for some reason (known bugs that are - * hard to fix for example), then + * hard to fix for example), then */ -/* TODO: dmalloc() test */ +/** @TODO: dmalloc() test */ #include "config.h" -#include "t_api.h" - +#include #include "dhcpd.h" -static void test_buffer_allocate(void); -static void test_buffer_reference(void); -static void test_buffer_dereference(void); -static void test_data_string_forget(void); -static void test_data_string_forget_nobuf(void); -static void test_data_string_copy(void); -static void test_data_string_copy_nobuf(void); +ATF_TC(buffer_allocate); -/* - * T_testlist is a list of tests that are invoked. - */ -testspec_t T_testlist[] = { - { test_buffer_allocate, - "buffer_allocate()" }, - { test_buffer_reference, - "buffer_reference()" }, - { test_buffer_dereference, - "buffer_dereference()" }, - { test_data_string_forget, - "data_string_forget()" }, - { test_data_string_forget_nobuf, - "data_string_forget(), no buffer" }, - { test_data_string_copy, - "data_string_copy()" }, - { test_data_string_copy_nobuf, - "data_string_copy(), no buffer" }, - { NULL, NULL } -}; - -static void -test_buffer_allocate(void) { - static const char *test_desc = - "buffer_allocate basic test"; - - struct buffer *buf; - - t_assert("buffer_allocate", 1, T_REQUIRED, "%s", test_desc); - - /* - * Check a 0-length buffer. - */ - buf = NULL; - if (!buffer_allocate(&buf, 0, MDL)) { - t_info("failed on 0-len buffer\n"); - t_result(T_FAIL); - return; - } - if (!buffer_dereference(&buf, MDL)) { - t_info("buffer_dereference() failed\n"); - t_result(T_FAIL); - return; - } - if (buf != NULL) { - t_info("buffer_dereference() did not NULL-out buffer\n"); - t_result(T_FAIL); - return; - } - - /* - * Check an actual buffer. - */ - buf = NULL; - if (!buffer_allocate(&buf, 100, MDL)) { - t_info("failed on allocate\n"); - t_result(T_FAIL); - return; - } - if (!buffer_dereference(&buf, MDL)) { - t_info("buffer_dereference() failed\n"); - t_result(T_FAIL); - return; - } - if (buf != NULL) { - t_info("buffer_dereference() did not NULL-out buffer\n"); - t_result(T_FAIL); - return; - } - - /* - * Okay, we're happy. - */ - t_result(T_PASS); +ATF_TC_HEAD(buffer_allocate, tc) { + atf_tc_set_md_var(tc, "descr", "buffer_allocate basic test"); } -static void -test_buffer_reference(void) { - static const char *test_desc = - "buffer_reference basic test"; - int result = T_PASS; +ATF_TC_BODY(buffer_allocate, tc) { + struct buffer *buf = 0; - struct buffer *a, *b; + /* + * Check a 0-length buffer. + */ + buf = NULL; + if (!buffer_allocate(&buf, 0, MDL)) { + atf_tc_fail("failed on 0-len buffer"); + } + if (!buffer_dereference(&buf, MDL)) { + atf_tc_fail("buffer_dereference() failed"); + } + if (buf != NULL) { + atf_tc_fail("buffer_dereference() did not NULL-out buffer"); + } - t_assert("buffer_reference", 1, T_REQUIRED, "%s", test_desc); + /* + * Check an actual buffer. + */ + buf = NULL; + if (!buffer_allocate(&buf, 100, MDL)) { + atf_tc_fail("failed on allocate 100 bytes\n"); + } + if (!buffer_dereference(&buf, MDL)) { + atf_tc_fail("buffer_dereference() failed"); + } + if (buf != NULL) { + atf_tc_fail("buffer_dereference() did not NULL-out buffer"); + } - /* - * Create a buffer. - */ - a = NULL; - if (!buffer_allocate(&a, 100, MDL)) { - t_info("failed on allocate\n"); - t_result(T_FAIL); - return; - } - - /* - * Confirm buffer_reference() doesn't work if we pass in NULL. - * - * TODO: we should confirm we get an error message here. - */ - if (buffer_reference(NULL, a, MDL)) { - t_info("succeeded on an error input\n"); - t_result(T_FAIL); - return; - } - - /* - * TODO: we should confirm we get an error message if we pass - * a non-NULL target. - */ - - /* - * Confirm we work under normal circumstances. - */ - b = NULL; - if (!buffer_reference(&b, a, MDL)) { - t_info("buffer_reference() failed\n"); - t_result(T_FAIL); - return; - } - - if (b != a) { - t_info("incorrect pointer\n"); - result = T_FAIL; - } - if (b->refcnt != 2) { - t_info("incorrect refcnt\n"); - result = T_FAIL; - } - - /* - * Clean up. - */ - if (!buffer_dereference(&b, MDL)) { - t_info("buffer_dereference() failed\n"); - t_result(T_FAIL); - return; - } - if (!buffer_dereference(&a, MDL)) { - t_info("buffer_dereference() failed\n"); - t_result(T_FAIL); - return; - } - - t_result(result); + /* + * Okay, we're happy. + */ + atf_tc_pass(); } -static void -test_buffer_dereference(void) { - static const char *test_desc = - "buffer_dereference basic test"; +ATF_TC(buffer_reference); - struct buffer *a, *b; - - t_assert("buffer_dereference", 1, T_REQUIRED, "%s", test_desc); - - /* - * Confirm buffer_dereference() doesn't work if we pass in NULL. - * - * TODO: we should confirm we get an error message here. - */ - if (buffer_dereference(NULL, MDL)) { - t_info("succeeded on an error input\n"); - t_result(T_FAIL); - return; - } - - /* - * Confirm buffer_dereference() doesn't work if we pass in - * a pointer to NULL. - * - * TODO: we should confirm we get an error message here. - */ - a = NULL; - if (buffer_dereference(&a, MDL)) { - t_info("succeeded on an error input\n"); - t_result(T_FAIL); - return; - } - - /* - * Confirm we work under normal circumstances. - */ - a = NULL; - if (!buffer_allocate(&a, 100, MDL)) { - t_info("failed on allocate\n"); - t_result(T_FAIL); - return; - } - if (!buffer_dereference(&a, MDL)) { - t_info("buffer_dereference() failed\n"); - t_result(T_FAIL); - return; - } - if (a != NULL) { - t_info("non-null buffer after buffer_dereference()\n"); - t_result(T_FAIL); - return; - } - - /* - * Confirm we get an error from negative refcnt. - * - * TODO: we should confirm we get an error message here. - */ - a = NULL; - if (!buffer_allocate(&a, 100, MDL)) { - t_info("failed on allocate\n"); - t_result(T_FAIL); - return; - } - b = NULL; - if (!buffer_reference(&b, a, MDL)) { - t_info("buffer_reference() failed\n"); - t_result(T_FAIL); - return; - } - a->refcnt = 0; /* purposely set to invalid value */ - if (buffer_dereference(&a, MDL)) { - t_info("buffer_dereference() succeeded on error input\n"); - t_result(T_FAIL); - return; - } - a->refcnt = 2; - if (!buffer_dereference(&b, MDL)) { - t_info("buffer_dereference() failed\n"); - t_result(T_FAIL); - return; - } - if (!buffer_dereference(&a, MDL)) { - t_info("buffer_dereference() failed\n"); - t_result(T_FAIL); - return; - } - - t_result(T_PASS); +ATF_TC_HEAD(buffer_reference, tc) { + atf_tc_set_md_var(tc, "descr", "buffer_reference basic test"); } -static void -test_data_string_forget(void) { - static const char *test_desc = - "data_string_forget basic test"; - int result = T_PASS; +ATF_TC_BODY(buffer_reference, tc) { - struct buffer *buf; - struct data_string a; - const char *str = "Lorem ipsum dolor sit amet turpis duis."; + struct buffer *a, *b; - t_assert("data_string_forget", 1, T_REQUIRED, "%s", test_desc); + /* + * Create a buffer. + */ + a = NULL; + if (!buffer_allocate(&a, 100, MDL)) { + atf_tc_fail("failed on allocate 100 bytes"); + } - /* - * Create the string we want to forget. - */ - memset(&a, 0, sizeof(a)); - a.len = strlen(str); - buf = NULL; - if (!buffer_allocate(&buf, a.len, MDL)) { - t_info("out of memory\n"); - t_result(T_FAIL); - return; - } - if (!buffer_reference(&a.buffer, buf, MDL)) { - t_info("buffer_reference() failed\n"); - t_result(T_FAIL); - return; - } - a.data = a.buffer->data; - memcpy(a.buffer->data, str, a.len); + /** + * Confirm buffer_reference() doesn't work if we pass in NULL. + * + * @TODO: we should confirm we get an error message here. + */ + if (buffer_reference(NULL, a, MDL)) { + atf_tc_fail("succeeded on an error input"); + } - /* - * Forget and confirm we've forgotten. - */ - data_string_forget(&a, MDL); + /** + * @TODO: we should confirm we get an error message if we pass + * a non-NULL target. + */ - if (a.len != 0) { - t_info("incorrect length\n"); - result = T_FAIL; - } - if (a.data != NULL) { - t_info("incorrect data\n"); - result = T_FAIL; - } - if (a.terminated) { - t_info("incorrect terminated\n"); - result = T_FAIL; - } - if (a.buffer != NULL) { - t_info("incorrect buffer\n"); - result = T_FAIL; - } - if (buf->refcnt != 1) { - t_info("too many references to buf\n"); - result = T_FAIL; - } + /* + * Confirm we work under normal circumstances. + */ + b = NULL; + if (!buffer_reference(&b, a, MDL)) { + atf_tc_fail("buffer_reference() failed"); + } - /* - * Clean up buffer. - */ - if (!buffer_dereference(&buf, MDL)) { - t_info("buffer_reference() failed\n"); - t_result(T_FAIL); - return; - } + if (b != a) { + atf_tc_fail("incorrect pointer returned"); + } + + if (b->refcnt != 2) { + atf_tc_fail("incorrect refcnt"); + } + + /* + * Clean up. + */ + if (!buffer_dereference(&b, MDL)) { + atf_tc_fail("buffer_dereference() failed"); + } + if (!buffer_dereference(&a, MDL)) { + atf_tc_fail("buffer_dereference() failed"); + } - t_result(result); } -static void -test_data_string_forget_nobuf(void) { - static const char *test_desc = - "data_string_forget test, data_string without buffer"; - int result = T_PASS; - struct data_string a; - const char *str = "Lorem ipsum dolor sit amet massa nunc."; +ATF_TC(buffer_dereference); - t_assert("data_string_forget, no buffer", 1, T_REQUIRED, "%s", test_desc); - - /* - * Create the string we want to forget. - */ - memset(&a, 0, sizeof(a)); - a.len = strlen(str); - a.data = (const unsigned char *)str; - a.terminated = 1; - - /* - * Forget and confirm we've forgotten. - */ - data_string_forget(&a, MDL); - - if (a.len != 0) { - t_info("incorrect length\n"); - result = T_FAIL; - } - if (a.data != NULL) { - t_info("incorrect data\n"); - result = T_FAIL; - } - if (a.terminated) { - t_info("incorrect terminated\n"); - result = T_FAIL; - } - if (a.buffer != NULL) { - t_info("incorrect buffer\n"); - result = T_FAIL; - } - - t_result(result); +ATF_TC_HEAD(buffer_dereference, tc) { + atf_tc_set_md_var(tc, "descr", "buffer_dereference basic test"); } -static void -test_data_string_copy(void) { - static const char *test_desc = - "data_string_copy basic test"; - int result = T_PASS; +ATF_TC_BODY(buffer_dereference, tc) { + struct buffer *a, *b; - struct data_string a, b; - const char *str = "Lorem ipsum dolor sit amet orci aliquam."; + /** + * Confirm buffer_dereference() doesn't work if we pass in NULL. + * + * TODO: we should confirm we get an error message here. + */ + if (buffer_dereference(NULL, MDL)) { + atf_tc_fail("succeeded on an error input"); + } - t_assert("data_string_copy", 1, T_REQUIRED, "%s", test_desc); + /** + * Confirm buffer_dereference() doesn't work if we pass in + * a pointer to NULL. + * + * @TODO: we should confirm we get an error message here. + */ + a = NULL; + if (buffer_dereference(&a, MDL)) { + atf_tc_fail("succeeded on an error input"); + } + /* + * Confirm we work under normal circumstances. + */ + a = NULL; + if (!buffer_allocate(&a, 100, MDL)) { + atf_tc_fail("failed on allocate"); + } + if (!buffer_dereference(&a, MDL)) { + atf_tc_fail("buffer_dereference() failed"); + } + if (a != NULL) { + atf_tc_fail("non-null buffer after buffer_dereference()"); + } - /* - * Create the string we want to copy. - */ - memset(&a, 0, sizeof(a)); - a.len = strlen(str); - if (!buffer_allocate(&a.buffer, a.len, MDL)) { - t_info("out of memory\n"); - t_result(T_FAIL); - return; - } - a.data = a.buffer->data; - memcpy(a.buffer->data, str, a.len); - - /* - * Copy the string, and confirm it works. - */ - memset(&b, 0, sizeof(b)); - data_string_copy(&b, &a, MDL); - - if (b.len != a.len) { - t_info("incorrect length\n"); - result = T_FAIL; - } - if (b.data != a.data) { - t_info("incorrect data\n"); - result = T_FAIL; - } - if (b.terminated != a.terminated) { - t_info("incorrect terminated\n"); - result = T_FAIL; - } - if (b.buffer != a.buffer) { - t_info("incorrect buffer\n"); - result = T_FAIL; - } - - /* - * Clean up. - */ - data_string_forget(&b, MDL); - data_string_forget(&a, MDL); - - t_result(result); + /** + * Confirm we get an error from negative refcnt. + * + * @TODO: we should confirm we get an error message here. + */ + a = NULL; + if (!buffer_allocate(&a, 100, MDL)) { + atf_tc_fail("failed on allocate"); + } + b = NULL; + if (!buffer_reference(&b, a, MDL)) { + atf_tc_fail("buffer_reference() failed"); + } + a->refcnt = 0; /* purposely set to invalid value */ + if (buffer_dereference(&a, MDL)) { + atf_tc_fail("buffer_dereference() succeeded on error input"); + } + a->refcnt = 2; + if (!buffer_dereference(&b, MDL)) { + atf_tc_fail("buffer_dereference() failed"); + } + if (!buffer_dereference(&a, MDL)) { + atf_tc_fail("buffer_dereference() failed"); + } } -static void -test_data_string_copy_nobuf(void) { - static const char *test_desc = - "data_string_copy test, data_string without buffer"; - int result = T_PASS; +ATF_TC(data_string_forget); - struct data_string a, b; - const char *str = "Lorem ipsum dolor sit amet cras amet."; - - t_assert("data_string_copy, no buffer", 1, T_REQUIRED, "%s", - test_desc); - - - /* - * Create the string we want to copy. - */ - memset(&a, 0, sizeof(a)); - a.len = strlen(str); - a.data = (const unsigned char *)str; - a.terminated = 1; - - /* - * Copy the string, and confirm it works. - */ - memset(&b, 0, sizeof(b)); - data_string_copy(&b, &a, MDL); - - if (b.len != a.len) { - t_info("incorrect length\n"); - result = T_FAIL; - } - if (b.data != a.data) { - t_info("incorrect data\n"); - result = T_FAIL; - } - if (b.terminated != a.terminated) { - t_info("incorrect terminated\n"); - result = T_FAIL; - } - if (b.buffer != a.buffer) { - t_info("incorrect buffer\n"); - result = T_FAIL; - } - - /* - * Clean up. - */ - data_string_forget(&b, MDL); - data_string_forget(&a, MDL); - - t_result(result); +ATF_TC_HEAD(data_string_forget, tc) { + atf_tc_set_md_var(tc, "descr", "data_string_forget basic test"); +} + +ATF_TC_BODY(data_string_forget, tc) { + struct buffer *buf; + struct data_string a; + const char *str = "Lorem ipsum dolor sit amet turpis duis."; + + /* + * Create the string we want to forget. + */ + memset(&a, 0, sizeof(a)); + a.len = strlen(str); + buf = NULL; + if (!buffer_allocate(&buf, a.len, MDL)) { + atf_tc_fail("out of memory"); + } + if (!buffer_reference(&a.buffer, buf, MDL)) { + atf_tc_fail("buffer_reference() failed"); + } + a.data = a.buffer->data; + memcpy(a.buffer->data, str, a.len); + + /* + * Forget and confirm we've forgotten. + */ + data_string_forget(&a, MDL); + + if (a.len != 0) { + atf_tc_fail("incorrect length"); + } + + if (a.data != NULL) { + atf_tc_fail("incorrect data"); + } + if (a.terminated) { + atf_tc_fail("incorrect terminated"); + } + if (a.buffer != NULL) { + atf_tc_fail("incorrect buffer"); + } + if (buf->refcnt != 1) { + atf_tc_fail("too many references to buf"); + } + + /* + * Clean up buffer. + */ + if (!buffer_dereference(&buf, MDL)) { + atf_tc_fail("buffer_reference() failed"); + } +} + +ATF_TC(data_string_forget_nobuf); + +ATF_TC_HEAD(data_string_forget_nobuf, tc) { + atf_tc_set_md_var(tc, "descr", "data_string_forget test, " + "data_string without buffer"); +} + +ATF_TC_BODY(data_string_forget_nobuf, tc) { + struct data_string a; + const char *str = "Lorem ipsum dolor sit amet massa nunc."; + + /* + * Create the string we want to forget. + */ + memset(&a, 0, sizeof(a)); + a.len = strlen(str); + a.data = (const unsigned char *)str; + a.terminated = 1; + + /* + * Forget and confirm we've forgotten. + */ + data_string_forget(&a, MDL); + + if (a.len != 0) { + atf_tc_fail("incorrect length"); + } + if (a.data != NULL) { + atf_tc_fail("incorrect data"); + } + if (a.terminated) { + atf_tc_fail("incorrect terminated"); + } + if (a.buffer != NULL) { + atf_tc_fail("incorrect buffer"); + } +} + +ATF_TC(data_string_copy); + +ATF_TC_HEAD(data_string_copy, tc) { + atf_tc_set_md_var(tc, "descr", "data_string_copy basic test"); +} + +ATF_TC_BODY(data_string_copy, tc) { + struct data_string a, b; + const char *str = "Lorem ipsum dolor sit amet orci aliquam."; + + /* + * Create the string we want to copy. + */ + memset(&a, 0, sizeof(a)); + a.len = strlen(str); + if (!buffer_allocate(&a.buffer, a.len, MDL)) { + atf_tc_fail("out of memory"); + } + a.data = a.buffer->data; + memcpy(a.buffer->data, str, a.len); + + /* + * Copy the string, and confirm it works. + */ + memset(&b, 0, sizeof(b)); + data_string_copy(&b, &a, MDL); + + if (b.len != a.len) { + atf_tc_fail("incorrect length"); + } + if (b.data != a.data) { + atf_tc_fail("incorrect data"); + } + if (b.terminated != a.terminated) { + atf_tc_fail("incorrect terminated"); + } + if (b.buffer != a.buffer) { + atf_tc_fail("incorrect buffer"); + } + + /* + * Clean up. + */ + data_string_forget(&b, MDL); + data_string_forget(&a, MDL); +} + +ATF_TC(data_string_copy_nobuf); + +ATF_TC_HEAD(data_string_copy_nobuf, tc) { + atf_tc_set_md_var(tc, "descr", "data_string_copy test, " + "data_string without buffer"); +} + +ATF_TC_BODY(data_string_copy_nobuf, tc) { + struct data_string a, b; + const char *str = "Lorem ipsum dolor sit amet cras amet."; + + /* + * Create the string we want to copy. + */ + memset(&a, 0, sizeof(a)); + a.len = strlen(str); + a.data = (const unsigned char *)str; + a.terminated = 1; + + /* + * Copy the string, and confirm it works. + */ + memset(&b, 0, sizeof(b)); + data_string_copy(&b, &a, MDL); + + if (b.len != a.len) { + atf_tc_fail("incorrect length"); + } + if (b.data != a.data) { + atf_tc_fail("incorrect data"); + } + if (b.terminated != a.terminated) { + atf_tc_fail("incorrect terminated"); + } + if (b.buffer != a.buffer) { + atf_tc_fail("incorrect buffer"); + } + + /* + * Clean up. + */ + data_string_forget(&b, MDL); + data_string_forget(&a, MDL); + +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, buffer_allocate); + ATF_TP_ADD_TC(tp, buffer_reference); + ATF_TP_ADD_TC(tp, buffer_dereference); + ATF_TP_ADD_TC(tp, data_string_forget); + ATF_TP_ADD_TC(tp, data_string_forget_nobuf); + ATF_TP_ADD_TC(tp, data_string_copy); + ATF_TP_ADD_TC(tp, data_string_copy_nobuf); + + return (atf_no_error()); } diff --git a/external/bsd/dhcp/dist/common/tree.c b/external/bsd/dhcp/dist/common/tree.c index 3df435752b9f..73347ef335b9 100644 --- a/external/bsd/dhcp/dist/common/tree.c +++ b/external/bsd/dhcp/dist/common/tree.c @@ -1,11 +1,11 @@ -/* $NetBSD: tree.c,v 1.1.1.1 2013/03/24 15:45:55 christos Exp $ */ +/* $NetBSD: tree.c,v 1.1.1.2 2013/03/24 22:50:33 christos Exp $ */ /* tree.c Routines for manipulating parse trees... */ /* - * Copyright (c) 2011 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2011-2012 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2007,2009 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1995-2003 by Internet Software Consortium * @@ -36,7 +36,7 @@ */ #include -__RCSID("$NetBSD: tree.c,v 1.1.1.1 2013/03/24 15:45:55 christos Exp $"); +__RCSID("$NetBSD: tree.c,v 1.1.1.2 2013/03/24 22:50:33 christos Exp $"); #include "dhcpd.h" #include @@ -1125,6 +1125,7 @@ int evaluate_boolean_expression (result, packet, lease, client_state, *result = 0; memset(&re, 0, sizeof(re)); if (bleft && bright && + (left.data != NULL) && (right.data != NULL) && (regcomp(&re, (char *)right.data, regflags) == 0) && (regexec(&re, (char *)left.data, (size_t)0, NULL, 0) == 0)) *result = 1; @@ -1216,17 +1217,15 @@ int evaluate_boolean_expression (result, packet, lease, client_state, return 0; case expr_not: - sleft = evaluate_boolean_expression (&bleft, packet, lease, - client_state, - in_options, cfg_options, - scope, - expr -> data.not); + sleft = evaluate_boolean_expression(&bleft, packet, lease, + client_state, + in_options, cfg_options, + scope, + expr->data.not); #if defined (DEBUG_EXPRESSIONS) - log_debug ("bool: not (%s) = %s", - sleft ? (bleft ? "true" : "false") : "NULL", - ((sleft && sright) - ? (!bleft ? "true" : "false") : "NULL")); - + log_debug("bool: not (%s) = %s", + sleft ? (bleft ? "true" : "false") : "NULL", + sleft ? (!bleft ? "true" : "false") : "NULL"); #endif if (sleft) { *result = !bleft; @@ -2413,6 +2412,7 @@ int evaluate_numeric_expression (result, packet, lease, client_state, struct binding *binding; struct binding_value *bv; unsigned long ileft, iright; + int rc = 0; switch (expr -> op) { case expr_check: @@ -2477,36 +2477,48 @@ int evaluate_numeric_expression (result, packet, lease, client_state, return status; case expr_extract_int16: - memset (&data, 0, sizeof data); + memset(&data, 0, sizeof(data)); status = (evaluate_data_expression (&data, packet, lease, client_state, in_options, - cfg_options, scope, expr -> data.extract_int, MDL)); - if (status && data.len >= 2) - *result = getUShort (data.data); + cfg_options, scope, expr->data.extract_int, MDL)); + if (status && data.len >= 2) { + *result = getUShort(data.data); + rc = 1; + } #if defined (DEBUG_EXPRESSIONS) - log_debug ("num: extract_int16 (%s) = %ld", - ((status && data.len >= 2) ? - print_hex_1 (data.len, data.data, 60) : "NULL"), - *result); + if (rc == 1) { + log_debug("num: extract_int16 (%s) = %ld", + print_hex_1(data.len, data.data, 60), + *result); + } else { + log_debug("num: extract_int16 (NULL) = NULL"); + } #endif - if (status) data_string_forget (&data, MDL); - return (status && data.len >= 2); + if (status) + data_string_forget(&data, MDL); + + return (rc); case expr_extract_int32: memset (&data, 0, sizeof data); status = (evaluate_data_expression (&data, packet, lease, client_state, in_options, cfg_options, scope, expr -> data.extract_int, MDL)); - if (status && data.len >= 4) + if (status && data.len >= 4) { *result = getULong (data.data); + rc = 1; + } #if defined (DEBUG_EXPRESSIONS) - log_debug ("num: extract_int32 (%s) = %ld", - ((status && data.len >= 4) ? - print_hex_1 (data.len, data.data, 60) : "NULL"), - *result); + if (rc == 1) { + log_debug ("num: extract_int32 (%s) = %ld", + print_hex_1 (data.len, data.data, 60), + *result); + } else { + log_debug ("num: extract_int32 (NULL) = NULL"); + } #endif if (status) data_string_forget (&data, MDL); - return (status && data.len >= 4); + return (rc); case expr_const_int: *result = expr -> data.const_int; @@ -2517,22 +2529,22 @@ int evaluate_numeric_expression (result, packet, lease, client_state, case expr_lease_time: if (!lease) { - log_error ("data: leased_lease: not available"); - return 0; + log_error("data: leased_lease: not available"); + return (0); } - if (lease -> ends < cur_time) { - log_error ("%s %lu when it is now %lu", - "data: lease_time: lease ends at", - (long)(lease -> ends), (long)cur_time); - return 0; + if (lease->ends < cur_time) { + log_error("%s %lu when it is now %lu", + "data: lease_time: lease ends at", + (long)(lease->ends), (long)cur_time); + return (0); } - *result = lease -> ends - cur_time; + *result = lease->ends - cur_time; #if defined (DEBUG_EXPRESSIONS) - log_debug ("number: lease-time = (%lu - %lu) = %ld", - lease -> ends, - cur_time, *result); + log_debug("number: lease-time = (%lu - %lu) = %ld", + (long unsigned)lease->ends, + (long unsigned)cur_time, *result); #endif - return 1; + return (1); case expr_dns_transaction: #if !defined (NSUPDATE_OLD) @@ -2895,10 +2907,17 @@ int evaluate_numeric_expression (result, packet, lease, client_state, return 0; } -/* Return data hanging off of an option cache structure, or if there - isn't any, evaluate the expression hanging off of it and return the - result of that evaluation. There should never be both an expression - and a valid data_string. */ +/* + * Return data hanging off of an option cache structure, or if there + * isn't any, evaluate the expression hanging off of it and return the + * result of that evaluation. There should never be both an expression + * and a valid data_string. + * + * returns 0 if there wasn't an expression or it couldn't be evaluated + * returns non-zero if there was an expression or string that was evaluated + * When it returns zero the arguements, in particualr resutl, should not + * be modified + */ int evaluate_option_cache (result, packet, lease, client_state, in_options, cfg_options, scope, oc, file, line) @@ -3606,6 +3625,7 @@ int write_expression (file, expr, col, indent, firstp) col = write_expression (file, expr -> data.suffix.len, col, scol, 0); col = token_print_indent (file, col, indent, "", "", ")"); + break; case expr_lcase: col = token_print_indent(file, col, indent, "", "", "lcase"); @@ -4141,19 +4161,10 @@ int fundef_dereference (ptr, file, line) const char *file; int line; { - struct fundef *bp = *ptr; + struct fundef *bp; struct string_list *sp, *next; - if (!ptr) { - log_error ("%s(%d): null pointer", file, line); -#if defined (POINTER_DEBUG) - abort (); -#else - return 0; -#endif - } - - if (!bp) { + if ((ptr == NULL) || (*ptr == NULL)) { log_error ("%s(%d): null pointer", file, line); #if defined (POINTER_DEBUG) abort (); @@ -4162,6 +4173,7 @@ int fundef_dereference (ptr, file, line) #endif } + bp = *ptr; bp -> refcnt--; rc_register (file, line, ptr, bp, bp -> refcnt, 1, RC_MISC); if (bp -> refcnt < 0) { @@ -4433,11 +4445,11 @@ int find_bound_string (struct data_string *value, if (binding -> value -> value.data.terminated) { data_string_copy (value, &binding -> value -> value.data, MDL); } else { - buffer_allocate (&value -> buffer, - binding -> value -> value.data.len, - MDL); - if (!value -> buffer) + if (buffer_allocate (&value->buffer, + binding->value->value.data.len, + MDL) == 0) { return 0; + } memcpy (value -> buffer -> data, binding -> value -> value.data.data, diff --git a/external/bsd/dhcp/dist/configure b/external/bsd/dhcp/dist/configure index af937a2fcc50..cda54e83e96d 100755 --- a/external/bsd/dhcp/dist/configure +++ b/external/bsd/dhcp/dist/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61 for DHCP 4.2.3. +# Generated by GNU Autoconf 2.61 for DHCP 4.2.5. # # Report bugs to . # @@ -574,8 +574,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='DHCP' PACKAGE_TARNAME='dhcp' -PACKAGE_VERSION='4.2.3' -PACKAGE_STRING='DHCP 4.2.3' +PACKAGE_VERSION='4.2.5' +PACKAGE_STRING='DHCP 4.2.5' PACKAGE_BUGREPORT='dhcp-users@isc.org' # Factoring default headers for most tests. @@ -697,6 +697,10 @@ GREP EGREP RANLIB byte_order +ATF_CFLAGS +ATF_LDFLAGS +HAVE_ATF_TRUE +HAVE_ATF_FALSE ac_prefix_program LDAP_CFLAGS LIBOBJS @@ -1213,7 +1217,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures DHCP 4.2.3 to adapt to many kinds of systems. +\`configure' configures DHCP 4.2.5 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1279,7 +1283,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of DHCP 4.2.3:";; + short | recursive ) echo "Configuration of DHCP 4.2.5:";; esac cat <<\_ACEOF @@ -1305,10 +1309,13 @@ Optional Features: --enable-ipv4-pktinfo enable use of pktinfo on IPv4 sockets (default is no) --enable-use-sockets use the standard BSD socket API (default is no) + --enable-secs-byteorder Correct bad byteorders in the secs field (default is + no). Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-atf=PATH specify location where atf was installed --with-srv-lease-file=PATH File for dhcpd leases (default is LOCALSTATEDIR/db/dhcpd.leases) @@ -1419,7 +1426,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -DHCP configure 4.2.3 +DHCP configure 4.2.5 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1433,7 +1440,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by DHCP $as_me 4.2.3, which was +It was created by DHCP $as_me 4.2.5, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -2126,7 +2133,7 @@ fi # Define the identity of the package. PACKAGE='dhcp' - VERSION='4.2.3' + VERSION='4.2.5' cat >>confdefs.h <<_ACEOF @@ -4659,7 +4666,9 @@ _ACEOF # Optional compile-time DEBUGging. # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then - enableval=$enable_debug; + enableval=$enable_debug; enable_debug=yes +else + enable_debug=no fi # This is very much off by default. @@ -4799,9 +4808,9 @@ _ACEOF fi -# Check whether --enable-IPv4_PKTINFO was given. -if test "${enable_IPv4_PKTINFO+set}" = set; then - enableval=$enable_IPv4_PKTINFO; +# Check whether --enable-ipv4_pktinfo was given. +if test "${enable_ipv4_pktinfo+set}" = set; then + enableval=$enable_ipv4_pktinfo; fi @@ -4813,9 +4822,9 @@ _ACEOF fi -# Check whether --enable-USE_SOCKETS was given. -if test "${enable_USE_SOCKETS+set}" = set; then - enableval=$enable_USE_SOCKETS; +# Check whether --enable-use_sockets was given. +if test "${enable_use_sockets+set}" = set; then + enableval=$enable_use_sockets; fi @@ -4827,6 +4836,71 @@ _ACEOF fi +# Try to hnadle incorrect byte order for secs field +# This is off by default +# Check whether --enable-secs_byteorder was given. +if test "${enable_secs_byteorder+set}" = set; then + enableval=$enable_secs_byteorder; +fi + + +if test "$enable_secs_byteorder" = "yes" ; then + +cat >>confdefs.h <<\_ACEOF +#define SECS_BYTEORDER 1 +_ACEOF + +fi + +# Testing section + +atf_path="no" + +# Check whether --with-atf was given. +if test "${with_atf+set}" = set; then + withval=$with_atf; atf_path="$withval" +fi + +if test "$atf_path" != "no" ; then + # Config path for pkg-config + atf_pcp="" + if test "$atf_path" != "yes" ; then + if test -f $atf_path/lib/pkgconfig/atf-c.pc ; then + atf_pcp=$atf_path/lib/pkgconfig + fi + else + # Not specified, try some common paths + atf_dirs="/usr /usr/local /usr/pkg /opt /opt/local" + for d in $atf_dirs + do + if test -f $d/lib/pkgconfig/atf-c.pc ; then + atf_pcp=$d/lib/pkgconfig + fi + done + fi + if test "$atf_pcp" = "" ; then + { { echo "$as_me:$LINENO: error: Unable to find atf files in location specified" >&5 +echo "$as_me: error: Unable to find atf files in location specified" >&2;} + { (exit 1); exit 1; }; } + else + ATF_CFLAGS="`PKG_CONFIG_PATH=$atf_pcp pkg-config --cflags atf-c` -DUNIT_TEST" + ATF_LDFLAGS="`PKG_CONFIG_PATH=$atf_pcp pkg-config --libs atf-c`" + + + fi +fi + + if test "$atf_pcp" != ""; then + HAVE_ATF_TRUE= + HAVE_ATF_FALSE='#' +else + HAVE_ATF_TRUE='#' + HAVE_ATF_FALSE= +fi + +### Uncomment this once docs.lab.isc.org upgrades to automake 1.11 +### AM_COND_IF([HAVE_ATF], [AC_DEFINE([HAVE_ATF], [1], [ATF framework specified?])]) + ### ### Path fun. Older versions of DHCP were installed in /usr/sbin, so we ### need to look there and potentially overwrite by default (but not if @@ -6796,7 +6870,7 @@ fi then cat >>confdefs.h <<\_ACEOF -#define HAVE_BPF "" +#define HAVE_BPF 1 _ACEOF fi @@ -6974,6 +7048,65 @@ fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext +# +# check for GCC noreturn attribute +# +{ echo "$as_me:$LINENO: checking for GCC noreturn attribute" >&5 +echo $ECHO_N "checking for GCC noreturn attribute... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +void foo() __attribute__((noreturn)); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define ISC_DHCP_NORETURN __attribute__((noreturn)) +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define ISC_DHCP_NORETURN +_ACEOF + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + # Look for optional headers. @@ -8119,7 +8252,7 @@ _ACEOF -# Solaris does not have the msg_control or msg_controlen members in +# Solaris does not have the msg_control or msg_controlen members # in the msghdr structure unless you define: # # _XOPEN_SOURCE, _XOPEN_SOURCE_EXTENDED, and __EXTENSIONS__ @@ -8663,7 +8796,7 @@ _ACEOF fi -ac_config_files="$ac_config_files Makefile client/Makefile common/Makefile common/tests/Makefile dhcpctl/Makefile dst/Makefile includes/Makefile omapip/Makefile relay/Makefile server/Makefile tests/Makefile" +ac_config_files="$ac_config_files Makefile client/Makefile common/Makefile common/tests/Makefile dhcpctl/Makefile dst/Makefile includes/Makefile omapip/Makefile relay/Makefile server/Makefile tests/Makefile server/tests/Makefile doc/devel/doxyfile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -8782,6 +8915,13 @@ echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi +if test -z "${HAVE_ATF_TRUE}" && test -z "${HAVE_ATF_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"HAVE_ATF\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"HAVE_ATF\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files @@ -9082,7 +9222,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by DHCP $as_me 4.2.3, which was +This file was extended by DHCP $as_me 4.2.5, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -9135,7 +9275,7 @@ Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -DHCP config.status 4.2.3 +DHCP config.status 4.2.5 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" @@ -9262,6 +9402,8 @@ do "relay/Makefile") CONFIG_FILES="$CONFIG_FILES relay/Makefile" ;; "server/Makefile") CONFIG_FILES="$CONFIG_FILES server/Makefile" ;; "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; + "server/tests/Makefile") CONFIG_FILES="$CONFIG_FILES server/tests/Makefile" ;; + "doc/devel/doxyfile") CONFIG_FILES="$CONFIG_FILES doc/devel/doxyfile" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} @@ -9407,13 +9549,17 @@ GREP!$GREP$ac_delim EGREP!$EGREP$ac_delim RANLIB!$RANLIB$ac_delim byte_order!$byte_order$ac_delim +ATF_CFLAGS!$ATF_CFLAGS$ac_delim +ATF_LDFLAGS!$ATF_LDFLAGS$ac_delim +HAVE_ATF_TRUE!$HAVE_ATF_TRUE$ac_delim +HAVE_ATF_FALSE!$HAVE_ATF_FALSE$ac_delim ac_prefix_program!$ac_prefix_program$ac_delim LDAP_CFLAGS!$LDAP_CFLAGS$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 87; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 91; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 @@ -9976,3 +10122,42 @@ fi sh util/bindvar.sh + +cat > config.report << END + + ISC DHCP source configure results: + -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + +Package: + Name: $PACKAGE_NAME + Version: $PACKAGE_VERSION + +C Compiler: $CC + +Flags: + DEFS: $DEFS + CFLAGS: $CFLAGS + +Features: + debug: $enable_debug + failover: $enable_failover + execute: $enable_execute + +Developer: + ATF unittests : $atf_path + +END +# TODO: Add Perl system tests + +if test "$atf_path" != "no" +then +echo "ATF_CFLAGS : $ATF_CFLAGS" >> config.report +echo "ATF_LDFLAGS : $ATF_LDFLAGS" >> config.report +echo +fi + +cat config.report + +echo +echo Now you can type "make" to build ISC DHCP +echo diff --git a/external/bsd/dhcp/dist/configure.ac b/external/bsd/dhcp/dist/configure.ac index 3ed50de31cda..a1c42c1e3955 100644 --- a/external/bsd/dhcp/dist/configure.ac +++ b/external/bsd/dhcp/dist/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([DHCP], [4.2.3], [dhcp-users@isc.org]) +AC_INIT([DHCP], [4.2.5], [dhcp-users@isc.org]) # we specify "foreign" to avoid having to have the GNU mandated files, # like AUTHORS, COPYING, and such @@ -50,7 +50,8 @@ AC_DEFINE_UNQUOTED([DHCP_BYTE_ORDER], [$byte_order], # Optional compile-time DEBUGging. AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], - [create a debug-only version of the software (default is no).])) + [create a debug-only version of the software (default is no).]), + [enable_debug=yes],[enable_debug=no]) # This is very much off by default. if test "$enable_debug" = "yes" ; then AC_DEFINE([DEBUG], [1], @@ -150,7 +151,7 @@ if test "$enable_early_chroot" = "yes" ; then [Define to any value to chroot() prior to loading config.]) fi -AC_ARG_ENABLE(IPv4_PKTINFO, +AC_ARG_ENABLE(ipv4_pktinfo, AC_HELP_STRING([--enable-ipv4-pktinfo], [enable use of pktinfo on IPv4 sockets (default is no)])) @@ -159,7 +160,7 @@ if test "$enable_ipv4_pktinfo" = "yes"; then [Define to 1 to enable IPv4 packet info support.]) fi -AC_ARG_ENABLE(USE_SOCKETS, +AC_ARG_ENABLE(use_sockets, AC_HELP_STRING([--enable-use-sockets], [use the standard BSD socket API (default is no)])) @@ -168,6 +169,55 @@ if test "$enable_use_sockets" = "yes"; then [Define to 1 to use the standard BSD socket API.]) fi +# Try to hnadle incorrect byte order for secs field +# This is off by default +AC_ARG_ENABLE(secs_byteorder, + AC_HELP_STRING([--enable-secs-byteorder], + [Correct bad byteorders in the secs field (default is no).])) + +if test "$enable_secs_byteorder" = "yes" ; then + AC_DEFINE([SECS_BYTEORDER], [1], + [Define to correct bad byteorders in secs field.]) +fi + +# Testing section + +atf_path="no" +AC_ARG_WITH([atf], + AC_HELP_STRING([--with-atf=PATH], + [specify location where atf was installed]), + [atf_path="$withval"]) +if test "$atf_path" != "no" ; then + # Config path for pkg-config + atf_pcp="" + if test "$atf_path" != "yes" ; then + if test -f $atf_path/lib/pkgconfig/atf-c.pc ; then + atf_pcp=$atf_path/lib/pkgconfig + fi + else + # Not specified, try some common paths + atf_dirs="/usr /usr/local /usr/pkg /opt /opt/local" + for d in $atf_dirs + do + if test -f $d/lib/pkgconfig/atf-c.pc ; then + atf_pcp=$d/lib/pkgconfig + fi + done + fi + if test "$atf_pcp" = "" ; then + AC_MSG_ERROR([Unable to find atf files in location specified]) + else + ATF_CFLAGS="`PKG_CONFIG_PATH=$atf_pcp pkg-config --cflags atf-c` -DUNIT_TEST" + ATF_LDFLAGS="`PKG_CONFIG_PATH=$atf_pcp pkg-config --libs atf-c`" + AC_SUBST(ATF_CFLAGS) + AC_SUBST(ATF_LDFLAGS) + fi +fi + +AM_CONDITIONAL(HAVE_ATF, test "$atf_pcp" != "") +### Uncomment this once docs.lab.isc.org upgrades to automake 1.11 +### AM_COND_IF([HAVE_ATF], [AC_DEFINE([HAVE_ATF], [1], [ATF framework specified?])]) + ### ### Path fun. Older versions of DHCP were installed in /usr/sbin, so we ### need to look there and potentially overwrite by default (but not if @@ -403,7 +453,7 @@ else AC_CHECK_HEADER(net/bpf.h, DO_BPF=1) if test -n "$DO_BPF" then - AC_DEFINE([HAVE_BPF], [""], + AC_DEFINE([HAVE_BPF], [1], [Define to 1 to use the Berkeley Packet Filter interface code.]) fi @@ -453,6 +503,18 @@ AC_TRY_LINK( [Define to 1 if the system has 'struct if_laddrreq'.])], [AC_MSG_RESULT(no)]) +# +# check for GCC noreturn attribute +# +AC_MSG_CHECKING(for GCC noreturn attribute) +AC_TRY_COMPILE([],[void foo() __attribute__((noreturn));], + [AC_MSG_RESULT(yes) + AC_DEFINE([ISC_DHCP_NORETURN], [__attribute__((noreturn))], + [Define to the string for a noreturn attribute.])], + [AC_MSG_RESULT(no) + AC_DEFINE([ISC_DHCP_NORETURN], [], + [Define to the string for a noreturn attribute.])]) + # Look for optional headers. AC_CHECK_HEADERS(sys/socket.h net/if_dl.h net/if6.h regex.h) @@ -488,7 +550,7 @@ AC_CHECK_SIZEOF(struct iaddr *, , [ #include ]) -# Solaris does not have the msg_control or msg_controlen members in +# Solaris does not have the msg_control or msg_controlen members # in the msghdr structure unless you define: # # _XOPEN_SOURCE, _XOPEN_SOURCE_EXTENDED, and __EXTENSIONS__ @@ -585,6 +647,47 @@ AC_OUTPUT([ relay/Makefile server/Makefile tests/Makefile + server/tests/Makefile + doc/devel/doxyfile ]) sh util/bindvar.sh + +cat > config.report << END + + ISC DHCP source configure results: + -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + +Package: + Name: $PACKAGE_NAME + Version: $PACKAGE_VERSION + +C Compiler: $CC + +Flags: + DEFS: $DEFS + CFLAGS: $CFLAGS + +Features: + debug: $enable_debug + failover: $enable_failover + execute: $enable_execute + +Developer: + ATF unittests : $atf_path + +END +# TODO: Add Perl system tests + +if test "$atf_path" != "no" +then +echo "ATF_CFLAGS : $ATF_CFLAGS" >> config.report +echo "ATF_LDFLAGS : $ATF_LDFLAGS" >> config.report +echo +fi + +cat config.report + +echo +echo Now you can type "make" to build ISC DHCP +echo diff --git a/external/bsd/dhcp/dist/contrib/3.0b1-lease-convert b/external/bsd/dhcp/dist/contrib/3.0b1-lease-convert index 517ea9e8ae73..f9a0d5f1751e 100644 --- a/external/bsd/dhcp/dist/contrib/3.0b1-lease-convert +++ b/external/bsd/dhcp/dist/contrib/3.0b1-lease-convert @@ -3,7 +3,7 @@ # Start Date: Mon, 26 Mar 2001 14:24:09 +0200 # Time-stamp: # File: leaseconvertor.pl -# RCSId: Id: 3.0b1-lease-convert,v 1.1 2001-04-18 19:17:34 mellon Exp +# RCSId: Id: 3.0b1-lease-convert,v 1.1 2001/04/18 19:17:34 mellon Exp # # Description: Convert 3.0b1 to 3.0b2/final lease file format # @@ -11,7 +11,7 @@ require 5.004; my $rcsID =<<'EOM'; -Id: 3.0b1-lease-convert,v 1.1 2001-04-18 19:17:34 mellon Exp +Id: 3.0b1-lease-convert,v 1.1 2001/04/18 19:17:34 mellon Exp EOM use strict; diff --git a/external/bsd/dhcp/dist/dhcpctl/Makefile.in b/external/bsd/dhcp/dist/dhcpctl/Makefile.in index 9344e30f61a5..1a2dcd438608 100644 --- a/external/bsd/dhcp/dist/dhcpctl/Makefile.in +++ b/external/bsd/dhcp/dist/dhcpctl/Makefile.in @@ -88,6 +88,8 @@ CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ +ATF_CFLAGS = @ATF_CFLAGS@ +ATF_LDFLAGS = @ATF_LDFLAGS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ diff --git a/external/bsd/dhcp/dist/dhcpctl/dhcpctl.3 b/external/bsd/dhcp/dist/dhcpctl/dhcpctl.3 index b5891291183f..a2df1f7556e0 100644 --- a/external/bsd/dhcp/dist/dhcpctl/dhcpctl.3 +++ b/external/bsd/dhcp/dist/dhcpctl/dhcpctl.3 @@ -1,10 +1,10 @@ -.\" $NetBSD: dhcpctl.3,v 1.1.1.1 2013/03/24 15:45:48 christos Exp $ +.\" $NetBSD: dhcpctl.3,v 1.1.1.2 2013/03/24 22:50:34 christos Exp $ .\" .\" -*- nroff -*- .\" .\" Project: DHCP .\" File: dhcpctl.3 -.\" RCSId: Id: dhcpctl.3,v 1.7.24.2 2011-04-25 23:49:52 sar Exp +.\" RCSId: Id: dhcpctl.3,v 1.7.24.2 2011/04/25 23:49:52 sar Exp .\" .\" Copyright (c) 2011 by Internet Systems Consortium, Inc. ("ISC") .\" Copyright (c) 2004,2009 by Internet Systems Consortium, Inc. ("ISC") diff --git a/external/bsd/dhcp/dist/dhcpctl/dhcpctl.h b/external/bsd/dhcp/dist/dhcpctl/dhcpctl.h index 5321e8dfd942..7715522e41be 100644 --- a/external/bsd/dhcp/dist/dhcpctl/dhcpctl.h +++ b/external/bsd/dhcp/dist/dhcpctl/dhcpctl.h @@ -1,6 +1,6 @@ -/* $NetBSD: dhcpctl.h,v 1.1.1.1 2013/03/24 15:45:47 christos Exp $ */ +/* $NetBSD: dhcpctl.h,v 1.1.1.2 2013/03/24 22:50:34 christos Exp $ */ -/* Id: dhcpctl.h,v 1.17.24.1 2009-11-20 01:49:01 sar Exp +/* Id: dhcpctl.h,v 1.17.24.1 2009/11/20 01:49:01 sar Exp Subroutines providing general support for objects. */ @@ -35,7 +35,7 @@ */ #include -__RCSID("$NetBSD: dhcpctl.h,v 1.1.1.1 2013/03/24 15:45:47 christos Exp $"); +__RCSID("$NetBSD: dhcpctl.h,v 1.1.1.2 2013/03/24 22:50:34 christos Exp $"); #ifndef _DHCPCTL_H_ #define _DHCPCTL_H_ diff --git a/external/bsd/dhcp/dist/dhcpctl/omshell.1 b/external/bsd/dhcp/dist/dhcpctl/omshell.1 index e994965b73be..8ec5e34cd125 100644 --- a/external/bsd/dhcp/dist/dhcpctl/omshell.1 +++ b/external/bsd/dhcp/dist/dhcpctl/omshell.1 @@ -1,7 +1,8 @@ -.\" $NetBSD: omshell.1,v 1.1.1.1 2013/03/24 15:45:47 christos Exp $ +.\" $NetBSD: omshell.1,v 1.1.1.2 2013/03/24 22:50:34 christos Exp $ .\" -.\" Id: omshell.1,v 1.5.24.1 2009-11-20 01:49:01 sar Exp +.\" Id: omshell.1,v 1.5.24.1 2009/11/20 01:49:01 sar Exp .\" +.\" Copyright (c) 2012 by Internet Systems Consortium, Inc. ("ISC") .\" Copyright (c) 2004,2009 by Internet Systems Consortium, Inc. ("ISC") .\" Copyright (c) 2001-2003 by Internet Software Consortium .\" @@ -27,7 +28,7 @@ .\" by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc. .\" To learn more about Internet Systems Consortium, see .\" ``https://www.isc.org/''. To learn more about Vixie Enterprises, -.\" see ``http://www.vix.com''. To learn more about Nominum, Inc., see +.\" see ``http://www.vix.com''. To learn more about Nominum, Inc., see .\" ``http://www.nominum.com''. .TH omshell 1 .SH NAME @@ -39,11 +40,11 @@ The OMAPI Command Shell, omshell, provides an interactive way to connect to, query, and possibly change, the ISC DHCP Server's state via OMAPI, the Object Management API. By using OMAPI and omshell, you do not have to stop, make changes, and then restart the DHCP server, but can make the changes -while the server is running. Omshell provides a way of accessing +while the server is running. Omshell provides a way of accessing OMAPI. .PP OMAPI is simply a communications mechanism that allows you to -manipulate objects. In order to actually \fIuse\fR omshell, you +manipulate objects. In order to actually \fIuse\fR omshell, you .I must understand what objects are available and how to use them. Documentation for OMAPI objects can be found in the documentation for @@ -278,7 +279,7 @@ dhcpd.conf, but was created dynamically via OMAPI. .SH RESETTING ATTRIBUTES .PP If you want to remove an attribute from an object, you can do this with the -\fBunset\fR command. Once you have unset an attribute, you must use the +\fBunset\fR command. Once you have unset an attribute, you must use the \fBupdate\fR command to update the remote object. So, if the host "some-host" from the previous example will not have a static IP address anymore, the commands in omshell would look like this: diff --git a/external/bsd/dhcp/dist/doc/Makefile b/external/bsd/dhcp/dist/doc/Makefile index 229a0c57cc2e..60a48fdf99e9 100644 --- a/external/bsd/dhcp/dist/doc/Makefile +++ b/external/bsd/dhcp/dist/doc/Makefile @@ -27,3 +27,18 @@ References.txt: References.xml References.html: References.xml xml2html References.xml +devel: + mkdir -p html + doxygen devel/doxyfile > html/doxygen.log 2>html/doxygen-warnings.log + +cppcheck: + mkdir -p html + cd .. && cppcheck --enable=all --inline-suppr \ + -f -v -j 2 -i tests/ -i dhcp-*/ \ + . 1> doc/html/cppcheck.log 2> doc/html/cppcheck-error.log + +# cppcheck can be extended with list of suppressions. +# --suppressions-list=doc/cppcheck-skip.txt \ + + +.PHONY: devel cppcheck \ No newline at end of file diff --git a/external/bsd/dhcp/dist/doc/References.html b/external/bsd/dhcp/dist/doc/References.html index 9bf4dc477187..b20b5aa9f866 100644 --- a/external/bsd/dhcp/dist/doc/References.html +++ b/external/bsd/dhcp/dist/doc/References.html @@ -145,7 +145,7 @@ ISC-DHCP-REFERENCESD. Hankins  T. Mrugalski  ISC - May 20, 2011 + January 04, 2012


ISC DHCP References Collection

@@ -740,6 +740,10 @@ DHCPv6 Protocol References

Precisely how to correctly support the above conundrums has not quite yet been settled, so support is incomplete.

+

[RFC5453] (Krishnan, S., “Reserved IPv6 Interface Identifiers,” February 2009.) creates a registry at IANA to reserve + interface identifiers and specifies a starting set. These IIDs should + not be used when constructing addresses to avoid possible conflicts. +



 TOC 

6.2.  @@ -974,14 +978,16 @@ References

Zeng, S., Volz, B., Kinnear, K., and J. Brzozowski, “DHCPv6 Relay Agent Echo Request Option,” RFC 4994, September 2007 (TXT). [RFC5007] Brzozowski, J., Kinnear, K., Volz, B., and S. Zeng, “DHCPv6 Leasequery,” RFC 5007, September 2007 (TXT). +[RFC5453] +Krishnan, S., “Reserved IPv6 Interface Identifiers,” RFC 5453, February 2009 (TXT). [RFC5460] Stapp, M., “DHCPv6 Bulk Leasequery,” RFC 5460, February 2009 (TXT). [I-D.ietf-mif-dhcpv6-route-option] -Dec, W., Mrugalski, T., Sun, T., and B. Sarikaya, “DHCPv6 Route Option,” draft-ietf-mif-dhcpv6-route-option-01 (work in progress), March 2011 (TXT). +Dec, W., Mrugalski, T., Sun, T., and B. Sarikaya, “DHCPv6 Route Options,” draft-ietf-mif-dhcpv6-route-option-03 (work in progress), September 2011 (TXT). [I-D.ietf-dhc-dhcpv6-ldra] Miles, D., Ooghe, S., Dec, W., Krishnan, S., and A. Kavanagh, “Lightweight DHCPv6 Relay Agent,” draft-ietf-dhc-dhcpv6-ldra-03 (work in progress), October 2010 (TXT). [I-D.ietf-dhc-dhcpv6-relay-supplied-options] -Lemon, T. and W. Wu, “Relay-Supplied DHCP Options,” draft-ietf-dhc-dhcpv6-relay-supplied-options-06 (work in progress), May 2011 (TXT). +Lemon, T. and W. Wu, “Relay-Supplied DHCP Options,” draft-ietf-dhc-dhcpv6-relay-supplied-options-09 (work in progress), September 2011 (TXT). [I-D.ietf-dhc-pd-exclude] Korhonen, J., Savolainen, T., Krishnan, S., and O. Troan, “Prefix Exclude Option for DHCPv6-based Prefix Delegation,” draft-ietf-dhc-pd-exclude-01 (work in progress), January 2011 (TXT). [I-D.ietf-dhc-secure-dhcpv6] diff --git a/external/bsd/dhcp/dist/doc/References.txt b/external/bsd/dhcp/dist/doc/References.txt index 9d28f23331fc..287272608493 100644 --- a/external/bsd/dhcp/dist/doc/References.txt +++ b/external/bsd/dhcp/dist/doc/References.txt @@ -4,7 +4,7 @@ ISC-DHCP-REFERENCES D. Hankins T. Mrugalski ISC - May 20, 2011 + January 04, 2012 ISC DHCP References Collection @@ -54,7 +54,7 @@ Copyright Notice Hankins & Mrugalski [Page 1] - ISC DHCP References Collection May 2011 + ISC DHCP References Collection January 2012 Table of Contents @@ -110,7 +110,7 @@ Table of Contents Hankins & Mrugalski [Page 2] - ISC DHCP References Collection May 2011 + ISC DHCP References Collection January 2012 1. Introduction @@ -166,7 +166,7 @@ Hankins & Mrugalski [Page 2] Hankins & Mrugalski [Page 3] - ISC DHCP References Collection May 2011 + ISC DHCP References Collection January 2012 o To produce new externally-visible behaviour, one must first @@ -222,7 +222,7 @@ Hankins & Mrugalski [Page 3] Hankins & Mrugalski [Page 4] - ISC DHCP References Collection May 2011 + ISC DHCP References Collection January 2012 address yet) interface. @@ -278,7 +278,7 @@ Hankins & Mrugalski [Page 4] Hankins & Mrugalski [Page 5] - ISC DHCP References Collection May 2011 + ISC DHCP References Collection January 2012 now unicast without ARP by inserting an entry into the ARP cache @@ -334,7 +334,7 @@ Hankins & Mrugalski [Page 5] Hankins & Mrugalski [Page 6] - ISC DHCP References Collection May 2011 + ISC DHCP References Collection January 2012 5. DHCPv4 Protocol References @@ -390,7 +390,7 @@ Hankins & Mrugalski [Page 6] Hankins & Mrugalski [Page 7] - ISC DHCP References Collection May 2011 + ISC DHCP References Collection January 2012 RFC2485 [RFC2485] defines the Open Group's UAP option. @@ -446,7 +446,7 @@ Hankins & Mrugalski [Page 7] Hankins & Mrugalski [Page 8] - ISC DHCP References Collection May 2011 + ISC DHCP References Collection January 2012 5.2.1. Relay Agent Information Option Options @@ -502,7 +502,7 @@ Hankins & Mrugalski [Page 8] Hankins & Mrugalski [Page 9] - ISC DHCP References Collection May 2011 + ISC DHCP References Collection January 2012 this document was edited, and the authors no longer show any interest @@ -558,7 +558,7 @@ Hankins & Mrugalski [Page 9] Hankins & Mrugalski [Page 10] - ISC DHCP References Collection May 2011 + ISC DHCP References Collection January 2012 IA_NAs within one packet from the client, our client only supports @@ -586,6 +586,10 @@ Hankins & Mrugalski [Page 10] Precisely how to correctly support the above conundrums has not quite yet been settled, so support is incomplete. + [RFC5453] creates a registry at IANA to reserve interface identifiers + and specifies a starting set. These IIDs should not be used when + constructing addresses to avoid possible conflicts. + 6.2. DHCPv6 Options References [RFC3319] defines the SIP server options for DHCPv6. @@ -605,18 +609,19 @@ Hankins & Mrugalski [Page 10] [RFC4242] defines the Information Refresh Time option, which advises DHCPv6 Information-Request clients to return for updated information. - [RFC4280] defines two BCMS server options for each protocol family. - - [RFC4580] defines a DHCPv6 subscriber-id option, which is similar in - principle to the DHCPv4 relay agent option of the same name. Hankins & Mrugalski [Page 11] - ISC DHCP References Collection May 2011 + ISC DHCP References Collection January 2012 + [RFC4280] defines two BCMS server options for each protocol family. + + [RFC4580] defines a DHCPv6 subscriber-id option, which is similar in + principle to the DHCPv4 relay agent option of the same name. + [RFC4649] defines a DHCPv6 remote-id option, which is similar in principle to the DHCPv4 relay agent remote-id. @@ -661,18 +666,17 @@ Hankins & Mrugalski [Page 11] [RFC2485] Drach, S., "DHCP Option for The Open Group's User Authentication Protocol", RFC 2485, January 1999. - [RFC2563] Troll, R., "DHCP Option to Disable Stateless Auto- - Configuration in IPv4 Clients", RFC 2563, May 1999. - - [RFC2610] Perkins, C. and E. Guttman, "DHCP Options for Service - Hankins & Mrugalski [Page 12] - ISC DHCP References Collection May 2011 + ISC DHCP References Collection January 2012 + [RFC2563] Troll, R., "DHCP Option to Disable Stateless Auto- + Configuration in IPv4 Clients", RFC 2563, May 1999. + + [RFC2610] Perkins, C. and E. Guttman, "DHCP Options for Service Location Protocol", RFC 2610, June 1999. [RFC2855] Fujisawa, K., "DHCP for IEEE 1394", RFC 2855, June 2000. @@ -717,18 +721,18 @@ Hankins & Mrugalski [Page 12] November 2002. [RFC3397] Aboba, B. and S. Cheshire, "Dynamic Host Configuration - Protocol (DHCP) Domain Search Option", RFC 3397, - November 2002. - - [RFC3442] Lemon, T., Cheshire, S., and B. Volz, "The Classless Hankins & Mrugalski [Page 13] - ISC DHCP References Collection May 2011 + ISC DHCP References Collection January 2012 + Protocol (DHCP) Domain Search Option", RFC 3397, + November 2002. + + [RFC3442] Lemon, T., Cheshire, S., and B. Volz, "The Classless Static Route Option for Dynamic Host Configuration Protocol (DHCP) version 4", RFC 3442, December 2002. @@ -773,18 +777,19 @@ Hankins & Mrugalski [Page 13] Suboption for the Dynamic Host Configuration Protocol (DHCP) Relay Agent Option", RFC 3993, March 2005. - [RFC4014] Droms, R. and J. Schnizlein, "Remote Authentication - Dial-In User Service (RADIUS) Attributes Suboption for the - Dynamic Host Configuration Protocol (DHCP) Relay Agent - Information Option", RFC 4014, February 2005. Hankins & Mrugalski [Page 14] - ISC DHCP References Collection May 2011 + ISC DHCP References Collection January 2012 + [RFC4014] Droms, R. and J. Schnizlein, "Remote Authentication + Dial-In User Service (RADIUS) Attributes Suboption for the + Dynamic Host Configuration Protocol (DHCP) Relay Agent + Information Option", RFC 4014, February 2005. + [RFC4030] Stapp, M. and T. Lemon, "The Authentication Suboption for the Dynamic Host Configuration Protocol (DHCP) Relay Agent Option", RFC 4030, March 2005. @@ -829,18 +834,17 @@ Hankins & Mrugalski [Page 14] Configuration Protocol (DHCP) Clients", RFC 4703, October 2006. - [RFC5010] Kinnear, K., Normoyle, M., and M. Stapp, "The Dynamic Host - Configuration Protocol Version 4 (DHCPv4) Relay Agent - Flags Suboption", RFC 5010, September 2007. - - Hankins & Mrugalski [Page 15] - ISC DHCP References Collection May 2011 + ISC DHCP References Collection January 2012 + [RFC5010] Kinnear, K., Normoyle, M., and M. Stapp, "The Dynamic Host + Configuration Protocol Version 4 (DHCPv4) Relay Agent + Flags Suboption", RFC 5010, September 2007. + [RFC5071] Hankins, D., "Dynamic Host Configuration Protocol Options Used by PXELINUX", RFC 5071, December 2007. @@ -885,18 +889,19 @@ Hankins & Mrugalski [Page 15] draft-ietf-dhc-leasequery-by-remote-id-09 (work in progress), December 2010. - [I-D.ietf-dhc-relay-id-suboption] - Stapp, M., "The DHCPv4 Relay Agent Identifier Suboption", - draft-ietf-dhc-relay-id-suboption-07 (work in progress), - July 2009. Hankins & Mrugalski [Page 16] - ISC DHCP References Collection May 2011 + ISC DHCP References Collection January 2012 + [I-D.ietf-dhc-relay-id-suboption] + Stapp, M., "The DHCPv4 Relay Agent Identifier Suboption", + draft-ietf-dhc-relay-id-suboption-07 (work in progress), + July 2009. + [I-D.ietf-mip6-hiopt] Jang, H., Yegin, A., Chowdhury, K., and J. Choi, "DHCP Options for Home Information Discovery in MIPv6", @@ -941,18 +946,17 @@ Hankins & Mrugalski [Page 16] Location Information Server (LIS)", RFC 5986, September 2010. - [I-D.ietf-dhc-vpn-option] - Kinnear, K., Johnson, R., and M. Stapp, "Virtual Subnet - Selection Options for DHCPv4 and DHCPv6", - draft-ietf-dhc-vpn-option-12 (work in progress), - Hankins & Mrugalski [Page 17] - ISC DHCP References Collection May 2011 + ISC DHCP References Collection January 2012 + [I-D.ietf-dhc-vpn-option] + Kinnear, K., Johnson, R., and M. Stapp, "Virtual Subnet + Selection Options for DHCPv4 and DHCPv6", + draft-ietf-dhc-vpn-option-12 (work in progress), October 2010. 7.3. Published DHCPv6 References @@ -997,18 +1001,18 @@ Hankins & Mrugalski [Page 17] [RFC4649] Volz, B., "Dynamic Host Configuration Protocol for IPv6 (DHCPv6) Relay Agent Remote-ID Option", RFC 4649, - August 2006. - - [RFC4704] Volz, B., "The Dynamic Host Configuration Protocol for - IPv6 (DHCPv6) Client Fully Qualified Domain Name (FQDN) Hankins & Mrugalski [Page 18] - ISC DHCP References Collection May 2011 + ISC DHCP References Collection January 2012 + August 2006. + + [RFC4704] Volz, B., "The Dynamic Host Configuration Protocol for + IPv6 (DHCPv6) Client Fully Qualified Domain Name (FQDN) Option", RFC 4704, October 2006. [RFC4994] Zeng, S., Volz, B., Kinnear, K., and J. Brzozowski, @@ -1018,13 +1022,16 @@ Hankins & Mrugalski [Page 18] [RFC5007] Brzozowski, J., Kinnear, K., Volz, B., and S. Zeng, "DHCPv6 Leasequery", RFC 5007, September 2007. + [RFC5453] Krishnan, S., "Reserved IPv6 Interface Identifiers", + RFC 5453, February 2009. + [RFC5460] Stapp, M., "DHCPv6 Bulk Leasequery", RFC 5460, February 2009. [I-D.ietf-mif-dhcpv6-route-option] Dec, W., Mrugalski, T., Sun, T., and B. Sarikaya, "DHCPv6 - Route Option", draft-ietf-mif-dhcpv6-route-option-01 (work - in progress), March 2011. + Route Options", draft-ietf-mif-dhcpv6-route-option-03 + (work in progress), September 2011. [I-D.ietf-dhc-dhcpv6-ldra] Miles, D., Ooghe, S., Dec, W., Krishnan, S., and A. @@ -1034,8 +1041,8 @@ Hankins & Mrugalski [Page 18] [I-D.ietf-dhc-dhcpv6-relay-supplied-options] Lemon, T. and W. Wu, "Relay-Supplied DHCP Options", - draft-ietf-dhc-dhcpv6-relay-supplied-options-06 (work in - progress), May 2011. + draft-ietf-dhc-dhcpv6-relay-supplied-options-09 (work in + progress), September 2011. [I-D.ietf-dhc-pd-exclude] Korhonen, J., Savolainen, T., Krishnan, S., and O. Troan, @@ -1050,6 +1057,14 @@ Hankins & Mrugalski [Page 18] [I-D.ietf-mext-nemo-pd] Droms, R., Thubert, P., Dupont, F., Haddad, W., and C. + + + +Hankins & Mrugalski [Page 19] + + ISC DHCP References Collection January 2012 + + Bernardos, "DHCPv6 Prefix Delegation for NEMO", draft-ietf-mext-nemo-pd-07 (work in progress), December 2010. @@ -1057,14 +1072,6 @@ Hankins & Mrugalski [Page 18] [I-D.ietf-dhc-duid-uuid] Narten, T. and J. Johnson, "Definition of the UUID-based DHCPv6 Unique Identifier (DUID-UUID)", - - - -Hankins & Mrugalski [Page 19] - - ISC DHCP References Collection May 2011 - - draft-ietf-dhc-duid-uuid-03 (work in progress), February 2011. @@ -1100,6 +1107,20 @@ Authors' Addresses Redwood City, CA 94063 + + + + + + + + + +Hankins & Mrugalski [Page 20] + + ISC DHCP References Collection January 2012 + + Tomasz Mrugalski Internet Systems Consortium, Inc. 950 Charter Street @@ -1116,5 +1137,40 @@ Authors' Addresses -Hankins & Mrugalski [Page 20] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Hankins & Mrugalski [Page 21] diff --git a/external/bsd/dhcp/dist/doc/References.xml b/external/bsd/dhcp/dist/doc/References.xml index 5b93c62f25b6..8a32067b8dff 100644 --- a/external/bsd/dhcp/dist/doc/References.xml +++ b/external/bsd/dhcp/dist/doc/References.xml @@ -1,6 +1,6 @@ - + @@ -92,6 +92,8 @@ 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.4702.xml'> + ]> @@ -133,7 +135,7 @@ - + ISC DHCP @@ -610,6 +612,10 @@ Precisely how to correctly support the above conundrums has not quite yet been settled, so support is incomplete. + + creates a registry at IANA to reserve + interface identifiers and specifies a starting set. These IIDs should + not be used when constructing addresses to avoid possible conflicts.
@@ -760,6 +766,7 @@ + diff --git a/external/bsd/dhcp/dist/doc/devel/doxyfile.in b/external/bsd/dhcp/dist/doc/devel/doxyfile.in new file mode 100644 index 000000000000..3ff0762db24b --- /dev/null +++ b/external/bsd/dhcp/dist/doc/devel/doxyfile.in @@ -0,0 +1,1792 @@ +# Doxyfile 1.8.1.1 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" "). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or sequence of words) that should +# identify the project. Note that if you do not use Doxywizard you need +# to put quotes around the project name if it contains spaces. + +PROJECT_NAME = "ISC DHCP" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = @PACKAGE_VERSION@ + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer +# a quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = "A reference DHCPv4 and DHCPv6 implementation" + +# With the PROJECT_LOGO tag one can specify an logo or icon that is +# included in the documentation. The maximum height of the logo should not +# exceed 55 pixels and the maximum width should not exceed 200 pixels. +# Doxygen will copy the logo to the output directory. + +PROJECT_LOGO = devel/isc-logo.jpg + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = YES + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, +# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English +# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, +# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, +# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = @abs_top_srcdir@ + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful if your file system +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding +# "class=itcl::class" will allow you to use the command class in the +# itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given extension. +# Doxygen has a built-in mapping, but you can override or extend it using this +# tag. The format is ext=language, where ext is a file extension, and language +# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, +# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make +# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C +# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions +# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all +# comments according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you +# can mix doxygen, HTML, and XML commands with Markdown formatting. +# Disable only in case of backward compatibilities issues. + +MARKDOWN_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also makes the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate getter +# and setter methods for a property. Setting this option to YES (the default) +# will make doxygen replace the get and set methods by a property in the +# documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and +# unions are shown inside the group in which they are included (e.g. using +# @ingroup) instead of on a separate page (for HTML and Man pages) or +# section (for LaTeX and RTF). + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and +# unions with only public data fields will be shown inline in the documentation +# of the scope in which they are defined (i.e. file, namespace, or group +# documentation), provided this scope is documented. If set to NO (the default), +# structs, classes, and unions are shown on a separate page (for HTML and Man +# pages) or section (for LaTeX and RTF). + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penalty. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will roughly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols. + +SYMBOL_CACHE_SIZE = 0 + +# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be +# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given +# their name and scope. Since this can be an expensive process and often the +# same symbol appear multiple times in the code, doxygen keeps a cache of +# pre-resolved symbols. If the cache is too small doxygen will become slower. +# If the cache is too large, memory is wasted. The cache size is given by this +# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal scope will be included in the documentation. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespaces are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen +# will list include files with double quotes in the documentation +# rather than with sharp brackets. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen +# will sort the (brief and detailed) documentation of class members so that +# constructors and destructors are listed first. If set to NO (the default) +# the constructors will appear in the respective orders defined by +# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. +# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO +# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to +# do proper type resolution of all parameters of a function it will reject a +# match between the prototype and the implementation of a member function even +# if there is only one candidate or it is obvious which candidate to choose +# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen +# will still accept a match between prototype and implementation in such cases. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or macro consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and macros in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. +# This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. +# You can optionally specify a file name after the option, if omitted +# DoxygenLayout.xml will be used as the name of the layout file. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files +# containing the references data. This must be a list of .bib files. The +# .bib extension is automatically appended if omitted. Using this command +# requires the bibtex tool to be installed. See also +# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style +# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this +# feature you need bibtex and perl available in the search path. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# The WARN_NO_PARAMDOC option can be enabled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = YES + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = doxygen-warnings.log + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = .. + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh +# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py +# *.f90 *.f *.for *.vhd *.vhdl + +FILE_PATTERNS = *.c *.h *.dox + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = */tests/* */bind/* + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. +# If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. +# Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. +# The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty or if +# non of the patterns match the file name, INPUT_FILTER is applied. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) +# and it is also possible to disable source filtering for a specific pattern +# using *.ext= (so without naming a filter). This option only has effect when +# FILTER_SOURCE_FILES is enabled. + +FILTER_SOURCE_PATTERNS = + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C, C++ and Fortran comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. +# Otherwise they will link to the documentation. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. Note that when using a custom header you are responsible +# for the proper inclusion of any scripts and style sheets that doxygen +# needs, which is dependent on the configuration options used. +# It is advised to generate a default header using "doxygen -w html +# header.html footer.html stylesheet.css YourConfigFile" and then modify +# that header. Note that the header is subject to change so you typically +# have to redo this when upgrading to a newer version of doxygen or when +# changing the value of configuration settings such as GENERATE_TREEVIEW! + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# style sheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that +# the files will be copied as-is; there are no commands or markers available. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. +# Doxygen will adjust the colors in the style sheet and background images +# according to this color. Hue is specified as an angle on a colorwheel, +# see http://en.wikipedia.org/wiki/Hue for more information. +# For instance the value 0 represents red, 60 is yellow, 120 is green, +# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. +# The allowed range is 0 to 359. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of +# the colors in the HTML output. For a value of 0 the output will use +# grayscales only. A value of 255 will produce the most vivid colors. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to +# the luminance component of the colors in the HTML output. Values below +# 100 gradually make the output lighter, whereas values above 100 make +# the output darker. The value divided by 100 is the actual gamma applied, +# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, +# and 100 does not change the gamma. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting +# this to NO can help when comparing the output of multiple runs. + +HTML_TIMESTAMP = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of +# entries shown in the various tree structured indices initially; the user +# can expand and collapse entries dynamically later on. Doxygen will expand +# the tree to such a level that at most the specified number of entries are +# visible (unless a fully collapsed tree already exceeds this amount). +# So setting the number of entries 1 will produce a full collapsed tree by +# default. 0 is a special value representing an infinite number of entries +# and will result in a full expanded tree by default. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated +# that can be used as input for Qt's qhelpgenerator to generate a +# Qt Compressed Help (.qch) of the generated HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#namespace + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#virtual-folders + +QHP_VIRTUAL_FOLDER = doc + +# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to +# add. For more information please see +# http://doc.trolltech.com/qthelpproject.html#custom-filters + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see +# +# Qt Help Project / Custom Filters. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's +# filter section matches. +# +# Qt Help Project / Filter Attributes. + +QHP_SECT_FILTER_ATTRS = + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files +# will be generated, which together with the HTML files, form an Eclipse help +# plugin. To install this plugin and make it available under the help contents +# menu in Eclipse, the contents of the directory containing the HTML and XML +# files needs to be copied into the plugins directory of eclipse. The name of +# the directory within the plugins directory should be the same as +# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before +# the help appears. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have +# this name. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) +# at top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. Since the tabs have the same information as the +# navigation tree you can set this option to NO if you already set +# GENERATE_TREEVIEW to YES. + +DISABLE_INDEX = YES + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to YES, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). +# Windows users are probably better off using the HTML help feature. +# Since the tree basically has the same information as the tab index you +# could consider to set DISABLE_INDEX to NO when enabling this option. + +GENERATE_TREEVIEW = YES + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values +# (range [0,1..20]) that doxygen will group on one line in the generated HTML +# documentation. Note that a value of 0 will completely suppress the enum +# values from appearing in the overview section. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open +# links to external symbols imported via tag files in a separate window. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are +# not supported properly for IE 6.0, but are supported on all modern browsers. +# Note that when changing this option you need to delete any form_*.png files +# in the HTML output before the changes have effect. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax +# (see http://www.mathjax.org) which uses client side Javascript for the +# rendering instead of using prerendered bitmaps. Use this if you do not +# have LaTeX installed or if you want to formulas look prettier in the HTML +# output. When enabled you may also need to install MathJax separately and +# configure the path to it using the MATHJAX_RELPATH option. + +USE_MATHJAX = NO + +# When MathJax is enabled you need to specify the location relative to the +# HTML output directory using the MATHJAX_RELPATH option. The destination +# directory should contain the MathJax.js script. For instance, if the mathjax +# directory is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to +# the MathJax Content Delivery Network so you can quickly see the result without +# installing MathJax. +# However, it is strongly recommended to install a local +# copy of MathJax from http://www.mathjax.org before deployment. + +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest + +# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension +# names that should be enabled during MathJax rendering. + +MATHJAX_EXTENSIONS = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box +# for the HTML output. The underlying search engine uses javascript +# and DHTML and should work on any modern browser. Note that when using +# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets +# (GENERATE_DOCSET) there is already a search function so this one should +# typically be disabled. For large projects the javascript based search engine +# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. + +SEARCHENGINE = YES + +# When the SERVER_BASED_SEARCH tag is enabled the search engine will be +# implemented using a PHP enabled web server instead of at the web client +# using Javascript. Doxygen will generate the search PHP script and index +# file to put on the web server. The advantage of the server +# based approach is that it scales better to large projects and allows +# full text search. The disadvantages are that it is more difficult to setup +# and does not have live searching capabilities. + +SERVER_BASED_SEARCH = NO + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. +# Note that when enabling USE_PDFLATEX this option is only used for +# generating bitmaps for formulas in the HTML output, but not in the +# Makefile that is written to the output directory. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4 + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for +# the generated latex document. The footer should contain everything after +# the last chapter. If it is left blank doxygen will generate a +# standard footer. Notice: only use this tag if you know what you are doing! + +LATEX_FOOTER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +# If LATEX_SOURCE_CODE is set to YES then doxygen will include +# source code with syntax highlighting in the LaTeX output. +# Note that which sources are shown also depends on other settings +# such as SOURCE_BROWSER. + +LATEX_SOURCE_CODE = NO + +# The LATEX_BIB_STYLE tag can be used to specify the style to use for the +# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See +# http://en.wikipedia.org/wiki/BibTeX for more info. + +LATEX_BIB_STYLE = plain + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load style sheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. +# This is useful +# if you want to understand what is going on. +# On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# pointed to by INCLUDE_PATH will be searched when a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition that +# overrules the definition found in the source code. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all references to function-like macros +# that are alone on a line, have an all uppercase name, and do not end with a +# semicolon, because these will confuse the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. For each +# tag file the location of the external documentation should be added. The +# format of a tag file without this location is as follows: +# +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths +# or URLs. Note that each tag file must have a unique name (where the name does +# NOT include the path). If a tag file is not located in the directory in which +# doxygen is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option also works with HAVE_DOT disabled, but it is recommended to +# install and use dot, since it yields more powerful graphs. + +CLASS_DIAGRAMS = NO + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is +# allowed to run in parallel. When set to 0 (the default) doxygen will +# base this on the number of processors available in the system. You can set it +# explicitly to a value larger than 0 to get control over the balance +# between CPU load and processing speed. + +DOT_NUM_THREADS = 0 + +# By default doxygen will use the Helvetica font for all dot files that +# doxygen generates. When you want a differently looking font you can specify +# the font name using DOT_FONTNAME. You need to make sure dot is able to find +# the font, which can be done by putting it in a standard location or by setting +# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the +# directory containing the font. + +DOT_FONTNAME = Helvetica + +# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. +# The default size is 10pt. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the Helvetica font. +# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to +# set the path where dot can find it. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If the UML_LOOK tag is enabled, the fields and methods are shown inside +# the class node. If there are many fields or methods and many nodes the +# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS +# threshold limits the number of items for each type to make the size more +# managable. Set this to 0 for no limit. Note that the threshold may be +# exceeded by 50% before the limit is enforced. + +UML_LIMIT_NUM_FIELDS = 10 + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will generate a graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are svg, png, jpg, or gif. +# If left blank png will be used. If you choose svg you need to set +# HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible in IE 9+ (other browsers do not have this requirement). + +DOT_IMAGE_FORMAT = png + +# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to +# enable generation of interactive SVG images that allow zooming and panning. +# Note that this requires a modern browser other than Internet Explorer. +# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you +# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible. Older versions of IE do not have SVG support. + +INTERACTIVE_SVG = NO + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MSCFILE_DIRS tag can be used to specify one or more directories that +# contain msc files that are included in the documentation (see the +# \mscfile command). + +MSCFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES diff --git a/external/bsd/dhcp/dist/doc/ja_JP.eucJP/dhclient-script.8 b/external/bsd/dhcp/dist/doc/ja_JP.eucJP/dhclient-script.8 index c63f24ce3fed..b7c4fc14ef6a 100644 --- a/external/bsd/dhcp/dist/doc/ja_JP.eucJP/dhclient-script.8 +++ b/external/bsd/dhcp/dist/doc/ja_JP.eucJP/dhclient-script.8 @@ -1,6 +1,6 @@ -.\" $NetBSD: dhclient-script.8,v 1.1.1.1 2013/03/24 15:45:49 christos Exp $ +.\" $NetBSD: dhclient-script.8,v 1.1.1.2 2013/03/24 22:50:26 christos Exp $ .\" -.\" Id: dhclient-script.8,v 1.3.24.1 2009-11-20 01:49:01 sar Exp +.\" Id: dhclient-script.8,v 1.3.24.1 2009/11/20 01:49:01 sar Exp .\" .\" Copyright (c) 2004,2009 by Internet Systems Consortium, Inc. ("ISC") .\" Copyright (c) 1996-2003 by Internet Software Consortium diff --git a/external/bsd/dhcp/dist/doc/ja_JP.eucJP/dhclient.8 b/external/bsd/dhcp/dist/doc/ja_JP.eucJP/dhclient.8 index 33736b4e8b54..dae2af5e1f94 100644 --- a/external/bsd/dhcp/dist/doc/ja_JP.eucJP/dhclient.8 +++ b/external/bsd/dhcp/dist/doc/ja_JP.eucJP/dhclient.8 @@ -1,6 +1,6 @@ -.\" $NetBSD: dhclient.8,v 1.1.1.1 2013/03/24 15:45:49 christos Exp $ +.\" $NetBSD: dhclient.8,v 1.1.1.2 2013/03/24 22:50:26 christos Exp $ .\" -.\" Id: dhclient.8,v 1.3.24.1 2009-11-20 01:49:01 sar Exp +.\" Id: dhclient.8,v 1.3.24.1 2009/11/20 01:49:01 sar Exp .\" .\" Copyright (c) 2004,2009 by Internet Systems Consortium, Inc. ("ISC") .\" Copyright (c) 1996-2003 by Internet Software Consortium diff --git a/external/bsd/dhcp/dist/doc/ja_JP.eucJP/dhclient.conf.5 b/external/bsd/dhcp/dist/doc/ja_JP.eucJP/dhclient.conf.5 index ecd7cf8167c4..3994f6e6d86a 100644 --- a/external/bsd/dhcp/dist/doc/ja_JP.eucJP/dhclient.conf.5 +++ b/external/bsd/dhcp/dist/doc/ja_JP.eucJP/dhclient.conf.5 @@ -1,6 +1,6 @@ -.\" $NetBSD: dhclient.conf.5,v 1.1.1.1 2013/03/24 15:45:49 christos Exp $ +.\" $NetBSD: dhclient.conf.5,v 1.1.1.2 2013/03/24 22:50:26 christos Exp $ .\" -.\" Id: dhclient.conf.5,v 1.3.24.1 2009-11-20 01:49:01 sar Exp +.\" Id: dhclient.conf.5,v 1.3.24.1 2009/11/20 01:49:01 sar Exp .\" .\" Copyright (c) 2004,2009 by Internet Systems Consortium, Inc. ("ISC") .\" Copyright (c) 1996-2003 by Internet Software Consortium diff --git a/external/bsd/dhcp/dist/doc/ja_JP.eucJP/dhclient.leases.5 b/external/bsd/dhcp/dist/doc/ja_JP.eucJP/dhclient.leases.5 index d5c8d1b11caa..db1686b9ae8d 100644 --- a/external/bsd/dhcp/dist/doc/ja_JP.eucJP/dhclient.leases.5 +++ b/external/bsd/dhcp/dist/doc/ja_JP.eucJP/dhclient.leases.5 @@ -1,6 +1,6 @@ -.\" $NetBSD: dhclient.leases.5,v 1.1.1.1 2013/03/24 15:45:49 christos Exp $ +.\" $NetBSD: dhclient.leases.5,v 1.1.1.2 2013/03/24 22:50:26 christos Exp $ .\" -.\" Id: dhclient.leases.5,v 1.3.24.1 2009-11-20 01:49:01 sar Exp +.\" Id: dhclient.leases.5,v 1.3.24.1 2009/11/20 01:49:01 sar Exp .\" .\" Copyright (c) 2004,2009 by Internet Systems Consortium, Inc. ("ISC") .\" Copyright (c) 1997-2003 by Internet Software Consortium diff --git a/external/bsd/dhcp/dist/doc/ja_JP.eucJP/dhcp-eval.5 b/external/bsd/dhcp/dist/doc/ja_JP.eucJP/dhcp-eval.5 index e588af90c999..b74015a4d26f 100644 --- a/external/bsd/dhcp/dist/doc/ja_JP.eucJP/dhcp-eval.5 +++ b/external/bsd/dhcp/dist/doc/ja_JP.eucJP/dhcp-eval.5 @@ -1,6 +1,6 @@ -.\" $NetBSD: dhcp-eval.5,v 1.1.1.1 2013/03/24 15:45:49 christos Exp $ +.\" $NetBSD: dhcp-eval.5,v 1.1.1.2 2013/03/24 22:50:26 christos Exp $ .\" -.\" Id: dhcp-eval.5,v 1.4.24.1 2009-11-20 01:49:01 sar Exp +.\" Id: dhcp-eval.5,v 1.4.24.1 2009/11/20 01:49:01 sar Exp .\" .\" Copyright (c) 2004,2009 by Internet Systems Consortium, Inc. ("ISC") .\" Copyright (c) 1996-2003 by Internet Software Consortium diff --git a/external/bsd/dhcp/dist/doc/ja_JP.eucJP/dhcp-options.5 b/external/bsd/dhcp/dist/doc/ja_JP.eucJP/dhcp-options.5 index fc00a37b1e55..266593496c90 100644 --- a/external/bsd/dhcp/dist/doc/ja_JP.eucJP/dhcp-options.5 +++ b/external/bsd/dhcp/dist/doc/ja_JP.eucJP/dhcp-options.5 @@ -1,6 +1,6 @@ -.\" $NetBSD: dhcp-options.5,v 1.1.1.1 2013/03/24 15:45:49 christos Exp $ +.\" $NetBSD: dhcp-options.5,v 1.1.1.2 2013/03/24 22:50:26 christos Exp $ .\" -.\" Id: dhcp-options.5,v 1.3.24.3 2011-01-20 23:46:46 sar Exp +.\" Id: dhcp-options.5,v 1.3.24.3 2011/01/20 23:46:46 sar Exp .\" .\" Copyright (c) 2009-2010 by Internet Systems Consortium, Inc. ("ISC") .\" Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") diff --git a/external/bsd/dhcp/dist/dst/Makefile.in b/external/bsd/dhcp/dist/dst/Makefile.in index 9684608fec3e..c415516ff81a 100644 --- a/external/bsd/dhcp/dist/dst/Makefile.in +++ b/external/bsd/dhcp/dist/dst/Makefile.in @@ -70,6 +70,8 @@ CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ +ATF_CFLAGS = @ATF_CFLAGS@ +ATF_LDFLAGS = @ATF_LDFLAGS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ diff --git a/external/bsd/dhcp/dist/dst/dst_api.c b/external/bsd/dhcp/dist/dst/dst_api.c index 49c1370d151c..0a3fe90c2ee1 100644 --- a/external/bsd/dhcp/dist/dst/dst_api.c +++ b/external/bsd/dhcp/dist/dst/dst_api.c @@ -1,12 +1,13 @@ -/* $NetBSD: dst_api.c,v 1.1.1.1 2013/03/24 15:45:56 christos Exp $ */ +/* $NetBSD: dst_api.c,v 1.1.1.2 2013/03/24 22:50:33 christos Exp $ */ #ifndef LINT -static const char rcsid[] = "Header: /proj/cvs/prod/DHCP/dst/dst_api.c,v 1.9 2009-10-29 00:46:48 sar Exp "; +static const char rcsid[] = "Header: /tmp/cvstest/DHCP/dst/dst_api.c,v 1.9.6.1 2012/04/11 15:43:55 sar Exp "; #endif /* * Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc. * Portions Copyright (c) 2007,2009 by Internet Systems Consortium, Inc. ("ISC") + * Portions Copyright (c) 2012 by Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -344,13 +345,13 @@ dst_read_key(const char *in_keyname, const unsigned in_id, in_alg)); return (NULL); } - if ((type && (DST_PUBLIC | DST_PRIVATE)) == 0) + if ((type & (DST_PUBLIC | DST_PRIVATE)) == 0) return (NULL); if (in_keyname == NULL) { EREPORT(("dst_read_private_key(): Null key name passed in\n")); return (NULL); } else - strcpy(keyname, in_keyname); + strncpy(keyname, in_keyname, PATH_MAX); /* before I read in the public key, check if it is allowed to sign */ if ((pubkey = dst_s_read_public_key(keyname, in_id, in_alg)) == NULL) @@ -444,6 +445,7 @@ dst_s_write_private_key(const DST_KEY *key) if ((nn = fwrite(encoded_block, 1, len, fp)) != len) { EREPORT(("dst_write_private_key(): Write failure on %s %d != %d errno=%d\n", file, out_len, nn, errno)); + fclose(fp); return (-5); } fclose(fp); @@ -664,7 +666,7 @@ dst_dnskey_to_key(const char *in_name, int alg ; int start = DST_KEY_START; - if (rdata == NULL || len <= DST_KEY_ALG) /* no data */ + if (in_name == NULL || rdata == NULL || len <= DST_KEY_ALG) /* no data */ return (NULL); alg = (u_int8_t) rdata[DST_KEY_ALG]; if (!dst_check_algorithm(alg)) { /* make sure alg is available */ @@ -675,8 +677,6 @@ dst_dnskey_to_key(const char *in_name, if ((key_st = dst_s_get_key_struct(in_name, alg, 0, 0, 0)) == NULL) return (NULL); - if (in_name == NULL) - return (NULL); key_st->dk_flags = dst_s_get_int16(rdata); key_st->dk_proto = (u_int16_t) rdata[DST_KEY_PROT]; if (key_st->dk_flags & DST_EXTEND_FLAG) { @@ -796,10 +796,12 @@ dst_buffer_to_key(const char *key_name, /* name of the key */ dkey->dk_func->from_dns_key != NULL) { if (dkey->dk_func->from_dns_key(dkey, key_buf, key_len) < 0) { EREPORT(("dst_buffer_to_key(): dst_buffer_to_hmac failed\n")); - return (dst_free_key(dkey)); + (void) (dst_free_key(dkey)); + return (NULL); } return (dkey); } + (void) (dst_free_key(dkey)); return (NULL); } @@ -1013,11 +1015,9 @@ dst_free_key(DST_KEY *f_key) else { EREPORT(("dst_free_key(): Unknown key alg %d\n", f_key->dk_alg)); - free(f_key->dk_KEY_struct); /* SHOULD NOT happen */ } if (f_key->dk_KEY_struct) { - free(f_key->dk_KEY_struct); - f_key->dk_KEY_struct = NULL; + SAFE_FREE(f_key->dk_KEY_struct); } if (f_key->dk_key_name) SAFE_FREE(f_key->dk_key_name); diff --git a/external/bsd/dhcp/dist/dst/dst_support.c b/external/bsd/dhcp/dist/dst/dst_support.c index 0db3836da34b..509769f934e4 100644 --- a/external/bsd/dhcp/dist/dst/dst_support.c +++ b/external/bsd/dhcp/dist/dst/dst_support.c @@ -1,11 +1,12 @@ -/* $NetBSD: dst_support.c,v 1.1.1.1 2013/03/24 15:45:55 christos Exp $ */ +/* $NetBSD: dst_support.c,v 1.1.1.2 2013/03/24 22:50:34 christos Exp $ */ -static const char rcsid[] = "Header: /proj/cvs/prod/DHCP/dst/dst_support.c,v 1.6.6.1 2009-11-20 01:49:01 sar Exp "; +static const char rcsid[] = "Header: /tmp/cvstest/DHCP/dst/dst_support.c,v 1.6.6.1 2009/11/20 01:49:01 sar Exp "; /* * Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc. * Portions Copyright (c) 2007,2009 by Internet Systems Consortium, Inc. ("ISC") + * Portions Copyright (c) 2012 by Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -60,6 +61,7 @@ dst_s_conv_bignum_u8_to_b64(char *out_buf, const unsigned out_len, { const u_char *bp = bin_data; char *op = out_buf; + int res = 0; unsigned lenh = 0, len64 = 0; unsigned local_in_len = bin_len; unsigned local_out_len = out_len; @@ -83,9 +85,10 @@ dst_s_conv_bignum_u8_to_b64(char *out_buf, const unsigned out_len, local_out_len -= lenh; op += lenh; } - len64 = b64_ntop(bp, local_in_len, op, local_out_len - 2); - if (len64 < 0) + res = b64_ntop(bp, local_in_len, op, local_out_len - 2); + if (res < 0) return (-1); + len64 = (unsigned) res; op += len64++; *(op++) = '\n'; /* put CR in the output */ *op = '\0'; /* make sure output is 0 terminated */ @@ -152,6 +155,7 @@ dst_s_conv_bignum_b64_to_u8(const char **buf, unsigned blen; char *bp; u_char bstr[RAW_KEY_SIZE]; + int res = 0; if (buf == NULL || *buf == NULL) { /* error checks */ EREPORT(("dst_s_conv_bignum_b64_to_u8: null input buffer.\n")); @@ -161,12 +165,13 @@ dst_s_conv_bignum_b64_to_u8(const char **buf, if (bp != NULL) *bp = '\0'; - blen = b64_pton(*buf, bstr, sizeof(bstr)); - if (blen <= 0) { + res = b64_pton(*buf, bstr, sizeof(bstr)); + if (res <= 0) { EREPORT(("dst_s_conv_bignum_b64_to_u8: decoded value is null.\n")); return (0); } - else if (loclen < blen) { + blen = (unsigned) res; + if (loclen < blen) { EREPORT(("dst_s_conv_bignum_b64_to_u8: decoded value is longer than output buffer.\n")); return (0); } @@ -431,7 +436,7 @@ dst_s_fopen(const char *filename, const char *mode, unsigned perm) unsigned plen = sizeof(pathname); if (*dst_path != '\0') { - strcpy(pathname, dst_path); + strncpy(pathname, dst_path, PATH_MAX); plen -= strlen(pathname); } else diff --git a/external/bsd/dhcp/dist/dst/hmac_link.c b/external/bsd/dhcp/dist/dst/hmac_link.c index a60434b33f94..c9f5845fde76 100644 --- a/external/bsd/dhcp/dist/dst/hmac_link.c +++ b/external/bsd/dhcp/dist/dst/hmac_link.c @@ -1,12 +1,13 @@ -/* $NetBSD: hmac_link.c,v 1.1.1.1 2013/03/24 15:45:56 christos Exp $ */ +/* $NetBSD: hmac_link.c,v 1.1.1.2 2013/03/24 22:50:34 christos Exp $ */ #ifdef HMAC_MD5 #ifndef LINT -static const char rcsid[] = "Header: /proj/cvs/prod/DHCP/dst/hmac_link.c,v 1.5.6.1 2009-11-20 01:49:01 sar Exp "; +static const char rcsid[] = "Header: /tmp/cvstest/DHCP/dst/hmac_link.c,v 1.5.6.1 2009/11/20 01:49:01 sar Exp "; #endif /* * Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc. * Portions Copyright (c) 2007,2009 by Internet Systems Consortium, Inc. ("ISC") + * Portions Copyright (c) 2012 by Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -89,6 +90,10 @@ dst_hmac_md5_sign(const int mode, DST_KEY *d_key, void **context, int sign_len = 0; MD5_CTX *ctx = NULL; + if (d_key == NULL || d_key->dk_KEY_struct == NULL) + return (-1); + key = (HMAC_Key *) d_key->dk_KEY_struct; + if (mode & SIG_MODE_INIT) ctx = (MD5_CTX *) malloc(sizeof(*ctx)); else if (context) @@ -96,10 +101,6 @@ dst_hmac_md5_sign(const int mode, DST_KEY *d_key, void **context, if (ctx == NULL) return (-1); - if (d_key == NULL || d_key->dk_KEY_struct == NULL) - return (-1); - key = (HMAC_Key *) d_key->dk_KEY_struct; - if (mode & SIG_MODE_INIT) { MD5Init(ctx); MD5Update(ctx, key->hk_ipad, HMAC_LEN); @@ -156,6 +157,10 @@ dst_hmac_md5_verify(const int mode, DST_KEY *d_key, void **context, HMAC_Key *key; MD5_CTX *ctx = NULL; + if (d_key == NULL || d_key->dk_KEY_struct == NULL) + return (-1); + key = (HMAC_Key *) d_key->dk_KEY_struct; + if (mode & SIG_MODE_INIT) ctx = (MD5_CTX *) malloc(sizeof(*ctx)); else if (context) @@ -163,10 +168,6 @@ dst_hmac_md5_verify(const int mode, DST_KEY *d_key, void **context, if (ctx == NULL) return (-1); - if (d_key == NULL || d_key->dk_KEY_struct == NULL) - return (-1); - - key = (HMAC_Key *) d_key->dk_KEY_struct; if (mode & SIG_MODE_INIT) { MD5Init(ctx); MD5Update(ctx, key->hk_ipad, HMAC_LEN); @@ -218,8 +219,11 @@ dst_buffer_to_hmac_md5(DST_KEY *dkey, const u_char *key, const unsigned keylen) HMAC_Key *hkey = NULL; MD5_CTX ctx; unsigned local_keylen = keylen; + u_char tk[MD5_LEN]; - if (dkey == NULL || key == NULL || keylen < 0) + /* Do we need to check if keylen == 0? The original + * code didn't, so we don't currently */ + if (dkey == NULL || key == NULL) return (-1); if ((hkey = (HMAC_Key *) malloc(sizeof(HMAC_Key))) == NULL) @@ -230,7 +234,7 @@ dst_buffer_to_hmac_md5(DST_KEY *dkey, const u_char *key, const unsigned keylen) /* if key is longer than HMAC_LEN bytes reset it to key=MD5(key) */ if (keylen > HMAC_LEN) { - u_char tk[MD5_LEN]; + memset(tk, 0, sizeof(tk)); MD5Init(&ctx); MD5Update(&ctx, (const unsigned char *)key, keylen); MD5Final(tk, &ctx); @@ -271,7 +275,7 @@ dst_hmac_md5_key_to_file_format(const DST_KEY *dkey, char *buff, const unsigned buff_len) { char *bp; - int i; + int i, res; unsigned len, b_len, key_len; u_char key[HMAC_LEN]; HMAC_Key *hkey; @@ -301,9 +305,10 @@ dst_hmac_md5_key_to_file_format(const DST_KEY *dkey, char *buff, bp += strlen("Key: "); b_len = buff_len - (bp - buff); - len = b64_ntop(key, key_len, bp, b_len); - if (len < 0) + res = b64_ntop(key, key_len, bp, b_len); + if (res < 0) return (-1); + len = (unsigned) res; bp += len; *(bp++) = '\n'; *bp = '\0'; diff --git a/external/bsd/dhcp/dist/dst/prandom.c b/external/bsd/dhcp/dist/dst/prandom.c index 616ced14d3a9..184e231e9f78 100644 --- a/external/bsd/dhcp/dist/dst/prandom.c +++ b/external/bsd/dhcp/dist/dst/prandom.c @@ -1,11 +1,11 @@ -/* $NetBSD: prandom.c,v 1.1.1.1 2013/03/24 15:45:56 christos Exp $ */ +/* $NetBSD: prandom.c,v 1.1.1.2 2013/03/24 22:50:34 christos Exp $ */ #ifndef LINT -static const char rcsid[] = "Header: /proj/cvs/prod/DHCP/dst/prandom.c,v 1.8.6.1 2009-11-20 01:49:01 sar Exp "; +static const char rcsid[] = "Header: /tmp/cvstest/DHCP/dst/prandom.c,v 1.8.6.2 2012/03/09 11:28:11 tomasz Exp "; #endif /* + * Portions Copyright (c) 2007,2009,2012 by Internet Systems Consortium, Inc. ("ISC") * Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc. - * Portions Copyright (c) 2007,2009 by Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -454,12 +454,12 @@ digest_file(dst_work *work) struct timeval tv; u_char buf[1024]; + name = files[f_cnt++]; if (f_round == 0 || files[f_cnt] == NULL || work->file_digest == NULL) if (gettimeofday(&tv, NULL)) /* only do this if needed */ return (0); if (f_round == 0) /* first time called set to one hour ago */ f_round = (tv.tv_sec - MAX_OLD); - name = files[f_cnt++]; if (files[f_cnt] == NULL) { /* end of list of files */ if(f_cnt <= 1) /* list is too short */ return (0); @@ -677,8 +677,10 @@ get_hmac_key(int step, int block) new->step = step; new->block = block; new->key = new_key; - if (dst_sign_data(SIG_MODE_INIT, new_key, &new->ctx, NULL, 0, NULL, 0)) + if (dst_sign_data(SIG_MODE_INIT, new_key, &new->ctx, NULL, 0, NULL, 0)) { + SAFE_FREE(new); return (NULL); + } return (new); } @@ -696,7 +698,6 @@ own_random(dst_work *work) { int dir = 0, b; int bytes, n, cmd = 0, dig = 0; - int start =0; /* * now get the initial seed to put into the quick random function from * the address of the work structure @@ -711,7 +712,6 @@ own_random(dst_work *work) /* pick a random number in the range of 0..7 based on that random number * perform some operations that yield random data */ - start = work->filled; n = (dst_s_quick_random(bytes) >> DST_SHIFT) & 0x07; switch (n) { case 0: @@ -824,8 +824,10 @@ dst_s_random(u_char *output, unsigned size) DST_HASH_SIZE * DST_NUM_HASHES); my_work->file_digest = NULL; - if (my_work->output == NULL) + if (my_work->output == NULL) { + SAFE_FREE(my_work); return (n); + } memset(my_work->output, 0x0, my_work->needed); /* allocate upto 4 different HMAC hash functions out of order */ #if DST_NUM_HASHES >= 3 @@ -838,8 +840,17 @@ dst_s_random(u_char *output, unsigned size) my_work->hash[3] = get_hmac_key(5, DST_RANDOM_BLOCK_SIZE / 4); #endif my_work->hash[0] = get_hmac_key(1, DST_RANDOM_BLOCK_SIZE); - if (my_work->hash[0] == NULL) /* if failure bail out */ + if (my_work->hash[0] == NULL) { /* if failure bail out */ + for (i = 1; i < DST_NUM_HASHES; i++) { + if (my_work->hash[i] != NULL) { + dst_free_key(my_work->hash[i]->key); + SAFE_FREE(my_work->hash[i]); + } + } + SAFE_FREE(my_work->output); + SAFE_FREE(my_work); return (n); + } s = own_random(my_work); /* if more generated than needed store it for future use */ if (s >= my_work->needed) { @@ -849,6 +860,9 @@ dst_s_random(u_char *output, unsigned size) n += my_work->needed; /* saving unused data for next time */ unused = s - my_work->needed; + if (unused > sizeof(old_unused)) { + unused = sizeof(old_unused); + } memcpy(old_unused, &my_work->output[my_work->needed], unused); } else { @@ -860,8 +874,10 @@ dst_s_random(u_char *output, unsigned size) /* delete the allocated work area */ for (i = 0; i < DST_NUM_HASHES; i++) { - dst_free_key(my_work->hash[i]->key); - SAFE_FREE(my_work->hash[i]); + if (my_work->hash[i] != NULL) { + dst_free_key(my_work->hash[i]->key); + SAFE_FREE(my_work->hash[i]); + } } SAFE_FREE(my_work->output); SAFE_FREE(my_work); @@ -895,7 +911,7 @@ dst_s_semi_random(u_char *output, unsigned size) prand_hash *hash; unsigned out = 0; unsigned i; - int n; + int n, res; if (output == NULL || size <= 0) return (-2); @@ -944,9 +960,13 @@ dst_s_semi_random(u_char *output, unsigned size) for (n = 0; n < DST_NUMBER_OF_COUNTERS; n++) i = (int) counter[n]++; - i = dst_sign_data(SIG_MODE_ALL, my_key, NULL, + res = dst_sign_data(SIG_MODE_ALL, my_key, NULL, (u_char *) counter, hb_size, semi_old, sizeof(semi_old)); + if (res < 0) { + return res; + } + i = (unsigned) res; if (i != hb_size) EREPORT(("HMAC SIGNATURE FAILURE %d\n", i)); cnt++; diff --git a/external/bsd/dhcp/dist/includes/Makefile.in b/external/bsd/dhcp/dist/includes/Makefile.in index f397bbeaab73..04efc143dccb 100644 --- a/external/bsd/dhcp/dist/includes/Makefile.in +++ b/external/bsd/dhcp/dist/includes/Makefile.in @@ -56,6 +56,8 @@ CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ +ATF_CFLAGS = @ATF_CFLAGS@ +ATF_LDFLAGS = @ATF_LDFLAGS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ diff --git a/external/bsd/dhcp/dist/includes/arpa/nameser.h b/external/bsd/dhcp/dist/includes/arpa/nameser.h index 09a8b5e9a444..064f216113b4 100644 --- a/external/bsd/dhcp/dist/includes/arpa/nameser.h +++ b/external/bsd/dhcp/dist/includes/arpa/nameser.h @@ -1,4 +1,4 @@ -/* $NetBSD: nameser.h,v 1.1.1.1 2013/03/24 15:45:50 christos Exp $ */ +/* $NetBSD: nameser.h,v 1.1.1.2 2013/03/24 22:50:35 christos Exp $ */ /* * Copyright (c) 1983, 1989, 1993 @@ -57,7 +57,7 @@ */ /* - * Id: nameser.h,v 1.6.24.1 2009-11-20 01:49:01 sar Exp + * Id: nameser.h,v 1.6.24.1 2009/11/20 01:49:01 sar Exp */ #ifndef _ARPA_NAMESER_H_ diff --git a/external/bsd/dhcp/dist/includes/arpa/nameser_compat.h b/external/bsd/dhcp/dist/includes/arpa/nameser_compat.h index c9f05542b26f..392374e4d049 100644 --- a/external/bsd/dhcp/dist/includes/arpa/nameser_compat.h +++ b/external/bsd/dhcp/dist/includes/arpa/nameser_compat.h @@ -1,4 +1,4 @@ -/* $NetBSD: nameser_compat.h,v 1.1.1.1 2013/03/24 15:45:50 christos Exp $ */ +/* $NetBSD: nameser_compat.h,v 1.1.1.2 2013/03/24 22:50:35 christos Exp $ */ /* Copyright (c) 1983, 1989 * The Regents of the University of California. All rights reserved. @@ -34,7 +34,7 @@ /* * from nameser.h 8.1 (Berkeley) 6/2/93 - * Id: nameser_compat.h,v 1.2 2000-01-27 23:28:08 mellon Exp + * Id: nameser_compat.h,v 1.2 2000/01/27 23:28:08 mellon Exp */ #ifndef _ARPA_NAMESER_COMPAT_ diff --git a/external/bsd/dhcp/dist/includes/cdefs.h b/external/bsd/dhcp/dist/includes/cdefs.h index 60833a7ccad5..e6cfe2fe8aff 100644 --- a/external/bsd/dhcp/dist/includes/cdefs.h +++ b/external/bsd/dhcp/dist/includes/cdefs.h @@ -1,12 +1,12 @@ -/* $NetBSD: cdefs.h,v 1.1.1.1 2013/03/24 15:45:49 christos Exp $ */ +/* $NetBSD: cdefs.h,v 1.1.1.2 2013/03/24 22:50:34 christos Exp $ */ /* cdefs.h Standard C definitions... */ /* - * Copyright (c) 2011 by Internet Systems Consortium, Inc. ("ISC") - * Copyright (c) 2004,2009 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2012 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004,2009,2011 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1996-2003 by Internet Software Consortium * Copyright (c) 1995 RadioMail Corporation. All rights reserved. * @@ -48,15 +48,25 @@ * the warning by the use of void. In conjunction with the use of -Werror * these warnings prohibit the compilation of the package. This macro * allows us to assign the return value to a variable and then ignore it. + * + * __attribute__((unused)) is added for avoiding another warning about set, + * but unused variable. This is produced by unused-but-set-variable switch + * that is enabled by default in gcc 4.6. */ #if !defined(__GNUC__) || (__GNUC__ < 4) #define IGNORE_RET(x) (void) x #else #define IGNORE_RET(x) \ do { \ - int ignore_return; \ - ignore_return = x; \ + int __attribute__((unused)) ignore_return ;\ + ignore_return = x; \ } while (0) #endif +/* This macro is defined to avoid unused-but-set-variable warning + * that is enabled in gcc 4.6 + */ + +#define IGNORE_UNUSED(x) { x = x; } + #endif /* __ISC_DHCP_CDEFS_H__ */ diff --git a/external/bsd/dhcp/dist/includes/config.h.in b/external/bsd/dhcp/dist/includes/config.h.in index 2e52f7dd820c..a762e51f3716 100644 --- a/external/bsd/dhcp/dist/includes/config.h.in +++ b/external/bsd/dhcp/dist/includes/config.h.in @@ -91,6 +91,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H +/* Define to the string for a noreturn attribute. */ +#undef ISC_DHCP_NORETURN + /* Define to 1 if the system has 'struct if_laddrconf'. */ #undef ISC_PLATFORM_HAVEIF_LADDRCONF @@ -124,6 +127,9 @@ /* Define to any value to include Ari's PARANOIA patch. */ #undef PARANOIA +/* Define to correct bad byteorders in secs field. */ +#undef SECS_BYTEORDER + /* The size of `struct iaddr *', as computed by sizeof. */ #undef SIZEOF_STRUCT_IADDR_P diff --git a/external/bsd/dhcp/dist/includes/dhcp.h b/external/bsd/dhcp/dist/includes/dhcp.h index 703a8433223d..8ae756d24e04 100644 --- a/external/bsd/dhcp/dist/includes/dhcp.h +++ b/external/bsd/dhcp/dist/includes/dhcp.h @@ -1,10 +1,11 @@ -/* $NetBSD: dhcp.h,v 1.1.1.1 2013/03/24 15:45:49 christos Exp $ */ +/* $NetBSD: dhcp.h,v 1.1.1.2 2013/03/24 22:50:35 christos Exp $ */ /* dhcp.h Protocol structures... */ /* + * Copyright (c) 2011-2012 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2009 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1995-2003 by Internet Software Consortium * @@ -81,6 +82,10 @@ struct dhcp_packet { #define HTYPE_ETHER 1 /* Ethernet 10Mbps */ #define HTYPE_IEEE802 6 /* IEEE 802.2 Token Ring... */ #define HTYPE_FDDI 8 /* FDDI... */ +#define HTYPE_INFINIBAND 32 /* IP over Infiniband */ +#define HTYPE_IPMP 255 /* IPMP - random hw address - there + * is no standard for this so we + * just steal a type */ /* Magic cookie validating dhcp options field (and bootp vendor extensions field). */ diff --git a/external/bsd/dhcp/dist/includes/dhctoken.h b/external/bsd/dhcp/dist/includes/dhctoken.h index 26863bbdd346..f46807c49d01 100644 --- a/external/bsd/dhcp/dist/includes/dhctoken.h +++ b/external/bsd/dhcp/dist/includes/dhctoken.h @@ -1,11 +1,11 @@ -/* $NetBSD: dhctoken.h,v 1.1.1.1 2013/03/24 15:45:50 christos Exp $ */ +/* $NetBSD: dhctoken.h,v 1.1.1.2 2013/03/24 22:50:34 christos Exp $ */ /* dhctoken.h Tokens for config file lexer and parser. */ /* - * Copyright (c) 2004,2007-2011 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004,2007-2012 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1996-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -35,7 +35,7 @@ */ #include -__RCSID("$NetBSD: dhctoken.h,v 1.1.1.1 2013/03/24 15:45:50 christos Exp $"); +__RCSID("$NetBSD: dhctoken.h,v 1.1.1.2 2013/03/24 22:50:34 christos Exp $"); enum dhcp_token { SEMI = ';', @@ -368,7 +368,8 @@ enum dhcp_token { INITIAL_DELAY = 664, GETHOSTBYNAME = 665, PRIMARY6 = 666, - SECONDARY6 = 667 + SECONDARY6 = 667, + TOKEN_INFINIBAND = 668 }; #define is_identifier(x) ((x) >= FIRST_TOKEN && \ diff --git a/external/bsd/dhcp/dist/includes/heap.h b/external/bsd/dhcp/dist/includes/heap.h index 63c1c79388e8..e1c1063a26ab 100644 --- a/external/bsd/dhcp/dist/includes/heap.h +++ b/external/bsd/dhcp/dist/includes/heap.h @@ -1,4 +1,4 @@ -/* $NetBSD: heap.h,v 1.1.1.1 2013/03/24 15:45:49 christos Exp $ */ +/* $NetBSD: heap.h,v 1.1.1.2 2013/03/24 22:50:35 christos Exp $ */ /* * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC") @@ -17,7 +17,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* Id: heap.h,v 1.3 2007-05-19 19:16:25 dhankins Exp */ +/* Id: heap.h,v 1.3 2007/05/19 19:16:25 dhankins Exp */ #ifndef ISC_HEAP_H #define ISC_HEAP_H 1 diff --git a/external/bsd/dhcp/dist/includes/omapip/omapip_p.h b/external/bsd/dhcp/dist/includes/omapip/omapip_p.h index 9b650f2dce90..e1267b3075d7 100644 --- a/external/bsd/dhcp/dist/includes/omapip/omapip_p.h +++ b/external/bsd/dhcp/dist/includes/omapip/omapip_p.h @@ -1,4 +1,4 @@ -/* $NetBSD: omapip_p.h,v 1.1.1.1 2013/03/24 15:45:50 christos Exp $ */ +/* $NetBSD: omapip_p.h,v 1.1.1.2 2013/03/24 22:50:36 christos Exp $ */ /* omapip_p.h @@ -36,7 +36,7 @@ */ #include -__RCSID("$NetBSD: omapip_p.h,v 1.1.1.1 2013/03/24 15:45:50 christos Exp $"); +__RCSID("$NetBSD: omapip_p.h,v 1.1.1.2 2013/03/24 22:50:36 christos Exp $"); #ifndef __OMAPIP_OMAPIP_P_H__ #define __OMAPIP_OMAPIP_P_H__ @@ -294,7 +294,7 @@ extern int log_perror; extern void (*log_cleanup) (void); void log_fatal (const char *, ...) - __attribute__((__format__(__printf__,1,2))); + __attribute__((__format__(__printf__,1,2))) ISC_DHCP_NORETURN; int log_error (const char *, ...) __attribute__((__format__(__printf__,1,2))); int log_info (const char *, ...) diff --git a/external/bsd/dhcp/dist/includes/site.h b/external/bsd/dhcp/dist/includes/site.h index 95c34d20118d..9df0e52337f0 100644 --- a/external/bsd/dhcp/dist/includes/site.h +++ b/external/bsd/dhcp/dist/includes/site.h @@ -1,4 +1,4 @@ -/* $NetBSD: site.h,v 1.1.1.1 2013/03/24 15:45:50 christos Exp $ */ +/* $NetBSD: site.h,v 1.1.1.2 2013/03/24 22:50:35 christos Exp $ */ /* Site-specific definitions. @@ -229,3 +229,51 @@ future. */ #define ACCEPT_LIST_IN_DOMAIN_NAME + +/* In RFC3315 section 17.2.2 stated that if the server was not going + to be able to assign any addresses to any IAs in a subsequent Request + from a client that the server should not include any IAs. This + requirement was removed in an errata from August 2010. Define the + following if you want the pre-errata version. + You should only enable this option if you have clients that + require the original functionality. */ + +/* #define RFC3315_PRE_ERRATA_2010_08 */ + +/* In previous versions of the code when the server generates a NAK + it doesn't attempt to determine if the configuration included a + server ID for that client. Defining this option causes the server + to make a modest effort to determine the server id when building + a NAK as a response. This effort will only check the first subnet + and pool associated with a shared subnet and will not check for + host declarations. With some configurations the server id + computed for a NAK may not match that computed for an ACK. */ + +/* #define SERVER_ID_FOR_NAK */ + +/* When processing a request do a simple check to compare the + server id the client sent with the one the server would send. + In order to minimize the complexity of the code the server + only checks for a server id option in the global and subnet + scopes. Complicated configurations may result in differnet + server ids for this check and when the server id for a reply + packet is determined, which would prohibit the server from + responding. + + The primary use for this option is when a client broadcasts + a request but requires the response to come from one of the + failover peers. An example of this would be when a client + reboots while its lease is still active - in this case both + servers will normally respond. Most of the time the client + won't check the server id and can use either of the responses. + However if the client does check the server id it may reject + the response if it came from the wrong peer. If the timing + is such that the "wrong" peer responds first most of the time + the client may not get an address for some time. + + Currently this option is only available when failover is in + use. + + Care should be taken before enabling this option. */ + +/* #define SERVER_ID_CHECK */ diff --git a/external/bsd/dhcp/dist/includes/t_api.h b/external/bsd/dhcp/dist/includes/t_api.h index a90588bd7c88..ec5f7c2e6b69 100644 --- a/external/bsd/dhcp/dist/includes/t_api.h +++ b/external/bsd/dhcp/dist/includes/t_api.h @@ -1,4 +1,4 @@ -/* $NetBSD: t_api.h,v 1.1.1.1 2013/03/24 15:45:50 christos Exp $ */ +/* $NetBSD: t_api.h,v 1.1.1.2 2013/03/24 22:50:35 christos Exp $ */ /* * Copyright (C) 2004-2007,2009 Internet Systems Consortium, Inc. ("ISC") @@ -17,7 +17,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* Id: t_api.h,v 1.3.8.1 2009-11-20 01:49:01 sar Exp */ +/* Id: t_api.h,v 1.3.8.1 2009/11/20 01:49:01 sar Exp */ #ifndef TESTS_T_API_H #define TESTS_T_API_H 1 diff --git a/external/bsd/dhcp/dist/omapip/Makefile.in b/external/bsd/dhcp/dist/omapip/Makefile.in index 86716df03dbe..c629549a523a 100644 --- a/external/bsd/dhcp/dist/omapip/Makefile.in +++ b/external/bsd/dhcp/dist/omapip/Makefile.in @@ -85,6 +85,8 @@ CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ +ATF_CFLAGS = @ATF_CFLAGS@ +ATF_LDFLAGS = @ATF_LDFLAGS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ diff --git a/external/bsd/dhcp/dist/omapip/alloc.c b/external/bsd/dhcp/dist/omapip/alloc.c index 1aabd9369ed8..3eca1051638b 100644 --- a/external/bsd/dhcp/dist/omapip/alloc.c +++ b/external/bsd/dhcp/dist/omapip/alloc.c @@ -1,4 +1,4 @@ -/* $NetBSD: alloc.c,v 1.1.1.1 2013/03/24 15:45:56 christos Exp $ */ +/* $NetBSD: alloc.c,v 1.1.1.2 2013/03/24 22:50:36 christos Exp $ */ /* alloc.c @@ -6,6 +6,7 @@ protocol... */ /* + * Copyright (c) 2012 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2009-2010 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1999-2003 by Internet Software Consortium @@ -37,7 +38,7 @@ */ #include -__RCSID("$NetBSD: alloc.c,v 1.1.1.1 2013/03/24 15:45:56 christos Exp $"); +__RCSID("$NetBSD: alloc.c,v 1.1.1.2 2013/03/24 22:50:36 christos Exp $"); #include "dhcpd.h" @@ -316,7 +317,7 @@ void dmalloc_dump_outstanding () inhistory = 1; if (!noted) { log_info (" %s(%d): %ld", dp -> file, - dp -> line, dp -> size); + dp -> line, (long) dp -> size); noted = 1; } print_rc_hist_entry (i); @@ -329,7 +330,8 @@ void dmalloc_dump_outstanding () if (!inhistory) #endif log_info (" %s(%d): %ld", - dp -> file, dp -> line, dp -> size); + dp -> file, dp -> line, + (long) dp -> size); } #endif } diff --git a/external/bsd/dhcp/dist/omapip/buffer.c b/external/bsd/dhcp/dist/omapip/buffer.c index a1fc606f4cb8..c462722efa0c 100644 --- a/external/bsd/dhcp/dist/omapip/buffer.c +++ b/external/bsd/dhcp/dist/omapip/buffer.c @@ -1,11 +1,12 @@ -/* $NetBSD: buffer.c,v 1.1.1.1 2013/03/24 15:45:56 christos Exp $ */ +/* $NetBSD: buffer.c,v 1.1.1.2 2013/03/24 22:50:36 christos Exp $ */ /* buffer.c Buffer access functions for the object management protocol... */ /* - * Copyright (c) 2004,2005,2007,2009 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2009,2012 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004,2005,2007 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1999-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -35,7 +36,7 @@ */ #include -__RCSID("$NetBSD: buffer.c,v 1.1.1.1 2013/03/24 15:45:56 christos Exp $"); +__RCSID("$NetBSD: buffer.c,v 1.1.1.2 2013/03/24 22:50:36 christos Exp $"); #include "dhcpd.h" @@ -284,9 +285,7 @@ isc_result_t omapi_connection_copyin (omapi_object_t *h, int sig_flags = SIG_MODE_UPDATE; omapi_connection_object_t *c; - /* Make sure len is valid. */ - if (len < 0) - return DHCP_R_INVALIDARG; + /* no need to verify len as it's unsigned */ if (!h || h -> type != omapi_type_connection) return DHCP_R_INVALIDARG; c = (omapi_connection_object_t *)h; diff --git a/external/bsd/dhcp/dist/omapip/connection.c b/external/bsd/dhcp/dist/omapip/connection.c index 8fbe8db266b8..f77db7fd40e7 100644 --- a/external/bsd/dhcp/dist/omapip/connection.c +++ b/external/bsd/dhcp/dist/omapip/connection.c @@ -1,11 +1,11 @@ -/* $NetBSD: connection.c,v 1.1.1.1 2013/03/24 15:45:57 christos Exp $ */ +/* $NetBSD: connection.c,v 1.1.1.2 2013/03/24 22:50:36 christos Exp $ */ /* connection.c Subroutines for dealing with connections. */ /* - * Copyright (c) 2009-2011 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2009-2012 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004,2007 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1999-2003 by Internet Software Consortium * @@ -36,7 +36,7 @@ */ #include -__RCSID("$NetBSD: connection.c,v 1.1.1.1 2013/03/24 15:45:57 christos Exp $"); +__RCSID("$NetBSD: connection.c,v 1.1.1.2 2013/03/24 22:50:36 christos Exp $"); #include "dhcpd.h" @@ -401,22 +401,23 @@ static void trace_connect_input (trace_type_t *ttype, /* Find the matching connect object, if there is one. */ omapi_array_foreach_begin (omapi_connections, omapi_connection_object_t, lp) { - for (i = 0; (lp -> connect_list && - i < lp -> connect_list -> count); i++) { + for (i = 0; (lp->connect_list && + i < lp->connect_list->count); i++) { if (!memcmp (&remote.sin_addr, - &lp -> connect_list -> addresses [i].address, + &lp->connect_list->addresses[i].address, sizeof remote.sin_addr) && (ntohs (remote.sin_port) == - lp -> connect_list -> addresses [i].port)) - lp -> state = omapi_connection_connected; - lp -> remote_addr = remote; - lp -> remote_addr.sin_family = AF_INET; - omapi_addr_list_dereference (&lp -> connect_list, MDL); - lp -> index = connect_index; - status = omapi_signal_in ((omapi_object_t *)lp, - "connect"); - omapi_connection_dereference (&lp, MDL); - return; + lp->connect_list->addresses[i].port)) { + lp->state = omapi_connection_connected; + lp->remote_addr = remote; + lp->remote_addr.sin_family = AF_INET; + omapi_addr_list_dereference(&lp->connect_list, MDL); + lp->index = connect_index; + status = omapi_signal_in((omapi_object_t *)lp, + "connect"); + omapi_connection_dereference (&lp, MDL); + return; + } } } omapi_array_foreach_end (omapi_connections, omapi_connection_object_t, lp); @@ -633,7 +634,7 @@ isc_result_t omapi_connection_connect (omapi_object_t *h) static isc_result_t omapi_connection_connect_internal (omapi_object_t *h) { - int error; + int error = 0; omapi_connection_object_t *c; socklen_t sl; isc_result_t status; diff --git a/external/bsd/dhcp/dist/omapip/handle.c b/external/bsd/dhcp/dist/omapip/handle.c index 376b8c68c4ed..8d729429c2ca 100644 --- a/external/bsd/dhcp/dist/omapip/handle.c +++ b/external/bsd/dhcp/dist/omapip/handle.c @@ -1,11 +1,11 @@ -/* $NetBSD: handle.c,v 1.1.1.1 2013/03/24 15:45:57 christos Exp $ */ +/* $NetBSD: handle.c,v 1.1.1.2 2013/03/24 22:50:36 christos Exp $ */ /* handle.c Functions for maintaining handles on objects. */ /* - * Copyright (c) 2009-2010 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2009-2010,2012 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1999-2003 by Internet Software Consortium * @@ -36,7 +36,7 @@ */ #include -__RCSID("$NetBSD: handle.c,v 1.1.1.1 2013/03/24 15:45:57 christos Exp $"); +__RCSID("$NetBSD: handle.c,v 1.1.1.2 2013/03/24 22:50:36 christos Exp $"); #include "dhcpd.h" @@ -257,7 +257,6 @@ static isc_result_t omapi_handle_lookup_in (omapi_object_t **o, omapi_handle_table_t *table, int op) { - omapi_handle_table_t *inner; omapi_handle_t scale, index; if (!table || table->first > h || table->limit <= h) @@ -287,7 +286,6 @@ static isc_result_t omapi_handle_lookup_in (omapi_object_t **o, handle must be the subtable of this table whose index into this table's array of children is the handle divided by the scale. */ index = (h - table->first) / scale; - inner = table->children[index].table; return(omapi_handle_lookup_in(o, h, table->children[index].table, op)); } diff --git a/external/bsd/dhcp/dist/omapip/iscprint.c b/external/bsd/dhcp/dist/omapip/iscprint.c index 95e119c81c2f..11e8dec282e2 100644 --- a/external/bsd/dhcp/dist/omapip/iscprint.c +++ b/external/bsd/dhcp/dist/omapip/iscprint.c @@ -1,4 +1,4 @@ -/* $NetBSD: iscprint.c,v 1.1.1.1 2013/03/24 15:45:57 christos Exp $ */ +/* $NetBSD: iscprint.c,v 1.1.1.2 2013/03/24 22:50:36 christos Exp $ */ /* * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") @@ -17,7 +17,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* Id: iscprint.c,v 1.2 2005-03-17 20:30:41 dhankins Exp */ +/* Id: iscprint.c,v 1.2 2005/03/17 20:30:41 dhankins Exp */ #include "dhcpd.h" @@ -25,7 +25,7 @@ #ifndef LINT static char copyright[] = -"Id: iscprint.c,v 1.2 2005-03-17 20:30:41 dhankins Exp Copyright (c) 2004 Internet Systems Consortium, Inc. All rights reserved."; +"Id: iscprint.c,v 1.2 2005/03/17 20:30:41 dhankins Exp Copyright (c) 2004 Internet Systems Consortium, Inc. All rights reserved."; #endif #define INSIST(cond) REQUIRE(cond) diff --git a/external/bsd/dhcp/dist/omapip/listener.c b/external/bsd/dhcp/dist/omapip/listener.c index 04baf35da149..d01b984b1bc4 100644 --- a/external/bsd/dhcp/dist/omapip/listener.c +++ b/external/bsd/dhcp/dist/omapip/listener.c @@ -1,10 +1,11 @@ -/* $NetBSD: listener.c,v 1.1.1.1 2013/03/24 15:45:57 christos Exp $ */ +/* $NetBSD: listener.c,v 1.1.1.2 2013/03/24 22:50:37 christos Exp $ */ /* listener.c Subroutines that support the generic listener object. */ /* + * Copyright (c) 2012 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004,2007,2009 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1999-2003 by Internet Software Consortium * @@ -35,7 +36,7 @@ */ #include -__RCSID("$NetBSD: listener.c,v 1.1.1.1 2013/03/24 15:45:57 christos Exp $"); +__RCSID("$NetBSD: listener.c,v 1.1.1.2 2013/03/24 22:50:37 christos Exp $"); #include "dhcpd.h" @@ -88,7 +89,14 @@ isc_result_t omapi_listen_addr (omapi_object_t *h, obj = (omapi_listener_object_t *)0; status = omapi_listener_allocate (&obj, MDL); if (status != ISC_R_SUCCESS) - return status; + /* + * we could simply return here but by going to + * error_exit we keep the code check tools happy + * without removing the NULL check on obj at + * the exit, which we could skip curently but + * might want in the future. + */ + goto error_exit; obj->socket = -1; /* Connect this object to the inner object. */ @@ -129,7 +137,7 @@ isc_result_t omapi_listen_addr (omapi_object_t *h, status = ISC_R_UNEXPECTED; goto error_exit; } - + #if defined (HAVE_SETFD) if (fcntl (obj -> socket, F_SETFD, 1) < 0) { status = ISC_R_UNEXPECTED; @@ -145,7 +153,7 @@ isc_result_t omapi_listen_addr (omapi_object_t *h, status = ISC_R_UNEXPECTED; goto error_exit; } - + /* Try to bind to the wildcard address using the port number we were given. */ i = bind (obj -> socket, @@ -374,6 +382,10 @@ static void trace_listener_accept_input (trace_type_t *ttype, obj = (omapi_connection_object_t *)0; status = omapi_listener_connect (&obj, lp, 0, &remote_addr); + if (status != ISC_R_SUCCESS) { + log_error("%s:%d: OMAPI: Failed to connect " + "a listener.", MDL); + } omapi_listener_dereference (&lp, MDL); return; } diff --git a/external/bsd/dhcp/dist/omapip/protocol.c b/external/bsd/dhcp/dist/omapip/protocol.c index 0edbc86f583a..7ed67af6e41d 100644 --- a/external/bsd/dhcp/dist/omapip/protocol.c +++ b/external/bsd/dhcp/dist/omapip/protocol.c @@ -1,11 +1,12 @@ -/* $NetBSD: protocol.c,v 1.1.1.1 2013/03/24 15:45:56 christos Exp $ */ +/* $NetBSD: protocol.c,v 1.1.1.2 2013/03/24 22:50:37 christos Exp $ */ /* protocol.c Functions supporting the object management protocol... */ /* - * Copyright (c) 2004-2007,2009 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2009,2012 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1999-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -35,7 +36,7 @@ */ #include -__RCSID("$NetBSD: protocol.c,v 1.1.1.1 2013/03/24 15:45:56 christos Exp $"); +__RCSID("$NetBSD: protocol.c,v 1.1.1.2 2013/03/24 22:50:37 christos Exp $"); #include "dhcpd.h" @@ -358,7 +359,7 @@ isc_result_t omapi_protocol_signal_handler (omapi_object_t *h, omapi_protocol_object_t *p; omapi_object_t *c; omapi_message_object_t *m; - omapi_value_t *signature; + omapi_value_t *signature = NULL; u_int16_t nlen; u_int32_t vlen; u_int32_t th; @@ -684,7 +685,6 @@ isc_result_t omapi_protocol_signal_handler (omapi_object_t *h, case omapi_protocol_signature_wait: if (p -> message -> id_object) { /* Compute the signature of the message. */ - signature = (omapi_value_t *)0; status = omapi_get_value_str (c, (omapi_object_t *)0, "input-signature", &signature); @@ -711,7 +711,9 @@ isc_result_t omapi_protocol_signal_handler (omapi_object_t *h, p -> message -> authlen); if (status != ISC_R_SUCCESS) { - omapi_value_dereference (&signature, MDL); + if (signature != NULL) { + omapi_value_dereference (&signature, MDL); + } omapi_disconnect (c, 1); return ISC_R_NOMEMORY; } @@ -730,7 +732,9 @@ isc_result_t omapi_protocol_signal_handler (omapi_object_t *h, p->verify_result = DHCP_R_INVALIDKEY; } - omapi_value_dereference (&signature, MDL); + if (signature != NULL) { + omapi_value_dereference (&signature, MDL); + } /* Process the message. */ message_done: @@ -864,10 +868,10 @@ isc_result_t omapi_protocol_set_value (omapi_object_t *h, p = (omapi_protocol_object_t *)h; if (omapi_ds_strcmp (name, "default-authenticator") == 0) { - if (value -> type != omapi_datatype_object) + if (!value || value -> type != omapi_datatype_object) return DHCP_R_INVALIDARG; - if (!value || !value -> u.object) { + if (!value -> u.object) { p -> default_auth = (omapi_remote_auth_t *)0; } else { for (r = p -> remote_auth_list; r; r = r -> next) @@ -931,12 +935,10 @@ isc_result_t omapi_protocol_destroy (omapi_object_t *h, dfree (p -> default_auth, file, line); while (p -> remote_auth_list) { - omapi_remote_auth_t *r = p -> remote_auth_list -> next; - p -> remote_auth_list = r; - if (r) { - omapi_object_dereference (&r -> a, file, line); - dfree (r, file, line); - } + omapi_remote_auth_t *r = p -> remote_auth_list; + p -> remote_auth_list = p -> remote_auth_list -> next; + omapi_object_dereference (&r -> a, file, line); + dfree (r, file, line); } return ISC_R_SUCCESS; } @@ -993,7 +995,11 @@ isc_result_t omapi_protocol_configure_security (omapi_object_t *h, l -> verify_auth = verify_auth; l -> insecure = 0; - return omapi_listener_configure_security (h -> outer, verify_addr); + if (h -> outer != NULL) { + return omapi_listener_configure_security (h -> outer, verify_addr); + } else { + return DHCP_R_INVALIDARG; + } } diff --git a/external/bsd/dhcp/dist/omapip/support.c b/external/bsd/dhcp/dist/omapip/support.c index 8dbfd55279d0..1c3e956094c6 100644 --- a/external/bsd/dhcp/dist/omapip/support.c +++ b/external/bsd/dhcp/dist/omapip/support.c @@ -1,12 +1,13 @@ -/* $NetBSD: support.c,v 1.1.1.1 2013/03/24 15:45:57 christos Exp $ */ +/* $NetBSD: support.c,v 1.1.1.2 2013/03/24 22:50:37 christos Exp $ */ /* support.c Subroutines providing general support for objects. */ /* - * Copyright (c) 2004-2007,2009-2010 - * by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2012 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2009-2010 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1999-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -36,7 +37,7 @@ */ #include -__RCSID("$NetBSD: support.c,v 1.1.1.1 2013/03/24 15:45:57 christos Exp $"); +__RCSID("$NetBSD: support.c,v 1.1.1.2 2013/03/24 22:50:37 christos Exp $"); #include "dhcpd.h" @@ -557,8 +558,14 @@ isc_result_t omapi_object_update (omapi_object_t *obj, omapi_object_t *id, if (status != ISC_R_SUCCESS && status != DHCP_R_UNCHANGED) return status; } + + /* + * For now ignore the return value. I'm not sure if we want to + * generate an error if we can't set the handle value. If we + * do add a check we probably should allow unchanged and notfound + */ if (handle) - omapi_set_int_value (obj, id, "remote-handle", (int)handle); + (void) omapi_set_int_value (obj, id, "remote-handle", (int)handle); status = omapi_signal (obj, "updated"); if (status != ISC_R_NOTFOUND) return status; diff --git a/external/bsd/dhcp/dist/omapip/trace.c b/external/bsd/dhcp/dist/omapip/trace.c index 4f7bc230e08c..62ffc096fb6d 100644 --- a/external/bsd/dhcp/dist/omapip/trace.c +++ b/external/bsd/dhcp/dist/omapip/trace.c @@ -1,4 +1,4 @@ -/* $NetBSD: trace.c,v 1.1.1.1 2013/03/24 15:45:57 christos Exp $ */ +/* $NetBSD: trace.c,v 1.1.1.2 2013/03/24 22:50:37 christos Exp $ */ /* trace.c @@ -7,6 +7,7 @@ transactions... */ /* + * Copyright (c) 2012 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2009-2010 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2001-2003 by Internet Software Consortium @@ -36,7 +37,7 @@ */ #include -__RCSID("$NetBSD: trace.c,v 1.1.1.1 2013/03/24 15:45:57 christos Exp $"); +__RCSID("$NetBSD: trace.c,v 1.1.1.2 2013/03/24 22:50:37 christos Exp $"); #include "dhcpd.h" #include @@ -240,6 +241,7 @@ isc_result_t trace_write_packet_iov (trace_type_t *ttype, /* We have to swap out the data, because it may be read back on a machine of different endianness. */ + memset(&tmp, 0, sizeof(tmp)); tmp.type_index = htonl (ttype -> index); tmp.when = htonl (time ((time_t *)0)); /* XXX */ tmp.length = htonl (length); @@ -695,27 +697,30 @@ isc_result_t trace_get_file (trace_type_t *ttype, } result = trace_get_next_packet (&ttype, tpkt, buf, len, &max); + /* done with tpkt, free it */ + dfree (tpkt, MDL); if (result != ISC_R_SUCCESS) { - dfree (tpkt, MDL); - if (*buf) + if (*buf) { dfree (*buf, MDL); + *buf = NULL; + } return result; } /* Make sure the filename is right. */ if (strcmp (filename, *buf)) { log_error ("Read file %s when expecting %s", *buf, filename); + dfree (*buf, MDL); + *buf = NULL; + status = fsetpos (traceinfile, &curpos); if (status < 0) { log_error ("fsetpos in tracefile failed: %m"); - dfree (tpkt, MDL); - dfree (*buf, MDL); return DHCP_R_PROTOCOLERROR; } return ISC_R_UNEXPECTEDTOKEN; } - dfree (tpkt, MDL); return ISC_R_SUCCESS; } #endif /* TRACING */ diff --git a/external/bsd/dhcp/dist/relay/Makefile.in b/external/bsd/dhcp/dist/relay/Makefile.in index 7e8f606a8a41..68ea8e3a9c1d 100644 --- a/external/bsd/dhcp/dist/relay/Makefile.in +++ b/external/bsd/dhcp/dist/relay/Makefile.in @@ -64,6 +64,8 @@ CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ +ATF_CFLAGS = @ATF_CFLAGS@ +ATF_LDFLAGS = @ATF_LDFLAGS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ diff --git a/external/bsd/dhcp/dist/relay/dhcrelay.8 b/external/bsd/dhcp/dist/relay/dhcrelay.8 index ea904fa1de05..703ab4f496e0 100644 --- a/external/bsd/dhcp/dist/relay/dhcrelay.8 +++ b/external/bsd/dhcp/dist/relay/dhcrelay.8 @@ -1,8 +1,8 @@ -.\" $NetBSD: dhcrelay.8,v 1.1.1.1 2013/03/24 15:45:59 christos Exp $ +.\" $NetBSD: dhcrelay.8,v 1.1.1.2 2013/03/24 22:50:37 christos Exp $ .\" .\" dhcrelay.8 .\" -.\" Copyright (c) 2009-2011 by Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (c) 2009-2012 by Internet Systems Consortium, Inc. ("ISC") .\" Copyright (c) 2004,2007 by Internet Systems Consortium, Inc. ("ISC") .\" Copyright (c) 1997-2003 by Internet Software Consortium .\" @@ -30,7 +30,7 @@ .\" Support and other services are available for ISC products - see .\" https://www.isc.org for more information or to learn more about ISC. .\" -.\" Id: dhcrelay.8,v 1.16.24.3 2011-04-15 22:12:50 sar Exp +.\" Id: dhcrelay.8,v 1.16.24.4 2012/05/14 23:20:00 sar Exp .\" .TH dhcrelay 8 .SH NAME @@ -178,7 +178,7 @@ will write a pid file. .TP -a Append an agent option field to each request before forwarding it to -the server. Agent option fields in responses sent from servers to +the server. Agent option fields in responses sent from servers to clients will be stripped before forwarding such responses back to the client. The agent option field will contain two agent options: the Circuit ID suboption and the Remote ID suboption. Currently, the Circuit ID will @@ -213,6 +213,8 @@ in four ways: It may \fIappend\fR its own set of relay options to the packet, leaving the supplied option field intact; it may \fIreplace\fR the existing agent option field; it may \fIforward\fR the packet unchanged; or, it may \fIdiscard\fR it. + +To use this option you must also enable the \fB-a\fR option. .PP \fIOptions available in DHCPv6 mode only:\fR .TP diff --git a/external/bsd/dhcp/dist/server/Makefile.am b/external/bsd/dhcp/dist/server/Makefile.am index cdfaf471ffef..dc5d4f3d593c 100644 --- a/external/bsd/dhcp/dist/server/Makefile.am +++ b/external/bsd/dhcp/dist/server/Makefile.am @@ -1,6 +1,12 @@ +# We want to build this directory first, before descending into tests subdir. +# The reason is that ideally the tests should link existing objects from this +# directory. That eliminates any discrepancies between tested code and +# production code. Sadly, we are not there yet. +SUBDIRS = . tests + AM_CPPFLAGS = -I.. -DLOCALSTATEDIR='"@localstatedir@"' -dist_sysconf_DATA = dhcpd.conf +dist_sysconf_DATA = dhcpd.conf.example sbin_PROGRAMS = dhcpd dhcpd_SOURCES = dhcpd.c dhcp.c bootp.c confpars.c db.c class.c failover.c \ omapi.c mdb.c stables.c salloc.c ddns.c dhcpleasequery.c \ diff --git a/external/bsd/dhcp/dist/server/Makefile.in b/external/bsd/dhcp/dist/server/Makefile.in index 3b0426b65aa1..ea381ddfca3f 100644 --- a/external/bsd/dhcp/dist/server/Makefile.in +++ b/external/bsd/dhcp/dist/server/Makefile.in @@ -70,6 +70,13 @@ CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(dhcpd_SOURCES) DIST_SOURCES = $(dhcpd_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive man5dir = $(mandir)/man5 man8dir = $(mandir)/man8 NROFF = nroff @@ -82,11 +89,16 @@ am__vpath_adj = case $$p in \ am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; dist_sysconfDATA_INSTALL = $(INSTALL_DATA) DATA = $(dist_sysconf_DATA) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive ETAGS = etags CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ +ATF_CFLAGS = @ATF_CFLAGS@ +ATF_LDFLAGS = @ATF_LDFLAGS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -176,8 +188,14 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ + +# We want to build this directory first, before descending into tests subdir. +# The reason is that ideally the tests should link existing objects from this +# directory. That eliminates any discrepancies between tested code and +# production code. Sadly, we are not there yet. +SUBDIRS = . tests AM_CPPFLAGS = -I.. -DLOCALSTATEDIR='"@localstatedir@"' -dist_sysconf_DATA = dhcpd.conf +dist_sysconf_DATA = dhcpd.conf.example dhcpd_SOURCES = dhcpd.c dhcp.c bootp.c confpars.c db.c class.c failover.c \ omapi.c mdb.c stables.c salloc.c ddns.c dhcpleasequery.c \ dhcpv6.c mdb6.c ldap.c ldap_casa.c @@ -189,7 +207,7 @@ dhcpd_LDADD = ../common/libdhcp.a ../omapip/libomapi.a \ man_MANS = dhcpd.8 dhcpd.conf.5 dhcpd.leases.5 EXTRA_DIST = $(man_MANS) -all: all-am +all: all-recursive .SUFFIXES: .SUFFIXES: .c .o .obj @@ -632,6 +650,76 @@ uninstall-dist_sysconfDATA: rm -f "$(DESTDIR)$(sysconfdir)/$$f"; \ done +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ @@ -642,10 +730,23 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) mkid -fID $$unique tags: TAGS -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ @@ -658,7 +759,7 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $$tags $$unique; \ fi ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ @@ -705,22 +806,40 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + distdir) \ + || exit 1; \ + fi; \ + done check-am: all-am -check: check-am +check: check-recursive all-am: Makefile $(PROGRAMS) $(MANS) $(DATA) -installdirs: +installdirs: installdirs-recursive +installdirs-am: for dir in "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(sysconfdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -installcheck: installcheck-am +installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ @@ -736,58 +855,58 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -clean: clean-am +clean: clean-recursive clean-am: clean-generic clean-sbinPROGRAMS mostlyclean-am -distclean: distclean-am +distclean: distclean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags -dvi: dvi-am +dvi: dvi-recursive dvi-am: -html: html-am +html: html-recursive -info: info-am +info: info-recursive info-am: install-data-am: install-man -install-dvi: install-dvi-am +install-dvi: install-dvi-recursive install-exec-am: install-dist_sysconfDATA install-sbinPROGRAMS -install-html: install-html-am +install-html: install-html-recursive -install-info: install-info-am +install-info: install-info-recursive install-man: install-man5 install-man8 -install-pdf: install-pdf-am +install-pdf: install-pdf-recursive -install-ps: install-ps-am +install-ps: install-ps-recursive installcheck-am: -maintainer-clean: maintainer-clean-am +maintainer-clean: maintainer-clean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic -mostlyclean: mostlyclean-am +mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic -pdf: pdf-am +pdf: pdf-recursive pdf-am: -ps: ps-am +ps: ps-recursive ps-am: @@ -796,22 +915,25 @@ uninstall-am: uninstall-dist_sysconfDATA uninstall-man \ uninstall-man: uninstall-man5 uninstall-man8 -.MAKE: install-am install-strip +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-sbinPROGRAMS ctags distclean distclean-compile \ - distclean-generic distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dist_sysconfDATA install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-man5 install-man8 install-pdf install-pdf-am \ - install-ps install-ps-am install-sbinPROGRAMS install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-dist_sysconfDATA uninstall-man \ - uninstall-man5 uninstall-man8 uninstall-sbinPROGRAMS +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic \ + clean-sbinPROGRAMS ctags ctags-recursive distclean \ + distclean-compile distclean-generic distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dist_sysconfDATA \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-man5 install-man8 install-pdf \ + install-pdf-am install-ps install-ps-am install-sbinPROGRAMS \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ + ps ps-am tags tags-recursive uninstall uninstall-am \ + uninstall-dist_sysconfDATA uninstall-man uninstall-man5 \ + uninstall-man8 uninstall-sbinPROGRAMS # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/external/bsd/dhcp/dist/server/bootp.c b/external/bsd/dhcp/dist/server/bootp.c index 9aca01053751..c038a3e09b1d 100644 --- a/external/bsd/dhcp/dist/server/bootp.c +++ b/external/bsd/dhcp/dist/server/bootp.c @@ -1,11 +1,12 @@ -/* $NetBSD: bootp.c,v 1.1.1.1 2013/03/24 15:46:01 christos Exp $ */ +/* $NetBSD: bootp.c,v 1.1.1.2 2013/03/24 22:50:38 christos Exp $ */ /* bootp.c BOOTP Protocol support. */ /* - * Copyright (c) 2004,2005,2007,2009 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2009,2012 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004,2005,2007 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1995-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -35,7 +36,7 @@ */ #include -__RCSID("$NetBSD: bootp.c,v 1.1.1.1 2013/03/24 15:46:01 christos Exp $"); +__RCSID("$NetBSD: bootp.c,v 1.1.1.2 2013/03/24 22:50:38 christos Exp $"); #include "dhcpd.h" #include @@ -181,11 +182,12 @@ void bootp (packet) } /* Execute the host statements. */ - execute_statements_in_scope ((struct binding_value **)0, - packet, lease, (struct client_state *)0, - packet -> options, options, - &lease -> scope, - hp -> group, lease -> subnet -> group); + if (hp != NULL) { + execute_statements_in_scope (NULL, packet, lease, NULL, + packet->options, options, + &lease->scope, + hp->group, lease->subnet->group); + } /* Drop the request if it's not allowed for this client. */ if ((oc = lookup_option (&server_universe, options, SV_ALLOW_BOOTP)) && @@ -366,15 +368,16 @@ void bootp (packet) } /* Report what we're doing... */ - log_info ("%s", msgbuf); - log_info ("BOOTREPLY for %s to %s (%s) via %s", - piaddr (lease->ip_addr), hp -> name, - print_hw_addr (packet -> raw -> htype, - packet -> raw -> hlen, - packet -> raw -> chaddr), - packet -> raw -> giaddr.s_addr - ? inet_ntoa (packet -> raw -> giaddr) - : packet -> interface -> name); + log_info("%s", msgbuf); + log_info("BOOTREPLY for %s to %s (%s) via %s", + piaddr(lease->ip_addr), + ((hp != NULL) && (hp->name != NULL)) ? hp -> name : "unknown", + print_hw_addr (packet->raw->htype, + packet->raw->hlen, + packet->raw->chaddr), + packet->raw->giaddr.s_addr + ? inet_ntoa (packet->raw->giaddr) + : packet->interface->name); /* Set up the parts of the address that are in common. */ to.sin_family = AF_INET; @@ -389,10 +392,16 @@ void bootp (packet) to.sin_port = local_port; if (fallback_interface) { - result = send_packet (fallback_interface, - (struct packet *)0, - &raw, outgoing.packet_length, - from, &to, &hto); + result = send_packet (fallback_interface, NULL, &raw, + outgoing.packet_length, from, + &to, &hto); + if (result < 0) { + log_error ("%s:%d: Failed to send %d byte long " + "packet over %s interface.", MDL, + outgoing.packet_length, + fallback_interface->name); + } + goto out; } @@ -412,10 +421,16 @@ void bootp (packet) } errno = 0; - result = send_packet (packet -> interface, - packet, &raw, outgoing.packet_length, - from, &to, &hto); + result = send_packet(packet->interface, packet, &raw, + outgoing.packet_length, from, &to, &hto); + if (result < 0) { + log_error ("%s:%d: Failed to send %d byte long packet over %s" + " interface.", MDL, outgoing.packet_length, + packet->interface->name); + } + out: + if (options) option_state_dereference (&options, MDL); if (lease) diff --git a/external/bsd/dhcp/dist/server/class.c b/external/bsd/dhcp/dist/server/class.c index 64238b6799e8..8bbde2f11e36 100644 --- a/external/bsd/dhcp/dist/server/class.c +++ b/external/bsd/dhcp/dist/server/class.c @@ -1,11 +1,12 @@ -/* $NetBSD: class.c,v 1.1.1.1 2013/03/24 15:46:02 christos Exp $ */ +/* $NetBSD: class.c,v 1.1.1.2 2013/03/24 22:50:38 christos Exp $ */ /* class.c Handling for client classes. */ /* - * Copyright (c) 2004,2007,2009 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2009,2012 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004,2007 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1998-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -35,7 +36,7 @@ */ #include -__RCSID("$NetBSD: class.c,v 1.1.1.1 2013/03/24 15:46:02 christos Exp $"); +__RCSID("$NetBSD: class.c,v 1.1.1.2 2013/03/24 22:50:38 christos Exp $"); #include "dhcpd.h" @@ -190,7 +191,7 @@ int check_collection (packet, lease, collection) } memset (nc -> billed_leases, 0, (nc -> lease_limit * - sizeof nc -> billed_leases)); + sizeof (struct lease *))); } data_string_copy (&nc -> hash_string, &data, MDL); diff --git a/external/bsd/dhcp/dist/server/confpars.c b/external/bsd/dhcp/dist/server/confpars.c index 6b92889f2586..1e5c3a1ffb93 100644 --- a/external/bsd/dhcp/dist/server/confpars.c +++ b/external/bsd/dhcp/dist/server/confpars.c @@ -1,11 +1,11 @@ -/* $NetBSD: confpars.c,v 1.1.1.1 2013/03/24 15:46:01 christos Exp $ */ +/* $NetBSD: confpars.c,v 1.1.1.2 2013/03/24 22:50:38 christos Exp $ */ /* confpars.c Parser for dhcpd config file... */ /* - * Copyright (c) 2004-2010 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004-2012 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1995-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -35,7 +35,7 @@ */ #include -__RCSID("$NetBSD: confpars.c,v 1.1.1.1 2013/03/24 15:46:01 christos Exp $"); +__RCSID("$NetBSD: confpars.c,v 1.1.1.2 2013/03/24 22:50:38 christos Exp $"); #include "dhcpd.h" @@ -1051,7 +1051,6 @@ void parse_failover_peer (cfile, group, type) if (hba_len != 32) { parse_warn (cfile, "HBA must be exactly 32 bytes."); - dfree (hba, MDL); break; } make_hba: @@ -2128,7 +2127,7 @@ int parse_class_declaration (cp, cfile, group, type) log_fatal ("no memory for billing"); memset (class -> billed_leases, 0, (class -> lease_limit * - sizeof class -> billed_leases)); + sizeof (struct lease *))); } data_string_copy (&class -> hash_string, &data, MDL); if (!pc -> hash && @@ -2324,7 +2323,7 @@ int parse_class_declaration (cp, cfile, group, type) log_fatal ("no memory for billed leases."); memset (class -> billed_leases, 0, (class -> lease_limit * - sizeof class -> billed_leases)); + sizeof (struct lease *))); have_billing_classes = 1; parse_semi (cfile); } else { @@ -2388,7 +2387,9 @@ void parse_shared_net_declaration (cfile, group) if (status != ISC_R_SUCCESS) log_fatal ("Can't allocate shared subnet: %s", isc_result_totext (status)); - clone_group (&share -> group, group, MDL); + if (clone_group (&share -> group, group, MDL) == 0) { + log_fatal ("Can't clone group for shared net"); + } shared_network_reference (&share -> group -> shared_network, share, MDL); @@ -2729,84 +2730,83 @@ void parse_group_declaration (cfile, group) enum dhcp_token token; struct group *g; int declaration = 0; - struct group_object *t; + struct group_object *t = NULL; isc_result_t status; char *name = NULL; int deletedp = 0; int dynamicp = 0; int staticp = 0; - g = (struct group *)0; - if (!clone_group (&g, group, MDL)) - log_fatal ("no memory for explicit group."); + g = NULL; + if (!clone_group(&g, group, MDL)) + log_fatal("no memory for explicit group."); - token = peek_token (&val, (unsigned *)0, cfile); + token = peek_token(&val, NULL, cfile); if (is_identifier (token) || token == STRING) { - next_token (&val, (unsigned *)0, cfile); + next_token(&val, NULL, cfile); - name = dmalloc (strlen (val) + 1, MDL); + name = dmalloc(strlen(val) + 1, MDL); if (!name) - log_fatal ("no memory for group decl name %s", val); - strcpy (name, val); + log_fatal("no memory for group decl name %s", val); + strcpy(name, val); } - if (!parse_lbrace (cfile)) { - group_dereference (&g, MDL); + if (!parse_lbrace(cfile)) { + group_dereference(&g, MDL); return; } do { - token = peek_token (&val, (unsigned *)0, cfile); + token = peek_token(&val, NULL, cfile); if (token == RBRACE) { - token = next_token (&val, (unsigned *)0, cfile); + token = next_token(&val, NULL, cfile); break; } else if (token == END_OF_FILE) { - token = next_token (&val, (unsigned *)0, cfile); - parse_warn (cfile, "unexpected end of file"); + token = next_token(&val, NULL, cfile); + parse_warn(cfile, "unexpected end of file"); break; } else if (token == TOKEN_DELETED) { - token = next_token (&val, (unsigned *)0, cfile); - parse_semi (cfile); + token = next_token(&val, NULL, cfile); + parse_semi(cfile); deletedp = 1; } else if (token == DYNAMIC) { - token = next_token (&val, (unsigned *)0, cfile); - parse_semi (cfile); + token = next_token(&val, NULL, cfile); + parse_semi(cfile); dynamicp = 1; } else if (token == STATIC) { - token = next_token (&val, (unsigned *)0, cfile); - parse_semi (cfile); + token = next_token(&val, NULL, cfile); + parse_semi(cfile); staticp = 1; } - declaration = parse_statement (cfile, g, GROUP_DECL, - (struct host_decl *)0, - declaration); + declaration = parse_statement(cfile, g, GROUP_DECL, + NULL, declaration); } while (1); if (name) { if (deletedp) { if (group_name_hash) { - t = (struct group_object *)0; - if (group_hash_lookup (&t, group_name_hash, - name, - strlen (name), MDL)) { - delete_group (t, 0); + t = NULL; + if (group_hash_lookup(&t, group_name_hash, + name, + strlen(name), MDL)) { + delete_group(t, 0); } } } else { - t = (struct group_object *)0; - status = group_object_allocate (&t, MDL); + t = NULL; + status = group_object_allocate(&t, MDL); if (status != ISC_R_SUCCESS) - log_fatal ("no memory for group decl %s: %s", - val, isc_result_totext (status)); - group_reference (&t -> group, g, MDL); - t -> name = name; - t -> flags = ((staticp ? GROUP_OBJECT_STATIC : 0) | - (dynamicp ? GROUP_OBJECT_DYNAMIC : 0) | - (deletedp ? GROUP_OBJECT_DELETED : 0)); - supersede_group (t, 0); + log_fatal("no memory for group decl %s: %s", + val, isc_result_totext(status)); + group_reference(&t->group, g, MDL); + t->name = name; + /* no need to include deletedp as it's handled above */ + t->flags = ((staticp ? GROUP_OBJECT_STATIC : 0) | + (dynamicp ? GROUP_OBJECT_DYNAMIC : 0)); + supersede_group(t, 0); } - if (t) - group_object_dereference (&t, MDL); + if (t != NULL) + group_object_dereference(&t, MDL); } } @@ -4446,21 +4446,39 @@ parse_ia_na_declaration(struct parse *cfile) { binding_scope_dereference(&scope, MDL); } - /* add to our various structures */ - ia_add_iasubopt(ia, iaaddr, MDL); - ia_reference(&iaaddr->ia, ia, MDL); + /* find the pool this address is in */ pool = NULL; if (find_ipv6_pool(&pool, D6O_IA_NA, &iaaddr->addr) != ISC_R_SUCCESS) { inet_ntop(AF_INET6, &iaaddr->addr, addr_buf, sizeof(addr_buf)); - parse_warn(cfile, "no pool found for address %s", + parse_warn(cfile, "no pool found for address %s", addr_buf); return; } - add_lease6(pool, iaaddr, end_time); - ipv6_pool_dereference(&pool, MDL); + + /* remove old information */ + if (cleanup_lease6(ia_na_active, pool, + iaaddr, ia) != ISC_R_SUCCESS) { + inet_ntop(AF_INET6, &iaaddr->addr, + addr_buf, sizeof(addr_buf)); + parse_warn(cfile, "duplicate na lease for address %s", + addr_buf); + } + + /* + * if we like the lease we add it to our various structues + * otherwise we leave it and it will get cleaned when we + * do the iasubopt_dereference. + */ + if ((state == FTS_ACTIVE) || (state == FTS_ABANDONED)) { + ia_add_iasubopt(ia, iaaddr, MDL); + ia_reference(&iaaddr->ia, ia, MDL); + add_lease6(pool, iaaddr, end_time); + } + iasubopt_dereference(&iaaddr, MDL); + ipv6_pool_dereference(&pool, MDL); } /* @@ -4809,19 +4827,37 @@ parse_ia_ta_declaration(struct parse *cfile) { binding_scope_dereference(&scope, MDL); } - /* add to our various structures */ - ia_add_iasubopt(ia, iaaddr, MDL); - ia_reference(&iaaddr->ia, ia, MDL); + /* find the pool this address is in */ pool = NULL; if (find_ipv6_pool(&pool, D6O_IA_TA, &iaaddr->addr) != ISC_R_SUCCESS) { inet_ntop(AF_INET6, &iaaddr->addr, addr_buf, sizeof(addr_buf)); - parse_warn(cfile, "no pool found for address %s", + parse_warn(cfile, "no pool found for address %s", addr_buf); return; } - add_lease6(pool, iaaddr, end_time); + + /* remove old information */ + if (cleanup_lease6(ia_ta_active, pool, + iaaddr, ia) != ISC_R_SUCCESS) { + inet_ntop(AF_INET6, &iaaddr->addr, + addr_buf, sizeof(addr_buf)); + parse_warn(cfile, "duplicate ta lease for address %s", + addr_buf); + } + + /* + * if we like the lease we add it to our various structues + * otherwise we leave it and it will get cleaned when we + * do the iasubopt_dereference. + */ + if ((state == FTS_ACTIVE) || (state == FTS_ABANDONED)) { + ia_add_iasubopt(ia, iaaddr, MDL); + ia_reference(&iaaddr->ia, ia, MDL); + add_lease6(pool, iaaddr, end_time); + } + ipv6_pool_dereference(&pool, MDL); iasubopt_dereference(&iaaddr, MDL); } @@ -5173,19 +5209,37 @@ parse_ia_pd_declaration(struct parse *cfile) { binding_scope_dereference(&scope, MDL); } - /* add to our various structures */ - ia_add_iasubopt(ia, iapref, MDL); - ia_reference(&iapref->ia, ia, MDL); + /* find the pool this address is in */ pool = NULL; if (find_ipv6_pool(&pool, D6O_IA_PD, &iapref->addr) != ISC_R_SUCCESS) { inet_ntop(AF_INET6, &iapref->addr, addr_buf, sizeof(addr_buf)); - parse_warn(cfile, "no pool found for address %s", + parse_warn(cfile, "no pool found for address %s", addr_buf); return; } - add_lease6(pool, iapref, end_time); + + /* remove old information */ + if (cleanup_lease6(ia_pd_active, pool, + iapref, ia) != ISC_R_SUCCESS) { + inet_ntop(AF_INET6, &iapref->addr, + addr_buf, sizeof(addr_buf)); + parse_warn(cfile, "duplicate pd lease for address %s", + addr_buf); + } + + /* + * if we like the lease we add it to our various structues + * otherwise we leave it and it will get cleaned when we + * do the iasubopt_dereference. + */ + if ((state == FTS_ACTIVE) || (state == FTS_ABANDONED)) { + ia_add_iasubopt(ia, iapref, MDL); + ia_reference(&iapref->ia, ia, MDL); + add_lease6(pool, iapref, end_time); + } + ipv6_pool_dereference(&pool, MDL); iasubopt_dereference(&iapref, MDL); } diff --git a/external/bsd/dhcp/dist/server/db.c b/external/bsd/dhcp/dist/server/db.c index b3b272e2d4e1..23287c875244 100644 --- a/external/bsd/dhcp/dist/server/db.c +++ b/external/bsd/dhcp/dist/server/db.c @@ -1,11 +1,11 @@ -/* $NetBSD: db.c,v 1.1.1.1 2013/03/24 15:46:01 christos Exp $ */ +/* $NetBSD: db.c,v 1.1.1.2 2013/03/24 22:50:39 christos Exp $ */ /* db.c Persistent database management routines for DHCPD... */ /* - * Copyright (c) 2004-2010 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004-2010,2012 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1995-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -35,12 +35,14 @@ */ #include -__RCSID("$NetBSD: db.c,v 1.1.1.1 2013/03/24 15:46:01 christos Exp $"); +__RCSID("$NetBSD: db.c,v 1.1.1.2 2013/03/24 22:50:39 christos Exp $"); #include "dhcpd.h" #include #include +#define LEASE_REWRITE_PERIOD 3600 + static isc_result_t write_binding_scope(FILE *db_file, struct binding *bnd, char *prepend); @@ -69,10 +71,9 @@ write_binding_scope(FILE *db_file, struct binding *bnd, char *prepend) { errno = 0; fprintf(db_file, "%sset %s = \"%s\";", prepend, bnd->name, s); + dfree(s, MDL); if (errno) return ISC_R_FAILURE; - - dfree(s, MDL); } else { return ISC_R_FAILURE; } @@ -1007,7 +1008,7 @@ int commit_leases () /* If we haven't rewritten the lease database in over an hour, rewrite it now. (The length of time should probably be configurable. */ - if (count && cur_time - write_time > 3600) { + if (count && cur_time - write_time > LEASE_REWRITE_PERIOD) { count = 0; write_time = cur_time; new_lease_file (); @@ -1015,6 +1016,21 @@ int commit_leases () return 1; } +/* + * rewrite the lease file about once an hour + * This is meant as a quick patch for ticket 24887. It allows + * us to rotate the v6 lease file without adding too many fsync() + * calls. In the future wes should revisit this area and add + * something similar to the delayed ack code for v4. + */ +int commit_leases_timed() +{ + if ((count != 0) && (cur_time - write_time > LEASE_REWRITE_PERIOD)) { + return (commit_leases()); + } + return (1); +} + void db_startup (testp) int testp; { @@ -1026,7 +1042,11 @@ void db_startup (testp) /* Read in the existing lease file... */ status = read_conf_file (path_dhcpd_db, (struct group *)0, 0, 1); - /* XXX ignore status? */ + if (status != ISC_R_SUCCESS) { + /* XXX ignore status? */ + ; + } + #if defined (TRACING) } #endif diff --git a/external/bsd/dhcp/dist/server/dhcp.c b/external/bsd/dhcp/dist/server/dhcp.c index e14d703cdac7..30e683925c2c 100644 --- a/external/bsd/dhcp/dist/server/dhcp.c +++ b/external/bsd/dhcp/dist/server/dhcp.c @@ -1,11 +1,11 @@ -/* $NetBSD: dhcp.c,v 1.1.1.1 2013/03/24 15:46:01 christos Exp $ */ +/* $NetBSD: dhcp.c,v 1.1.1.2 2013/03/24 22:50:40 christos Exp $ */ /* dhcp.c DHCP Protocol engine. */ /* - * Copyright (c) 2004-2011 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004-2012 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1995-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -35,7 +35,7 @@ */ #include -__RCSID("$NetBSD: dhcp.c,v 1.1.1.1 2013/03/24 15:46:01 christos Exp $"); +__RCSID("$NetBSD: dhcp.c,v 1.1.1.2 2013/03/24 22:50:40 christos Exp $"); #include "dhcpd.h" #include @@ -424,7 +424,6 @@ void dhcprequest (packet, ms_nulltp, ip_lease) #if defined (FAILOVER_PROTOCOL) dhcp_failover_state_t *peer; #endif - int have_server_identifier = 0; int have_requested_addr = 0; oc = lookup_option (&dhcp_universe, packet -> options, @@ -478,9 +477,10 @@ void dhcprequest (packet, ms_nulltp, ip_lease) * safe. */ sprintf (smbuf, " (%s)", piaddr (sip)); - have_server_identifier = 1; - } else + } else { smbuf [0] = 0; + sip.len = 0; + } /* %Audit% This is log output. %2004.06.17,Safe% * If we truncate we hope the user can get a hint from the log. @@ -561,6 +561,27 @@ void dhcprequest (packet, ms_nulltp, ip_lease) goto out; } +#if defined(SERVER_ID_CHECK) + /* Do a quick check on the server source address to see if + it is ours. sip is the incoming servrer id. To avoid + problems with confused clients we do some sanity checks + to verify sip's length and that it isn't all zeros. + We then get the server id we would likely use for this + packet and compare them. If they don't match it we assume + we didn't send the offer and so we don't process the request. + */ + + if ((sip.len == 4) && + (memcmp(sip.iabuf, "\0\0\0\0", sip.len) != 0)) { + struct in_addr from; + setup_server_source_address(&from, NULL, packet); + if (memcmp(sip.iabuf, &from, sip.len) != 0) { + log_debug("%s: not our server id", msgbuf); + goto out; + } + } +#endif /* if defined(SERVER_ID_CHECK) */ + /* At this point it's possible that we will get a broadcast DHCPREQUEST for a lease that we didn't offer, because both we and the peer are in a position to offer it. @@ -974,6 +995,8 @@ void dhcpinform (packet, ms_nulltp) struct sockaddr_in to; struct in_addr from; isc_boolean_t zeroed_ciaddr; + struct interface_info *interface; + int result; /* The client should set ciaddr to its IP address, but apparently it's common for clients not to do this, so we'll use their IP @@ -1144,7 +1167,7 @@ void dhcpinform (packet, ms_nulltp) option_cache_dereference (&oc, MDL); } - get_server_source_address(&from, options, packet); + get_server_source_address(&from, options, options, packet); /* Use the subnet mask from the subnet declaration if no other mask has been provided. */ @@ -1174,7 +1197,7 @@ void dhcpinform (packet, ms_nulltp) packet -> options, options, &global_scope, oc, MDL)) { struct universe *u = (struct universe *)0; - + if (!universe_hash_lookup (&u, universe_hash, (const char *)d1.data, d1.len, MDL)) { @@ -1319,10 +1342,17 @@ void dhcpinform (packet, ms_nulltp) packet->interface->name); errno = 0; - send_packet ((fallback_interface - ? fallback_interface : packet -> interface), - &outgoing, &raw, outgoing.packet_length, - from, &to, (struct hardware *)0); + interface = (fallback_interface ? fallback_interface + : packet -> interface); + result = send_packet(interface, &outgoing, &raw, + outgoing.packet_length, from, &to, NULL); + if (result < 0) { + log_error ("%s:%d: Failed to send %d byte long packet over %s " + "interface.", MDL, outgoing.packet_length, + interface->name); + } + + if (subnet) subnet_dereference (&subnet, MDL); } @@ -1384,8 +1414,23 @@ void nak_lease (packet, cip) &i, 0, MDL); save_option (&dhcp_universe, options, oc); option_cache_dereference (&oc, MDL); - - get_server_source_address(&from, options, packet); + + /* + * If we are configured to do so we try to find a server id + * option even for NAKS by calling setup_server_source_address(). + * This function will set up an options list from the global + * and subnet scopes before trying to get the source address. + * + * Otherwise we simply call get_server_source_address() + * directly, without a server options list, this means + * we'll get the source address from the interface address. + */ +#if defined(SERVER_ID_FOR_NAK) + setup_server_source_address(&from, options, packet); +#else + get_server_source_address(&from, NULL, options, packet); +#endif /* if defined(SERVER_ID_FOR_NAK) */ + /* If there were agent options in the incoming packet, return * them. We do not check giaddr to detect the presence of a @@ -1469,6 +1514,13 @@ void nak_lease (packet, cip) result = send_packet(fallback_interface, packet, &raw, outgoing.packet_length, from, &to, NULL); + if (result < 0) { + log_error ("%s:%d: Failed to send %d byte long " + "packet over %s interface.", MDL, + outgoing.packet_length, + fallback_interface->name); + } + return; } } else { @@ -1479,6 +1531,12 @@ void nak_lease (packet, cip) errno = 0; result = send_packet(packet->interface, packet, &raw, outgoing.packet_length, from, &to, NULL); + if (result < 0) { + log_error ("%s:%d: Failed to send %d byte long packet over %s " + "interface.", MDL, outgoing.packet_length, + packet->interface->name); + } + } void ack_lease (packet, lease, offer, when, msg, ms_nulltp, hp) @@ -2468,7 +2526,7 @@ void ack_lease (packet, lease, offer, when, msg, ms_nulltp, hp) offer == DHCPACK, offer == DHCPACK)) { #else /* defined(DELAYED_ACK) */ /* Install the new information on 'lt' onto the lease at - * 'lease'.  We will not 'commit' this information to disk + * 'lease'. We will not 'commit' this information to disk * yet (fsync()), we will 'propogate' the information if * this is BOOTP or a DHCPACK, but we will not 'pimmediate'ly * transmit failover binding updates (this is delayed until @@ -2553,10 +2611,10 @@ void ack_lease (packet, lease, offer, when, msg, ms_nulltp, hp) if (oc -> option) option_reference(&(noc->option), oc->option, MDL); - } - save_option (&dhcp_universe, state -> options, noc); - option_cache_dereference (&noc, MDL); + save_option (&dhcp_universe, state -> options, noc); + option_cache_dereference (&noc, MDL); + } } /* Now, if appropriate, put in DHCP-specific options that @@ -2576,7 +2634,8 @@ void ack_lease (packet, lease, offer, when, msg, ms_nulltp, hp) option_cache_dereference (&oc, MDL); } - get_server_source_address(&from, state->options, packet); + get_server_source_address(&from, state->options, + state->options, packet); memcpy(state->from.iabuf, &from, sizeof(from)); state->from.len = sizeof(from); @@ -3169,11 +3228,16 @@ void dhcp_reply (lease) to.sin_port = remote_port; /* For debugging. */ if (fallback_interface) { - result = send_packet (fallback_interface, - (struct packet *)0, - &raw, packet_length, - raw.siaddr, &to, - (struct hardware *)0); + result = send_packet(fallback_interface, NULL, &raw, + packet_length, raw.siaddr, &to, + NULL); + if (result < 0) { + log_error ("%s:%d: Failed to send %d byte long " + "packet over %s interface.", MDL, + packet_length, + fallback_interface->name); + } + free_lease_state (state, MDL); lease -> state = (struct lease_state *)0; @@ -3202,11 +3266,16 @@ void dhcp_reply (lease) to.sin_port = remote_port; if (fallback_interface) { - result = send_packet (fallback_interface, - (struct packet *)0, - &raw, packet_length, - raw.siaddr, &to, - (struct hardware *)0); + result = send_packet(fallback_interface, NULL, &raw, + packet_length, raw.siaddr, &to, + NULL); + if (result < 0) { + log_error("%s:%d: Failed to send %d byte long" + " packet over %s interface.", MDL, + packet_length, + fallback_interface->name); + } + free_lease_state (state, MDL); lease -> state = (struct lease_state *)0; return; @@ -3231,10 +3300,14 @@ void dhcp_reply (lease) memcpy (&from, state -> from.iabuf, sizeof from); - result = send_packet (state -> ip, - (struct packet *)0, &raw, packet_length, - from, &to, - unicastp ? &hto : (struct hardware *)0); + result = send_packet(state->ip, NULL, &raw, packet_length, + from, &to, unicastp ? &hto : NULL); + if (result < 0) { + log_error ("%s:%d: Failed to send %d byte long " + "packet over %s interface.", MDL, + packet_length, state->ip->name); + } + /* Free all of the entries in the option_state structure now that we're done with them. */ @@ -4331,23 +4404,47 @@ int locate_network (packet) /* * Try to figure out the source address to send packets from. * - * If the packet we received specified the server address, then we - * will use that. + * from is the address structure we use to return any address + * we find. * - * Otherwise, use the first address from the interface. If we do - * this, we also save this into the option cache as the server - * address. + * options is the option cache to search. This may include + * options from the incoming packet and configuration information. + * + * out_options is the outgoing option cache. This cache + * may be the same as options. If send_options isn't NULL + * we may save the server address option into it. We do so + * if send_options is different than options or if the option + * wasn't in options and we needed to find the address elsewhere. + * + * packet is the state structure for the incoming packet + * + * When finding the address we first check to see if it is + * in the options list. If it isn't we use the first address + * from the interface. + * + * While this is slightly more complicated than I'd like it allows + * us to use the same code in several different places. ack, + * inform and lease query use it to find the address and fill + * in the options if we get the address from the interface. + * nack uses it to find the address and copy it to the outgoing + * cache. dhcprequest uses it to find the address for comparison + * and doesn't need to add it to an outgoing list. */ + void get_server_source_address(struct in_addr *from, struct option_state *options, + struct option_state *out_options, struct packet *packet) { unsigned option_num; - struct option_cache *oc; + struct option_cache *oc = NULL; struct data_string d; - struct in_addr *a; + struct in_addr *a = NULL; + isc_boolean_t found = ISC_FALSE; + int allocate = 0; memset(&d, 0, sizeof(d)); + memset(from, 0, sizeof(*from)); option_num = DHO_DHCP_SERVER_IDENTIFIER; oc = lookup_option(&dhcp_universe, options, option_num); @@ -4356,32 +4453,111 @@ get_server_source_address(struct in_addr *from, packet->options, options, &global_scope, oc, MDL)) { if (d.len == sizeof(*from)) { + found = ISC_TRUE; memcpy(from, d.data, sizeof(*from)); - data_string_forget(&d, MDL); - return; + + /* + * Arrange to save a copy of the data + * to the outgoing list. + */ + if ((out_options != NULL) && + (options != out_options)) { + a = from; + allocate = 1; + } } data_string_forget(&d, MDL); } oc = NULL; } - if (packet->interface->address_count > 0) { - if (option_cache_allocate(&oc, MDL)) { - a = &packet->interface->addresses[0]; - if (make_const_data(&oc->expression, - (unsigned char *)a, sizeof(*a), - 0, 0, MDL)) { - option_code_hash_lookup(&oc->option, - dhcp_universe.code_hash, - &option_num, 0, MDL); - save_option(&dhcp_universe, options, oc); - } - option_cache_dereference(&oc, MDL); - } + if ((found == ISC_FALSE) && + (packet->interface->address_count > 0)) { *from = packet->interface->addresses[0]; - } else { - memset(from, 0, sizeof(*from)); + + if (out_options != NULL) { + a = &packet->interface->addresses[0]; + } } + + if ((a != NULL) && + (option_cache_allocate(&oc, MDL))) { + if (make_const_data(&oc->expression, + (unsigned char *)a, sizeof(*a), + 0, allocate, MDL)) { + option_code_hash_lookup(&oc->option, + dhcp_universe.code_hash, + &option_num, 0, MDL); + save_option(&dhcp_universe, out_options, oc); + } + option_cache_dereference(&oc, MDL); + } + + return; +} + +/* + * Set up an option state list to try and find a server option. + * We don't go through all possible options - in particualr we + * skip the hosts and we don't include the lease to avoid + * making changes to it. This means that we won't get the + * correct server id if the admin puts them on hosts or + * builds the server id with information from the lease. + * + * As this is a fallback function (used to handle NAKs or + * sort out server id mismatch in failover) and requires + * configuration by the admin, it should be okay. + */ + +void +setup_server_source_address(struct in_addr *from, + struct option_state *options, + struct packet *packet) { + + struct option_state *sid_options = NULL; + + if (packet->shared_network != NULL) { + option_state_allocate (&sid_options, MDL); + + /* + * If we have a subnet and group start with that else start + * with the shared network group. The first will recurse and + * include the second. + */ + if ((packet->shared_network->subnets != NULL) && + (packet->shared_network->subnets->group != NULL)) { + execute_statements_in_scope(NULL, packet, NULL, NULL, + packet->options, sid_options, + &global_scope, + packet->shared_network->subnets->group, + NULL); + } else { + execute_statements_in_scope(NULL, packet, NULL, NULL, + packet->options, sid_options, + &global_scope, + packet->shared_network->group, + NULL); + } + + /* do the pool if there is one */ + if (packet->shared_network->pools != NULL) { + execute_statements_in_scope(NULL, packet, NULL, NULL, + packet->options, sid_options, + &global_scope, + packet->shared_network->pools->group, + packet->shared_network->group); + } + + /* currently we don't bother with classes or hosts as + * neither seems to be useful in this case */ + } + + /* Make the call to get the server address */ + get_server_source_address(from, sid_options, options, packet); + + /* get rid of the option cache */ + if (sid_options != NULL) + option_state_dereference(&sid_options, MDL); } /* diff --git a/external/bsd/dhcp/dist/server/dhcpd.8 b/external/bsd/dhcp/dist/server/dhcpd.8 index b902cde31fae..0b2ebc2c016b 100644 --- a/external/bsd/dhcp/dist/server/dhcpd.8 +++ b/external/bsd/dhcp/dist/server/dhcpd.8 @@ -1,8 +1,8 @@ -.\" $NetBSD: dhcpd.8,v 1.1.1.1 2013/03/24 15:46:05 christos Exp $ +.\" $NetBSD: dhcpd.8,v 1.1.1.2 2013/03/24 22:50:40 christos Exp $ .\" .\" dhcpd.8 .\" -.\" Copyright (c) 2009-2011 by Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (c) 2009-2012 by Internet Systems Consortium, Inc. ("ISC") .\" Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC") .\" Copyright (c) 1996-2003 by Internet Software Consortium .\" @@ -30,7 +30,7 @@ .\" Support and other services are available for ISC products - see .\" https://www.isc.org for more information or to learn more about ISC. .\" -.\" Id: dhcpd.8,v 1.30.24.5 2011-05-20 14:33:28 tomasz Exp +.\" Id: dhcpd.8,v 1.30.24.5 2011/05/20 14:33:28 tomasz Exp .\" .TH dhcpd 8 .SH NAME @@ -107,7 +107,7 @@ functionality, with certain restrictions. .PP The DHCP protocol allows a host which is unknown to the network administrator to be automatically assigned a new IP address out of a -pool of IP addresses for its network. In order for this to work, the +pool of IP addresses for its network. In order for this to work, the network administrator allocates address pools in each subnet and enters them into the dhcpd.conf(5) file. .PP @@ -132,30 +132,30 @@ address. .PP In order to keep track of leases across system reboots and server restarts, dhcpd keeps a list of leases it has assigned in the -dhcpd.leases(5) file. Before dhcpd grants a lease to a host, it +dhcpd.leases(5) file. Before dhcpd grants a lease to a host, it records the lease in this file and makes sure that the contents of the -file are flushed to disk. This ensures that even in the event of a +file are flushed to disk. This ensures that even in the event of a system crash, dhcpd will not forget about a lease that it has -assigned. On startup, after reading the dhcpd.conf file, dhcpd +assigned. On startup, after reading the dhcpd.conf file, dhcpd reads the dhcpd.leases file to refresh its memory about what leases have been assigned. .PP New leases are appended to the end of the dhcpd.leases -file. In order to prevent the file from becoming arbitrarily large, +file. In order to prevent the file from becoming arbitrarily large, from time to time dhcpd creates a new dhcpd.leases file from its in-core lease database. Once this file has been written to disk, the old file is renamed .IR dhcpd.leases~ , -and the new file is renamed dhcpd.leases. If the system crashes in +and the new file is renamed dhcpd.leases. If the system crashes in the middle of this process, whichever dhcpd.leases file remains will contain all the lease information, so there is no need for a special crash recovery process. .PP BOOTP support is also provided by this server. Unlike DHCP, the BOOTP protocol does not provide a protocol for recovering -dynamically-assigned addresses once they are no longer needed. It is +dynamically-assigned addresses once they are no longer needed. It is still possible to dynamically assign addresses to BOOTP clients, but -some administrative process for reclaiming addresses is required. By +some administrative process for reclaiming addresses is required. By default, leases are granted to BOOTP clients in perpetuity, although the network administrator may set an earlier cutoff date or a shorter lease length for BOOTP leases if that makes sense. @@ -165,18 +165,18 @@ simply provide a declaration in the dhcpd.conf file for each BOOTP client, permanently assigning an address to each client. .PP Whenever changes are made to the dhcpd.conf file, dhcpd must be -restarted. To restart dhcpd, send a SIGTERM (signal 15) to the +restarted. To restart dhcpd, send a SIGTERM (signal 15) to the process ID contained in .IR RUNDIR/dhcpd.pid , and then re-invoke dhcpd. Because the DHCP server database is not as lightweight as a BOOTP database, dhcpd does not automatically restart itself when it sees a change to the dhcpd.conf file. .PP -Note: We get a lot of complaints about this. We realize that it would +Note: We get a lot of complaints about this. We realize that it would be nice if one could send a SIGHUP to the server and have it reload -the database. This is not technically impossible, but it would +the database. This is not technically impossible, but it would require a great deal of work, our resources are extremely limited, and -they can be better spent elsewhere. So please don't complain about +they can be better spent elsewhere. So please don't complain about this on the mailing list unless you're prepared to fund a project to implement this feature, or prepared to do it yourself. .SH COMMAND LINE @@ -225,7 +225,7 @@ out of inittab on System V systems. Send log messages to the standard error descriptor. This can be useful for debugging, and also at sites where a complete log of all dhcp activity must be kept but syslogd is not -reliable or otherwise cannot be used. Normally, +reliable or otherwise cannot be used. Normally, .B dhcpd will log all output using the \fBsyslog(3)\fR function with the log facility set to @@ -242,13 +242,13 @@ from a system startup script (e.g., /etc/rc). .BI \-t Test the configuration file. The server tests the configuration file for correct syntax, but will not attempt to perform any network -operations. This can be used to test a new configuration file +operations. This can be used to test a new configuration file automatically before installing it. .TP .BI \-T Test the lease file. The server tests the lease file for correct syntax, but will not attempt to perform any network -operations. This can be used to test a new leaes file +operations. This can be used to test a new leaes file automatically before installing it. .TP .BI \-tf \ tracefile @@ -295,17 +295,17 @@ will write a pid file. If the program is invoked with this option it will not check for an existing server process. .PP .SH CONFIGURATION -The syntax of the dhcpd.conf(5) file is discussed separately. This +The syntax of the dhcpd.conf(5) file is discussed separately. This section should be used as an overview of the configuration process, and the dhcpd.conf(5) documentation should be consulted for detailed reference information. .PP .SH Subnets dhcpd needs to know the subnet numbers and netmasks of all subnets for -which it will be providing service. In addition, in order to +which it will be providing service. In addition, in order to dynamically allocate addresses, it must be assigned one or more ranges of addresses on each subnet which it can in turn assign to client -hosts as they boot. Thus, a very simple configuration providing DHCP +hosts as they boot. Thus, a very simple configuration providing DHCP support might look like this: .nf .sp 1 @@ -329,21 +329,21 @@ subnet statement must appear. .PP .SH Lease Lengths DHCP leases can be assigned almost any length from zero seconds to -infinity. What lease length makes sense for any given subnet, or for +infinity. What lease length makes sense for any given subnet, or for any given installation, will vary depending on the kinds of hosts being served. .PP For example, in an office environment where systems are added from time to time and removed from time to time, but move relatively infrequently, it might make sense to allow lease times of a month or -more. In a final test environment on a manufacturing floor, it may +more. In a final test environment on a manufacturing floor, it may make more sense to assign a maximum lease length of 30 minutes - enough time to go through a simple test procedure on a network appliance before packaging it up for delivery. .PP It is possible to specify two lease lengths: the default length that will be assigned if a client doesn't ask for any particular lease -length, and a maximum lease length. These are specified as clauses +length, and a maximum lease length. These are specified as clauses to the subnet command: .nf .sp 1 @@ -356,7 +356,7 @@ to the subnet command: .PP This particular subnet declaration specifies a default lease time of 600 seconds (ten minutes), and a maximum lease time of 7200 seconds -(two hours). Other common values would be 86400 (one day), 604800 +(two hours). Other common values would be 86400 (one day), 604800 (one week) and 2592000 (30 days). .PP Each subnet need not have the same lease\(emin the case of an office @@ -365,10 +365,10 @@ server, it might make sense to have widely disparate values for default and maximum lease times on each subnet. .SH BOOTP Support Each BOOTP client must be explicitly declared in the dhcpd.conf -file. A very basic client declaration will specify the client +file. A very basic client declaration will specify the client network interface's hardware address and the IP address to assign to -that client. If the client needs to be able to load a boot file from -the server, that file's name must be specified. A simple bootp +that client. If the client needs to be able to load a boot file from +the server, that file's name must be specified. A simple bootp client declaration might look like this: .nf .sp 1 @@ -386,10 +386,10 @@ the client can access various network services (e.g., DNS, IP routers, and so on). .PP These options can be specified on a per-subnet basis, and, for BOOTP -clients, also on a per-client basis. In the event that a BOOTP +clients, also on a per-client basis. In the event that a BOOTP client declaration specifies options that are also specified in its subnet declaration, the options specified in the client declaration -take precedence. A reasonably complete DHCP configuration might +take precedence. A reasonably complete DHCP configuration might look something like this: .nf .sp 1 @@ -428,15 +428,15 @@ clients connect to the server using TCP/IP, authenticate, and can then examine the server's current status and make changes to it. .PP Rather than implementing the underlying OMAPI protocol directly, user -programs should use the dhcpctl API or OMAPI itself. Dhcpctl is a +programs should use the dhcpctl API or OMAPI itself. Dhcpctl is a wrapper that handles some of the housekeeping chores that OMAPI does -not do automatically. Dhcpctl and OMAPI are documented in \fBdhcpctl(3)\fR +not do automatically. Dhcpctl and OMAPI are documented in \fBdhcpctl(3)\fR and \fBomapi(3)\fR. .PP -OMAPI exports objects, which can then be examined and modified. The +OMAPI exports objects, which can then be examined and modified. The DHCP server exports the following objects: lease, host, -failover-state and group. Each object has a number of methods that -are provided: lookup, create, and destroy. In addition, it is +failover-state and group. Each object has a number of methods that +are provided: lookup, create, and destroy. In addition, it is possible to look at attributes that are stored on objects, and in some cases to modify those attributes. .SH THE LEASE OBJECT @@ -544,7 +544,7 @@ The time of the last transaction with the client on this lease. .SH THE HOST OBJECT Hosts can be created, destroyed, looked up, examined and modified. If a host declaration is created or deleted using OMAPI, that -information will be recorded in the dhcpd.leases file. It is +information will be recorded in the dhcpd.leases file. It is permissible to delete host declarations that are declared in the dhcpd.conf file. .PP @@ -552,7 +552,7 @@ Hosts have the following attributes: .PP .B name \fIdata\fR lookup, examine, modify .RS 0.5i -the name of the host declaration. This name must be unique among all +the name of the host declaration. This name must be unique among all host declarations. .RE .PP @@ -570,7 +570,7 @@ Only valid if hardware-type is also present. .B hardware-type \fIinteger\fR lookup, examine, modify .RS 0.5i the type of the network interface that will be used to match the -client, if any. Only valid if hardware-address is also present. +client, if any. Only valid if hardware-address is also present. .RE .PP .B dhcp-client-identifier \fIdata\fR lookup, examine, modify @@ -582,7 +582,7 @@ client, if any. .B ip-address \fIdata\fR examine, modify .RS 0.5i a fixed IP address which is reserved for a DHCP client that matches -this host declaration. The IP address will only be assigned to the +this host declaration. The IP address will only be assigned to the client if it is valid for the network segment to which the client is connected. .RE @@ -596,7 +596,7 @@ executed whenever a message from the client is being processed. .B known \fIinteger\fR examine, modify .RS 0.5i if nonzero, indicates that a client matching this host declaration -will be treated as \fIknown\fR in pool permit lists. If zero, the +will be treated as \fIknown\fR in pool permit lists. If zero, the client will not be treated as known. .RE .SH THE GROUP OBJECT @@ -608,7 +608,7 @@ dhcpd.conf file. .PP Named groups currently can only be associated with hosts - this allows one set of statements to be efficiently attached -to more than one host declaration. +to more than one host declaration. .PP Groups have the following attributes: .PP @@ -625,7 +625,7 @@ executed whenever a message from a client whose host declaration references this group is processed. .RE .SH THE CONTROL OBJECT -The control object allows you to shut the server down. If the server +The control object allows you to shut the server down. If the server is doing failover with another peer, it will make a clean transition into the shutdown state and notify its peer, so that the peer can go into partner down, and then record the "recover" state in the lease @@ -702,7 +702,7 @@ relationship. .B local-state \fIinteger\fR examine, modify .RS 0.5i Indicates the present state of the DHCP server in this failover -relationship. Possible values for state are: +relationship. Possible values for state are: .RE .RS 1i .PP @@ -730,12 +730,12 @@ relationship. Possible values for state are: In general it is not a good idea to make changes to this state. However, in the case that the failover partner is known to be down, it can be useful to set the DHCP server's failover state to partner -down. At this point the DHCP server will take over service of the +down. At this point the DHCP server will take over service of the failover partner's leases as soon as possible, and will give out -normal leases, not leases that are restricted by MCLT. If you do put +normal leases, not leases that are restricted by MCLT. If you do put the DHCP server into the partner-down when the other DHCP server is not in the partner-down state, but is not reachable, IP address -assignment conflicts are possible, even likely. Once a server has +assignment conflicts are possible, even likely. Once a server has been put into partner-down mode, its failover partner must not be brought back online until communication is possible between the two servers. @@ -802,6 +802,6 @@ dhclient(8), dhcrelay(8), dhcpd.conf(5), dhcpd.leases(5) .B dhcpd(8) was originally written by Ted Lemon under a contract with Vixie Labs. Funding for this project was provided by Internet Systems -Consortium. Version 3 of the DHCP server was funded by Nominum, Inc. +Consortium. Version 3 of the DHCP server was funded by Nominum, Inc. Information about Internet Systems Consortium is available at .B https://www.isc.org/\fR. diff --git a/external/bsd/dhcp/dist/server/dhcpd.c b/external/bsd/dhcp/dist/server/dhcpd.c index c775552c5cc1..2ffb32533091 100644 --- a/external/bsd/dhcp/dist/server/dhcpd.c +++ b/external/bsd/dhcp/dist/server/dhcpd.c @@ -1,11 +1,11 @@ -/* $NetBSD: dhcpd.c,v 1.1.1.1 2013/03/24 15:46:00 christos Exp $ */ +/* $NetBSD: dhcpd.c,v 1.1.1.2 2013/03/24 22:50:40 christos Exp $ */ /* dhcpd.c DHCP Server Daemon. */ /* - * Copyright (c) 2004-2011 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004-2013 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1996-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -35,10 +35,10 @@ */ #include -__RCSID("$NetBSD: dhcpd.c,v 1.1.1.1 2013/03/24 15:46:00 christos Exp $"); +__RCSID("$NetBSD: dhcpd.c,v 1.1.1.2 2013/03/24 22:50:40 christos Exp $"); static const char copyright[] = -"Copyright 2004-2011 Internet Systems Consortium."; +"Copyright 2004-2013 Internet Systems Consortium."; static const char arr [] = "All rights reserved."; static const char message [] = "Internet Systems Consortium DHCP Server"; static const char url [] = @@ -63,7 +63,9 @@ static const char url [] = # undef group #endif /* PARANOIA */ +#ifndef UNIT_TEST static void usage(void); +#endif struct iaddr server_identifier; int server_identifier_matched; @@ -1206,7 +1208,7 @@ void postdb_startup (void) } /* Print usage message. */ - +#ifndef UNIT_TEST static void usage(void) { log_info("%s %s", message, PACKAGE_VERSION); @@ -1230,6 +1232,7 @@ usage(void) { " [-pf pid-file] [--no-pid] [-s server]\n" " [if0 [...ifN]]"); } +#endif void lease_pinged (from, packet, length) struct iaddr from; diff --git a/external/bsd/dhcp/dist/server/dhcpd.conf.5 b/external/bsd/dhcp/dist/server/dhcpd.conf.5 index 7faaafc9b0b2..b43bb2d2326f 100644 --- a/external/bsd/dhcp/dist/server/dhcpd.conf.5 +++ b/external/bsd/dhcp/dist/server/dhcpd.conf.5 @@ -1,8 +1,8 @@ -.\" $NetBSD: dhcpd.conf.5,v 1.1.1.1 2013/03/24 15:46:05 christos Exp $ +.\" $NetBSD: dhcpd.conf.5,v 1.1.1.2 2013/03/24 22:50:39 christos Exp $ .\" .\" dhcpd.conf.5 .\" -.\" Copyright (c) 2004-2011 by Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (c) 2004-2012 by Internet Systems Consortium, Inc. ("ISC") .\" Copyright (c) 1996-2003 by Internet Software Consortium .\" .\" Permission to use, copy, modify, and distribute this software for any @@ -29,7 +29,7 @@ .\" Support and other services are available for ISC products - see .\" https://www.isc.org for more information or to learn more about ISC. .\" -.\" Id: dhcpd.conf.5,v 1.106.18.7 2011-09-21 20:43:10 sar Exp +.\" Id: dhcpd.conf.5,v 1.106.18.8 2012/04/02 22:51:02 sar Exp .\" .TH dhcpd.conf 5 .SH NAME @@ -39,14 +39,14 @@ The dhcpd.conf file contains configuration information for .IR dhcpd, the Internet Systems Consortium DHCP Server. .PP -The dhcpd.conf file is a free-form ASCII text file. It is parsed by -the recursive-descent parser built into dhcpd. The file may contain +The dhcpd.conf file is a free-form ASCII text file. It is parsed by +the recursive-descent parser built into dhcpd. The file may contain extra tabs and newlines for formatting purposes. Keywords in the file -are case-insensitive. Comments may be placed anywhere within the -file (except within quotes). Comments begin with the # character and +are case-insensitive. Comments may be placed anywhere within the +file (except within quotes). Comments begin with the # character and end at the end of the line. .PP -The file essentially consists of a list of statements. Statements +The file essentially consists of a list of statements. Statements fall into two broad categories - parameters and declarations. .PP Parameter statements either say how to do something (e.g., how long a @@ -57,17 +57,17 @@ client (e.g., use gateway 220.177.244.7). Declarations are used to describe the topology of the network, to describe clients on the network, to provide addresses that can be assigned to clients, or to apply a group of parameters to a -group of declarations. In any group of parameters and declarations, +group of declarations. In any group of parameters and declarations, all parameters must be specified before any declarations which depend on those parameters may be specified. .PP Declarations about network topology include the \fIshared-network\fR -and the \fIsubnet\fR declarations. If clients on a subnet are to be +and the \fIsubnet\fR declarations. If clients on a subnet are to be assigned addresses dynamically, a \fIrange\fR declaration must appear within the -\fIsubnet\fR declaration. For clients with statically assigned +\fIsubnet\fR declaration. For clients with statically assigned addresses, or for installations where only known clients will be -served, each such client must have a \fIhost\fR declaration. If +served, each such client must have a \fIhost\fR declaration. If parameters are to be applied to a group of declarations which are not related strictly on a per-subnet basis, the \fIgroup\fR declaration can be used. @@ -79,11 +79,11 @@ that subnet. A \fIsubnet\fR declaration is required for each subnet even if no addresses will be dynamically allocated on that subnet. .PP Some installations have physical networks on which more than one IP -subnet operates. For example, if there is a site-wide requirement +subnet operates. For example, if there is a site-wide requirement that 8-bit subnet masks be used, but a department with a single physical ethernet network expands to the point where it has more than 254 nodes, it may be necessary to run two 8-bit subnets on the same -ethernet until such time as a new physical network can be added. In +ethernet until such time as a new physical network can be added. In this case, the \fIsubnet\fR declarations for these two networks must be enclosed in a \fIshared-network\fR declaration. .PP @@ -96,10 +96,10 @@ subnets) will receive the same configuration as stateful ones. Some sites may have departments which have clients on more than one subnet, but it may be desirable to offer those clients a uniform set of parameters which are different than what would be offered to -clients from other departments on the same subnet. For clients which +clients from other departments on the same subnet. For clients which will be declared explicitly with \fIhost\fR declarations, these declarations can be enclosed in a \fIgroup\fR declaration along with -the parameters which are common to that department. For clients +the parameters which are common to that department. For clients whose addresses will be dynamically assigned, class declarations and conditional declarations may be used to group parameter assignments based on information the client sends. @@ -108,10 +108,10 @@ When a client is to be booted, its boot parameters are determined by consulting that client's \fIhost\fR declaration (if any), and then consulting any \fIclass\fR declarations matching the client, followed by the \fIpool\fR, \fIsubnet\fR and \fIshared-network\fR -declarations for the IP address assigned to the client. Each of +declarations for the IP address assigned to the client. Each of these declarations itself appears within a lexical scope, and all declarations at less specific lexical scopes are also consulted for -client option declarations. Scopes are never considered +client option declarations. Scopes are never considered twice, and if parameters are declared in more than one scope, the parameter declared in the most specific scope is the one that is used. @@ -119,7 +119,7 @@ used. When dhcpd tries to find a \fIhost\fR declaration for a client, it first looks for a \fIhost\fR declaration which has a \fIfixed-address\fR declaration that lists an IP address that is valid -for the subnet or shared network on which the client is booting. If +for the subnet or shared network on which the client is booting. If it doesn't find any such entry, it tries to find an entry which has no \fIfixed-address\fR declaration. .SH EXAMPLES @@ -163,9 +163,9 @@ Figure 1 .fi .PP Notice that at the beginning of the file, there's a place -for global parameters. These might be things like the organization's +for global parameters. These might be things like the organization's domain name, the addresses of the name servers (if they are common to -the entire organization), and so on. So, for example: +the entire organization), and so on. So, for example: .nf option domain-name "isc.org"; @@ -183,17 +183,17 @@ possible, both addresses are supplied to the client. .PP The most obvious reason for having subnet-specific parameters as shown in Figure 1 is that each subnet, of necessity, has its own -router. So for the first subnet, for example, there should be +router. So for the first subnet, for example, there should be something like: .nf option routers 204.254.239.1; .fi .PP -Note that the address here is specified numerically. This is not +Note that the address here is specified numerically. This is not required - if you have a different domain name for each interface on your router, it's perfectly legitimate to use the domain name for that -interface instead of the numeric address. However, in many cases +interface instead of the numeric address. However, in many cases there may be only one domain name for all of a router's IP addresses, and it would not be appropriate to use that name here. .PP @@ -217,24 +217,24 @@ lease timeout somewhat shorter than the default: .fi .PP You may have noticed that while some parameters start with the -\fIoption\fR keyword, some do not. Parameters starting with the +\fIoption\fR keyword, some do not. Parameters starting with the \fIoption\fR keyword correspond to actual DHCP options, while parameters that do not start with the option keyword either control the behavior of the DHCP server (e.g., how long a lease dhcpd will give out), or specify client parameters that are not optional in the DHCP protocol (for example, server-name and filename). .PP -In Figure 1, each host had \fIhost-specific parameters\fR. These +In Figure 1, each host had \fIhost-specific parameters\fR. These could include such things as the \fIhostname\fR option, the name of a file to upload (the \fIfilename\fR parameter) and the address of the server from which to upload the file (the \fInext-server\fR -parameter). In general, any parameter can appear anywhere that +parameter). In general, any parameter can appear anywhere that parameters are allowed, and will be applied according to the scope in which the parameter appears. .PP -Imagine that you have a site with a lot of NCD X-Terminals. These +Imagine that you have a site with a lot of NCD X-Terminals. These terminals come in a variety of models, and you want to specify the -boot files for each model. One way to do this would be to have host +boot files for each model. One way to do this would be to have host declarations for each server and group them by model: .nf @@ -270,14 +270,14 @@ The .B pool declaration can be used to specify a pool of addresses that will be treated differently than another pool of addresses, even on the same -network segment or subnet. For example, you may want to provide a +network segment or subnet. For example, you may want to provide a large set of addresses that can be assigned to DHCP clients that are registered to your DHCP server, while providing a smaller set of addresses, possibly with short lease times, that are available for -unknown clients. If you have a firewall, you may be able to arrange +unknown clients. If you have a firewall, you may be able to arrange for addresses from one pool to be allowed access to the Internet, while addresses in another pool are not, thus encouraging users to -register their DHCP clients. To do this, you would set up a pair of +register their DHCP clients. To do this, you would set up a pair of pool declarations: .PP .nf @@ -311,11 +311,11 @@ As you can see in the preceding example, pools can have permit lists that control which clients are allowed access to the pool and which aren't. Each entry in a pool's permit list is introduced with the .I allow -or \fIdeny\fR keyword. If a pool has a permit list, then only those +or \fIdeny\fR keyword. If a pool has a permit list, then only those clients that match specific entries on the permit list will be -eligible to be assigned addresses from the pool. If a pool has a +eligible to be assigned addresses from the pool. If a pool has a deny list, then only those clients that do not match any entries on -the deny list will be eligible. If both permit and deny lists exist +the deny list will be eligible. If both permit and deny lists exist for a pool, then only clients that match the permit list and do not match the deny list will be allowed access. .SH DYNAMIC ADDRESS ALLOCATION @@ -342,7 +342,7 @@ If that host declaration contains a fixed-address declaration that lists an IP address that is valid for the network segment to which the client is connected. In this case, the DHCP server will never do dynamic address allocation. In this case, the client is \fIrequired\fR -to take the address specified in the host declaration. If the +to take the address specified in the host declaration. If the client sends a DHCPREQUEST for some other address, the server will respond with a DHCPNAK. .PP @@ -361,35 +361,35 @@ If no existing lease is found, or if the client is forbidden to receive the existing lease, then the server will look in the list of address pools for the network segment to which the client is attached for a lease that is not in use and that the client is permitted to -have. It looks through each pool declaration in sequence (all +have. It looks through each pool declaration in sequence (all .I range declarations that appear outside of pool declarations are grouped into -a single pool with no permit list). If the permit list for the pool +a single pool with no permit list). If the permit list for the pool allows the client to be allocated an address from that pool, the pool -is examined to see if there is an address available. If so, then the -client is tentatively assigned that address. Otherwise, the next -pool is tested. If no addresses are found that can be assigned to +is examined to see if there is an address available. If so, then the +client is tentatively assigned that address. Otherwise, the next +pool is tested. If no addresses are found that can be assigned to the client, no response is sent to the client. .PP If an address is found that the client is permitted to have, and that has never been assigned to any client before, the address is -immediately allocated to the client. If the address is available for +immediately allocated to the client. If the address is available for allocation but has been previously assigned to a different client, the server will keep looking in hopes of finding an address that has never before been assigned to a client. .PP The DHCP server generates the list of available IP addresses from a -hash table. This means that the addresses are not sorted in any +hash table. This means that the addresses are not sorted in any particular order, and so it is not possible to predict the order in -which the DHCP server will allocate IP addresses. Users of previous +which the DHCP server will allocate IP addresses. Users of previous versions of the ISC DHCP server may have become accustomed to the DHCP server allocating IP addresses in ascending order, but this is no longer possible, and there is no way to configure this behavior with version 3 of the ISC DHCP server. .SH IP ADDRESS CONFLICT PREVENTION The DHCP server checks IP addresses to see if they are in use before -allocating them to clients. It does this by sending an ICMP Echo -request message to the IP address being allocated. If no ICMP Echo +allocating them to clients. It does this by sending an ICMP Echo +request message to the IP address being allocated. If no ICMP Echo reply is received within a second, the address is assumed to be free. This is only done for leases that have been specified in range statements, and only when the lease is thought by the DHCP server to @@ -398,24 +398,24 @@ the lease as in use. .PP If a response is received to an ICMP Echo request, the DHCP server assumes that there is a configuration error - the IP address is in use -by some host on the network that is not a DHCP client. It marks the +by some host on the network that is not a DHCP client. It marks the address as abandoned, and will not assign it to clients. .PP If a DHCP client tries to get an IP address, but none are available, but there are abandoned IP addresses, then the DHCP server will -attempt to reclaim an abandoned IP address. It marks one IP address +attempt to reclaim an abandoned IP address. It marks one IP address as free, and then does the same ICMP Echo request check described -previously. If there is no answer to the ICMP Echo request, the +previously. If there is no answer to the ICMP Echo request, the address is assigned to the client. .PP The DHCP server does not cycle through abandoned IP addresses if the -first IP address it tries to reclaim is free. Rather, when the next +first IP address it tries to reclaim is free. Rather, when the next DHCPDISCOVER comes in from the client, it will attempt a new allocation using the same method described here, and will typically try a new IP address. .SH DHCP FAILOVER This version of the ISC DHCP server supports the DHCP failover -protocol as documented in draft-ietf-dhc-failover-12.txt. This is +protocol as documented in draft-ietf-dhc-failover-12.txt. This is not a final protocol document, and we have not done interoperability testing with other vendors' implementations of this protocol, so you must not assume that this implementation conforms to the standard. @@ -423,9 +423,9 @@ If you wish to use the failover protocol, make sure that both failover peers are running the same version of the ISC DHCP server. .PP The failover protocol allows two DHCP servers (and no more than two) -to share a common address pool. Each server will have about half of +to share a common address pool. Each server will have about half of the available IP addresses in the pool at any given time for -allocation. If one server fails, the other server will continue to +allocation. If one server fails, the other server will continue to renew leases out of the pool, and will allocate new addresses out of the roughly half of available addresses that it had when communications with the other server were lost. @@ -433,13 +433,13 @@ communications with the other server were lost. It is possible during a prolonged failure to tell the remaining server that the other server is down, in which case the remaining server will (over time) reclaim all the addresses the other server had available -for allocation, and begin to reuse them. This is called putting the +for allocation, and begin to reuse them. This is called putting the server into the PARTNER-DOWN state. .PP You can put the server into the PARTNER-DOWN state either by using the .B omshell (1) command or by stopping the server, editing the last failover state -declaration in the lease file, and restarting the server. If you use +declaration in the lease file, and restarting the server. If you use this last method, change the "my state" line to: .PP .nf @@ -461,22 +461,22 @@ server into the PARTNER-DOWN state, and then *that* server goes down, and the other server comes back up, the other server will not know that the first server was in the PARTNER-DOWN state, and may issue addresses previously issued by the other server to different clients, -resulting in IP address conflicts. Before putting a server into +resulting in IP address conflicts. Before putting a server into PARTNER-DOWN state, therefore, make .I sure that the other server will not restart automatically. .PP The failover protocol defines a primary server role and a secondary -server role. There are some differences in how primaries and +server role. There are some differences in how primaries and secondaries act, but most of the differences simply have to do with providing a way for each peer to behave in the opposite way from the -other. So one server must be configured as primary, and the other +other. So one server must be configured as primary, and the other must be configured as secondary, and it doesn't matter too much which one is which. .SH FAILOVER STARTUP When a server starts that has not previously communicated with its failover peer, it must establish communications with its failover peer -and synchronize with it before it can serve clients. This can happen +and synchronize with it before it can serve clients. This can happen either because you have just configured your DHCP servers to perform failover for the first time, or because one of your failover servers has failed catastrophically and lost its database. @@ -502,15 +502,15 @@ made the transition into normal operation. .PP In the case where both servers detect that they have never before communicated with their partner, they both come up in this recovery -state and follow the procedure we have just described. In this case, +state and follow the procedure we have just described. In this case, no service will be provided to DHCP clients until MCLT has expired. .SH CONFIGURING FAILOVER In order to configure failover, you need to write a peer declaration that configures the failover protocol, and you need to write peer references in each pool declaration for which you want to do -failover. You do not have to do failover for all pools on a given -network segment. You must not tell one server it's doing failover -on a particular address pool and tell the other it is not. You must +failover. You do not have to do failover for all pools on a given +network segment. You must not tell one server it's doing failover +on a particular address pool and tell the other it is not. You must not have any common address pools on which you are not doing failover. A pool declaration that utilizes failover would look like this: .PP @@ -623,11 +623,11 @@ statement .PP The \fBmax-response-delay\fR statement tells the DHCP server how many seconds may pass without receiving a message from its failover -peer before it assumes that connection has failed. This number +peer before it assumes that connection has failed. This number should be small enough that a transient network failure that breaks the connection will not result in the servers being out of communication for a long time, but large enough that the server isn't -constantly making and breaking connections. This parameter must be +constantly making and breaking connections. This parameter must be specified. .RE .PP @@ -640,8 +640,8 @@ statement .PP The \fBmax-unacked-updates\fR statement tells the remote DHCP server how many BNDUPD messages it can send before it receives a BNDACK -from the local system. We don't have enough operational experience -to say what a good value for this is, but 10 seems to work. This +from the local system. We don't have enough operational experience +to say what a good value for this is, but 10 seems to work. This parameter must be specified. .RE .PP @@ -652,14 +652,14 @@ statement .PP .B mclt \fIseconds\fR\fB;\fR .PP -The \fBmclt\fR statement defines the Maximum Client Lead Time. It +The \fBmclt\fR statement defines the Maximum Client Lead Time. It must be specified on the primary, and may not be specified on the -secondary. This is the length of time for which a lease may be -renewed by either failover peer without contacting the other. The +secondary. This is the length of time for which a lease may be +renewed by either failover peer without contacting the other. The longer you set this, the longer it will take for the running server to -recover IP addresses after moving into PARTNER-DOWN state. The +recover IP addresses after moving into PARTNER-DOWN state. The shorter you set it, the more load your servers will experience when -they are not communicating. A value of something like 3600 is +they are not communicating. A value of something like 3600 is probably reasonable, but again bear in mind that we have no real operational experience with this. .RE @@ -672,7 +672,7 @@ statement .B split \fIindex\fR\fB;\fR .PP The split statement specifies the split between the primary and -secondary for the purposes of load balancing. Whenever a client +secondary for the purposes of load balancing. Whenever a client makes a DHCP request, the DHCP server runs a hash on the client identification, resulting in value from 0 to 255. This is used as an index into a 256 bit field. If the bit at that index is set, @@ -693,8 +693,8 @@ statement .PP The hba statement specifies the split between the primary and secondary as a bitmap rather than a cutoff, which theoretically allows -for finer-grained control. In practice, there is probably no need -for such fine-grained control, however. An example hba statement: +for finer-grained control. In practice, there is probably no need +for such fine-grained control, however. An example hba statement: .PP .nf hba ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff: @@ -889,9 +889,9 @@ default to values 60 and 3600 respectively (to place balance events between .RE .SH CLIENT CLASSING Clients can be separated into classes, and treated differently -depending on what class they are in. This separation can be done +depending on what class they are in. This separation can be done either with a conditional statement, or with a match statement within -the class declaration. It is possible to specify a limit on the +the class declaration. It is possible to specify a limit on the total number of clients within a particular class or subclass that may hold leases at one time, and it is possible to specify automatic subclassing based on the contents of the client packet. @@ -907,7 +907,7 @@ class "ras-clients" { .PP Note that whether you use matching expressions or add statements (or both) to classify clients, you must always write a class declaration -for any class that you use. If there will be no match statement and +for any class that you use. If there will be no match statement and no in-scope statements for a class, the declaration should look like this: .PP @@ -917,12 +917,12 @@ class "ras-clients" { .fi .SH SUBCLASSES .PP -In addition to classes, it is possible to declare subclasses. A +In addition to classes, it is possible to declare subclasses. A subclass is a class with the same name as a regular class, but with a specific submatch expression which is hashed for quick matching. This is essentially a speed hack - the main difference between five classes with match expressions and one class with five subclasses is -that it will be quicker to find the subclasses. Subclasses work as +that it will be quicker to find the subclasses. Subclasses work as follows: .PP .nf @@ -953,14 +953,14 @@ subnet 10.0.0.0 netmask 255.255.255.0 { The data following the class name in the subclass declaration is a constant value to use in matching the match expression for the class. When class matching is done, the server will evaluate the match -expression and then look the result up in the hash table. If it +expression and then look the result up in the hash table. If it finds a match, the client is considered a member of both the class and the subclass. .PP -Subclasses can be declared with or without scope. In the above +Subclasses can be declared with or without scope. In the above example, the sole purpose of the subclass is to allow some clients access to one address pool, while other clients are given access to -the other pool, so these subclasses are declared without scopes. If +the other pool, so these subclasses are declared without scopes. If part of the purpose of the subclass were to define different parameter values for some clients, you might want to declare some subclasses with scopes. @@ -987,12 +987,12 @@ manual page. .SH PER-CLASS LIMITS ON DYNAMIC ADDRESS ALLOCATION .PP You may specify a limit to the number of clients in a class that can -be assigned leases. The effect of this will be to make it difficult -for a new client in a class to get an address. Once a class with +be assigned leases. The effect of this will be to make it difficult +for a new client in a class to get an address. Once a class with such a limit has reached its limit, the only way a new client in that class can get a lease is for an existing client to relinquish its lease, either by letting it expire, or by sending a DHCPRELEASE -packet. Classes with lease limits are specified as follows: +packet. Classes with lease limits are specified as follows: .PP .nf class "limited-1" { @@ -1007,9 +1007,9 @@ a lease at one time. It is possible to declare a .I spawning class\fR. A spawning class is a class that automatically produces subclasses -based on what the client sends. The reason that spawning classes +based on what the client sends. The reason that spawning classes were created was to make it possible to create lease-limited classes -on the fly. The envisioned application is a cable-modem environment +on the fly. The envisioned application is a cable-modem environment where the ISP wishes to provide clients at a particular site with more than one IP address, but does not wish to provide such clients with their own subnet, nor give them an unlimited number of IP addresses @@ -1017,8 +1017,8 @@ from the network segment to which they are connected. .PP Many cable modem head-end systems can be configured to add a Relay Agent Information option to DHCP packets when relaying them to the -DHCP server. These systems typically add a circuit ID or remote ID -option that uniquely identifies the customer site. To take advantage +DHCP server. These systems typically add a circuit ID or remote ID +option that uniquely identifies the customer site. To take advantage of this, you can write a class declaration as follows: .PP .nf @@ -1029,12 +1029,12 @@ class "customer" { .fi .PP Now whenever a request comes in from a customer site, the circuit ID -option will be checked against the class's hash table. If a subclass +option will be checked against the class's hash table. If a subclass is found that matches the circuit ID, the client will be classified in -that subclass and treated accordingly. If no subclass is found +that subclass and treated accordingly. If no subclass is found matching the circuit ID, a new one will be created and logged in the .B dhcpd.leases -file, and the client will be classified in this new class. Once the +file, and the client will be classified in this new class. Once the client has been classified, it will be treated according to the rules of the class, including, in this case, being subject to the per-site limit of four leases. @@ -1046,9 +1046,9 @@ fairly straightforward one. .PP In some cases, it may be useful to use one expression to assign a client to a particular class, and a second expression to put it into a -subclass of that class. This can be done by combining the \fBmatch +subclass of that class. This can be done by combining the \fBmatch if\fR and \fBspawn with\fR statements, or the \fBmatch if\fR and -\fBmatch\fR statements. For example: +\fBmatch\fR statements. For example: .PP .nf class "jr-cable-modems" { @@ -1076,7 +1076,7 @@ compliant so any DNS server supporting RFC 2136 should be able to accept updates from the DHCP server. .PP Two DNS update schemes are currently implemented, and another is -planned. The two that are currently implemented are the ad-hoc DNS +planned. The two that are currently implemented are the ad-hoc DNS update mode and the interim DHCP-DNS interaction draft update mode. In the future we plan to add a third mode which will be the standard DNS update method based on the RFCS for DHCP-DNS interaction and DHCID @@ -1100,7 +1100,7 @@ The ad-hoc Dynamic DNS update scheme implemented in this version of the ISC DHCP server is a prototype design, which does not have much to do with the standard update method that is being standardized in the IETF DHC working group, but rather implements some -very basic, yet useful, update capabilities. This mode +very basic, yet useful, update capabilities. This mode .B does not work with the .I failover protocol @@ -1108,7 +1108,7 @@ because it does not account for the possibility of two different DHCP servers updating the same set of DNS records. .PP For the ad-hoc DNS update method, the client's FQDN is derived in two -parts. First, the hostname is determined. Then, the domain name is +parts. First, the hostname is determined. Then, the domain name is determined, and appended to the hostname. .PP The DHCP server determines the client's hostname by first looking for @@ -1137,39 +1137,39 @@ not attempt to perform a DNS update. The client's fully-qualified domain name, derived as we have described, is used as the name on which an "A" record will be stored. The A record will contain the IP address that the client was assigned -in its lease. If there is already an A record with the same name in +in its lease. If there is already an A record with the same name in the DNS server, no update of either the A or PTR records will occur - this prevents a client from claiming that its hostname is the name of -some network server. For example, if you have a fileserver called +some network server. For example, if you have a fileserver called "fs.sneedville.edu", and the client claims its hostname is "fs", no DNS update will be done for that client, and an error message will be logged. .PP If the A record update succeeds, a PTR record update for the assigned -IP address will be done, pointing to the A record. This update is +IP address will be done, pointing to the A record. This update is unconditional - it will be done even if another PTR record of the same -name exists. Since the IP address has been assigned to the DHCP +name exists. Since the IP address has been assigned to the DHCP server, this should be safe. .PP Please note that the current implementation assumes clients only have -a single network interface. A client with two network interfaces -will see unpredictable behavior. This is considered a bug, and will -be fixed in a later release. It may be helpful to enable the +a single network interface. A client with two network interfaces +will see unpredictable behavior. This is considered a bug, and will +be fixed in a later release. It may be helpful to enable the .I one-lease-per-client parameter so that roaming clients do not trigger this same behavior. .PP The DHCP protocol normally involves a four-packet exchange - first the client sends a DHCPDISCOVER message, then the server sends a DHCPOFFER, then the client sends a DHCPREQUEST, then the server sends -a DHCPACK. In the current version of the server, the server will do +a DHCPACK. In the current version of the server, the server will do a DNS update after it has received the DHCPREQUEST, and before it has -sent the DHCPACK. It only sends the DNS update if it has not sent +sent the DHCPACK. It only sends the DNS update if it has not sent one for the client's address before, in order to minimize the impact on the DHCP server. .PP When the client's lease expires, the DHCP server (if it is operating at the time, or when next it operates) will remove the client's A and -PTR records from the DNS database. If the client releases its lease +PTR records from the DNS database. If the client releases its lease by sending a DHCPRELEASE message, the server will likewise remove the A and PTR records. .SH THE INTERIM DNS UPDATE SCHEME @@ -1206,25 +1206,25 @@ will briefly document the operation of this update style here. .PP The first point to understand about this style of DNS update is that unlike the ad-hoc style, the DHCP server does not necessarily -always update both the A and the PTR records. The FQDN option +always update both the A and the PTR records. The FQDN option includes a flag which, when sent by the client, indicates that the -client wishes to update its own A record. In that case, the server +client wishes to update its own A record. In that case, the server can be configured either to honor the client's intentions or ignore -them. This is done with the statement \fIallow client-updates;\fR or -the statement \fIignore client-updates;\fR. By default, client +them. This is done with the statement \fIallow client-updates;\fR or +the statement \fIignore client-updates;\fR. By default, client updates are allowed. .PP If the server is configured to allow client updates, then if the client sends a fully-qualified domain name in the FQDN option, the server will use that name the client sent in the FQDN option to update -the PTR record. For example, let us say that the client is a visitor -from the "radish.org" domain, whose hostname is "jschmoe". The -server is for the "example.org" domain. The DHCP client indicates in -the FQDN option that its FQDN is "jschmoe.radish.org.". It also -indicates that it wants to update its own A record. The DHCP server +the PTR record. For example, let us say that the client is a visitor +from the "radish.org" domain, whose hostname is "jschmoe". The +server is for the "example.org" domain. The DHCP client indicates in +the FQDN option that its FQDN is "jschmoe.radish.org.". It also +indicates that it wants to update its own A record. The DHCP server therefore does not attempt to set up an A record for the client, but does set up a PTR record for the IP address that it assigns the -client, pointing at jschmoe.radish.org. Once the DHCP client has an +client, pointing at jschmoe.radish.org. Once the DHCP client has an IP address, it can update its own A record, assuming that the "radish.org" DNS server will allow it to do so. .PP @@ -1234,7 +1234,7 @@ choose a name for the client from either the fqdn option (if present) or the hostname option (if present). It will use its own domain name for the client, just as in the ad-hoc update scheme. It will then update both the A and PTR record, using the name that it -chose for the client. If the client sends a fully-qualified domain +chose for the client. If the client sends a fully-qualified domain name in the fqdn option, the server uses only the leftmost part of the domain name - in the example above, "jschmoe" instead of "jschmoe.radish.org". @@ -1257,27 +1257,27 @@ The other difference between the ad-hoc scheme and the interim scheme is that with the interim scheme, a method is used that allows more than one DHCP server to update the DNS database without accidentally deleting A records that shouldn't be deleted nor failing -to add A records that should be added. The scheme works as follows: +to add A records that should be added. The scheme works as follows: .PP When the DHCP server issues a client a new lease, it creates a text string that is an MD5 hash over the DHCP client's identification (see -draft-ietf-dnsext-dhcid-rr-??.txt for details). The update adds an A +draft-ietf-dnsext-dhcid-rr-??.txt for details). The update adds an A record with the name the server chose and a TXT record containing the -hashed identifier string (hashid). If this update succeeds, the +hashed identifier string (hashid). If this update succeeds, the server is done. .PP If the update fails because the A record already exists, then the DHCP server attempts to add the A record with the prerequisite that there must be a TXT record in the same name as the new A record, and that -TXT record's contents must be equal to hashid. If this update -succeeds, then the client has its A record and PTR record. If it +TXT record's contents must be equal to hashid. If this update +succeeds, then the client has its A record and PTR record. If it fails, then the name the client has been assigned (or requested) is in -use, and can't be used by the client. At this point the DHCP server +use, and can't be used by the client. At this point the DHCP server gives up trying to do a DNS update for the client until the client chooses a new name. .PP The interim DNS update scheme is called interim for two reasons. -First, it does not quite follow the RFCs. The RFCs call for a +First, it does not quite follow the RFCs. The RFCs call for a new DHCID RRtype while he interim DNS update scheme uses a TXT record. The ddns-resolution draft called for the DHCP server to put a DHCID RR on the PTR record, but the \fIinterim\fR update method does not do this. @@ -1287,7 +1287,7 @@ add a DHCID RR to the PTR record. In addition to these differences, the server also does not update very aggressively. Because each DNS update involves a round trip to the DNS server, there is a cost associated with doing updates even if they -do not actually modify the DNS database. So the DHCP server tracks +do not actually modify the DNS database. So the DHCP server tracks whether or not it has updated the record in the past (this information is stored on the lease) and does not attempt to update records that it thinks it has already updated. @@ -1295,7 +1295,7 @@ thinks it has already updated. This can lead to cases where the DHCP server adds a record, and then the record is deleted through some other mechanism, but the server never again updates the DNS because it thinks the data is already -there. In this case the data can be removed from the lease through +there. In this case the data can be removed from the lease through operator intervention, and once this has been done, the DNS will be updated the next time the client renews. .SH DYNAMIC DNS UPDATE SECURITY @@ -1303,8 +1303,8 @@ updated the next time the client renews. When you set your DNS server up to allow updates from the DHCP server, you may be exposing it to unauthorized updates. To avoid this, you should use TSIG signatures - a method of cryptographically signing -updates using a shared secret key. As long as you protect the -secrecy of this key, your updates should also be secure. Note, +updates using a shared secret key. As long as you protect the +secrecy of this key, your updates should also be secure. Note, however, that the DHCP protocol itself provides no security, and that clients can therefore provide information to the DHCP server which the DHCP server will then use in its updates, with the constraints @@ -1338,7 +1338,7 @@ zone "17.10.10.in-addr.arpa" { .fi .PP You will also have to configure your DHCP server to do updates to -these zones. To do so, you need to add something like this to your +these zones. To do so, you need to add something like this to your dhcpd.conf file: .PP .nf @@ -1370,7 +1370,7 @@ is limited and is currently set to three. .PP Note that the zone declarations have to correspond to authority records in your name server - in the above example, there must be an -SOA record for "example.org." and for "17.10.10.in-addr.arpa.". For +SOA record for "example.org." and for "17.10.10.in-addr.arpa.". For example, if there were a subdomain "foo.example.org" with no separate SOA, you could not write a zone declaration for "foo.example.org." Also keep in mind that zone names in your DHCP configuration should end in a @@ -1423,14 +1423,14 @@ logging { .fi .PP You must create the /var/log/named-auth.info and -/var/log/update-debug.log files before starting the name server. For +/var/log/update-debug.log files before starting the name server. For more information on configuring ISC BIND, consult the documentation that accompanies it. .SH REFERENCE: EVENTS .PP There are three kinds of events that can happen regarding a lease, and it is possible to declare statements that occur when any of these -events happen. These events are the commit event, when the server +events happen. These events are the commit event, when the server has made a commitment of a certain lease to a client, the release event, when the client has released the server from its commitment, and the expiry event, when the commitment expires. @@ -1438,12 +1438,12 @@ and the expiry event, when the commitment expires. To declare a set of statements to execute when an event happens, you must use the \fBon\fR statement, followed by the name of the event, followed by a series of statements to execute when the event happens, -enclosed in braces. Events are used to implement DNS +enclosed in braces. Events are used to implement DNS updates, so you should not define your own event handlers if you are using the built-in DNS update mechanism. .PP The built-in version of the DNS update mechanism is in a text -string towards the top of server/dhcpd.c. If you want to use events +string towards the top of server/dhcpd.c. If you want to use events for things other than DNS updates, and you also want DNS updates, you will have to start out by copying this code into your dhcpd.conf file and modifying it. @@ -1485,9 +1485,9 @@ There is no way to distinguish on which subnet of a shared network a client should boot. .PP .I Name -should be the name of the shared network. This name is used when +should be the name of the shared network. This name is used when printing debugging messages, so it should be descriptive for the -shared network. The name may have the syntax of a valid domain name +shared network. The name may have the syntax of a valid domain name (although it will never be used as such), or it may be any arbitrary name, enclosed in quotes. .PP @@ -1506,16 +1506,16 @@ The \fIsubnet\fR statement is used to provide dhcpd with enough information to tell whether or not an IP address is on that subnet. It may also be used to provide subnet-specific parameters and to specify what addresses may be dynamically allocated to clients booting -on that subnet. Such addresses are specified using the \fIrange\fR +on that subnet. Such addresses are specified using the \fIrange\fR declaration. .PP The .I subnet-number should be an IP address or domain name which resolves to the subnet -number of the subnet being described. The +number of the subnet being described. The .I netmask should be an IP address or domain name which resolves to the subnet mask -of the subnet being described. The subnet number, together with the +of the subnet being described. The subnet number, together with the netmask, are sufficient to determine whether any given IP address is on the specified subnet. .PP @@ -1555,12 +1555,12 @@ should be an IPv6 network identifier, specified as ip6-address/bits. .fi .PP For any subnet on which addresses will be assigned dynamically, there -must be at least one \fIrange\fR statement. The range statement -gives the lowest and highest IP addresses in a range. All IP +must be at least one \fIrange\fR statement. The range statement +gives the lowest and highest IP addresses in a range. All IP addresses in the range should be in the subnet in which the -\fIrange\fR statement is declared. The \fIdynamic-bootp\fR flag may +\fIrange\fR statement is declared. The \fIdynamic-bootp\fR flag may be specified if addresses in the specified range may be dynamically -assigned to BOOTP clients as well as DHCP clients. When specifying a +assigned to BOOTP clients as well as DHCP clients. When specifying a single address, \fIhigh-address\fR can be omitted. .PP .B The @@ -1661,7 +1661,7 @@ by matching the \fRdhcp-client-identifier\fR option specified in the \fIhost\fR declaration or the client does not provide a \fRdhcp-client-identifier\fR option, by matching the \fIhardware\fR parameter in the \fIhost\fR declaration to the network hardware -address supplied by the client. BOOTP clients do not normally +address supplied by the client. BOOTP clients do not normally provide a \fIdhcp-client-identifier\fR, so the hardware address must be used for all clients that may boot using the BOOTP protocol. .PP @@ -1673,8 +1673,8 @@ Please be aware that .B only the \fIdhcp-client-identifier\fR option and the hardware address can be used to match a host declaration, or the \fIhost-identifier option\fR -parameter for DHCPv6 servers. For example, it is not possible to -match a host declaration to a \fIhost-name\fR option. This is +parameter for DHCPv6 servers. For example, it is not possible to +match a host declaration to a \fIhost-name\fR option. This is because the host-name option cannot be guaranteed to be unique for any given client, whereas both the hardware address and \fIdhcp-client-identifier\fR option are at least theoretically @@ -1692,7 +1692,7 @@ guaranteed to be unique to a given client. .fi .PP The group statement is used simply to apply one or more parameters to -a group of declarations. It can be used to group hosts, shared +a group of declarations. It can be used to group hosts, shared networks, subnets, or even other groups. .SH REFERENCE: ALLOW AND DENY The @@ -1704,7 +1704,7 @@ various sorts of requests. The allow and deny keywords actually have different meanings depending on the context. In a pool context, these keywords can be used to set up access lists for address allocation pools. In other contexts, the keywords simply control general server -behavior with respect to clients based on scope. In a non-pool +behavior with respect to clients based on scope. In a non-pool context, the .I ignore keyword can be used in place of the @@ -1725,7 +1725,7 @@ declarations. \fBignore unknown-clients;\fR .PP The \fBunknown-clients\fR flag is used to tell dhcpd whether -or not to dynamically assign addresses to unknown clients. Dynamic +or not to dynamically assign addresses to unknown clients. Dynamic address assignment to unknown clients is \fBallow\fRed by default. An unknown client is simply a client that has no host declaration. .PP @@ -1746,11 +1746,6 @@ The \fBbootp\fR flag is used to tell dhcpd whether or not to respond to bootp queries. Bootp queries are \fBallow\fRed by default. .PP -This option does not satisfy the requirement of failover peers for denying -dynamic bootp clients. The \fBdeny dynamic bootp clients;\fR option should -be used instead. See the ALLOW AND DENY WITHIN POOL DECLARATIONS section -of this man page for more details. -.PP .B The .I booting .B keyword @@ -1761,7 +1756,7 @@ of this man page for more details. .PP The \fBbooting\fR flag is used to tell dhcpd whether or not to respond to queries from a particular client. This keyword only has meaning -when it appears in a host declaration. By default, booting is +when it appears in a host declaration. By default, booting is \fBallow\fRed, but if it is disabled for a particular client, then that client will not be able to get an address from the DHCP server. .PP @@ -1774,16 +1769,16 @@ that client will not be able to get an address from the DHCP server. .PP Host declarations can match client messages based on the DHCP Client Identifier option or based on the client's network hardware type and -MAC address. If the MAC address is used, the host declaration will +MAC address. If the MAC address is used, the host declaration will match any client with that MAC address - even clients with different -client identifiers. This doesn't normally happen, but is possible +client identifiers. This doesn't normally happen, but is possible when one computer has more than one operating system installed on it - for example, Microsoft Windows and NetBSD or Linux. .PP The \fBduplicates\fR flag tells the DHCP server that if a request is received from a client that matches the MAC address of a host declaration, any other leases matching that MAC address should be -discarded by the server, even if the UID is not the same. This is a +discarded by the server, even if the UID is not the same. This is a violation of the DHCP protocol, but can prevent clients whose client identifiers change regularly from holding many leases at the same time. By default, duplicates are \fBallow\fRed. @@ -1797,18 +1792,18 @@ By default, duplicates are \fBallow\fRed. \fBignore declines;\fR .PP The DHCPDECLINE message is used by DHCP clients to indicate that the -lease the server has offered is not valid. When the server receives +lease the server has offered is not valid. When the server receives a DHCPDECLINE for a particular address, it normally abandons that address, assuming that some unauthorized system is using it. Unfortunately, a malicious or buggy client can, using DHCPDECLINE -messages, completely exhaust the DHCP server's allocation pool. The +messages, completely exhaust the DHCP server's allocation pool. The server will reclaim these leases, but while the client is running through the pool, it may cause serious thrashing in the DNS, and it will also cause the DHCP server to forget old DHCP client address allocations. .PP The \fBdeclines\fR flag tells the DHCP server whether or not to honor -DHCPDECLINE messages. If it is set to \fBdeny\fR or \fBignore\fR in +DHCPDECLINE messages. If it is set to \fBdeny\fR or \fBignore\fR in a particular scope, the DHCP server will not respond to DHCPDECLINE messages. .PP @@ -1821,7 +1816,7 @@ messages. .PP The \fBclient-updates\fR flag tells the DHCP server whether or not to honor the client's intention to do its own update of its A record. -This is only relevant when doing \fIinterim\fR DNS updates. See the +This is only relevant when doing \fIinterim\fR DNS updates. See the documentation under the heading THE INTERIM DNS UPDATE SCHEME for details. .PP @@ -1844,15 +1839,15 @@ work pretty much the same way whether the client is sending a DHCPDISCOVER or a DHCPREQUEST message - an address will be allocated to the client (either the old address it's requesting, or a new address) and then that address will be tested to see if it's okay to -let the client have it. If the client requested it, and it's not -okay, the server will send a DHCPNAK message. Otherwise, the server -will simply not respond to the client. If it is okay to give the +let the client have it. If the client requested it, and it's not +okay, the server will send a DHCPNAK message. Otherwise, the server +will simply not respond to the client. If it is okay to give the address to the client, the server will send a DHCPACK message. .PP The primary motivation behind pool declarations is to have address -allocation pools whose allocation policies are different. A client +allocation pools whose allocation policies are different. A client may be denied access to one pool, but allowed access to another pool -on the same network segment. In order for this to work, access +on the same network segment. In order for this to work, access control has to be done during address allocation, not after address allocation is done. .PP @@ -1895,18 +1890,18 @@ this pool to any bootp client. .PP If specified, this statement either allows or prevents allocation from this pool to any client that has been authenticated using the DHCP -authentication protocol. This is not yet supported. +authentication protocol. This is not yet supported. .PP \fBunauthenticated clients;\fR .PP If specified, this statement either allows or prevents allocation from this pool to any client that has not been authenticated using the DHCP -authentication protocol. This is not yet supported. +authentication protocol. This is not yet supported. .PP \fBall clients;\fR .PP If specified, this statement either allows or prevents allocation from -this pool to all clients. This can be used when you want to write a +this pool to all clients. This can be used when you want to write a pool declaration for some reason, but hold it in reserve, or when you want to renumber your network quickly, and thus want the server to force all clients that have been allocated addresses from this pool to @@ -1952,13 +1947,13 @@ statement The DHCP and BOOTP protocols both require DHCP and BOOTP clients to set the broadcast bit in the flags field of the BOOTP message header. Unfortunately, some DHCP and BOOTP clients do not do this, and -therefore may not receive responses from the DHCP server. The DHCP +therefore may not receive responses from the DHCP server. The DHCP server can be made to always broadcast its responses to clients by setting this flag to \'on\' for the relevant scope; relevant scopes would be inside a conditional statement, as a parameter for a class, or as a parameter -for a host declaration. To avoid creating excess broadcast traffic on your +for a host declaration. To avoid creating excess broadcast traffic on your network, we recommend that you restrict the use of this option to as few -clients as possible. For example, the Microsoft DHCP client is known not +clients as possible. For example, the Microsoft DHCP client is known not to have this problem, as are the OpenTransport and ISC DHCP clients. .RE .PP @@ -1970,7 +1965,7 @@ statement .B always-reply-rfc1048 \fIflag\fR\fB;\fR .PP Some BOOTP clients expect RFC1048-style responses, but do not follow -RFC1048 when sending their requests. You can tell that a client is +RFC1048 when sending their requests. You can tell that a client is having this problem if it is not getting the options you have configured for it and if you see in the server log the message "(non-rfc1048)" printed with each BOOTREQUEST that is logged. @@ -1978,7 +1973,7 @@ configured for it and if you see in the server log the message If you want to send rfc1048 options to such a client, you can set the .B always-reply-rfc1048 option in that client's host declaration, and the DHCP server will -respond with an RFC-1048-style vendor options field. This flag can +respond with an RFC-1048-style vendor options field. This flag can be set in any scope, and will affect all clients covered by that scope. .RE @@ -2002,13 +1997,13 @@ from a legitimate DHCP server on the network. Network administrators setting up authoritative DHCP servers for their networks should always write \fBauthoritative;\fR at the top of their configuration file to indicate that the DHCP server \fIshould\fR send -DHCPNAK messages to misconfigured clients. If this is not done, +DHCPNAK messages to misconfigured clients. If this is not done, clients will be unable to get a correct IP address after changing subnets until their old lease has expired, which could take quite a long time. .PP Usually, writing \fBauthoritative;\fR at the top level of the file -should be sufficient. However, if a DHCP server is to be set up so +should be sufficient. However, if a DHCP server is to be set up so that it is aware of some networks for which it is authoritative and some networks for which it is not, it may be more appropriate to declare authority on a per-network-segment basis. @@ -2031,7 +2026,7 @@ The \fIboot-unknown-clients\fR statement If the \fIboot-unknown-clients\fR statement is present and has a value of \fIfalse\fR or \fIoff\fR, then clients for which there is no .I host -declaration will not be allowed to obtain IP addresses. If this +declaration will not be allowed to obtain IP addresses. If this statement is not present or has a value of \fItrue\fR or \fIon\fR, then clients without host declarations will be allowed to obtain IP addresses, as long as those addresses are not restricted by @@ -2058,7 +2053,7 @@ The \fIddns-hostname\fR statement .B ddns-hostname \fIname\fB;\fR .PP The \fIname\fR parameter should be the hostname that will be used in -setting up the client's A and PTR records. If no ddns-hostname is +setting up the client's A and PTR records. If no ddns-hostname is specified in scope, then the server will derive the hostname automatically, using an algorithm that varies for each of the different update methods. @@ -2080,13 +2075,13 @@ The \fIddns-rev-domainname\fR statement .B ddns-rev-domainname \fIname\fB;\fR The \fIname\fR parameter should be the domain name that will be appended to the client's reversed IP address to produce a name for use -in the client's PTR record. By default, this is "in-addr.arpa.", but +in the client's PTR record. By default, this is "in-addr.arpa.", but the default can be overridden here. .PP The reversed IP address to which this domain name is appended is always the IP address of the client, in dotted quad notation, reversed - for example, if the IP address assigned to the client is -10.17.92.74, then the reversed IP address is 74.92.17.10. So a +10.17.92.74, then the reversed IP address is 74.92.17.10. So a client with that IP address would, by default, be given a PTR record of 10.17.92.74.in-addr.arpa. .RE @@ -2114,9 +2109,9 @@ is \fBnone\fR. \fBddns-updates \fIflag\fR\fB;\fR .PP The \fIddns-updates\fR parameter controls whether or not the server will -attempt to do a DNS update when a lease is confirmed. Set this to \fIoff\fR +attempt to do a DNS update when a lease is confirmed. Set this to \fIoff\fR if the server should not attempt to do updates within a certain scope. -The \fIddns-updates\fR parameter is on by default. To disable DNS +The \fIddns-updates\fR parameter is on by default. To disable DNS updates in all scopes, it is preferable to use the \fIddns-update-style\fR statement, setting the style to \fInone\fR. .RE @@ -2176,9 +2171,9 @@ statement .PP The \fIdo-forward-updates\fR statement instructs the DHCP server as to whether it should attempt to update a DHCP client's A record -when the client acquires or renews a lease. This statement has no +when the client acquires or renews a lease. This statement has no effect unless DNS updates are enabled and \fBddns-update-style\fR is -set to \fBinterim\fR. Forward updates are enabled by default. If +set to \fBinterim\fR. Forward updates are enabled by default. If this statement is used to disable forward updates, the DHCP server will never attempt to update the client's A record, and will only ever attempt to update the client's PTR record if the client supplies an @@ -2226,11 +2221,11 @@ statement .B dynamic-bootp-lease-length\fR \fIlength\fR\fB;\fR .PP The \fIdynamic-bootp-lease-length\fR statement is used to set the -length of leases dynamically assigned to BOOTP clients. At some +length of leases dynamically assigned to BOOTP clients. At some sites, it may be possible to assume that a lease is no longer in use if its holder has not used BOOTP or DHCP to get its address within -a certain time period. The period is specified in \fIlength\fR as a -number of seconds. If a client reboots using BOOTP during the +a certain time period. The period is specified in \fIlength\fR as a +number of seconds. If a client reboots using BOOTP during the timeout period, the lease duration is reset to \fIlength\fR, so a BOOTP client that boots frequently enough will never lose its lease. Needless to say, this parameter should be adjusted with extreme @@ -2293,7 +2288,7 @@ The \fIget-lease-hostnames\fR statement is used to tell dhcpd whether or not to look up the domain name corresponding to the IP address of each address in the lease pool and use that address for the DHCP \fIhostname\fR option. If \fIflag\fR is true, then this lookup is -done for all addresses in the current scope. By default, or if +done for all addresses in the current scope. By default, or if \fIflag\fR is false, no lookups are done. .RE .PP @@ -2309,7 +2304,7 @@ address must be declared using a \fIhardware\fR clause in the .I host statement. .I hardware-type -must be the name of a physical hardware interface type. Currently, +must be the name of a physical hardware interface type. Currently, only the .B ethernet and @@ -2320,7 +2315,7 @@ hardware type (and others) would also be desirable. The .I hardware-address should be a set of hexadecimal octets (numbers from 0 through ff) -separated by colons. The \fIhardware\fR statement may also be used +separated by colons. The \fIhardware\fR statement may also be used for DHCP clients. .RE .PP @@ -2364,8 +2359,8 @@ statement .B lease-file-name \fIname\fB;\fR .PP .I Name -should be the name of the DHCP server's lease file. By default, this -is DBDIR/dhcpd.leases. This statement \fBmust\fR appear in the outer +should be the name of the DHCP server's lease file. By default, this +is DBDIR/dhcpd.leases. This statement \fBmust\fR appear in the outer scope of the configuration file - if it appears in some other scope, it will have no effect. Furthermore, it has no effect if overridden by the @@ -2462,16 +2457,16 @@ statement .B log-facility \fIfacility\fB;\fR .PP This statement causes the DHCP server to do all of its logging on the -specified log facility once the dhcpd.conf file has been read. By -default the DHCP server logs to the daemon facility. Possible log +specified log facility once the dhcpd.conf file has been read. By +default the DHCP server logs to the daemon facility. Possible log facilities include auth, authpriv, cron, daemon, ftp, kern, lpr, mail, mark, news, ntp, security, syslog, user, uucp, and local0 through -local7. Not all of these facilities are available on all systems, +local7. Not all of these facilities are available on all systems, and there may be other facilities available on other systems. .PP In addition to setting this value, you may need to modify your .I syslog.conf -file to configure logging of the DHCP server. For example, you might +file to configure logging of the DHCP server. For example, you might add a line like this: .PP .nf @@ -2539,15 +2534,15 @@ statement should be the minimum number of seconds since a client began trying to acquire a new lease before the DHCP server will respond to its request. The number of seconds is based on what the client reports, and the maximum -value that the client can report is 255 seconds. Generally, setting this +value that the client can report is 255 seconds. Generally, setting this to one will result in the DHCP server not responding to the client's first request, but always responding to its second request. .PP This can be used to set up a secondary DHCP server which never offers an address to a client -until the primary server has been given a chance to do so. If the primary +until the primary server has been given a chance to do so. If the primary server is down, the client will bind to the secondary server, but otherwise -clients should always bind to the primary. Note that this does not, by +clients should always bind to the primary. Note that this does not, by itself, permit a primary server and a secondary server to share a pool of dynamically-allocatable addresses. .RE @@ -2561,7 +2556,7 @@ statement .PP The \fInext-server\fR statement is used to specify the host address of the server from which the initial boot file (specified in the -\fIfilename\fR statement) is to be loaded. \fIServer-name\fR should +\fIfilename\fR statement) is to be loaded. \fIServer-name\fR should be a numeric IP address or a domain name. .RE .PP @@ -2573,7 +2568,7 @@ statement .B omapi-port\fR \fIport\fR\fB;\fR .PP The \fIomapi-port\fR statement causes the DHCP server to listen for -OMAPI connections on the specified port. This statement is required +OMAPI connections on the specified port. This statement is required to enable the OMAPI protocol, which is used to examine and modify the state of the DHCP server as it is running. .RE @@ -2587,12 +2582,12 @@ statement .PP If this flag is enabled, whenever a client sends a DHCPREQUEST for a particular lease, the server will automatically free any other leases -the client holds. This presumes that when the client sends a +the client holds. This presumes that when the client sends a DHCPREQUEST, it has forgotten any lease not mentioned in the DHCPREQUEST - i.e., the client has only a single network interface .I and it does not remember leases it's holding on networks to which it is -not currently attached. Neither of these assumptions are guaranteed +not currently attached. Neither of these assumptions are guaranteed or provable, so we urge caution in the use of this statement. .RE .PP @@ -2605,9 +2600,9 @@ statement .I name\fR\fB;\fR .PP .I Name -should be the name of the DHCP server's process ID file. This is the +should be the name of the DHCP server's process ID file. This is the file in which the DHCP server's process ID is stored when the server -starts. By default, this is RUNDIR/dhcpd.pid. Like the +starts. By default, this is RUNDIR/dhcpd.pid. Like the .I lease-file-name statement, this statement must appear in the outer scope of the configuration file. It has no effect if overridden by the @@ -2650,13 +2645,13 @@ statement .PP When the DHCP server is considering dynamically allocating an IP address to a client, it first sends an ICMP Echo request (a \fIping\fR) -to the address being assigned. It waits for a second, and if no -ICMP Echo response has been heard, it assigns the address. If a +to the address being assigned. It waits for a second, and if no +ICMP Echo response has been heard, it assigns the address. If a response \fIis\fR heard, the lease is abandoned, and the server does not respond to the client. .PP This \fIping check\fR introduces a default one-second delay in responding -to DHCPDISCOVER messages, which can be a problem for some clients. The +to DHCPDISCOVER messages, which can be a problem for some clients. The default delay of one second may be configured using the ping-timeout parameter. The ping-check configuration parameter can be used to control checking - if its value is false, no ping check is done. @@ -2722,13 +2717,13 @@ statement .B server-identifier \fIhostname\fR\fB;\fR .PP The server-identifier statement can be used to define the value that -is sent in the DHCP Server Identifier option for a given scope. The +is sent in the DHCP Server Identifier option for a given scope. The value specified \fBmust\fR be an IP address for the DHCP server, and must be reachable by all clients served by a particular scope. .PP The use of the server-identifier statement is not recommended - the only reason to use it is to force a value other than the default value to be -sent on occasions where the default value would be incorrect. The default +sent on occasions where the default value would be incorrect. The default value is the first IP address associated with the physical network interface on which the request arrived. .PP @@ -2775,7 +2770,7 @@ statement .B server-name "\fIname\fB";\fR .PP The \fIserver-name\fR statement can be used to inform the client of -the name of the server from which it is booting. \fIName\fR should +the name of the server from which it is booting. \fIName\fR should be the name that will be provided to the client. .RE .PP @@ -2787,15 +2782,15 @@ statement .B site-option-space "\fIname\fB";\fR .PP The \fIsite-option-space\fR statement can be used to determine from -what option space site-local options will be taken. This can be used +what option space site-local options will be taken. This can be used in much the same way as the \fIvendor-option-space\fR statement. Site-local options in DHCP are those options whose numeric codes are -greater than 224. These options are intended for site-specific +greater than 224. These options are intended for site-specific uses, but are frequently used by vendors of embedded hardware that -contains DHCP clients. Because site-specific options are allocated +contains DHCP clients. Because site-specific options are allocated on an ad hoc basis, it is quite possible that one vendor's DHCP client might use the same option code that another vendor's client uses, for -different purposes. The \fIsite-option-space\fR option can be used +different purposes. The \fIsite-option-space\fR option can be used to assign a different set of site-specific options for each such vendor, using conditional evaluation (see \fBdhcp-eval (5)\fR for details). @@ -2812,7 +2807,7 @@ If the \fIstash-agent-options\fR parameter is true for a given client, the server will record the relay agent information options sent during the client's initial DHCPREQUEST message when the client was in the SELECTING state and behave as if those options are included in all -subsequent DHCPREQUEST messages sent in the RENEWING state. This +subsequent DHCPREQUEST messages sent in the RENEWING state. This works around a problem with relay agent information options, which is that they usually not appear in DHCPREQUEST messages sent by the client in the RENEWING state, because such messages are unicast @@ -2843,12 +2838,12 @@ statement If the \fIupdate-optimization\fR parameter is false for a given client, the server will attempt a DNS update for that client each time the client renews its lease, rather than only attempting an update when it -appears to be necessary. This will allow the DNS to heal from +appears to be necessary. This will allow the DNS to heal from database inconsistencies more easily, but the cost is that the DHCP -server must do many more DNS updates. We recommend leaving this option +server must do many more DNS updates. We recommend leaving this option enabled, which is the default. This option only affects the behavior of the interim DNS update scheme, and has no effect on the ad-hoc DNS update -scheme. If this parameter is not specified, or is true, the DHCP server +scheme. If this parameter is not specified, or is true, the DHCP server will only update when the client information changes, the client gets a different lease, or the client's lease expires. .RE @@ -2863,11 +2858,11 @@ statement The \fIupdate-static-leases\fR flag, if enabled, causes the DHCP server to do DNS updates for clients even if those clients are being assigned their IP address using a \fIfixed-address\fR statement - that -is, the client is being given a static assignment. This can only -work with the \fIinterim\fR DNS update scheme. It is not +is, the client is being given a static assignment. This can only +work with the \fIinterim\fR DNS update scheme. It is not recommended because the DHCP server has no way to tell that the update has been done, and therefore will not delete the record when it is not -in use. Also, the server must attempt the update each time the +in use. Also, the server must attempt the update each time the client renews its lease, which could have a significant performance impact in environments that place heavy demands on the DHCP server. .RE @@ -2882,7 +2877,7 @@ statement If the \fIuse-host-decl-names\fR parameter is true in a given scope, then for every host declaration within that scope, the name provided for the host declaration will be supplied to the client as its -hostname. So, for example, +hostname. So, for example, .PP .nf group { @@ -2908,9 +2903,9 @@ override the use of the name in the host declaration. .PP It should be noted here that most DHCP clients completely ignore the host-name option sent by the DHCP server, and there is no way to -configure them not to do this. So you generally have a choice of +configure them not to do this. So you generally have a choice of either not having any hostname to client IP address mapping that the -client will recognize, or doing DNS updates. It is beyond +client will recognize, or doing DNS updates. It is beyond the scope of this document to describe how to make this determination. .RE @@ -2925,9 +2920,9 @@ statement If the \fIuse-lease-addr-for-default-route\fR parameter is true in a given scope, then instead of sending the value specified in the routers option (or sending no value at all), the IP address of the -lease being assigned is sent to the client. This supposedly causes +lease being assigned is sent to the client. This supposedly causes Win95 machines to ARP for all IP addresses, which can be helpful if -your router is configured for proxy ARP. The use of this feature is +your router is configured for proxy ARP. The use of this feature is not recommended, because it won't work for many DHCP clients. .RE .PP @@ -2939,16 +2934,16 @@ statement .B vendor-option-space \fIstring\fR\fB;\fR .PP The \fIvendor-option-space\fR parameter determines from what option -space vendor options are taken. The use of this configuration +space vendor options are taken. The use of this configuration parameter is illustrated in the \fBdhcp-options(5)\fR manual page, in the \fIVENDOR ENCAPSULATED OPTIONS\fR section. .RE .SH SETTING PARAMETER VALUES USING EXPRESSIONS Sometimes it's helpful to be able to set the value of a DHCP server -parameter based on some value that the client has sent. To do this, -you can use expression evaluation. The +parameter based on some value that the client has sent. To do this, +you can use expression evaluation. The .B dhcp-eval(5) -manual page describes how to write expressions. To assign the result +manual page describes how to write expressions. To assign the result of an evaluation to an option, define the option as follows: .nf .sp 1 @@ -3008,7 +3003,7 @@ dhcpd(8), dhcpd.leases(5), dhcp-options(5), dhcp-eval(5), RFC2132, RFC2131. .SH AUTHOR .B dhcpd.conf(5) was written by Ted Lemon -under a contract with Vixie Labs. Funding +under a contract with Vixie Labs. Funding for this project was provided by Internet Systems Consortium. Information about Internet Systems Consortium can be found at .B https://www.isc.org. diff --git a/external/bsd/dhcp/dist/server/dhcpd.conf.example b/external/bsd/dhcp/dist/server/dhcpd.conf.example new file mode 100644 index 000000000000..5eab9516d4fe --- /dev/null +++ b/external/bsd/dhcp/dist/server/dhcpd.conf.example @@ -0,0 +1,104 @@ +# dhcpd.conf +# +# Sample configuration file for ISC dhcpd +# + +# option definitions common to all supported networks... +option domain-name "example.org"; +option domain-name-servers ns1.example.org, ns2.example.org; + +default-lease-time 600; +max-lease-time 7200; + +# Use this to enble / disable dynamic dns updates globally. +#ddns-update-style none; + +# If this DHCP server is the official DHCP server for the local +# network, the authoritative directive should be uncommented. +#authoritative; + +# Use this to send dhcp log messages to a different log file (you also +# have to hack syslog.conf to complete the redirection). +log-facility local7; + +# No service will be given on this subnet, but declaring it helps the +# DHCP server to understand the network topology. + +subnet 10.152.187.0 netmask 255.255.255.0 { +} + +# This is a very basic subnet declaration. + +subnet 10.254.239.0 netmask 255.255.255.224 { + range 10.254.239.10 10.254.239.20; + option routers rtr-239-0-1.example.org, rtr-239-0-2.example.org; +} + +# This declaration allows BOOTP clients to get dynamic addresses, +# which we don't really recommend. + +subnet 10.254.239.32 netmask 255.255.255.224 { + range dynamic-bootp 10.254.239.40 10.254.239.60; + option broadcast-address 10.254.239.31; + option routers rtr-239-32-1.example.org; +} + +# A slightly different configuration for an internal subnet. +subnet 10.5.5.0 netmask 255.255.255.224 { + range 10.5.5.26 10.5.5.30; + option domain-name-servers ns1.internal.example.org; + option domain-name "internal.example.org"; + option routers 10.5.5.1; + option broadcast-address 10.5.5.31; + default-lease-time 600; + max-lease-time 7200; +} + +# Hosts which require special configuration options can be listed in +# host statements. If no address is specified, the address will be +# allocated dynamically (if possible), but the host-specific information +# will still come from the host declaration. + +host passacaglia { + hardware ethernet 0:0:c0:5d:bd:95; + filename "vmunix.passacaglia"; + server-name "toccata.fugue.com"; +} + +# Fixed IP addresses can also be specified for hosts. These addresses +# should not also be listed as being available for dynamic assignment. +# Hosts for which fixed IP addresses have been specified can boot using +# BOOTP or DHCP. Hosts for which no fixed address is specified can only +# be booted with DHCP, unless there is an address range on the subnet +# to which a BOOTP client is connected which has the dynamic-bootp flag +# set. +host fantasia { + hardware ethernet 08:00:07:26:c0:a5; + fixed-address fantasia.fugue.com; +} + +# You can declare a class of clients and then do address allocation +# based on that. The example below shows a case where all clients +# in a certain class get addresses on the 10.17.224/24 subnet, and all +# other clients get addresses on the 10.0.29/24 subnet. + +class "foo" { + match if substring (option vendor-class-identifier, 0, 4) = "SUNW"; +} + +shared-network 224-29 { + subnet 10.17.224.0 netmask 255.255.255.0 { + option routers rtr-224.example.org; + } + subnet 10.0.29.0 netmask 255.255.255.0 { + option routers rtr-29.example.org; + } + pool { + allow members of "foo"; + range 10.17.224.10 10.17.224.250; + } + pool { + deny members of "foo"; + range 10.0.29.10 10.0.29.230; + } +} diff --git a/external/bsd/dhcp/dist/server/dhcpd.leases.5 b/external/bsd/dhcp/dist/server/dhcpd.leases.5 index e44030154018..be0f5748c6dc 100644 --- a/external/bsd/dhcp/dist/server/dhcpd.leases.5 +++ b/external/bsd/dhcp/dist/server/dhcpd.leases.5 @@ -1,4 +1,4 @@ -.\" $NetBSD: dhcpd.leases.5,v 1.1.1.1 2013/03/24 15:46:05 christos Exp $ +.\" $NetBSD: dhcpd.leases.5,v 1.1.1.2 2013/03/24 22:50:41 christos Exp $ .\" .\" dhcpd.leases.5 .\" @@ -30,7 +30,7 @@ .\" see ``http://www.vix.com''. To learn more about Nominum, Inc., see .\" ``http://www.nominum.com''. .\" -.\" Id: dhcpd.leases.5,v 1.14.24.3 2011-09-19 00:24:22 sar Exp +.\" Id: dhcpd.leases.5,v 1.14.24.3 2011/09/19 00:24:22 sar Exp .\" .TH dhcpd.leases 5 .SH NAME diff --git a/external/bsd/dhcp/dist/server/failover.c b/external/bsd/dhcp/dist/server/failover.c index e12914f9c4b5..af8683420cee 100644 --- a/external/bsd/dhcp/dist/server/failover.c +++ b/external/bsd/dhcp/dist/server/failover.c @@ -1,11 +1,11 @@ -/* $NetBSD: failover.c,v 1.1.1.1 2013/03/24 15:46:02 christos Exp $ */ +/* $NetBSD: failover.c,v 1.1.1.2 2013/03/24 22:50:42 christos Exp $ */ /* failover.c Failover protocol support code... */ /* - * Copyright (c) 2004-2011 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004-2012 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1999-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -35,8 +35,9 @@ */ #include -__RCSID("$NetBSD: failover.c,v 1.1.1.1 2013/03/24 15:46:02 christos Exp $"); +__RCSID("$NetBSD: failover.c,v 1.1.1.2 2013/03/24 22:50:42 christos Exp $"); +#include "cdefs.h" #include "dhcpd.h" #include @@ -2417,7 +2418,8 @@ dhcp_failover_pool_dobalance(dhcp_failover_state_t *state, struct shared_network *s; struct pool *p; binding_state_t peer_lease_state; - binding_state_t my_lease_state; + /* binding_state_t my_lease_state; */ + /* XXX Why is this my_lease_state never used? */ struct lease **lq; int (*log_func)(const char *, ...); const char *result, *reqlog; @@ -2441,12 +2443,12 @@ dhcp_failover_pool_dobalance(dhcp_failover_state_t *state, if (p->failover_peer->i_am == primary) { lts = (p->free_leases - p->backup_leases) / 2; peer_lease_state = FTS_BACKUP; - my_lease_state = FTS_FREE; + /* my_lease_state = FTS_FREE; */ lq = &p->free; } else { lts = (p->backup_leases - p->free_leases) / 2; peer_lease_state = FTS_FREE; - my_lease_state = FTS_BACKUP; + /* my_lease_state = FTS_BACKUP; */ lq = &p->backup; } @@ -3262,13 +3264,13 @@ isc_result_t dhcp_failover_state_stuff (omapi_object_t *c, omapi_object_t *id, omapi_object_t *h) { + /* In this function c should be a (omapi_connection_object_t *) */ + dhcp_failover_state_t *s; - omapi_connection_object_t *conn; isc_result_t status; if (c -> type != omapi_type_connection) return DHCP_R_INVALIDARG; - conn = (omapi_connection_object_t *)c; if (h -> type != dhcp_type_failover_state) return DHCP_R_INVALIDARG; @@ -4311,6 +4313,8 @@ void dhcp_failover_send_contact (void *vstate) if (obufix) { log_debug ("%s", obuf); } +#else + IGNORE_UNUSED(status); #endif return; } @@ -4359,6 +4363,8 @@ isc_result_t dhcp_failover_send_state (dhcp_failover_state_t *state) if (obufix) { log_debug ("%s", obuf); } +#else + IGNORE_UNUSED(status); #endif return ISC_R_SUCCESS; } @@ -4451,7 +4457,9 @@ isc_result_t dhcp_failover_send_connectack (omapi_object_t *l, ? dhcp_failover_make_option(FTO_RELATIONSHIP_NAME, FMA, strlen(state->name), state->name) : (link->imsg->options_present & FTB_RELATIONSHIP_NAME) - ? &link->imsg->relationship_name + ? dhcp_failover_make_option(FTO_RELATIONSHIP_NAME, FMA, + link->imsg->relationship_name.count, + link->imsg->relationship_name.data) : &skip_failover_option, state ? dhcp_failover_make_option (FTO_MAX_UNACKED, FMA, @@ -4495,7 +4503,6 @@ isc_result_t dhcp_failover_send_disconnect (omapi_object_t *l, const char *message) { dhcp_failover_link_t *link; - dhcp_failover_state_t *state; isc_result_t status; #if defined (DEBUG_FAILOVER_MESSAGES) char obuf [64]; @@ -4510,7 +4517,6 @@ isc_result_t dhcp_failover_send_disconnect (omapi_object_t *l, if (!l || l -> type != dhcp_type_failover_link) return DHCP_R_INVALIDARG; link = (dhcp_failover_link_t *)l; - state = link -> state_object; if (!l -> outer || l -> outer -> type != omapi_type_connection) return DHCP_R_INVALIDARG; @@ -5045,7 +5051,7 @@ failover_lease_is_better(dhcp_failover_state_t *state, struct lease *lease, isc_result_t dhcp_failover_process_bind_update (dhcp_failover_state_t *state, failover_message_t *msg) { - struct lease *lt, *lease; + struct lease *lt = NULL, *lease = NULL; struct iaddr ia; int reason = FTR_MISC_REJECT; const char *message; @@ -5066,8 +5072,6 @@ isc_result_t dhcp_failover_process_bind_update (dhcp_failover_state_t *state, ia.len = sizeof msg -> assigned_addr; memcpy (ia.iabuf, &msg -> assigned_addr, ia.len); - lease = (struct lease *)0; - lt = (struct lease *)0; if (!find_lease_by_ip_addr (&lease, ia, MDL)) { message = "unknown IP address"; reason = FTR_ILLEGAL_IP_ADDR; @@ -5223,7 +5227,7 @@ isc_result_t dhcp_failover_process_bind_update (dhcp_failover_state_t *state, */ if (msg->binding_status == FTS_ACTIVE && (chaddr_changed || ident_changed)) { - ddns_removals(lease, NULL, NULL); + (void) ddns_removals(lease, NULL, NULL, ISC_FALSE); if (lease->scope != NULL) binding_scope_dereference(&lease->scope, MDL); @@ -5839,38 +5843,52 @@ int load_balance_mine (struct packet *packet, dhcp_failover_state_t *state) struct data_string ds; unsigned char hbaix; int hm; + u_int16_t ec; - if (state -> load_balance_max_secs < ntohs (packet -> raw -> secs)) { - return 1; + ec = ntohs(packet->raw->secs); + +#if defined(SECS_BYTEORDER) + /* + * If desired check to see if the secs field may have been byte + * swapped. We assume it has if the high order byte isn't cleared + * while the low order byte is cleared. In this case we swap the + * bytes and continue processing. + */ + if ((ec > 255) && ((ec & 0xff) == 0)) { + ec = (ec >> 8) | (ec << 8); + } +#endif + + if (state->load_balance_max_secs < ec) { + return (1); } /* If we don't have a hash bucket array, we can't tell if this one's ours, so we assume it's not. */ - if (!state -> hba) - return 0; + if (!state->hba) + return (0); - oc = lookup_option (&dhcp_universe, packet -> options, - DHO_DHCP_CLIENT_IDENTIFIER); - memset (&ds, 0, sizeof ds); + oc = lookup_option(&dhcp_universe, packet->options, + DHO_DHCP_CLIENT_IDENTIFIER); + memset(&ds, 0, sizeof ds); if (oc && - evaluate_option_cache (&ds, packet, (struct lease *)0, - (struct client_state *)0, - packet -> options, (struct option_state *)0, - &global_scope, oc, MDL)) { - hbaix = loadb_p_hash (ds.data, ds.len); + evaluate_option_cache(&ds, packet, NULL, NULL, + packet->options, NULL, + &global_scope, oc, MDL)) { + hbaix = loadb_p_hash(ds.data, ds.len); data_string_forget(&ds, MDL); } else { - hbaix = loadb_p_hash (packet -> raw -> chaddr, - packet -> raw -> hlen); + hbaix = loadb_p_hash(packet->raw->chaddr, + packet->raw->hlen); } hm = state->hba[(hbaix >> 3) & 0x1F] & (1 << (hbaix & 0x07)); - if (state -> i_am == primary) - return hm; + if (state->i_am == primary) + return (hm); else - return !hm; + return (!hm); } /* The inverse of load_balance_mine ("load balance theirs"). We can't @@ -6334,6 +6352,8 @@ static isc_result_t failover_message_dereference (failover_message_t **mp, dfree (m -> hba.data, file, line); if (m -> message.data) dfree (m -> message.data, file, line); + if (m -> relationship_name.data) + dfree (m -> relationship_name.data, file, line); if (m -> reply_options.data) dfree (m -> reply_options.data, file, line); if (m -> request_options.data) diff --git a/external/bsd/dhcp/dist/server/ldap.c b/external/bsd/dhcp/dist/server/ldap.c index 3e664b4f2d37..0a0cc576cee7 100644 --- a/external/bsd/dhcp/dist/server/ldap.c +++ b/external/bsd/dhcp/dist/server/ldap.c @@ -1,4 +1,4 @@ -/* $NetBSD: ldap.c,v 1.1.1.1 2013/03/24 15:46:05 christos Exp $ */ +/* $NetBSD: ldap.c,v 1.1.1.2 2013/03/24 22:50:42 christos Exp $ */ /* ldap.c @@ -1990,7 +1990,7 @@ find_subclass_in_ldap (struct class *class, struct class **newclass, return (0); } memset ((*newclass)->billed_leases, 0, - ((*newclass)->lease_limit * sizeof (*newclass)->billed_leases)); + ((*newclass)->lease_limit * sizeof (struct lease *))); } data_string_copy (&(*newclass)->hash_string, data, MDL); diff --git a/external/bsd/dhcp/dist/server/mdb.c b/external/bsd/dhcp/dist/server/mdb.c index 797f59534c18..3b4e8407c080 100644 --- a/external/bsd/dhcp/dist/server/mdb.c +++ b/external/bsd/dhcp/dist/server/mdb.c @@ -1,11 +1,11 @@ -/* $NetBSD: mdb.c,v 1.1.1.1 2013/03/24 15:46:03 christos Exp $ */ +/* $NetBSD: mdb.c,v 1.1.1.2 2013/03/24 22:50:42 christos Exp $ */ /* mdb.c Server-specific in-memory database support. */ /* - * Copyright (c) 2004-2011 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004-2012 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1996-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -35,7 +35,7 @@ */ #include -__RCSID("$NetBSD: mdb.c,v 1.1.1.1 2013/03/24 15:46:03 christos Exp $"); +__RCSID("$NetBSD: mdb.c,v 1.1.1.2 2013/03/24 22:50:42 christos Exp $"); #include "dhcpd.h" #include "omapip/hash.h" @@ -312,16 +312,13 @@ isc_result_t enter_host (hd, dynamicp, commit) /* See if there's a statement that sets the client identifier. This is a kludge - the client identifier really shouldn't be set with an executable statement. */ - esp = (struct executable_statement *)0; - if (executable_statement_foreach (hd -> group -> statements, + esp = NULL; + if (executable_statement_foreach (hd->group->statements, find_uid_statement, &esp, 0)) { - evaluate_option_cache (&hd -> client_identifier, - (struct packet *)0, - (struct lease *)0, - (struct client_state *)0, - (struct option_state *)0, - (struct option_state *)0, &global_scope, - esp -> data.option, MDL); + (void) evaluate_option_cache (&hd->client_identifier, + NULL, NULL, NULL, NULL, NULL, + &global_scope, + esp->data.option, MDL); } /* If we got a client identifier, hash this entry by @@ -1426,10 +1423,11 @@ int supersede_lease (comp, lease, commit, propogate, pimmediate) void make_binding_state_transition (struct lease *lease) { + #if defined (FAILOVER_PROTOCOL) dhcp_failover_state_t *peer; - if (lease && lease -> pool && lease -> pool -> failover_peer) + if (lease -> pool && lease -> pool -> failover_peer) peer = lease -> pool -> failover_peer; else peer = (dhcp_failover_state_t *)0; @@ -1450,7 +1448,7 @@ void make_binding_state_transition (struct lease *lease) lease -> binding_state == FTS_ACTIVE && lease -> next_binding_state != FTS_RELEASED))) { #if defined (NSUPDATE) - ddns_removals(lease, NULL, NULL); + (void) ddns_removals(lease, NULL, NULL, ISC_TRUE); #endif if (lease -> on_expiry) { execute_statements ((struct binding_value **)0, @@ -1516,7 +1514,7 @@ void make_binding_state_transition (struct lease *lease) * release message. This is not true of expiry, where the * peer may have extended the lease. */ - ddns_removals(lease, NULL, NULL); + (void) ddns_removals(lease, NULL, NULL, ISC_TRUE); #endif if (lease -> on_release) { execute_statements ((struct binding_value **)0, @@ -1576,17 +1574,18 @@ void make_binding_state_transition (struct lease *lease) case FTS_RELEASED: case FTS_ABANDONED: case FTS_RESET: - lease -> next_binding_state = FTS_FREE; + lease->next_binding_state = FTS_FREE; #if defined(FAILOVER_PROTOCOL) /* If we are not in partner_down, leases don't go from EXPIRED to FREE on a timeout - only on an update. If we're in partner_down, they expire at mclt past the time we entered partner_down. */ - if (lease -> pool -> failover_peer && - lease -> pool -> failover_peer -> me.state == partner_down) - lease -> tsfp = - (lease -> pool -> failover_peer -> me.stos + - lease -> pool -> failover_peer -> mclt); + if ((lease->pool != NULL) && + (lease->pool->failover_peer != NULL) && + (lease->pool->failover_peer->me.state == partner_down)) + lease->tsfp = + (lease->pool->failover_peer->me.stos + + lease->pool->failover_peer->mclt); #endif /* FAILOVER_PROTOCOL */ break; @@ -1685,7 +1684,7 @@ void release_lease (lease, packet) /* If there are statements to execute when the lease is released, execute them. */ #if defined (NSUPDATE) - ddns_removals(lease, NULL, NULL); + (void) ddns_removals(lease, NULL, NULL, ISC_FALSE); #endif if (lease -> on_release) { execute_statements ((struct binding_value **)0, @@ -1759,7 +1758,7 @@ void abandon_lease (lease, message) { struct lease *lt = (struct lease *)0; #if defined (NSUPDATE) - ddns_removals(lease, NULL, NULL); + (void) ddns_removals(lease, NULL, NULL, ISC_FALSE); #endif if (!lease_copy (<, lease, MDL)) @@ -1783,6 +1782,14 @@ void abandon_lease (lease, message) lease_dereference (<, MDL); } +#if 0 +/* + * This doesn't appear to be in use for anything anymore. + * I'm ifdeffing it now and if there are no complaints in + * the future it will be removed. + * SAR + */ + /* Abandon the specified lease (set its timeout to infinity and its particulars to zero, and re-hash it as appropriate. */ @@ -1791,7 +1798,7 @@ void dissociate_lease (lease) { struct lease *lt = (struct lease *)0; #if defined (NSUPDATE) - ddns_removals(lease, NULL, NULL); + (void) ddns_removals(lease, NULL, NULL, ISC_FALSE); #endif if (!lease_copy (<, lease, MDL)) @@ -1816,6 +1823,7 @@ void dissociate_lease (lease) supersede_lease (lease, lt, 1, 1, 1); lease_dereference (<, MDL); } +#endif /* Timer called when a lease in a particular pool expires. */ void pool_timer (vpool) @@ -1966,9 +1974,17 @@ int find_lease_by_hw_addr (struct lease **lp, const char *file, int line) { if (hwlen == 0) - return 0; - return lease_id_hash_lookup(lp, lease_hw_addr_hash, hwaddr, hwlen, - file, line); + return (0); + + /* + * If it's an infiniband address don't bother + * as we don't have a useful address to hash. + */ + if ((hwlen == 1) && (hwaddr[0] == HTYPE_INFINIBAND)) + return (0); + + return (lease_id_hash_lookup(lp, lease_hw_addr_hash, hwaddr, hwlen, + file, line)); } /* If the lease is preferred over the candidate, return truth. The @@ -2133,6 +2149,8 @@ void uid_hash_delete (lease) } /* Add the specified lease to the hardware address hash. */ +/* We don't add leases with infiniband addresses to the + * hash as there isn't any address to hash on. */ void hw_hash_add(struct lease *lease) @@ -2142,6 +2160,14 @@ hw_hash_add(struct lease *lease) struct lease *prev = NULL; struct lease *next = NULL; + /* + * If it's an infiniband address don't bother + * as we don't have a useful address to hash. + */ + if ((lease->hardware_addr.hlen == 1) && + (lease->hardware_addr.hbuf[0] == HTYPE_INFINIBAND)) + return; + /* If it's not in the hash, just add it. */ if (!find_lease_by_hw_addr (&head, lease -> hardware_addr.hbuf, lease -> hardware_addr.hlen, MDL)) @@ -2213,6 +2239,14 @@ void hw_hash_delete (lease) struct lease *head = (struct lease *)0; struct lease *next = (struct lease *)0; + /* + * If it's an infiniband address don't bother + * as we don't have a useful address to hash. + */ + if ((lease->hardware_addr.hlen == 1) && + (lease->hardware_addr.hbuf[0] == HTYPE_INFINIBAND)) + return; + /* If it's not in the hash, we have no work to do. */ if (!find_lease_by_hw_addr (&head, lease -> hardware_addr.hbuf, lease -> hardware_addr.hlen, MDL)) { diff --git a/external/bsd/dhcp/dist/server/omapi.c b/external/bsd/dhcp/dist/server/omapi.c index 5bd6e7aa949a..2117829981ce 100644 --- a/external/bsd/dhcp/dist/server/omapi.c +++ b/external/bsd/dhcp/dist/server/omapi.c @@ -1,11 +1,11 @@ -/* $NetBSD: omapi.c,v 1.1.1.1 2013/03/24 15:46:03 christos Exp $ */ +/* $NetBSD: omapi.c,v 1.1.1.2 2013/03/24 22:50:43 christos Exp $ */ /* omapi.c OMAPI object interfaces for the DHCP server. */ /* - * Copyright (c) 2004-2010 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004-2010,2012 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1999-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -35,7 +35,7 @@ */ #include -__RCSID("$NetBSD: omapi.c,v 1.1.1.1 2013/03/24 15:46:03 christos Exp $"); +__RCSID("$NetBSD: omapi.c,v 1.1.1.2 2013/03/24 22:50:43 christos Exp $"); /* Many, many thanks to Brian Murrell and BCtel for this code - BCtel provided the funding that resulted in this code and the entire @@ -485,12 +485,11 @@ isc_result_t dhcp_lease_destroy (omapi_object_t *h, const char *file, int line) isc_result_t dhcp_lease_signal_handler (omapi_object_t *h, const char *name, va_list ap) { - struct lease *lease; + /* h should point to (struct lease *) */ isc_result_t status; if (h -> type != dhcp_type_lease) return DHCP_R_INVALIDARG; - lease = (struct lease *)h; if (!strcmp (name, "updated")) return ISC_R_SUCCESS; @@ -990,20 +989,21 @@ isc_result_t dhcp_host_set_value (omapi_object_t *h, if (!omapi_ds_strcmp (name, "hardware-type")) { int type; - if (value && (value -> type == omapi_datatype_data && - value -> u.buffer.len == sizeof type)) { - if (value -> u.buffer.len > sizeof type) - return DHCP_R_INVALIDARG; - memcpy (&type, - value -> u.buffer.value, - value -> u.buffer.len); - type = ntohl (type); - } else if (value -> type == omapi_datatype_int) - type = value -> u.integer; + if ((value != NULL) && + ((value->type == omapi_datatype_data) && + (value->u.buffer.len == sizeof(type)))) { + if (value->u.buffer.len > sizeof(type)) + return (DHCP_R_INVALIDARG); + memcpy(&type, value->u.buffer.value, + value->u.buffer.len); + type = ntohl(type); + } else if ((value != NULL) && + (value->type == omapi_datatype_int)) + type = value->u.integer; else - return DHCP_R_INVALIDARG; - host -> interface.hbuf [0] = type; - return ISC_R_SUCCESS; + return (DHCP_R_INVALIDARG); + host->interface.hbuf[0] = type; + return (ISC_R_SUCCESS); } if (!omapi_ds_strcmp (name, "dhcp-client-identifier")) { @@ -1180,14 +1180,13 @@ isc_result_t dhcp_host_get_value (omapi_object_t *h, omapi_object_t *id, isc_result_t dhcp_host_destroy (omapi_object_t *h, const char *file, int line) { - struct host_decl *host; if (h -> type != dhcp_type_host) return DHCP_R_INVALIDARG; - host = (struct host_decl *)h; #if defined (DEBUG_MEMORY_LEAKAGE) || \ defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) + struct host_decl *host = (struct host_decl *)h; if (host -> n_ipaddr) host_dereference (&host -> n_ipaddr, file, line); if (host -> n_dynamic) @@ -1393,7 +1392,7 @@ isc_result_t dhcp_host_lookup (omapi_object_t **lp, tv -> value -> u.buffer.value, tv -> value -> u.buffer.len, MDL); omapi_value_dereference (&tv, MDL); - + if (*lp && *lp != (omapi_object_t *)host) { omapi_object_dereference (lp, MDL); if (host) @@ -1599,12 +1598,11 @@ isc_result_t dhcp_pool_set_value (omapi_object_t *h, omapi_data_string_t *name, omapi_typed_data_t *value) { - struct pool *pool; + /* h should point to (struct pool *) */ isc_result_t status; if (h -> type != dhcp_type_pool) return DHCP_R_INVALIDARG; - pool = (struct pool *)h; /* No values to set yet. */ @@ -1624,12 +1622,11 @@ isc_result_t dhcp_pool_get_value (omapi_object_t *h, omapi_object_t *id, omapi_data_string_t *name, omapi_value_t **value) { - struct pool *pool; + /* h should point to (struct pool *) */ isc_result_t status; if (h -> type != dhcp_type_pool) return DHCP_R_INVALIDARG; - pool = (struct pool *)h; /* No values to get yet. */ @@ -1645,7 +1642,6 @@ isc_result_t dhcp_pool_get_value (omapi_object_t *h, omapi_object_t *id, isc_result_t dhcp_pool_destroy (omapi_object_t *h, const char *file, int line) { - struct pool *pool; #if defined (DEBUG_MEMORY_LEAKAGE) || \ defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) struct permit *pc, *pn; @@ -1653,10 +1649,10 @@ isc_result_t dhcp_pool_destroy (omapi_object_t *h, const char *file, int line) if (h -> type != dhcp_type_pool) return DHCP_R_INVALIDARG; - pool = (struct pool *)h; #if defined (DEBUG_MEMORY_LEAKAGE) || \ defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) + struct pool *pool = (struct pool *)h; if (pool -> next) pool_dereference (&pool -> next, file, line); if (pool -> group) @@ -1697,13 +1693,11 @@ isc_result_t dhcp_pool_destroy (omapi_object_t *h, const char *file, int line) isc_result_t dhcp_pool_signal_handler (omapi_object_t *h, const char *name, va_list ap) { - struct pool *pool; + /* h should point to (struct pool *) */ isc_result_t status; - int updatep = 0; if (h -> type != dhcp_type_pool) return DHCP_R_INVALIDARG; - pool = (struct pool *)h; /* Can't write pools yet. */ @@ -1714,8 +1708,7 @@ isc_result_t dhcp_pool_signal_handler (omapi_object_t *h, if (status == ISC_R_SUCCESS) return status; } - if (updatep) - return ISC_R_SUCCESS; + return ISC_R_NOTFOUND; } @@ -1723,12 +1716,11 @@ isc_result_t dhcp_pool_stuff_values (omapi_object_t *c, omapi_object_t *id, omapi_object_t *h) { - struct pool *pool; + /* h should point to (struct pool *) */ isc_result_t status; if (h -> type != dhcp_type_pool) return DHCP_R_INVALIDARG; - pool = (struct pool *)h; /* Can't stuff pool values yet. */ @@ -1956,14 +1948,13 @@ isc_result_t dhcp_class_get_value (omapi_object_t *h, omapi_object_t *id, isc_result_t dhcp_class_destroy (omapi_object_t *h, const char *file, int line) { - struct class *class; if (h -> type != dhcp_type_class && h -> type != dhcp_type_subclass) return DHCP_R_INVALIDARG; - class = (struct class *)h; #if defined (DEBUG_MEMORY_LEAKAGE) || \ defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) + struct class *class = (struct class *)h; if (class -> nic) class_dereference (&class -> nic, file, line); if (class -> superclass) @@ -2070,7 +2061,7 @@ class_signal_handler(omapi_object_t *h, if (updatep) return ISC_R_SUCCESS; - + return ISC_R_NOTFOUND; } @@ -2088,12 +2079,11 @@ isc_result_t dhcp_class_stuff_values (omapi_object_t *c, omapi_object_t *id, omapi_object_t *h) { - struct class *class; + /* h should point to (struct class *) */ isc_result_t status; if (h -> type != dhcp_type_class) return DHCP_R_INVALIDARG; - class = (struct class *)h; /* Can't stuff class values yet. */ diff --git a/external/bsd/dhcp/dist/server/salloc.c b/external/bsd/dhcp/dist/server/salloc.c index d208154c5d06..ef17ada979fc 100644 --- a/external/bsd/dhcp/dist/server/salloc.c +++ b/external/bsd/dhcp/dist/server/salloc.c @@ -1,11 +1,12 @@ -/* $NetBSD: salloc.c,v 1.1.1.1 2013/03/24 15:46:03 christos Exp $ */ +/* $NetBSD: salloc.c,v 1.1.1.2 2013/03/24 22:50:43 christos Exp $ */ /* salloc.c Memory allocation for the DHCP server... */ /* - * Copyright (c) 2004-2007,2009 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2009,2012 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1996-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -35,7 +36,7 @@ */ #include -__RCSID("$NetBSD: salloc.c,v 1.1.1.1 2013/03/24 15:46:03 christos Exp $"); +__RCSID("$NetBSD: salloc.c,v 1.1.1.2 2013/03/24 22:50:43 christos Exp $"); #include "dhcpd.h" #include @@ -43,48 +44,50 @@ __RCSID("$NetBSD: salloc.c,v 1.1.1.1 2013/03/24 15:46:03 christos Exp $"); #if defined (COMPACT_LEASES) struct lease *free_leases; -# if defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) +#if defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) struct lease *lease_hunks; void relinquish_lease_hunks () { - struct lease *c, *n, **p, *f; + struct lease *c, *n, **p; int i; /* Account for all the leases on the free list. */ - for (n = lease_hunks; n; n = n -> next) { - for (i = 1; i < n -> starts + 1; i++) { + for (n = lease_hunks; n; n = n->next) { + for (i = 1; i < n->starts + 1; i++) { p = &free_leases; - for (c = free_leases; c; c = c -> next) { - if (c == &n [i]) { - *p = c -> next; - n -> ends++; + for (c = free_leases; c; c = c->next) { + if (c == &n[i]) { + *p = c->next; + n->ends++; break; } - p = &c -> next; + p = &c->next; } if (!c) { - log_info ("lease %s refcnt %d", - piaddr (n [i].ip_addr), n [i].refcnt); - dump_rc_history (&n [i]); + log_info("lease %s refcnt %d", + piaddr (n[i].ip_addr), n[i].refcnt); +#if defined (DEBUG_RC_HISTORY) + dump_rc_history(&n[i]); +#endif } } } - + for (c = lease_hunks; c; c = n) { - n = c -> next; - if (c -> ends != c -> starts) { - log_info ("lease hunk %lx leases %ld free %ld", - (unsigned long)c, (unsigned long)c -> starts, - (unsigned long)c -> ends); + n = c->next; + if (c->ends != c->starts) { + log_info("lease hunk %lx leases %ld free %ld", + (unsigned long)c, (unsigned long)(c->starts), + (unsigned long)(c->ends)); } - dfree (c, MDL); + dfree(c, MDL); } /* Free all the rogue leases. */ for (c = free_leases; c; c = n) { - n = c -> next; - dfree (c, MDL); + n = c->next; + dfree(c, MDL); } } #endif diff --git a/external/bsd/dhcp/dist/server/tests/Atffile b/external/bsd/dhcp/dist/server/tests/Atffile new file mode 100644 index 000000000000..b2fdc0f1384e --- /dev/null +++ b/external/bsd/dhcp/dist/server/tests/Atffile @@ -0,0 +1,5 @@ +Content-Type: application/X-atf-atffile; version="1" + +prop: test-suite = dhcp4 + +tp-glob: *_unittests diff --git a/external/bsd/dhcp/dist/server/tests/Makefile.am b/external/bsd/dhcp/dist/server/tests/Makefile.am new file mode 100644 index 000000000000..d9945a1276e1 --- /dev/null +++ b/external/bsd/dhcp/dist/server/tests/Makefile.am @@ -0,0 +1,54 @@ +SUBDIRS = . + +AM_CPPFLAGS = $(ATF_CFLAGS) -DUNIT_TEST -I$(top_srcdir)/includes +AM_CPPFLAGS += -I$(top_srcdir)/bind/include -I$(top_srcdir) +AM_CPPFLAGS += -DLOCALSTATEDIR='"."' + +EXTRA_DIST = Atffile + +# for autotools debugging only +info: + @echo "ATF_CFLAGS=$(ATF_CFLAGS)" + @echo "ATF_LDFLAGS=$(ATF_LDFLAGS)" + @echo "ATF_LIBS=$(ATF_LIBS)" + +DHCPSRC = ../dhcp.c ../bootp.c ../confpars.c ../db.c ../class.c \ + ../failover.c ../omapi.c ../mdb.c ../stables.c ../salloc.c \ + ../ddns.c ../dhcpleasequery.c ../dhcpv6.c ../mdb6.c \ + ../ldap.c ../ldap_casa.c ../dhcpd.c + +DHCPLIBS = $(top_builddir)/common/libdhcp.a $(top_builddir)/omapip/libomapi.a \ + $(top_builddir)/dhcpctl/libdhcpctl.a $(top_builddir)/bind/lib/libdns.a \ + $(top_builddir)/bind/lib/libisc.a + +ATF_TESTS = +TESTS = +if HAVE_ATF + +check: $(ATF_TESTS) + atf-run | atf-report + +ATF_TESTS += dhcpd_unittests legacy_unittests hash_unittests load_bal_unittests + +dhcpd_unittests_SOURCES = $(DHCPSRC) +dhcpd_unittests_SOURCES += simple_unittest.c + +dhcpd_unittests_LDADD = $(ATF_LDFLAGS) +dhcpd_unittests_LDADD += $(DHCPLIBS) + +dhcpd_unittests_LDFLAGS = $(AM_LDFLAGS) $(ATF_LDFLAGS) + +hash_unittests_SOURCES = $(DHCPSRC) hash_unittest.c +hash_unittests_LDADD = $(DHCPLIBS) $(ATF_LDFLAGS) + + +# This is a legacy unittest. It replaces main() with something that was in mdb6.c +legacy_unittests_SOURCES = $(DHCPSRC) mdb6_unittest.c +legacy_unittests_LDADD = $(DHCPLIBS) $(ATF_LDFLAGS) + +load_bal_unittests_SOURCES = $(DHCPSRC) load_bal_unittest.c +load_bal_unittests_LDADD = $(DHCPLIBS) $(ATF_LDFLAGS) + +endif + +check_PROGRAMS = $(ATF_TESTS) $(TESTS) diff --git a/external/bsd/dhcp/dist/server/tests/Makefile.in b/external/bsd/dhcp/dist/server/tests/Makefile.in new file mode 100644 index 000000000000..633192f65d2e --- /dev/null +++ b/external/bsd/dhcp/dist/server/tests/Makefile.in @@ -0,0 +1,933 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +TESTS = +@HAVE_ATF_TRUE@am__append_1 = dhcpd_unittests legacy_unittests hash_unittests load_bal_unittests +check_PROGRAMS = $(am__EXEEXT_2) $(am__EXEEXT_3) +subdir = server/tests +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/includes/config.h +CONFIG_CLEAN_FILES = +@HAVE_ATF_TRUE@am__EXEEXT_1 = dhcpd_unittests$(EXEEXT) \ +@HAVE_ATF_TRUE@ legacy_unittests$(EXEEXT) \ +@HAVE_ATF_TRUE@ hash_unittests$(EXEEXT) \ +@HAVE_ATF_TRUE@ load_bal_unittests$(EXEEXT) +am__EXEEXT_2 = $(am__EXEEXT_1) +am__EXEEXT_3 = +am__dhcpd_unittests_SOURCES_DIST = ../dhcp.c ../bootp.c ../confpars.c \ + ../db.c ../class.c ../failover.c ../omapi.c ../mdb.c \ + ../stables.c ../salloc.c ../ddns.c ../dhcpleasequery.c \ + ../dhcpv6.c ../mdb6.c ../ldap.c ../ldap_casa.c ../dhcpd.c \ + simple_unittest.c +am__objects_1 = dhcp.$(OBJEXT) bootp.$(OBJEXT) confpars.$(OBJEXT) \ + db.$(OBJEXT) class.$(OBJEXT) failover.$(OBJEXT) \ + omapi.$(OBJEXT) mdb.$(OBJEXT) stables.$(OBJEXT) \ + salloc.$(OBJEXT) ddns.$(OBJEXT) dhcpleasequery.$(OBJEXT) \ + dhcpv6.$(OBJEXT) mdb6.$(OBJEXT) ldap.$(OBJEXT) \ + ldap_casa.$(OBJEXT) dhcpd.$(OBJEXT) +@HAVE_ATF_TRUE@am_dhcpd_unittests_OBJECTS = $(am__objects_1) \ +@HAVE_ATF_TRUE@ simple_unittest.$(OBJEXT) +dhcpd_unittests_OBJECTS = $(am_dhcpd_unittests_OBJECTS) +am__DEPENDENCIES_1 = +@HAVE_ATF_TRUE@dhcpd_unittests_DEPENDENCIES = $(am__DEPENDENCIES_1) \ +@HAVE_ATF_TRUE@ $(DHCPLIBS) +dhcpd_unittests_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(dhcpd_unittests_LDFLAGS) $(LDFLAGS) -o $@ +am__hash_unittests_SOURCES_DIST = ../dhcp.c ../bootp.c ../confpars.c \ + ../db.c ../class.c ../failover.c ../omapi.c ../mdb.c \ + ../stables.c ../salloc.c ../ddns.c ../dhcpleasequery.c \ + ../dhcpv6.c ../mdb6.c ../ldap.c ../ldap_casa.c ../dhcpd.c \ + hash_unittest.c +@HAVE_ATF_TRUE@am_hash_unittests_OBJECTS = $(am__objects_1) \ +@HAVE_ATF_TRUE@ hash_unittest.$(OBJEXT) +hash_unittests_OBJECTS = $(am_hash_unittests_OBJECTS) +@HAVE_ATF_TRUE@hash_unittests_DEPENDENCIES = $(DHCPLIBS) \ +@HAVE_ATF_TRUE@ $(am__DEPENDENCIES_1) +am__legacy_unittests_SOURCES_DIST = ../dhcp.c ../bootp.c ../confpars.c \ + ../db.c ../class.c ../failover.c ../omapi.c ../mdb.c \ + ../stables.c ../salloc.c ../ddns.c ../dhcpleasequery.c \ + ../dhcpv6.c ../mdb6.c ../ldap.c ../ldap_casa.c ../dhcpd.c \ + mdb6_unittest.c +@HAVE_ATF_TRUE@am_legacy_unittests_OBJECTS = $(am__objects_1) \ +@HAVE_ATF_TRUE@ mdb6_unittest.$(OBJEXT) +legacy_unittests_OBJECTS = $(am_legacy_unittests_OBJECTS) +@HAVE_ATF_TRUE@legacy_unittests_DEPENDENCIES = $(DHCPLIBS) \ +@HAVE_ATF_TRUE@ $(am__DEPENDENCIES_1) +am__load_bal_unittests_SOURCES_DIST = ../dhcp.c ../bootp.c \ + ../confpars.c ../db.c ../class.c ../failover.c ../omapi.c \ + ../mdb.c ../stables.c ../salloc.c ../ddns.c \ + ../dhcpleasequery.c ../dhcpv6.c ../mdb6.c ../ldap.c \ + ../ldap_casa.c ../dhcpd.c load_bal_unittest.c +@HAVE_ATF_TRUE@am_load_bal_unittests_OBJECTS = $(am__objects_1) \ +@HAVE_ATF_TRUE@ load_bal_unittest.$(OBJEXT) +load_bal_unittests_OBJECTS = $(am_load_bal_unittests_OBJECTS) +@HAVE_ATF_TRUE@load_bal_unittests_DEPENDENCIES = $(DHCPLIBS) \ +@HAVE_ATF_TRUE@ $(am__DEPENDENCIES_1) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/includes +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(dhcpd_unittests_SOURCES) $(hash_unittests_SOURCES) \ + $(legacy_unittests_SOURCES) $(load_bal_unittests_SOURCES) +DIST_SOURCES = $(am__dhcpd_unittests_SOURCES_DIST) \ + $(am__hash_unittests_SOURCES_DIST) \ + $(am__legacy_unittests_SOURCES_DIST) \ + $(am__load_bal_unittests_SOURCES_DIST) +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +ATF_CFLAGS = @ATF_CFLAGS@ +ATF_LDFLAGS = @ATF_LDFLAGS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDAP_CFLAGS = @LDAP_CFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_prefix_program = @ac_prefix_program@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build_alias = @build_alias@ +builddir = @builddir@ +byte_order = @byte_order@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +SUBDIRS = . +AM_CPPFLAGS = $(ATF_CFLAGS) -DUNIT_TEST -I$(top_srcdir)/includes \ + -I$(top_srcdir)/bind/include -I$(top_srcdir) \ + -DLOCALSTATEDIR='"."' +EXTRA_DIST = Atffile +DHCPSRC = ../dhcp.c ../bootp.c ../confpars.c ../db.c ../class.c \ + ../failover.c ../omapi.c ../mdb.c ../stables.c ../salloc.c \ + ../ddns.c ../dhcpleasequery.c ../dhcpv6.c ../mdb6.c \ + ../ldap.c ../ldap_casa.c ../dhcpd.c + +DHCPLIBS = $(top_builddir)/common/libdhcp.a $(top_builddir)/omapip/libomapi.a \ + $(top_builddir)/dhcpctl/libdhcpctl.a $(top_builddir)/bind/lib/libdns.a \ + $(top_builddir)/bind/lib/libisc.a + +ATF_TESTS = $(am__append_1) +@HAVE_ATF_TRUE@dhcpd_unittests_SOURCES = $(DHCPSRC) simple_unittest.c +@HAVE_ATF_TRUE@dhcpd_unittests_LDADD = $(ATF_LDFLAGS) $(DHCPLIBS) +@HAVE_ATF_TRUE@dhcpd_unittests_LDFLAGS = $(AM_LDFLAGS) $(ATF_LDFLAGS) +@HAVE_ATF_TRUE@hash_unittests_SOURCES = $(DHCPSRC) hash_unittest.c +@HAVE_ATF_TRUE@hash_unittests_LDADD = $(DHCPLIBS) $(ATF_LDFLAGS) + +# This is a legacy unittest. It replaces main() with something that was in mdb6.c +@HAVE_ATF_TRUE@legacy_unittests_SOURCES = $(DHCPSRC) mdb6_unittest.c +@HAVE_ATF_TRUE@legacy_unittests_LDADD = $(DHCPLIBS) $(ATF_LDFLAGS) +@HAVE_ATF_TRUE@load_bal_unittests_SOURCES = $(DHCPSRC) load_bal_unittest.c +@HAVE_ATF_TRUE@load_bal_unittests_LDADD = $(DHCPLIBS) $(ATF_LDFLAGS) +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign server/tests/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign server/tests/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-checkPROGRAMS: + -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) +dhcpd_unittests$(EXEEXT): $(dhcpd_unittests_OBJECTS) $(dhcpd_unittests_DEPENDENCIES) + @rm -f dhcpd_unittests$(EXEEXT) + $(dhcpd_unittests_LINK) $(dhcpd_unittests_OBJECTS) $(dhcpd_unittests_LDADD) $(LIBS) +hash_unittests$(EXEEXT): $(hash_unittests_OBJECTS) $(hash_unittests_DEPENDENCIES) + @rm -f hash_unittests$(EXEEXT) + $(LINK) $(hash_unittests_OBJECTS) $(hash_unittests_LDADD) $(LIBS) +legacy_unittests$(EXEEXT): $(legacy_unittests_OBJECTS) $(legacy_unittests_DEPENDENCIES) + @rm -f legacy_unittests$(EXEEXT) + $(LINK) $(legacy_unittests_OBJECTS) $(legacy_unittests_LDADD) $(LIBS) +load_bal_unittests$(EXEEXT): $(load_bal_unittests_OBJECTS) $(load_bal_unittests_DEPENDENCIES) + @rm -f load_bal_unittests$(EXEEXT) + $(LINK) $(load_bal_unittests_OBJECTS) $(load_bal_unittests_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bootp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/class.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/confpars.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/db.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddns.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dhcp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dhcpd.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dhcpleasequery.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dhcpv6.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/failover.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash_unittest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ldap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ldap_casa.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_bal_unittest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mdb.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mdb6.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mdb6_unittest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/omapi.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/salloc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple_unittest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stables.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +dhcp.o: ../dhcp.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dhcp.o -MD -MP -MF $(DEPDIR)/dhcp.Tpo -c -o dhcp.o `test -f '../dhcp.c' || echo '$(srcdir)/'`../dhcp.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dhcp.Tpo $(DEPDIR)/dhcp.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../dhcp.c' object='dhcp.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dhcp.o `test -f '../dhcp.c' || echo '$(srcdir)/'`../dhcp.c + +dhcp.obj: ../dhcp.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dhcp.obj -MD -MP -MF $(DEPDIR)/dhcp.Tpo -c -o dhcp.obj `if test -f '../dhcp.c'; then $(CYGPATH_W) '../dhcp.c'; else $(CYGPATH_W) '$(srcdir)/../dhcp.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dhcp.Tpo $(DEPDIR)/dhcp.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../dhcp.c' object='dhcp.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dhcp.obj `if test -f '../dhcp.c'; then $(CYGPATH_W) '../dhcp.c'; else $(CYGPATH_W) '$(srcdir)/../dhcp.c'; fi` + +bootp.o: ../bootp.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bootp.o -MD -MP -MF $(DEPDIR)/bootp.Tpo -c -o bootp.o `test -f '../bootp.c' || echo '$(srcdir)/'`../bootp.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/bootp.Tpo $(DEPDIR)/bootp.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../bootp.c' object='bootp.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bootp.o `test -f '../bootp.c' || echo '$(srcdir)/'`../bootp.c + +bootp.obj: ../bootp.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bootp.obj -MD -MP -MF $(DEPDIR)/bootp.Tpo -c -o bootp.obj `if test -f '../bootp.c'; then $(CYGPATH_W) '../bootp.c'; else $(CYGPATH_W) '$(srcdir)/../bootp.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/bootp.Tpo $(DEPDIR)/bootp.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../bootp.c' object='bootp.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bootp.obj `if test -f '../bootp.c'; then $(CYGPATH_W) '../bootp.c'; else $(CYGPATH_W) '$(srcdir)/../bootp.c'; fi` + +confpars.o: ../confpars.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT confpars.o -MD -MP -MF $(DEPDIR)/confpars.Tpo -c -o confpars.o `test -f '../confpars.c' || echo '$(srcdir)/'`../confpars.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/confpars.Tpo $(DEPDIR)/confpars.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../confpars.c' object='confpars.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o confpars.o `test -f '../confpars.c' || echo '$(srcdir)/'`../confpars.c + +confpars.obj: ../confpars.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT confpars.obj -MD -MP -MF $(DEPDIR)/confpars.Tpo -c -o confpars.obj `if test -f '../confpars.c'; then $(CYGPATH_W) '../confpars.c'; else $(CYGPATH_W) '$(srcdir)/../confpars.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/confpars.Tpo $(DEPDIR)/confpars.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../confpars.c' object='confpars.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o confpars.obj `if test -f '../confpars.c'; then $(CYGPATH_W) '../confpars.c'; else $(CYGPATH_W) '$(srcdir)/../confpars.c'; fi` + +db.o: ../db.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT db.o -MD -MP -MF $(DEPDIR)/db.Tpo -c -o db.o `test -f '../db.c' || echo '$(srcdir)/'`../db.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/db.Tpo $(DEPDIR)/db.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../db.c' object='db.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o db.o `test -f '../db.c' || echo '$(srcdir)/'`../db.c + +db.obj: ../db.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT db.obj -MD -MP -MF $(DEPDIR)/db.Tpo -c -o db.obj `if test -f '../db.c'; then $(CYGPATH_W) '../db.c'; else $(CYGPATH_W) '$(srcdir)/../db.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/db.Tpo $(DEPDIR)/db.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../db.c' object='db.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o db.obj `if test -f '../db.c'; then $(CYGPATH_W) '../db.c'; else $(CYGPATH_W) '$(srcdir)/../db.c'; fi` + +class.o: ../class.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT class.o -MD -MP -MF $(DEPDIR)/class.Tpo -c -o class.o `test -f '../class.c' || echo '$(srcdir)/'`../class.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/class.Tpo $(DEPDIR)/class.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../class.c' object='class.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o class.o `test -f '../class.c' || echo '$(srcdir)/'`../class.c + +class.obj: ../class.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT class.obj -MD -MP -MF $(DEPDIR)/class.Tpo -c -o class.obj `if test -f '../class.c'; then $(CYGPATH_W) '../class.c'; else $(CYGPATH_W) '$(srcdir)/../class.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/class.Tpo $(DEPDIR)/class.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../class.c' object='class.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o class.obj `if test -f '../class.c'; then $(CYGPATH_W) '../class.c'; else $(CYGPATH_W) '$(srcdir)/../class.c'; fi` + +failover.o: ../failover.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT failover.o -MD -MP -MF $(DEPDIR)/failover.Tpo -c -o failover.o `test -f '../failover.c' || echo '$(srcdir)/'`../failover.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/failover.Tpo $(DEPDIR)/failover.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../failover.c' object='failover.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o failover.o `test -f '../failover.c' || echo '$(srcdir)/'`../failover.c + +failover.obj: ../failover.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT failover.obj -MD -MP -MF $(DEPDIR)/failover.Tpo -c -o failover.obj `if test -f '../failover.c'; then $(CYGPATH_W) '../failover.c'; else $(CYGPATH_W) '$(srcdir)/../failover.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/failover.Tpo $(DEPDIR)/failover.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../failover.c' object='failover.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o failover.obj `if test -f '../failover.c'; then $(CYGPATH_W) '../failover.c'; else $(CYGPATH_W) '$(srcdir)/../failover.c'; fi` + +omapi.o: ../omapi.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT omapi.o -MD -MP -MF $(DEPDIR)/omapi.Tpo -c -o omapi.o `test -f '../omapi.c' || echo '$(srcdir)/'`../omapi.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/omapi.Tpo $(DEPDIR)/omapi.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../omapi.c' object='omapi.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o omapi.o `test -f '../omapi.c' || echo '$(srcdir)/'`../omapi.c + +omapi.obj: ../omapi.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT omapi.obj -MD -MP -MF $(DEPDIR)/omapi.Tpo -c -o omapi.obj `if test -f '../omapi.c'; then $(CYGPATH_W) '../omapi.c'; else $(CYGPATH_W) '$(srcdir)/../omapi.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/omapi.Tpo $(DEPDIR)/omapi.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../omapi.c' object='omapi.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o omapi.obj `if test -f '../omapi.c'; then $(CYGPATH_W) '../omapi.c'; else $(CYGPATH_W) '$(srcdir)/../omapi.c'; fi` + +mdb.o: ../mdb.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mdb.o -MD -MP -MF $(DEPDIR)/mdb.Tpo -c -o mdb.o `test -f '../mdb.c' || echo '$(srcdir)/'`../mdb.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/mdb.Tpo $(DEPDIR)/mdb.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../mdb.c' object='mdb.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mdb.o `test -f '../mdb.c' || echo '$(srcdir)/'`../mdb.c + +mdb.obj: ../mdb.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mdb.obj -MD -MP -MF $(DEPDIR)/mdb.Tpo -c -o mdb.obj `if test -f '../mdb.c'; then $(CYGPATH_W) '../mdb.c'; else $(CYGPATH_W) '$(srcdir)/../mdb.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/mdb.Tpo $(DEPDIR)/mdb.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../mdb.c' object='mdb.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mdb.obj `if test -f '../mdb.c'; then $(CYGPATH_W) '../mdb.c'; else $(CYGPATH_W) '$(srcdir)/../mdb.c'; fi` + +stables.o: ../stables.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stables.o -MD -MP -MF $(DEPDIR)/stables.Tpo -c -o stables.o `test -f '../stables.c' || echo '$(srcdir)/'`../stables.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/stables.Tpo $(DEPDIR)/stables.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../stables.c' object='stables.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stables.o `test -f '../stables.c' || echo '$(srcdir)/'`../stables.c + +stables.obj: ../stables.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stables.obj -MD -MP -MF $(DEPDIR)/stables.Tpo -c -o stables.obj `if test -f '../stables.c'; then $(CYGPATH_W) '../stables.c'; else $(CYGPATH_W) '$(srcdir)/../stables.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/stables.Tpo $(DEPDIR)/stables.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../stables.c' object='stables.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stables.obj `if test -f '../stables.c'; then $(CYGPATH_W) '../stables.c'; else $(CYGPATH_W) '$(srcdir)/../stables.c'; fi` + +salloc.o: ../salloc.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT salloc.o -MD -MP -MF $(DEPDIR)/salloc.Tpo -c -o salloc.o `test -f '../salloc.c' || echo '$(srcdir)/'`../salloc.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/salloc.Tpo $(DEPDIR)/salloc.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../salloc.c' object='salloc.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o salloc.o `test -f '../salloc.c' || echo '$(srcdir)/'`../salloc.c + +salloc.obj: ../salloc.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT salloc.obj -MD -MP -MF $(DEPDIR)/salloc.Tpo -c -o salloc.obj `if test -f '../salloc.c'; then $(CYGPATH_W) '../salloc.c'; else $(CYGPATH_W) '$(srcdir)/../salloc.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/salloc.Tpo $(DEPDIR)/salloc.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../salloc.c' object='salloc.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o salloc.obj `if test -f '../salloc.c'; then $(CYGPATH_W) '../salloc.c'; else $(CYGPATH_W) '$(srcdir)/../salloc.c'; fi` + +ddns.o: ../ddns.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ddns.o -MD -MP -MF $(DEPDIR)/ddns.Tpo -c -o ddns.o `test -f '../ddns.c' || echo '$(srcdir)/'`../ddns.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ddns.Tpo $(DEPDIR)/ddns.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../ddns.c' object='ddns.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ddns.o `test -f '../ddns.c' || echo '$(srcdir)/'`../ddns.c + +ddns.obj: ../ddns.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ddns.obj -MD -MP -MF $(DEPDIR)/ddns.Tpo -c -o ddns.obj `if test -f '../ddns.c'; then $(CYGPATH_W) '../ddns.c'; else $(CYGPATH_W) '$(srcdir)/../ddns.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ddns.Tpo $(DEPDIR)/ddns.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../ddns.c' object='ddns.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ddns.obj `if test -f '../ddns.c'; then $(CYGPATH_W) '../ddns.c'; else $(CYGPATH_W) '$(srcdir)/../ddns.c'; fi` + +dhcpleasequery.o: ../dhcpleasequery.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dhcpleasequery.o -MD -MP -MF $(DEPDIR)/dhcpleasequery.Tpo -c -o dhcpleasequery.o `test -f '../dhcpleasequery.c' || echo '$(srcdir)/'`../dhcpleasequery.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dhcpleasequery.Tpo $(DEPDIR)/dhcpleasequery.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../dhcpleasequery.c' object='dhcpleasequery.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dhcpleasequery.o `test -f '../dhcpleasequery.c' || echo '$(srcdir)/'`../dhcpleasequery.c + +dhcpleasequery.obj: ../dhcpleasequery.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dhcpleasequery.obj -MD -MP -MF $(DEPDIR)/dhcpleasequery.Tpo -c -o dhcpleasequery.obj `if test -f '../dhcpleasequery.c'; then $(CYGPATH_W) '../dhcpleasequery.c'; else $(CYGPATH_W) '$(srcdir)/../dhcpleasequery.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dhcpleasequery.Tpo $(DEPDIR)/dhcpleasequery.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../dhcpleasequery.c' object='dhcpleasequery.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dhcpleasequery.obj `if test -f '../dhcpleasequery.c'; then $(CYGPATH_W) '../dhcpleasequery.c'; else $(CYGPATH_W) '$(srcdir)/../dhcpleasequery.c'; fi` + +dhcpv6.o: ../dhcpv6.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dhcpv6.o -MD -MP -MF $(DEPDIR)/dhcpv6.Tpo -c -o dhcpv6.o `test -f '../dhcpv6.c' || echo '$(srcdir)/'`../dhcpv6.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dhcpv6.Tpo $(DEPDIR)/dhcpv6.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../dhcpv6.c' object='dhcpv6.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dhcpv6.o `test -f '../dhcpv6.c' || echo '$(srcdir)/'`../dhcpv6.c + +dhcpv6.obj: ../dhcpv6.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dhcpv6.obj -MD -MP -MF $(DEPDIR)/dhcpv6.Tpo -c -o dhcpv6.obj `if test -f '../dhcpv6.c'; then $(CYGPATH_W) '../dhcpv6.c'; else $(CYGPATH_W) '$(srcdir)/../dhcpv6.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dhcpv6.Tpo $(DEPDIR)/dhcpv6.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../dhcpv6.c' object='dhcpv6.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dhcpv6.obj `if test -f '../dhcpv6.c'; then $(CYGPATH_W) '../dhcpv6.c'; else $(CYGPATH_W) '$(srcdir)/../dhcpv6.c'; fi` + +mdb6.o: ../mdb6.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mdb6.o -MD -MP -MF $(DEPDIR)/mdb6.Tpo -c -o mdb6.o `test -f '../mdb6.c' || echo '$(srcdir)/'`../mdb6.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/mdb6.Tpo $(DEPDIR)/mdb6.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../mdb6.c' object='mdb6.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mdb6.o `test -f '../mdb6.c' || echo '$(srcdir)/'`../mdb6.c + +mdb6.obj: ../mdb6.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mdb6.obj -MD -MP -MF $(DEPDIR)/mdb6.Tpo -c -o mdb6.obj `if test -f '../mdb6.c'; then $(CYGPATH_W) '../mdb6.c'; else $(CYGPATH_W) '$(srcdir)/../mdb6.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/mdb6.Tpo $(DEPDIR)/mdb6.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../mdb6.c' object='mdb6.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mdb6.obj `if test -f '../mdb6.c'; then $(CYGPATH_W) '../mdb6.c'; else $(CYGPATH_W) '$(srcdir)/../mdb6.c'; fi` + +ldap.o: ../ldap.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ldap.o -MD -MP -MF $(DEPDIR)/ldap.Tpo -c -o ldap.o `test -f '../ldap.c' || echo '$(srcdir)/'`../ldap.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ldap.Tpo $(DEPDIR)/ldap.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../ldap.c' object='ldap.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ldap.o `test -f '../ldap.c' || echo '$(srcdir)/'`../ldap.c + +ldap.obj: ../ldap.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ldap.obj -MD -MP -MF $(DEPDIR)/ldap.Tpo -c -o ldap.obj `if test -f '../ldap.c'; then $(CYGPATH_W) '../ldap.c'; else $(CYGPATH_W) '$(srcdir)/../ldap.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ldap.Tpo $(DEPDIR)/ldap.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../ldap.c' object='ldap.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ldap.obj `if test -f '../ldap.c'; then $(CYGPATH_W) '../ldap.c'; else $(CYGPATH_W) '$(srcdir)/../ldap.c'; fi` + +ldap_casa.o: ../ldap_casa.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ldap_casa.o -MD -MP -MF $(DEPDIR)/ldap_casa.Tpo -c -o ldap_casa.o `test -f '../ldap_casa.c' || echo '$(srcdir)/'`../ldap_casa.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ldap_casa.Tpo $(DEPDIR)/ldap_casa.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../ldap_casa.c' object='ldap_casa.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ldap_casa.o `test -f '../ldap_casa.c' || echo '$(srcdir)/'`../ldap_casa.c + +ldap_casa.obj: ../ldap_casa.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ldap_casa.obj -MD -MP -MF $(DEPDIR)/ldap_casa.Tpo -c -o ldap_casa.obj `if test -f '../ldap_casa.c'; then $(CYGPATH_W) '../ldap_casa.c'; else $(CYGPATH_W) '$(srcdir)/../ldap_casa.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ldap_casa.Tpo $(DEPDIR)/ldap_casa.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../ldap_casa.c' object='ldap_casa.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ldap_casa.obj `if test -f '../ldap_casa.c'; then $(CYGPATH_W) '../ldap_casa.c'; else $(CYGPATH_W) '$(srcdir)/../ldap_casa.c'; fi` + +dhcpd.o: ../dhcpd.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dhcpd.o -MD -MP -MF $(DEPDIR)/dhcpd.Tpo -c -o dhcpd.o `test -f '../dhcpd.c' || echo '$(srcdir)/'`../dhcpd.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dhcpd.Tpo $(DEPDIR)/dhcpd.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../dhcpd.c' object='dhcpd.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dhcpd.o `test -f '../dhcpd.c' || echo '$(srcdir)/'`../dhcpd.c + +dhcpd.obj: ../dhcpd.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dhcpd.obj -MD -MP -MF $(DEPDIR)/dhcpd.Tpo -c -o dhcpd.obj `if test -f '../dhcpd.c'; then $(CYGPATH_W) '../dhcpd.c'; else $(CYGPATH_W) '$(srcdir)/../dhcpd.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dhcpd.Tpo $(DEPDIR)/dhcpd.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../dhcpd.c' object='dhcpd.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dhcpd.obj `if test -f '../dhcpd.c'; then $(CYGPATH_W) '../dhcpd.c'; else $(CYGPATH_W) '$(srcdir)/../dhcpd.c'; fi` + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *$$ws$$tst$$ws*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + echo "XPASS: $$tst"; \ + ;; \ + *) \ + echo "PASS: $$tst"; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *$$ws$$tst$$ws*) \ + xfail=`expr $$xfail + 1`; \ + echo "XFAIL: $$tst"; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + echo "FAIL: $$tst"; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + echo "SKIP: $$tst"; \ + fi; \ + done; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="All $$all tests passed"; \ + else \ + banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all tests failed"; \ + else \ + banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + skipped="($$skip tests were not run)"; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + test -z "$$skipped" || echo "$$skipped"; \ + test -z "$$report" || echo "$$report"; \ + echo "$$dashes"; \ + test "$$failed" -eq 0; \ + else :; fi + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-checkPROGRAMS clean-generic mostlyclean-am + +distclean: distclean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-exec-am: + +install-html: install-html-recursive + +install-info: install-info-recursive + +install-man: + +install-pdf: install-pdf-recursive + +install-ps: install-ps-recursive + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-TESTS check-am clean \ + clean-checkPROGRAMS clean-generic ctags ctags-recursive \ + distclean distclean-compile distclean-generic distclean-tags \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ + ps ps-am tags tags-recursive uninstall uninstall-am + + +# for autotools debugging only +info: + @echo "ATF_CFLAGS=$(ATF_CFLAGS)" + @echo "ATF_LDFLAGS=$(ATF_LDFLAGS)" + @echo "ATF_LIBS=$(ATF_LIBS)" + +@HAVE_ATF_TRUE@check: $(ATF_TESTS) +@HAVE_ATF_TRUE@ atf-run | atf-report +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/external/bsd/dhcp/dist/server/tests/hash_unittest.c b/external/bsd/dhcp/dist/server/tests/hash_unittest.c new file mode 100644 index 000000000000..b99e35f05658 --- /dev/null +++ b/external/bsd/dhcp/dist/server/tests/hash_unittest.c @@ -0,0 +1,609 @@ +/* $NetBSD: hash_unittest.c,v 1.1.1.1 2013/03/24 22:50:43 christos Exp $ */ + +/* + * Copyright (c) 2012 by Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Internet Systems Consortium, Inc. + * 950 Charter Street + * Redwood City, CA 94063 + * + * https://www.isc.org/ + * + */ + +#include "config.h" +#include +#include +#include "dhcpd.h" + +/* + * The following structures are kept here for reference only. As hash functions + * are somewhat convoluted, they are copied here for the reference. Original + * location is specified. Keep in mind that it may change over time: + * + * copied from server/omapi.c:49 * + * omapi_object_type_t *dhcp_type_lease; + * omapi_object_type_t *dhcp_type_pool; + * omapi_object_type_t *dhcp_type_class; + * omapi_object_type_t *dhcp_type_subclass; + * omapi_object_type_t *dhcp_type_host; + * + * copied from server/salloc.c:138 + * OMAPI_OBJECT_ALLOC (lease, struct lease, dhcp_type_lease) + * OMAPI_OBJECT_ALLOC (class, struct class, dhcp_type_class) + * OMAPI_OBJECT_ALLOC (subclass, struct class, dhcp_type_subclass) + * OMAPI_OBJECT_ALLOC (pool, struct pool, dhcp_type_pool) + * OMAPI_OBJECT_ALLOC (host, struct host_decl, dhcp_type_host) + * + * copied from server/mdb.c:2686 + * HASH_FUNCTIONS(lease_ip, const unsigned char *, struct lease, lease_ip_hash_t, + * lease_reference, lease_dereference, do_ip4_hash) + * HASH_FUNCTIONS(lease_id, const unsigned char *, struct lease, lease_id_hash_t, + * lease_reference, lease_dereference, do_id_hash) + * HASH_FUNCTIONS (host, const unsigned char *, struct host_decl, host_hash_t, + * host_reference, host_dereference, do_string_hash) + * HASH_FUNCTIONS (class, const char *, struct class, class_hash_t, + * class_reference, class_dereference, do_string_hash) + * + * copied from server/mdb.c:46 + * host_hash_t *host_hw_addr_hash; + * host_hash_t *host_uid_hash; + * host_hash_t *host_name_hash; + * lease_id_hash_t *lease_uid_hash; + * lease_ip_hash_t *lease_ip_addr_hash; + * lease_id_hash_t *lease_hw_addr_hash; + */ + +/** + * @brief sets client-id field in host declaration + * + * @param host pointer to host declaration + * @param uid pointer to client-id data + * @param uid_len length of the client-id data + * + * @return 1 if successful, 0 otherwise + */ +int lease_set_clientid(struct host_decl *host, const unsigned char *uid, int uid_len) { + + /* clean-up this mess and set client-identifier in a sane way */ + int real_len = uid_len; + if (uid_len == 0) { + real_len = strlen((const char *)uid) + 1; + } + + memset(&host->client_identifier, 0, sizeof(host->client_identifier)); + host->client_identifier.len = uid_len; + if (!buffer_allocate(&host->client_identifier.buffer, real_len, MDL)) { + return 0; + } + host->client_identifier.data = host->client_identifier.buffer->data; + memcpy((char *)host->client_identifier.data, uid, real_len); + + return 1; +} + +/// @brief executes uid hash test for specified client-ids (2 hosts) +/// +/// Creates two host structures, adds first host to the uid hash, +/// then adds second host to the hash, then removes first host, +/// then removed the second. Many checks are performed during all +/// operations. +/// +/// @param clientid1 client-id of the first host +/// @param clientid1_len client-id1 length (may be 0 for strings) +/// @param clientid2 client-id of the second host +/// @param clientid2_len client-id2 length (may be 0 for strings) +void lease_hash_test_2hosts(unsigned char clientid1[], size_t clientid1_len, + unsigned char clientid2[], size_t clientid2_len) { + + printf("Checking hash operation for 2 hosts: clientid1-len=%lu" + "clientid2-len=%lu\n", (unsigned long) clientid1_len, + (unsigned long) clientid2_len); + + dhcp_db_objects_setup (); + dhcp_common_objects_setup (); + + /* check that there is actually zero hosts in the hash */ + /* @todo: host_hash_for_each() */ + + struct host_decl *host1 = 0, *host2 = 0; + struct host_decl *check = 0; + + /* === step 1: allocate hosts === */ + ATF_CHECK_MSG(host_allocate(&host1, MDL) == ISC_R_SUCCESS, + "Failed to allocate host"); + ATF_CHECK_MSG(host_allocate(&host2, MDL) == ISC_R_SUCCESS, + "Failed to allocate host"); + + ATF_CHECK_MSG(host_new_hash(&host_uid_hash, HOST_HASH_SIZE, MDL) != 0, + "Unable to create new hash"); + + ATF_CHECK_MSG(buffer_allocate(&host1->client_identifier.buffer, + clientid1_len, MDL) != 0, + "Can't allocate uid buffer for host1"); + + ATF_CHECK_MSG(buffer_allocate(&host2->client_identifier.buffer, + clientid2_len, MDL) != 0, + "Can't allocate uid buffer for host2"); + + /* setting up host1->client_identifier is actually not needed */ + /* + ATF_CHECK_MSG(lease_set_clientid(host1, clientid1, actual1_len) != 0, + "Failed to set client-id for host1"); + + ATF_CHECK_MSG(lease_set_clientid(host2, clientid2, actual2_len) != 0, + "Failed to set client-id for host2"); + */ + + ATF_CHECK_MSG(host1->refcnt == 1, "Invalid refcnt for host1"); + ATF_CHECK_MSG(host2->refcnt == 1, "Invalid refcnt for host2"); + + /* verify that our hosts are not in the hash yet */ + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid1, + clientid1_len, MDL) == 0, + "Host1 is not supposed to be in the uid_hash."); + + ATF_CHECK_MSG(!check, "Host1 is not supposed to be in the uid_hash."); + + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid2, + clientid2_len, MDL) == 0, + "Host2 is not supposed to be in the uid_hash."); + ATF_CHECK_MSG(!check, "Host2 is not supposed to be in the uid_hash."); + + + /* === step 2: add first host to the hash === */ + host_hash_add(host_uid_hash, clientid1, clientid1_len, host1, MDL); + + /* 2 pointers expected: ours (host1) and the one stored in hash */ + ATF_CHECK_MSG(host1->refcnt == 2, "Invalid refcnt for host1"); + /* 1 pointer expected: just ours (host2) */ + ATF_CHECK_MSG(host2->refcnt == 1, "Invalid refcnt for host2"); + + /* verify that host1 is really in the hash and the we can find it */ + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid1, + clientid1_len, MDL), + "Host1 was supposed to be in the uid_hash."); + ATF_CHECK_MSG(check, "Host1 was supposed to be in the uid_hash."); + + /* Hey! That's not the host we were looking for! */ + ATF_CHECK_MSG(check == host1, "Wrong host returned by host_hash_lookup"); + + /* 3 pointers: host1, (stored in hash), check */ + ATF_CHECK_MSG(host1->refcnt == 3, "Invalid refcnt for host1"); + + /* reference count should be increased because we not have a pointer */ + + host_dereference(&check, MDL); /* we don't need it now */ + + ATF_CHECK_MSG(check == NULL, "check pointer is supposed to be NULL"); + + /* 2 pointers: host1, (stored in hash) */ + ATF_CHECK_MSG(host1->refcnt == 2, "Invalid refcnt for host1"); + + /* verify that host2 is not in the hash */ + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid2, + clientid2_len, MDL) == 0, + "Host2 was not supposed to be in the uid_hash[2]."); + ATF_CHECK_MSG(check == NULL, "Host2 was not supposed to be in the hash."); + + + /* === step 3: add second hot to the hash === */ + host_hash_add(host_uid_hash, clientid2, clientid2_len, host2, MDL); + + /* 2 pointers expected: ours (host1) and the one stored in hash */ + ATF_CHECK_MSG(host2->refcnt == 2, "Invalid refcnt for host2"); + + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid2, + clientid2_len, MDL), + "Host2 was supposed to be in the uid_hash."); + ATF_CHECK_MSG(check, "Host2 was supposed to be in the uid_hash."); + + /* Hey! That's not the host we were looking for! */ + ATF_CHECK_MSG(check == host2, "Wrong host returned by host_hash_lookup"); + + /* 3 pointers: host1, (stored in hash), check */ + ATF_CHECK_MSG(host2->refcnt == 3, "Invalid refcnt for host1"); + + host_dereference(&check, MDL); /* we don't need it now */ + + /* now we have 2 hosts in the hash */ + + /* verify that host1 is still in the hash and the we can find it */ + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid1, + clientid1_len, MDL), + "Host1 was supposed to be in the uid_hash."); + ATF_CHECK_MSG(check, "Host1 was supposed to be in the uid_hash."); + + /* Hey! That's not the host we were looking for! */ + ATF_CHECK_MSG(check == host1, "Wrong host returned by host_hash_lookup"); + + /* 3 pointers: host1, (stored in hash), check */ + ATF_CHECK_MSG(host1->refcnt == 3, "Invalid refcnt for host1"); + + host_dereference(&check, MDL); /* we don't need it now */ + + + /** + * @todo check that there is actually two hosts in the hash. + * Use host_hash_for_each() for that. + */ + + /* === step 4: remove first host from the hash === */ + + /* delete host from hash */ + host_hash_delete(host_uid_hash, clientid1, clientid1_len, MDL); + + ATF_CHECK_MSG(host1->refcnt == 1, "Invalid refcnt for host1"); + ATF_CHECK_MSG(host2->refcnt == 2, "Invalid refcnt for host2"); + + /* verify that host1 is no longer in the hash */ + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid1, + clientid1_len, MDL) == 0, + "Host1 is not supposed to be in the uid_hash."); + ATF_CHECK_MSG(!check, "Host1 is not supposed to be in the uid_hash."); + + /* host2 should be still there, though */ + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid2, + clientid2_len, MDL), + "Host2 was supposed to still be in the uid_hash."); + host_dereference(&check, MDL); + + /* === step 5: remove second host from the hash === */ + host_hash_delete(host_uid_hash, clientid2, clientid2_len, MDL); + + ATF_CHECK_MSG(host1->refcnt == 1, "Invalid refcnt for host1"); + ATF_CHECK_MSG(host2->refcnt == 1, "Invalid refcnt for host2"); + + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid2, + clientid2_len, MDL) == 0, + "Host2 was not supposed to be in the uid_hash anymore."); + + host_dereference(&host1, MDL); + host_dereference(&host2, MDL); + + /* + * No easy way to check if the host object were actually released. + * We could run it in valgrind and check for memory leaks. + */ + +#if defined (DEBUG_MEMORY_LEAKAGE) && defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) + /* @todo: Should be called in cleanup */ + free_everything (); +#endif +} + +/// @brief executes uid hash test for specified client-ids (3 hosts) +/// +/// Creates three host structures, adds first host to the uid hash, +/// then adds second host to the hash, then removes first host, +/// then removed the second. Many checks are performed during all +/// operations. +/// +/// @param clientid1 client-id of the first host +/// @param clientid1_len client-id1 length (may be 0 for strings) +/// @param clientid2 client-id of the second host +/// @param clientid2_len client-id2 length (may be 0 for strings) +/// @param clientid3 client-id of the second host +/// @param clientid3_len client-id2 length (may be 0 for strings) +void lease_hash_test_3hosts(unsigned char clientid1[], size_t clientid1_len, + unsigned char clientid2[], size_t clientid2_len, + unsigned char clientid3[], size_t clientid3_len) { + + printf("Checking hash operation for 3 hosts: clientid1-len=%lu" + " clientid2-len=%lu clientid3-len=%lu\n", + (unsigned long) clientid1_len, (unsigned long) clientid2_len, + (unsigned long) clientid3_len); + + dhcp_db_objects_setup (); + dhcp_common_objects_setup (); + + /* check that there is actually zero hosts in the hash */ + /* @todo: host_hash_for_each() */ + + struct host_decl *host1 = 0, *host2 = 0, *host3 = 0; + struct host_decl *check = 0; + + /* === step 1: allocate hosts === */ + ATF_CHECK_MSG(host_allocate(&host1, MDL) == ISC_R_SUCCESS, + "Failed to allocate host"); + ATF_CHECK_MSG(host_allocate(&host2, MDL) == ISC_R_SUCCESS, + "Failed to allocate host"); + ATF_CHECK_MSG(host_allocate(&host3, MDL) == ISC_R_SUCCESS, + "Failed to allocate host"); + + ATF_CHECK_MSG(host_new_hash(&host_uid_hash, HOST_HASH_SIZE, MDL) != 0, + "Unable to create new hash"); + + ATF_CHECK_MSG(buffer_allocate(&host1->client_identifier.buffer, + clientid1_len, MDL) != 0, + "Can't allocate uid buffer for host1"); + ATF_CHECK_MSG(buffer_allocate(&host2->client_identifier.buffer, + clientid2_len, MDL) != 0, + "Can't allocate uid buffer for host2"); + ATF_CHECK_MSG(buffer_allocate(&host3->client_identifier.buffer, + clientid3_len, MDL) != 0, + "Can't allocate uid buffer for host3"); + + /* verify that our hosts are not in the hash yet */ + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid1, + clientid1_len, MDL) == 0, + "Host1 is not supposed to be in the uid_hash."); + + ATF_CHECK_MSG(!check, "Host1 is not supposed to be in the uid_hash."); + + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid2, + clientid2_len, MDL) == 0, + "Host2 is not supposed to be in the uid_hash."); + ATF_CHECK_MSG(!check, "Host2 is not supposed to be in the uid_hash."); + + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid3, + clientid3_len, MDL) == 0, + "Host3 is not supposed to be in the uid_hash."); + ATF_CHECK_MSG(!check, "Host3 is not supposed to be in the uid_hash."); + + /* === step 2: add hosts to the hash === */ + host_hash_add(host_uid_hash, clientid1, clientid1_len, host1, MDL); + host_hash_add(host_uid_hash, clientid2, clientid2_len, host2, MDL); + host_hash_add(host_uid_hash, clientid3, clientid3_len, host3, MDL); + + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid1, + clientid1_len, MDL), + "Host1 was supposed to be in the uid_hash."); + /* Hey! That's not the host we were looking for! */ + ATF_CHECK_MSG(check == host1, "Wrong host returned by host_hash_lookup"); + host_dereference(&check, MDL); /* we don't need it now */ + + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid2, + clientid2_len, MDL), + "Host2 was supposed to be in the uid_hash."); + ATF_CHECK_MSG(check, "Host2 was supposed to be in the uid_hash."); + /* Hey! That's not the host we were looking for! */ + ATF_CHECK_MSG(check == host2, "Wrong host returned by host_hash_lookup"); + host_dereference(&check, MDL); /* we don't need it now */ + + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid3, + clientid3_len, MDL), + "Host3 was supposed to be in the uid_hash."); + ATF_CHECK_MSG(check, "Host3 was supposed to be in the uid_hash."); + /* Hey! That's not the host we were looking for! */ + ATF_CHECK_MSG(check == host3, "Wrong host returned by host_hash_lookup"); + host_dereference(&check, MDL); /* we don't need it now */ + + /* === step 4: remove first host from the hash === */ + + /* delete host from hash */ + host_hash_delete(host_uid_hash, clientid1, clientid1_len, MDL); + + /* verify that host1 is no longer in the hash */ + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid1, + clientid1_len, MDL) == 0, + "Host1 is not supposed to be in the uid_hash."); + ATF_CHECK_MSG(!check, "Host1 is not supposed to be in the uid_hash."); + + /* host2 and host3 should be still there, though */ + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid2, + clientid2_len, MDL), + "Host2 was supposed to still be in the uid_hash."); + host_dereference(&check, MDL); + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid3, + clientid3_len, MDL), + "Host3 was supposed to still be in the uid_hash."); + host_dereference(&check, MDL); + + /* === step 5: remove second host from the hash === */ + host_hash_delete(host_uid_hash, clientid2, clientid2_len, MDL); + + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid2, + clientid2_len, MDL) == 0, + "Host2 was not supposed to be in the uid_hash anymore."); + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid3, + clientid3_len, MDL), + "Host3 was supposed to still be in the uid_hash."); + host_dereference(&check, MDL); + + /* === step 6: remove the last (third) host from the hash === */ + host_hash_delete(host_uid_hash, clientid3, clientid3_len, MDL); + + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid3, + clientid3_len, MDL) == 0, + "Host3 was not supposed to be in the uid_hash anymore."); + host_dereference(&check, MDL); + + + host_dereference(&host1, MDL); + host_dereference(&host2, MDL); + host_dereference(&host3, MDL); + + /* + * No easy way to check if the host object were actually released. + * We could run it in valgrind and check for memory leaks. + */ + +#if defined (DEBUG_MEMORY_LEAKAGE) && defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) + /* @todo: Should be called in cleanup */ + free_everything (); +#endif +} + +ATF_TC(lease_hash_basic_2hosts); + +ATF_TC_HEAD(lease_hash_basic_2hosts, tc) { + atf_tc_set_md_var(tc, "descr", "Basic lease hash tests"); + /* + * The following functions are tested: + * host_allocate(), host_new_hash(), buffer_allocate(), host_hash_lookup() + * host_hash_add(), host_hash_delete() + */ +} + +ATF_TC_BODY(lease_hash_basic_2hosts, tc) { + + unsigned char clientid1[] = { 0x1, 0x2, 0x3 }; + unsigned char clientid2[] = { 0xff, 0xfe }; + + lease_hash_test_2hosts(clientid1, sizeof(clientid1), + clientid2, sizeof(clientid2)); +} + + +ATF_TC(lease_hash_string_2hosts); + +ATF_TC_HEAD(lease_hash_string_2hosts, tc) { + atf_tc_set_md_var(tc, "descr", "string-based lease hash tests"); + /* + * The following functions are tested: + * host_allocate(), host_new_hash(), buffer_allocate(), host_hash_lookup() + * host_hash_add(), host_hash_delete() + */ +} + +ATF_TC_BODY(lease_hash_string_2hosts, tc) { + + unsigned char clientid1[] = "Alice"; + unsigned char clientid2[] = "Bob"; + + lease_hash_test_2hosts(clientid1, 0, clientid2, 0); +} + + +ATF_TC(lease_hash_negative1); + +ATF_TC_HEAD(lease_hash_negative1, tc) { + atf_tc_set_md_var(tc, "descr", "Negative tests for lease hash"); +} + +ATF_TC_BODY(lease_hash_negative1, tc) { + + unsigned char clientid1[] = { 0x1 }; + unsigned char clientid2[] = { 0x0 }; + + lease_hash_test_2hosts(clientid1, 0, clientid2, 1); +} + + + +ATF_TC(lease_hash_string_3hosts); +ATF_TC_HEAD(lease_hash_string_3hosts, tc) { + atf_tc_set_md_var(tc, "descr", "string-based lease hash tests"); + /* + * The following functions are tested: + * host_allocate(), host_new_hash(), buffer_allocate(), host_hash_lookup() + * host_hash_add(), host_hash_delete() + */ +} +ATF_TC_BODY(lease_hash_string_3hosts, tc) { + + unsigned char clientid1[] = "Alice"; + unsigned char clientid2[] = "Bob"; + unsigned char clientid3[] = "Charlie"; + + lease_hash_test_3hosts(clientid1, 0, clientid2, 0, clientid3, 0); +} + + +ATF_TC(lease_hash_basic_3hosts); +ATF_TC_HEAD(lease_hash_basic_3hosts, tc) { + atf_tc_set_md_var(tc, "descr", "Basic lease hash tests"); + /* + * The following functions are tested: + * host_allocate(), host_new_hash(), buffer_allocate(), host_hash_lookup() + * host_hash_add(), host_hash_delete() + */ +} +ATF_TC_BODY(lease_hash_basic_3hosts, tc) { + + unsigned char clientid1[] = { 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9 }; + unsigned char clientid2[] = { 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8 }; + unsigned char clientid3[] = { 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; + + lease_hash_test_3hosts(clientid1, sizeof(clientid1), + clientid2, sizeof(clientid2), + clientid3, sizeof(clientid3)); +} + +#if 0 +/* This test is disabled as we solved the issue by prohibiting + the code from using an improper client id earlier and restoring + the hash code to its previous state. As we may choose to + redo the hash code again this test hasn't been deleted. +*/ +/* this test is a direct reproduction of 29851 issue */ +ATF_TC(uid_hash_rt29851); + +ATF_TC_HEAD(uid_hash_rt29851, tc) { + atf_tc_set_md_var(tc, "descr", "Uid hash tests"); + + /* + * this test should last less than millisecond. If its execution + * is longer than 3 second, we hit infinite loop. + */ + atf_tc_set_md_var(tc, "timeout", "3"); +} + +ATF_TC_BODY(uid_hash_rt29851, tc) { + + unsigned char clientid1[] = { 0x0 }; + unsigned char clientid2[] = { 0x0 }; + unsigned char clientid3[] = { 0x0 }; + + int clientid1_len = 1; + int clientid2_len = 1; + int clientid3_len = 0; + + struct lease *lease1 = 0, *lease2 = 0, *lease3 = 0; + + dhcp_db_objects_setup (); + dhcp_common_objects_setup (); + + ATF_CHECK(lease_id_new_hash(&lease_uid_hash, LEASE_HASH_SIZE, MDL)); + + ATF_CHECK(lease_allocate (&lease1, MDL) == ISC_R_SUCCESS); + ATF_CHECK(lease_allocate (&lease2, MDL) == ISC_R_SUCCESS); + ATF_CHECK(lease_allocate (&lease3, MDL) == ISC_R_SUCCESS); + + lease1->uid = clientid1; + lease2->uid = clientid2; + lease3->uid = clientid3; + + lease1->uid_len = clientid1_len; + lease2->uid_len = clientid2_len; + lease3->uid_len = clientid3_len; + + uid_hash_add(lease1); + /* uid_hash_delete(lease2); // not necessary for actual issue repro */ + uid_hash_add(lease3); + + /* lease2->uid_len = 0; // not necessary for actual issue repro */ + /* uid_hash_delete(lease2); // not necessary for actual issue repro */ + /* uid_hash_delete(lease3); // not necessary for actual issue repro */ + uid_hash_delete(lease1); + + /* lease2->uid_len = 1; // not necessary for actual issue repro */ + uid_hash_add(lease1); + uid_hash_delete(lease2); +} +#endif + +ATF_TP_ADD_TCS(tp) { + ATF_TP_ADD_TC(tp, lease_hash_basic_2hosts); + ATF_TP_ADD_TC(tp, lease_hash_basic_3hosts); + ATF_TP_ADD_TC(tp, lease_hash_string_2hosts); + ATF_TP_ADD_TC(tp, lease_hash_string_3hosts); + ATF_TP_ADD_TC(tp, lease_hash_negative1); +#if 0 /* see comment in function */ + ATF_TP_ADD_TC(tp, uid_hash_rt29851); +#endif + return (atf_no_error()); +} diff --git a/external/bsd/dhcp/dist/server/tests/load_bal_unittest.c b/external/bsd/dhcp/dist/server/tests/load_bal_unittest.c new file mode 100644 index 000000000000..dfe938fb4382 --- /dev/null +++ b/external/bsd/dhcp/dist/server/tests/load_bal_unittest.c @@ -0,0 +1,193 @@ +/* $NetBSD: load_bal_unittest.c,v 1.1.1.1 2013/03/24 22:50:43 christos Exp $ */ + +/* + * Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include + +#include "dhcpd.h" + +#include + +/* + * Test the load balancing code. + * + * The two main variables are: + * packet => the "packet" being processed + * state => the "state" of the failover peer + * We only fill in the fields necessary for our testing + * packet->raw->secs => amount of time the client has been trying + * packet->raw->hlen => the length of the mac address of the client + * packet->raw->chaddr => the mac address of the client + * To simplify the tests the mac address will be only 1 byte long and + * not really matter. Instead the hba will be all 1s and the tests + * will use the primary/secondary flag to change the expected result. + * + * state->i_am => primary or secondary + * state->load_balance_max_secs => maxixum time for a client to be trying + * before the other peer responds + * set to 5 for these tests + * state->hba = array of hash buckets assigning the hash to primary or secondary + * set to all ones (all primary) for theses tests + */ + +ATF_TC(load_balance); + +ATF_TC_HEAD(load_balance, tc) +{ + atf_tc_set_md_var(tc, "descr", "This test case checks that " + "load balancing works."); +} + +ATF_TC_BODY(load_balance, tc) +{ + struct packet packet; + struct dhcp_packet raw; + dhcp_failover_state_t pstate, sstate; + u_int8_t hba[256]; + + memset(&packet, 0, sizeof(struct packet)); + memset(&raw, 0, sizeof(struct dhcp_packet)); + packet.raw = &raw; + raw.hlen = 1; + raw.chaddr[0] = 14; + + memset(hba, 0xFF, 256); + + /* primary state */ + memset(&pstate, 0, sizeof(dhcp_failover_state_t)); + pstate.i_am = primary; + pstate.load_balance_max_secs = 5; + pstate.hba = hba; + + /* secondary state, we can reuse the hba as it doesn't change */ + memset(&sstate, 0, sizeof(dhcp_failover_state_t)); + sstate.i_am = secondary; + sstate.load_balance_max_secs = 5; + sstate.hba = hba; + + /* Basic check, primary accepted, secondary not */ + raw.secs = htons(0); + if (load_balance_mine(&packet, &pstate) != 1) { + atf_tc_fail("ERROR: primary not accepted %s:%d", MDL); + } + + if (load_balance_mine(&packet, &sstate) != 0) { + atf_tc_fail("ERROR: secondary accepted %s:%d", MDL); + } + + + /* Timeout not exceeded, primary accepted, secondary not */ + raw.secs = htons(2); + if (load_balance_mine(&packet, &pstate) != 1) { + atf_tc_fail("ERROR: primary not accepted %s:%d", MDL); + } + + if (load_balance_mine(&packet, &sstate) != 0) { + atf_tc_fail("ERROR: secondary accepted %s:%d", MDL); + } + + /* Timeout exceeded, both accepted */ + raw.secs = htons(6); + if (load_balance_mine(&packet, &pstate) != 1) { + atf_tc_fail("ERROR: primary not accepted %s:%d", MDL); + } + + if (load_balance_mine(&packet, &sstate) != 1) { + atf_tc_fail("ERROR: secondary not accepted %s:%d", MDL); + } + + /* Timeout exeeded with a large value, both accepted */ + raw.secs = htons(257); + if (load_balance_mine(&packet, &pstate) != 1) { + atf_tc_fail("ERROR: primary not accepted %s:%d", MDL); + } + + if (load_balance_mine(&packet, &sstate) != 1) { + atf_tc_fail("ERROR: secondary not accepted %s:%d", MDL); + } + +} + +ATF_TC(load_balance_swap); + +ATF_TC_HEAD(load_balance_swap, tc) +{ + atf_tc_set_md_var(tc, "descr", "This test case checks that " + "load balancing works with byteswapping."); +} + +ATF_TC_BODY(load_balance_swap, tc) +{ +#if defined(SECS_BYTEORDER) + struct packet packet; + struct dhcp_packet raw; + dhcp_failover_state_t pstate, sstate; + u_int8_t hba[256]; + + memset(&packet, 0, sizeof(struct packet)); + memset(&raw, 0, sizeof(struct dhcp_packet)); + packet.raw = &raw; + raw.hlen = 1; + raw.chaddr[0] = 14; + + memset(hba, 0xFF, 256); + + /* primary state */ + memset(&pstate, 0, sizeof(dhcp_failover_state_t)); + pstate.i_am = primary; + pstate.load_balance_max_secs = 5; + pstate.hba = hba; + + /* secondary state, we can reuse the hba as it doesn't change */ + memset(&sstate, 0, sizeof(dhcp_failover_state_t)); + sstate.i_am = secondary; + sstate.load_balance_max_secs = 5; + sstate.hba = hba; + + /* Small byteswapped timeout, primary accepted, secondary not*/ + raw.secs = htons(256); + if (load_balance_mine(&packet, &pstate) != 1) { + atf_tc_fail("ERROR: primary not accepted %s:%d", MDL); + } + + if (load_balance_mine(&packet, &sstate) != 0) { + atf_tc_fail("ERROR: secondary accepted %s:%d", MDL); + } + + /* Large byteswapped timeout, both accepted*/ + raw.secs = htons(256 * 6); + if (load_balance_mine(&packet, &pstate) != 1) { + atf_tc_fail("ERROR: primary not accepted %s:%d", MDL); + } + + if (load_balance_mine(&packet, &sstate) != 1) { + atf_tc_fail("ERROR: secondary not accepted %s:%d", MDL); + } + +#else + atf_tc_skip("SECS_BYTEORDER not defined"); +#endif +} + + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, load_balance); + ATF_TP_ADD_TC(tp, load_balance_swap); + + return (atf_no_error()); +} diff --git a/external/bsd/dhcp/dist/server/tests/mdb6_unittest.c b/external/bsd/dhcp/dist/server/tests/mdb6_unittest.c new file mode 100644 index 000000000000..5be99a95e5a5 --- /dev/null +++ b/external/bsd/dhcp/dist/server/tests/mdb6_unittest.c @@ -0,0 +1,959 @@ +/* $NetBSD: mdb6_unittest.c,v 1.1.1.1 2013/03/24 22:50:43 christos Exp $ */ + +/* + * Copyright (C) 2007-2012 by Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include "config.h" + +#include +#include +#include + +#include +#include "dhcpd.h" +#include "omapip/omapip.h" +#include "omapip/hash.h" +#include + +#include + +#include + +void build_prefix6(struct in6_addr *pref, const struct in6_addr *net_start_pref, + int pool_bits, int pref_bits, + const struct data_string *input); + +/* + * Basic iaaddr manipulation. + * Verify construction and referencing of an iaaddr. + */ + +ATF_TC(iaaddr_basic); +ATF_TC_HEAD(iaaddr_basic, tc) +{ + atf_tc_set_md_var(tc, "descr", "This test case checks that basic " + "IAADDR manipulation is possible."); +} +ATF_TC_BODY(iaaddr_basic, tc) +{ + struct iasubopt *iaaddr; + struct iasubopt *iaaddr_copy; + + /* set up dhcp globals */ + dhcp_context_create(); + + /* and other common arguments */ + iaaddr = NULL; + iaaddr_copy = NULL; + + /* tests */ + if (iasubopt_allocate(&iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_allocate() %s:%d", MDL); + } + if (iaaddr->state != FTS_FREE) { + atf_tc_fail("ERROR: bad state %s:%d", MDL); + } + if (iaaddr->heap_index != -1) { + atf_tc_fail("ERROR: bad heap_index %s:%d", MDL); + } + if (iasubopt_reference(&iaaddr_copy, iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_reference() %s:%d", MDL); + } + if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_reference() %s:%d", MDL); + } + if (iasubopt_dereference(&iaaddr_copy, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_reference() %s:%d", MDL); + } +} + +/* + * Basic iaaddr sanity checks. + * Verify that the iaaddr code does some sanity checking. + */ + +ATF_TC(iaaddr_negative); +ATF_TC_HEAD(iaaddr_negative, tc) +{ + atf_tc_set_md_var(tc, "descr", "This test case checks that IAADDR " + "option code can handle various negative scenarios."); +} +ATF_TC_BODY(iaaddr_negative, tc) +{ + struct iasubopt *iaaddr; + struct iasubopt *iaaddr_copy; + + /* set up dhcp globals */ + dhcp_context_create(); + + /* tests */ + /* bogus allocate arguments */ + if (iasubopt_allocate(NULL, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: iasubopt_allocate() %s:%d", MDL); + } + iaaddr = (struct iasubopt *)1; + if (iasubopt_allocate(&iaaddr, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: iasubopt_allocate() %s:%d", MDL); + } + + /* bogus reference arguments */ + iaaddr = NULL; + if (iasubopt_allocate(&iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_allocate() %s:%d", MDL); + } + if (iasubopt_reference(NULL, iaaddr, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: iasubopt_reference() %s:%d", MDL); + } + iaaddr_copy = (struct iasubopt *)1; + if (iasubopt_reference(&iaaddr_copy, iaaddr, + MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: iasubopt_reference() %s:%d", MDL); + } + iaaddr_copy = NULL; + if (iasubopt_reference(&iaaddr_copy, NULL, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: iasubopt_reference() %s:%d", MDL); + } + if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_reference() %s:%d", MDL); + } + + /* bogus dereference arguments */ + if (iasubopt_dereference(NULL, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: iasubopt_dereference() %s:%d", MDL); + } + iaaddr = NULL; + if (iasubopt_dereference(&iaaddr, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: iasubopt_dereference() %s:%d", MDL); + } +} + +/* + * Basic ia_na manipulation. + */ + +ATF_TC(ia_na_basic); +ATF_TC_HEAD(ia_na_basic, tc) +{ + atf_tc_set_md_var(tc, "descr", "This test case checks that IA_NA code can " + "handle various basic scenarios."); +} +ATF_TC_BODY(ia_na_basic, tc) +{ + uint32_t iaid; + struct ia_xx *ia_na; + struct ia_xx *ia_na_copy; + struct iasubopt *iaaddr; + + /* set up dhcp globals */ + dhcp_context_create(); + + /* and other common arguments */ + iaid = 666; + ia_na = NULL; + ia_na_copy = NULL; + iaaddr = NULL; + + /* tests */ + if (ia_allocate(&ia_na, iaid, "TestDUID", 8, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ia_allocate() %s:%d", MDL); + } + if (memcmp(ia_na->iaid_duid.data, &iaid, sizeof(iaid)) != 0) { + atf_tc_fail("ERROR: bad IAID_DUID %s:%d", MDL); + } + if (memcmp(ia_na->iaid_duid.data+sizeof(iaid), "TestDUID", 8) != 0) { + atf_tc_fail("ERROR: bad IAID_DUID %s:%d", MDL); + } + if (ia_na->num_iasubopt != 0) { + atf_tc_fail("ERROR: bad num_iasubopt %s:%d", MDL); + } + if (ia_reference(&ia_na_copy, ia_na, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ia_reference() %s:%d", MDL); + } + if (iasubopt_allocate(&iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_allocate() %s:%d", MDL); + } + if (ia_add_iasubopt(ia_na, iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ia_add_iasubopt() %s:%d", MDL); + } + ia_remove_iasubopt(ia_na, iaaddr, MDL); + if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_reference() %s:%d", MDL); + } + if (ia_dereference(&ia_na, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ia_dereference() %s:%d", MDL); + } + if (ia_dereference(&ia_na_copy, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ia_dereference() %s:%d", MDL); + } +} + +/* + * Lots of iaaddr in our ia_na. + * Create many iaaddrs and attach them to an ia_na + * then clean up by removing them one at a time and + * all at once by dereferencing the ia_na. + */ + +ATF_TC(ia_na_manyaddrs); +ATF_TC_HEAD(ia_na_manyaddrs, tc) +{ + atf_tc_set_md_var(tc, "descr", "This test case checks that IA_NA can " + "handle lots of addresses."); +} +ATF_TC_BODY(ia_na_manyaddrs, tc) +{ + uint32_t iaid; + struct ia_xx *ia_na; + struct iasubopt *iaaddr; + int i; + + /* set up dhcp globals */ + dhcp_context_create(); + + /* tests */ + /* lots of iaaddr that we delete */ + iaid = 666; + ia_na = NULL; + if (ia_allocate(&ia_na, iaid, "TestDUID", 8, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ia_allocate() %s:%d", MDL); + } + for (i=0; i<100; i++) { + iaaddr = NULL; + if (iasubopt_allocate(&iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_allocate() %s:%d", MDL); + } + if (ia_add_iasubopt(ia_na, iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ia_add_iasubopt() %s:%d", MDL); + } + if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_reference() %s:%d", MDL); + } + } + +#if 0 + for (i=0; i<100; i++) { + iaaddr = ia_na->iasubopt[random() % ia_na->num_iasubopt]; + ia_remove_iasubopt(ia_na, iaaddr, MDL); + /* TODO: valgrind reports problem here: Invalid read of size 8 + * Address 0x51e6258 is 56 bytes inside a block of size 88 free'd */ + } +#endif + if (ia_dereference(&ia_na, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ia_dereference() %s:%d", MDL); + } + + /* lots of iaaddr, let dereference cleanup */ + iaid = 666; + ia_na = NULL; + if (ia_allocate(&ia_na, iaid, "TestDUID", 8, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ia_allocate() %s:%d", MDL); + } + for (i=0; i<100; i++) { + iaaddr = NULL; + if (iasubopt_allocate(&iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_allocate() %s:%d", MDL); + } + if (ia_add_iasubopt(ia_na, iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ia_add_iasubopt() %s:%d", MDL); + } + if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_reference() %s:%d", MDL); + } + } + if (ia_dereference(&ia_na, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ia_dereference() %s:%d", MDL); + } +} + +/* + * Basic ia_na sanity checks. + * Verify that the ia_na code does some sanity checking. + */ + +ATF_TC(ia_na_negative); +ATF_TC_HEAD(ia_na_negative, tc) +{ + atf_tc_set_md_var(tc, "descr", "This test case checks that IA_NA option " + "code can handle various negative scenarios."); +} +ATF_TC_BODY(ia_na_negative, tc) +{ + uint32_t iaid; + struct ia_xx *ia_na; + struct ia_xx *ia_na_copy; + + /* set up dhcp globals */ + dhcp_context_create(); + + /* tests */ + /* bogus allocate arguments */ + if (ia_allocate(NULL, 123, "", 0, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: ia_allocate() %s:%d", MDL); + } + ia_na = (struct ia_xx *)1; + if (ia_allocate(&ia_na, 456, "", 0, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: ia_allocate() %s:%d", MDL); + } + + /* bogus reference arguments */ + iaid = 666; + ia_na = NULL; + if (ia_allocate(&ia_na, iaid, "TestDUID", 8, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ia_allocate() %s:%d", MDL); + } + if (ia_reference(NULL, ia_na, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: ia_reference() %s:%d", MDL); + } + ia_na_copy = (struct ia_xx *)1; + if (ia_reference(&ia_na_copy, ia_na, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: ia_reference() %s:%d", MDL); + } + ia_na_copy = NULL; + if (ia_reference(&ia_na_copy, NULL, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: ia_reference() %s:%d", MDL); + } + if (ia_dereference(&ia_na, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ia_dereference() %s:%d", MDL); + } + + /* bogus dereference arguments */ + if (ia_dereference(NULL, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: ia_dereference() %s:%d", MDL); + } + + /* bogus remove */ + iaid = 666; + ia_na = NULL; + if (ia_allocate(&ia_na, iaid, "TestDUID", 8, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ia_allocate() %s:%d", MDL); + } + ia_remove_iasubopt(ia_na, NULL, MDL); + if (ia_dereference(&ia_na, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ia_dereference() %s:%d", MDL); + } +} + +/* + * Basic ipv6_pool manipulation. + * Verify that basic pool operations work properly. + * The operations include creating a pool and creating, + * renewing, expiring, releasing and declining addresses. + */ + +ATF_TC(ipv6_pool_basic); +ATF_TC_HEAD(ipv6_pool_basic, tc) +{ + atf_tc_set_md_var(tc, "descr", "This test case checks that IPv6 pool " + "manipulation is possible."); +} +ATF_TC_BODY(ipv6_pool_basic, tc) +{ + struct iasubopt *iaaddr; + struct in6_addr addr; + struct ipv6_pool *pool; + struct ipv6_pool *pool_copy; + char addr_buf[INET6_ADDRSTRLEN]; + char *uid; + struct data_string ds; + struct iasubopt *expired_iaaddr; + unsigned int attempts; + + /* set up dhcp globals */ + dhcp_context_create(); + + /* and other common arguments */ + inet_pton(AF_INET6, "1:2:3:4::", &addr); + + uid = "client0"; + memset(&ds, 0, sizeof(ds)); + ds.len = strlen(uid); + if (!buffer_allocate(&ds.buffer, ds.len, MDL)) { + atf_tc_fail("Out of memory"); + } + ds.data = ds.buffer->data; + memcpy((char *)ds.data, uid, ds.len); + + /* tests */ + /* allocate, reference */ + pool = NULL; + if (ipv6_pool_allocate(&pool, D6O_IA_NA, &addr, + 64, 128, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ipv6_pool_allocate() %s:%d", MDL); + } + if (pool->num_active != 0) { + atf_tc_fail("ERROR: bad num_active %s:%d", MDL); + } + if (pool->bits != 64) { + atf_tc_fail("ERROR: bad bits %s:%d", MDL); + } + inet_ntop(AF_INET6, &pool->start_addr, addr_buf, sizeof(addr_buf)); + if (strcmp(inet_ntop(AF_INET6, &pool->start_addr, addr_buf, + sizeof(addr_buf)), "1:2:3:4::") != 0) { + atf_tc_fail("ERROR: bad start_addr %s:%d", MDL); + } + pool_copy = NULL; + if (ipv6_pool_reference(&pool_copy, pool, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ipv6_pool_reference() %s:%d", MDL); + } + + /* create_lease6, renew_lease6, expire_lease6 */ + iaaddr = NULL; + if (create_lease6(pool, &iaaddr, + &attempts, &ds, 1) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: create_lease6() %s:%d", MDL); + } + if (pool->num_inactive != 1) { + atf_tc_fail("ERROR: bad num_inactive %s:%d", MDL); + } + if (renew_lease6(pool, iaaddr) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: renew_lease6() %s:%d", MDL); + } + if (pool->num_active != 1) { + atf_tc_fail("ERROR: bad num_active %s:%d", MDL); + } + expired_iaaddr = NULL; + if (expire_lease6(&expired_iaaddr, pool, 0) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: expire_lease6() %s:%d", MDL); + } + if (expired_iaaddr != NULL) { + atf_tc_fail("ERROR: should not have expired a lease %s:%d", MDL); + } + if (pool->num_active != 1) { + atf_tc_fail("ERROR: bad num_active %s:%d", MDL); + } + if (expire_lease6(&expired_iaaddr, pool, 1000) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: expire_lease6() %s:%d", MDL); + } + if (expired_iaaddr == NULL) { + atf_tc_fail("ERROR: should have expired a lease %s:%d", MDL); + } + if (iasubopt_dereference(&expired_iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_dereference() %s:%d", MDL); + } + if (pool->num_active != 0) { + atf_tc_fail("ERROR: bad num_active %s:%d", MDL); + } + if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_dereference() %s:%d", MDL); + } + + /* release_lease6, decline_lease6 */ + if (create_lease6(pool, &iaaddr, &attempts, + &ds, 1) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: create_lease6() %s:%d", MDL); + } + if (renew_lease6(pool, iaaddr) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: renew_lease6() %s:%d", MDL); + } + if (pool->num_active != 1) { + atf_tc_fail("ERROR: bad num_active %s:%d", MDL); + } + if (release_lease6(pool, iaaddr) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: decline_lease6() %s:%d", MDL); + } + if (pool->num_active != 0) { + atf_tc_fail("ERROR: bad num_active %s:%d", MDL); + } + if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_dereference() %s:%d", MDL); + } + if (create_lease6(pool, &iaaddr, &attempts, + &ds, 1) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: create_lease6() %s:%d", MDL); + } + if (renew_lease6(pool, iaaddr) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: renew_lease6() %s:%d", MDL); + } + if (pool->num_active != 1) { + atf_tc_fail("ERROR: bad num_active %s:%d", MDL); + } + if (decline_lease6(pool, iaaddr) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: decline_lease6() %s:%d", MDL); + } + if (pool->num_active != 1) { + atf_tc_fail("ERROR: bad num_active %s:%d", MDL); + } + if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_dereference() %s:%d", MDL); + } + + /* dereference */ + if (ipv6_pool_dereference(&pool, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ipv6_pool_reference() %s:%d", MDL); + } + if (ipv6_pool_dereference(&pool_copy, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ipv6_pool_reference() %s:%d", MDL); + } +} + +/* + * Basic ipv6_pool sanity checks. + * Verify that the ipv6_pool code does some sanity checking. + */ + +ATF_TC(ipv6_pool_negative); +ATF_TC_HEAD(ipv6_pool_negative, tc) +{ + atf_tc_set_md_var(tc, "descr", "This test case checks that IPv6 pool " + "can handle negative cases."); +} +ATF_TC_BODY(ipv6_pool_negative, tc) +{ + struct in6_addr addr; + struct ipv6_pool *pool; + struct ipv6_pool *pool_copy; + + /* set up dhcp globals */ + dhcp_context_create(); + + /* and other common arguments */ + inet_pton(AF_INET6, "1:2:3:4::", &addr); + + /* tests */ + if (ipv6_pool_allocate(NULL, D6O_IA_NA, &addr, + 64, 128, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: ipv6_pool_allocate() %s:%d", MDL); + } + pool = (struct ipv6_pool *)1; + if (ipv6_pool_allocate(&pool, D6O_IA_NA, &addr, + 64, 128, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: ipv6_pool_allocate() %s:%d", MDL); + } + if (ipv6_pool_reference(NULL, pool, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: ipv6_pool_reference() %s:%d", MDL); + } + pool_copy = (struct ipv6_pool *)1; + if (ipv6_pool_reference(&pool_copy, pool, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: ipv6_pool_reference() %s:%d", MDL); + } + pool_copy = NULL; + if (ipv6_pool_reference(&pool_copy, NULL, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: ipv6_pool_reference() %s:%d", MDL); + } + if (ipv6_pool_dereference(NULL, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: ipv6_pool_dereference() %s:%d", MDL); + } + if (ipv6_pool_dereference(&pool_copy, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: ipv6_pool_dereference() %s:%d", MDL); + } +} + + +/* + * Order of expiration. + * Add several addresses to a pool and check that + * they expire in the proper order. + */ + +ATF_TC(expire_order); +ATF_TC_HEAD(expire_order, tc) +{ + atf_tc_set_md_var(tc, "descr", "This test case checks that order " + "of lease expiration is handled properly."); +} +ATF_TC_BODY(expire_order, tc) +{ + struct iasubopt *iaaddr; + struct ipv6_pool *pool; + struct in6_addr addr; + int i; + char *uid; + struct data_string ds; + struct iasubopt *expired_iaaddr; + unsigned int attempts; + + /* set up dhcp globals */ + dhcp_context_create(); + + /* and other common arguments */ + inet_pton(AF_INET6, "1:2:3:4::", &addr); + + uid = "client0"; + memset(&ds, 0, sizeof(ds)); + ds.len = strlen(uid); + if (!buffer_allocate(&ds.buffer, ds.len, MDL)) { + atf_tc_fail("Out of memory"); + } + ds.data = ds.buffer->data; + memcpy((char *)ds.data, uid, ds.len); + + iaaddr = NULL; + expired_iaaddr = NULL; + + /* tests */ + pool = NULL; + if (ipv6_pool_allocate(&pool, D6O_IA_NA, &addr, + 64, 128, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ipv6_pool_allocate() %s:%d", MDL); + } + + for (i=10; i<100; i+=10) { + if (create_lease6(pool, &iaaddr, &attempts, + &ds, i) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: create_lease6() %s:%d", MDL); + } + if (renew_lease6(pool, iaaddr) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: renew_lease6() %s:%d", MDL); + } + if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_dereference() %s:%d", MDL); + } + if (pool->num_active != (i / 10)) { + atf_tc_fail("ERROR: bad num_active %s:%d", MDL); + } + } + if (pool->num_active != 9) { + atf_tc_fail("ERROR: bad num_active %s:%d", MDL); + } + + for (i=10; i<100; i+=10) { + if (expire_lease6(&expired_iaaddr, + pool, 1000) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: expire_lease6() %s:%d", MDL); + } + if (expired_iaaddr == NULL) { + atf_tc_fail("ERROR: should have expired a lease %s:%d", + MDL); + } + if (pool->num_active != (9 - (i / 10))) { + atf_tc_fail("ERROR: bad num_active %s:%d", MDL); + } + if (expired_iaaddr->hard_lifetime_end_time != i) { + atf_tc_fail("ERROR: bad hard_lifetime_end_time %s:%d", + MDL); + } + if (iasubopt_dereference(&expired_iaaddr, MDL) != + ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_dereference() %s:%d", MDL); + } + } + if (pool->num_active != 0) { + atf_tc_fail("ERROR: bad num_active %s:%d", MDL); + } + expired_iaaddr = NULL; + if (expire_lease6(&expired_iaaddr, pool, 1000) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: expire_lease6() %s:%d", MDL); + } + if (ipv6_pool_dereference(&pool, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ipv6_pool_dereference() %s:%d", MDL); + } +} + +/* + * Reduce the expiration period of a lease. + * This test reduces the expiration period of + * a lease to verify we process reductions + * properly. + */ +ATF_TC(expire_order_reduce); +ATF_TC_HEAD(expire_order_reduce, tc) +{ + atf_tc_set_md_var(tc, "descr", "This test case checks that reducing " + "the expiration time of a lease works properly."); +} +ATF_TC_BODY(expire_order_reduce, tc) +{ + struct iasubopt *iaaddr1, *iaaddr2; + struct ipv6_pool *pool; + struct in6_addr addr; + char *uid; + struct data_string ds; + struct iasubopt *expired_iaaddr; + unsigned int attempts; + + /* set up dhcp globals */ + dhcp_context_create(); + + /* and other common arguments */ + inet_pton(AF_INET6, "1:2:3:4::", &addr); + + uid = "client0"; + memset(&ds, 0, sizeof(ds)); + ds.len = strlen(uid); + if (!buffer_allocate(&ds.buffer, ds.len, MDL)) { + atf_tc_fail("Out of memory"); + } + ds.data = ds.buffer->data; + memcpy((char *)ds.data, uid, ds.len); + + pool = NULL; + iaaddr1 = NULL; + iaaddr2 = NULL; + expired_iaaddr = NULL; + + /* + * Add two leases iaaddr1 with expire time of 200 + * and iaaddr2 with expire time of 300. Then update + * iaaddr2 to expire in 100 instead. This should cause + * iaaddr2 to move with the hash list. + */ + /* create pool and add iaaddr1 and iaaddr2 */ + if (ipv6_pool_allocate(&pool, D6O_IA_NA, &addr, + 64, 128, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ipv6_pool_allocate() %s:%d", MDL); + } + if (create_lease6(pool, &iaaddr1, &attempts, &ds, 200) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: create_lease6() %s:%d", MDL); + } + if (renew_lease6(pool, iaaddr1) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: renew_lease6() %s:%d", MDL); + } + if (create_lease6(pool, &iaaddr2, &attempts, &ds, 300) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: create_lease6() %s:%d", MDL); + } + if (renew_lease6(pool, iaaddr2) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: renew_lease6() %s:%d", MDL); + } + + /* verify pool */ + if (pool->num_active != 2) { + atf_tc_fail("ERROR: bad num_active %s:%d", MDL); + } + + /* reduce lease for iaaddr2 */ + iaaddr2->soft_lifetime_end_time = 100; + if (renew_lease6(pool, iaaddr2) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: renew_lease6() %s:%d", MDL); + } + + /* expire a lease, it should be iaaddr2 with an expire time of 100 */ + if (expire_lease6(&expired_iaaddr, pool, 1000) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: expire_lease6() %s:%d", MDL); + } + if (expired_iaaddr == NULL) { + atf_tc_fail("ERROR: should have expired a lease %s:%d", MDL); + } + if (expired_iaaddr != iaaddr2) { + atf_tc_fail("Error: incorrect lease expired %s:%d", MDL); + } + if (expired_iaaddr->hard_lifetime_end_time != 100) { + atf_tc_fail("ERROR: bad hard_lifetime_end_time %s:%d", MDL); + } + if (iasubopt_dereference(&expired_iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_dereference() %s:%d", MDL); + } + + /* expire a lease, it should be iaaddr1 with an expire time of 200 */ + if (expire_lease6(&expired_iaaddr, pool, 1000) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: expire_lease6() %s:%d", MDL); + } + if (expired_iaaddr == NULL) { + atf_tc_fail("ERROR: should have expired a lease %s:%d", MDL); + } + if (expired_iaaddr != iaaddr1) { + atf_tc_fail("Error: incorrect lease expired %s:%d", MDL); + } + if (expired_iaaddr->hard_lifetime_end_time != 200) { + atf_tc_fail("ERROR: bad hard_lifetime_end_time %s:%d", MDL); + } + if (iasubopt_dereference(&expired_iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_dereference() %s:%d", MDL); + } + + /* cleanup */ + if (iasubopt_dereference(&iaaddr1, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_dereference() %s:%d", MDL); + } + if (iasubopt_dereference(&iaaddr2, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_dereference() %s:%d", MDL); + } + if (ipv6_pool_dereference(&pool, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ipv6_pool_dereference() %s:%d", MDL); + } +} + +/* + * Small pool. + * check that a small pool behaves properly. + */ + +ATF_TC(small_pool); +ATF_TC_HEAD(small_pool, tc) +{ + atf_tc_set_md_var(tc, "descr", "This test case checks that small pool " + "is handled properly."); +} +ATF_TC_BODY(small_pool, tc) +{ + struct in6_addr addr; + struct ipv6_pool *pool; + struct iasubopt *iaaddr; + char *uid; + struct data_string ds; + unsigned int attempts; + + /* set up dhcp globals */ + dhcp_context_create(); + + /* and other common arguments */ + inet_pton(AF_INET6, "1:2:3:4::", &addr); + addr.s6_addr[14] = 0x81; + + uid = "client0"; + memset(&ds, 0, sizeof(ds)); + ds.len = strlen(uid); + if (!buffer_allocate(&ds.buffer, ds.len, MDL)) { + atf_tc_fail("Out of memory"); + } + ds.data = ds.buffer->data; + memcpy((char *)ds.data, uid, ds.len); + + pool = NULL; + iaaddr = NULL; + + /* tests */ + if (ipv6_pool_allocate(&pool, D6O_IA_NA, &addr, + 127, 128, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ipv6_pool_allocate() %s:%d", MDL); + } + + if (create_lease6(pool, &iaaddr, &attempts, + &ds, 42) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: create_lease6() %s:%d", MDL); + } + if (renew_lease6(pool, iaaddr) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: renew_lease6() %s:%d", MDL); + } + if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_dereference() %s:%d", MDL); + } + if (create_lease6(pool, &iaaddr, &attempts, + &ds, 11) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: create_lease6() %s:%d", MDL); + } + if (renew_lease6(pool, iaaddr) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: renew_lease6() %s:%d", MDL); + } + if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_dereference() %s:%d", MDL); + } + if (create_lease6(pool, &iaaddr, &attempts, + &ds, 11) != ISC_R_NORESOURCES) { + atf_tc_fail("ERROR: create_lease6() %s:%d", MDL); + } + if (ipv6_pool_dereference(&pool, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ipv6_pool_dereference() %s:%d", MDL); + } +} + +/* + * Address to pool mapping. + * Verify that we find the proper pool for an address + * or don't find a pool if we don't have one for the given + * address. + */ +ATF_TC(many_pools); +ATF_TC_HEAD(many_pools, tc) +{ + atf_tc_set_md_var(tc, "descr", "This test case checks that functions " + "across all pools are working correctly."); +} +ATF_TC_BODY(many_pools, tc) +{ + struct in6_addr addr; + struct ipv6_pool *pool; + + /* set up dhcp globals */ + dhcp_context_create(); + + /* and other common arguments */ + inet_pton(AF_INET6, "1:2:3:4::", &addr); + + /* tests */ + + pool = NULL; + if (ipv6_pool_allocate(&pool, D6O_IA_NA, &addr, + 64, 128, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ipv6_pool_allocate() %s:%d", MDL); + } + if (add_ipv6_pool(pool) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: add_ipv6_pool() %s:%d", MDL); + } + if (ipv6_pool_dereference(&pool, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ipv6_pool_dereference() %s:%d", MDL); + } + pool = NULL; + if (find_ipv6_pool(&pool, D6O_IA_NA, &addr) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: find_ipv6_pool() %s:%d", MDL); + } + if (ipv6_pool_dereference(&pool, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ipv6_pool_dereference() %s:%d", MDL); + } + inet_pton(AF_INET6, "1:2:3:4:ffff:ffff:ffff:ffff", &addr); + pool = NULL; + if (find_ipv6_pool(&pool, D6O_IA_NA, &addr) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: find_ipv6_pool() %s:%d", MDL); + } + if (ipv6_pool_dereference(&pool, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ipv6_pool_dereference() %s:%d", MDL); + } + inet_pton(AF_INET6, "1:2:3:5::", &addr); + pool = NULL; + if (find_ipv6_pool(&pool, D6O_IA_NA, &addr) != ISC_R_NOTFOUND) { + atf_tc_fail("ERROR: find_ipv6_pool() %s:%d", MDL); + } + inet_pton(AF_INET6, "1:2:3:3:ffff:ffff:ffff:ffff", &addr); + pool = NULL; + if (find_ipv6_pool(&pool, D6O_IA_NA, &addr) != ISC_R_NOTFOUND) { + atf_tc_fail("ERROR: find_ipv6_pool() %s:%d", MDL); + } + +/* iaid = 666; + ia_na = NULL; + if (ia_allocate(&ia_na, iaid, "TestDUID", 8, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ia_allocate() %s:%d", MDL); + }*/ + + { + struct in6_addr r; + struct data_string ds; + u_char data[16]; + char buf[64]; + int i, j; + + memset(&ds, 0, sizeof(ds)); + memset(data, 0xaa, sizeof(data)); + ds.len = 16; + ds.data = data; + + inet_pton(AF_INET6, "3ffe:501:ffff:100::", &addr); + for (i = 32; i < 42; i++) + for (j = i + 1; j < 49; j++) { + memset(&r, 0, sizeof(r)); + memset(buf, 0, 64); + build_prefix6(&r, &addr, i, j, &ds); + inet_ntop(AF_INET6, &r, buf, 64); + printf("%d,%d-> %s/%d\n", i, j, buf, j); + } + } +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, iaaddr_basic); + ATF_TP_ADD_TC(tp, iaaddr_negative); + ATF_TP_ADD_TC(tp, ia_na_basic); + ATF_TP_ADD_TC(tp, ia_na_manyaddrs); + ATF_TP_ADD_TC(tp, ia_na_negative); + ATF_TP_ADD_TC(tp, ipv6_pool_basic); + ATF_TP_ADD_TC(tp, ipv6_pool_negative); + ATF_TP_ADD_TC(tp, expire_order); + ATF_TP_ADD_TC(tp, expire_order_reduce); + ATF_TP_ADD_TC(tp, small_pool); + ATF_TP_ADD_TC(tp, many_pools); + + return (atf_no_error()); +} diff --git a/external/bsd/dhcp/dist/server/tests/simple_unittest.c b/external/bsd/dhcp/dist/server/tests/simple_unittest.c new file mode 100644 index 000000000000..493af886617d --- /dev/null +++ b/external/bsd/dhcp/dist/server/tests/simple_unittest.c @@ -0,0 +1,79 @@ +/* $NetBSD: simple_unittest.c,v 1.1.1.1 2013/03/24 22:50:44 christos Exp $ */ + +/* + * Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include + +/* That is an example ATF test case, tailored to ISC DHCP sources. + For detailed description with examples, see man 3 atf-c-api. */ + +/* this macro defines a name of a test case. Typical test case constists + of an initial test declaration (ATF_TC()) followed by 3 phases: + + - Initialization: ATF_TC_HEAD() + - Main body: ATF_TC_BODY() + - Cleanup: ATF_TC_CLEANUP() + + In many cases initialization or cleanup are not needed. Use + ATF_TC_WITHOUT_HEAD() or ATF_TC_WITH_CLEANUP() as needed. */ +ATF_TC(simple_test_case); + + +ATF_TC_HEAD(simple_test_case, tc) +{ + atf_tc_set_md_var(tc, "descr", "This test case is a simple DHCP test."); +} +ATF_TC_BODY(simple_test_case, tc) +{ + int condition = 1; + int this_is_linux = 1; + /* Failing condition will fail the test, but the code + itself will continue */ + ATF_CHECK( 2 > 1 ); + + /* assert style check. Test will abort if the condition is not met. */ + ATF_REQUIRE( 5 > 4 ); + + ATF_CHECK_EQ(4, 2 + 2); /* Non-fatal test. */ + ATF_REQUIRE_EQ(4, 2 + 2); /* Fatal test. */ + + /* tests can also explicitly report test result */ + if (!condition) { + atf_tc_fail("Condition not met!"); /* Explicit failure. */ + } + + if (!this_is_linux) { + atf_tc_skip("Skipping test. This Linux-only test."); + } + + if (condition && this_is_linux) { + /* no extra comments for pass needed. It just passed. */ + atf_tc_pass(); + } + +} + +/* This macro defines main() method that will call specified + test cases. tp and simple_test_case names can be whatever you want + as long as it is a valid variable identifier. */ +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, simple_test_case); + + return (atf_no_error()); +} diff --git a/external/bsd/dhcp/dist/tests/HOWTO-unit-test b/external/bsd/dhcp/dist/tests/HOWTO-unit-test index e863497981ba..b84beba3a732 100644 --- a/external/bsd/dhcp/dist/tests/HOWTO-unit-test +++ b/external/bsd/dhcp/dist/tests/HOWTO-unit-test @@ -1,153 +1,63 @@ Introduction ------------ +That is only a brief overview of tests in ISC DHCP. For more thorough +description, see ISC DHCP Developer's Guide. You can generate it, by +having Doxygen installed and doing: + + cd doc + make devel + +and then opening doc/html/index.html + +Tests Overview +-------------- + In DHCP, a unit test exercises a particular piece of code in isolation. There is a separate unit test per module or API. Each unit test lives in a directory beneath the code it is designed to exercise. -So, we have: +So, we (will eventually) have: + server/tests/ client/tests/ common/tests/ dhcpctl/tests/ And so on. -Ideally each function would be invoked with every possible type of -input, and each branch of every function would be checked. In practice -we try to be a bit more pragmatic, and target the most basic -operations, as well tricky code, and areas we have seen bugs in the -past. - +We are using ATF (Automated Test Framework) as a framework to run our +unittests. See ISC DHCP Developer's Guide for much more thorough +description of unit-test and ATF framework in general. Running Unit Tests ------------------ -In order to run the unit tests for DHCP, use: +In order to run the unit tests for DHCP, enable ATF support during configure: + +$ ./configure --with-atf + +And then use: $ make check -This will run all of the unit tests. +This will run all of the unit tests. Make sure that ATF is actually +installed and that you have atf-run and atf-report tool in your PATH. You can run a single test by going to the appropriate test directory and invoking the test directly: -$ cd common/tests -$ make test_alloc -$ ./test_alloc +$ cd server/tests +$ atf-run | atf-report There are also a number of options that you can use when running a -test. To see these, use the "-u" flag on the program. - +test. See atf-run and atf-report documentation. Adding a New Unit Test ---------------------- -To add an additional test to an existing test program, you must create -a function for the new test in the C source file: - -static void -mynewtest(void) { - static const char *test_desc = "describe the test"; - - t_assert("mynewtest", 1, T_REQUIRED, test_desc); - - /* ... test code ... */ - - t_result(T_PASS); -} - -Then add this function to the T_testlist[] array in the file: - -testspec_t T_testlist[] = { - ... - { mynewtest, "some new test" }, - { NULL, NULL } -}; - -Then you should be able to compile and run your new test. - +See ISC DHCP Developer's Guide. Adding a New Unit Test Program ------------------------------ -To add a new program, such as when a new module is added, you can copy -the "unit_test_sample.c" file (in this directory) to a new name, add -the new file as a target in Makefile.am, and begin adding tests. Do -not forget to add it to CVS via "cvs add". - -If there is no "tests" directory for a given subdirectory, then one -must be created. This can be done by: - -1. Creating the directory: - - $ mkdir $subdir/tests - $ cvs add tests - -2. Adding the subdirectory to the build system: - - Add to $subdir/Makefile.am: - - SUBDIRS = tests - - Add to the AC_OUTPUT macro in configure.ac: - - $subdir/tests/Makefile - -3. Create a Makefile.am in the new directory, something like this: - - AM_CPPFLAGS = -I../.. - - check_PROGRAMS = test_foo - - TESTS = test_foo - - test_foo_SOURCES = test_foo.c - test_foo_LDADD = ../../tests/libt_api.a # plus others... - - -See existing Makefile.am for examples, and the Automake documentation: - - http://www.gnu.org/software/automake/manual/html_node/Tests.html - - -Support Functions ------------------ - -Here are a few of the most useful functions defined in t_api that you -can use in testing: - - void - t_assert(const char *component, int anum, int class, - const char *what, ...); - - The name of this function is slightly misleading. It - actually just prints out an error message in the test - output. - - void - t_info(const char *format, ...); - - Prints out a message in the test output. You should - include "\n" at the end. - - void - t_result(int result); - - Prints out the result in the test output. You should - use one of the constants for this: - - T_PASS - T_FAIL - T_UNRESOLVED - T_UNSUPPORTED - T_UNTESTED - T_THREADONLY - -Additional Testing ------------------- - -Other static or runtime testing is always an option. For instance, you -can use valgrind to check for memory leaks. - - -Id: HOWTO-unit-test,v 1.2 2007-11-16 11:04:12 shane Exp +See ISC DHCP Developer's Guide. diff --git a/external/bsd/dhcp/dist/tests/Makefile.in b/external/bsd/dhcp/dist/tests/Makefile.in index d18fd1626dbe..3feb6f201207 100644 --- a/external/bsd/dhcp/dist/tests/Makefile.in +++ b/external/bsd/dhcp/dist/tests/Makefile.in @@ -58,6 +58,8 @@ CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ +ATF_CFLAGS = @ATF_CFLAGS@ +ATF_LDFLAGS = @ATF_LDFLAGS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ diff --git a/external/bsd/dhcp/dist/tests/t_api.c b/external/bsd/dhcp/dist/tests/t_api.c index e347938f6c26..7fb7d545133e 100644 --- a/external/bsd/dhcp/dist/tests/t_api.c +++ b/external/bsd/dhcp/dist/tests/t_api.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_api.c,v 1.1.1.1 2013/03/24 15:45:50 christos Exp $ */ +/* $NetBSD: t_api.c,v 1.1.1.2 2013/03/24 22:50:44 christos Exp $ */ /* * Copyright (C) 2004, 2005, 2007, 2009 Internet Systems Consortium, Inc. ("ISC") @@ -17,7 +17,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* Id: t_api.c,v 1.4 2009-10-28 04:12:30 sar Exp */ +/* Id: t_api.c,v 1.4 2009/10/28 04:12:30 sar Exp */ /*! \file */ diff --git a/external/bsd/dhcp/dist/util/bindvar.sh b/external/bsd/dhcp/dist/util/bindvar.sh index c6204adc4337..4416b68f186f 100644 --- a/external/bsd/dhcp/dist/util/bindvar.sh +++ b/external/bsd/dhcp/dist/util/bindvar.sh @@ -14,7 +14,7 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# Id: bindvar.sh,v 1.2.2.1 2009-12-02 22:35:03 sar Exp +# Id: bindvar.sh,v 1.2 2009/12/02 20:43:52 sar Exp # Create a file with the base directory and gmake pat for # use by the bind/Makefile, we do this to minimize portability