updat to 4.2.5
This commit is contained in:
parent
cc3878e808
commit
b576cb34cf
2
external/bsd/dhcp/dist/LICENSE
vendored
2
external/bsd/dhcp/dist/LICENSE
vendored
@ -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
|
||||
|
3
external/bsd/dhcp/dist/Makefile.am
vendored
3
external/bsd/dhcp/dist/Makefile.am
vendored
@ -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
|
||||
|
||||
|
12
external/bsd/dhcp/dist/Makefile.in
vendored
12
external/bsd/dhcp/dist/Makefile.in
vendored
@ -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)"
|
||||
|
56
external/bsd/dhcp/dist/README
vendored
56
external/bsd/dhcp/dist/README
vendored
@ -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 <string.h>
|
||||
+#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <atf-c.h>
|
||||
|
||||
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 <sys/param.h>
|
||||
-#include <sys/sysctl.h>
|
||||
+//#include <sys/sysctl.h>
|
||||
}
|
||||
|
||||
#include <cerrno>
|
||||
|
||||
Other Solaris Items
|
||||
|
||||
One problem which has been observed and is not fixed in this
|
||||
|
257
external/bsd/dhcp/dist/RELNOTES
vendored
257
external/bsd/dhcp/dist/RELNOTES
vendored
@ -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
|
||||
<dhcp-users@isc.org>.
|
||||
|
||||
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_<option_name>=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
|
||||
|
4
external/bsd/dhcp/dist/aclocal.m4
vendored
4
external/bsd/dhcp/dist/aclocal.m4
vendored
@ -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'.])])
|
||||
|
2
external/bsd/dhcp/dist/client/Makefile.am
vendored
2
external/bsd/dhcp/dist/client/Makefile.am
vendored
@ -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 \
|
||||
|
4
external/bsd/dhcp/dist/client/Makefile.in
vendored
4
external/bsd/dhcp/dist/client/Makefile.in
vendored
@ -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 \
|
||||
|
17
external/bsd/dhcp/dist/client/clparse.c
vendored
17
external/bsd/dhcp/dist/client/clparse.c
vendored
@ -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 <sys/cdefs.h>
|
||||
__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 <errno.h>
|
||||
@ -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
|
||||
|
27
external/bsd/dhcp/dist/client/dhclient-script.8
vendored
27
external/bsd/dhcp/dist/client/dhclient-script.8
vendored
@ -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
|
||||
|
66
external/bsd/dhcp/dist/client/dhclient.8
vendored
66
external/bsd/dhcp/dist/client/dhclient.8
vendored
@ -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,
|
||||
|
143
external/bsd/dhcp/dist/client/dhclient.conf.5
vendored
143
external/bsd/dhcp/dist/client/dhclient.conf.5
vendored
@ -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.
|
||||
|
36
external/bsd/dhcp/dist/client/dhclient.conf.example
vendored
Normal file
36
external/bsd/dhcp/dist/client/dhclient.conf.example
vendored
Normal file
@ -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;
|
||||
}
|
@ -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
|
||||
|
@ -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$
|
||||
|
||||
|
2
external/bsd/dhcp/dist/client/scripts/macos
vendored
2
external/bsd/dhcp/dist/client/scripts/macos
vendored
@ -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
|
||||
#
|
||||
|
6
external/bsd/dhcp/dist/common/Makefile.am
vendored
6
external/bsd/dhcp/dist/common/Makefile.am
vendored
@ -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
|
||||
|
9
external/bsd/dhcp/dist/common/Makefile.in
vendored
9
external/bsd/dhcp/dist/common/Makefile.in
vendored
@ -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:
|
||||
|
15
external/bsd/dhcp/dist/common/alloc.c
vendored
15
external/bsd/dhcp/dist/common/alloc.c
vendored
@ -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 <sys/cdefs.h>
|
||||
__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 <omapip/omapip_p.h>
|
||||
@ -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);
|
||||
|
71
external/bsd/dhcp/dist/common/comapi.c
vendored
71
external/bsd/dhcp/dist/common/comapi.c
vendored
@ -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 <sys/cdefs.h>
|
||||
__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. */
|
||||
|
||||
|
166
external/bsd/dhcp/dist/common/dhcp-eval.5
vendored
166
external/bsd/dhcp/dist/common/dhcp-eval.5
vendored
@ -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.
|
||||
|
175
external/bsd/dhcp/dist/common/dhcp-options.5
vendored
175
external/bsd/dhcp/dist/common/dhcp-options.5
vendored
@ -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:
|
||||
|
139
external/bsd/dhcp/dist/common/execute.c
vendored
139
external/bsd/dhcp/dist/common/execute.c
vendored
@ -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 <sys/cdefs.h>
|
||||
__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 <omapip/omapip_p.h>
|
||||
@ -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:
|
||||
|
9
external/bsd/dhcp/dist/common/lpf.c
vendored
9
external/bsd/dhcp/dist/common/lpf.c
vendored
@ -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\"",
|
||||
|
284
external/bsd/dhcp/dist/common/options.c
vendored
284
external/bsd/dhcp/dist/common/options.c
vendored
@ -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 <sys/cdefs.h>
|
||||
__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);
|
||||
}
|
||||
|
53
external/bsd/dhcp/dist/common/packet.c
vendored
53
external/bsd/dhcp/dist/common/packet.c
vendored
@ -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. */
|
||||
|
239
external/bsd/dhcp/dist/common/parse.c
vendored
239
external/bsd/dhcp/dist/common/parse.c
vendored
@ -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 <sys/cdefs.h>
|
||||
__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 <syslog.h>
|
||||
@ -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))
|
||||
|
23
external/bsd/dhcp/dist/common/print.c
vendored
23
external/bsd/dhcp/dist/common/print.c
vendored
@ -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 <sys/cdefs.h>
|
||||
__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);
|
||||
|
89
external/bsd/dhcp/dist/common/socket.c
vendored
89
external/bsd/dhcp/dist/common/socket.c
vendored
@ -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 <sys/cdefs.h>
|
||||
__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 <net/if.h>
|
||||
#include <sys/sockio.h>
|
||||
#include <net/if_dl.h>
|
||||
#include <sys/dlpi.h>
|
||||
#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);
|
||||
|
14
external/bsd/dhcp/dist/common/tables.c
vendored
14
external/bsd/dhcp/dist/common/tables.c
vendored
@ -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 <sys/cdefs.h>
|
||||
__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",
|
||||
|
5
external/bsd/dhcp/dist/common/tests/Atffile
vendored
Normal file
5
external/bsd/dhcp/dist/common/tests/Atffile
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
Content-Type: application/X-atf-atffile; version="1"
|
||||
|
||||
prop: test-suite = dhcp4
|
||||
|
||||
tp-glob: *_unittest
|
23
external/bsd/dhcp/dist/common/tests/Makefile.am
vendored
23
external/bsd/dhcp/dist/common/tests/Makefile.am
vendored
@ -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)
|
||||
|
313
external/bsd/dhcp/dist/common/tests/Makefile.in
vendored
313
external/bsd/dhcp/dist/common/tests/Makefile.in
vendored
@ -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:
|
||||
|
790
external/bsd/dhcp/dist/common/tests/test_alloc.c
vendored
790
external/bsd/dhcp/dist/common/tests/test_alloc.c
vendored
@ -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 <atf-c.h>
|
||||
#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());
|
||||
}
|
||||
|
132
external/bsd/dhcp/dist/common/tree.c
vendored
132
external/bsd/dhcp/dist/common/tree.c
vendored
@ -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 <sys/cdefs.h>
|
||||
__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 <omapip/omapip_p.h>
|
||||
@ -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,
|
||||
|
227
external/bsd/dhcp/dist/configure
vendored
227
external/bsd/dhcp/dist/configure
vendored
@ -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 <dhcp-users@isc.org>.
|
||||
#
|
||||
@ -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 <bug-autoconf@gnu.org>."
|
||||
_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
|
||||
|
115
external/bsd/dhcp/dist/configure.ac
vendored
115
external/bsd/dhcp/dist/configure.ac
vendored
@ -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 <stdio.h>
|
||||
])
|
||||
|
||||
# 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
|
||||
|
@ -3,7 +3,7 @@
|
||||
# Start Date: Mon, 26 Mar 2001 14:24:09 +0200
|
||||
# Time-stamp: <Monday, 26 March 2001 16:09:44 by brister>
|
||||
# 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;
|
||||
|
2
external/bsd/dhcp/dist/dhcpctl/Makefile.in
vendored
2
external/bsd/dhcp/dist/dhcpctl/Makefile.in
vendored
@ -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@
|
||||
|
4
external/bsd/dhcp/dist/dhcpctl/dhcpctl.3
vendored
4
external/bsd/dhcp/dist/dhcpctl/dhcpctl.3
vendored
@ -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")
|
||||
|
6
external/bsd/dhcp/dist/dhcpctl/dhcpctl.h
vendored
6
external/bsd/dhcp/dist/dhcpctl/dhcpctl.h
vendored
@ -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 <sys/cdefs.h>
|
||||
__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_
|
||||
|
13
external/bsd/dhcp/dist/dhcpctl/omshell.1
vendored
13
external/bsd/dhcp/dist/dhcpctl/omshell.1
vendored
@ -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:
|
||||
|
15
external/bsd/dhcp/dist/doc/Makefile
vendored
15
external/bsd/dhcp/dist/doc/Makefile
vendored
@ -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
|
12
external/bsd/dhcp/dist/doc/References.html
vendored
12
external/bsd/dhcp/dist/doc/References.html
vendored
@ -145,7 +145,7 @@
|
||||
<tr><td class="header">ISC-DHCP-REFERENCES</td><td class="header">D. Hankins</td></tr>
|
||||
<tr><td class="header"> </td><td class="header">T. Mrugalski</td></tr>
|
||||
<tr><td class="header"> </td><td class="header">ISC</td></tr>
|
||||
<tr><td class="header"> </td><td class="header">May 20, 2011</td></tr>
|
||||
<tr><td class="header"> </td><td class="header">January 04, 2012</td></tr>
|
||||
</table></td></tr></table>
|
||||
<h1><br />ISC DHCP References Collection</h1>
|
||||
|
||||
@ -740,6 +740,10 @@ DHCPv6 Protocol References</h3>
|
||||
<p>Precisely how to correctly support the above conundrums has not
|
||||
quite yet been settled, so support is incomplete.
|
||||
</p>
|
||||
<p><a class='info' href='#RFC5453'>[RFC5453]<span> (</span><span class='info'>Krishnan, S., “Reserved IPv6 Interface Identifiers,” February 2009.</span><span>)</span></a> 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.
|
||||
</p>
|
||||
<a name="anchor20"></a><br /><hr />
|
||||
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
|
||||
<a name="rfc.section.6.2"></a><h3>6.2.
|
||||
@ -974,14 +978,16 @@ References</h3>
|
||||
<td class="author-text">Zeng, S., Volz, B., Kinnear, K., and J. Brzozowski, “<a href="http://tools.ietf.org/html/rfc4994">DHCPv6 Relay Agent Echo Request Option</a>,” RFC 4994, September 2007 (<a href="http://www.rfc-editor.org/rfc/rfc4994.txt">TXT</a>).</td></tr>
|
||||
<tr><td class="author-text" valign="top"><a name="RFC5007">[RFC5007]</a></td>
|
||||
<td class="author-text">Brzozowski, J., Kinnear, K., Volz, B., and S. Zeng, “<a href="http://tools.ietf.org/html/rfc5007">DHCPv6 Leasequery</a>,” RFC 5007, September 2007 (<a href="http://www.rfc-editor.org/rfc/rfc5007.txt">TXT</a>).</td></tr>
|
||||
<tr><td class="author-text" valign="top"><a name="RFC5453">[RFC5453]</a></td>
|
||||
<td class="author-text">Krishnan, S., “<a href="http://tools.ietf.org/html/rfc5453">Reserved IPv6 Interface Identifiers</a>,” RFC 5453, February 2009 (<a href="http://www.rfc-editor.org/rfc/rfc5453.txt">TXT</a>).</td></tr>
|
||||
<tr><td class="author-text" valign="top"><a name="RFC5460">[RFC5460]</a></td>
|
||||
<td class="author-text">Stapp, M., “<a href="http://tools.ietf.org/html/rfc5460">DHCPv6 Bulk Leasequery</a>,” RFC 5460, February 2009 (<a href="http://www.rfc-editor.org/rfc/rfc5460.txt">TXT</a>).</td></tr>
|
||||
<tr><td class="author-text" valign="top"><a name="I-D.ietf-mif-dhcpv6-route-option">[I-D.ietf-mif-dhcpv6-route-option]</a></td>
|
||||
<td class="author-text">Dec, W., Mrugalski, T., Sun, T., and B. Sarikaya, “<a href="http://tools.ietf.org/html/draft-ietf-mif-dhcpv6-route-option-01">DHCPv6 Route Option</a>,” draft-ietf-mif-dhcpv6-route-option-01 (work in progress), March 2011 (<a href="http://www.ietf.org/internet-drafts/draft-ietf-mif-dhcpv6-route-option-01.txt">TXT</a>).</td></tr>
|
||||
<td class="author-text">Dec, W., Mrugalski, T., Sun, T., and B. Sarikaya, “<a href="http://tools.ietf.org/html/draft-ietf-mif-dhcpv6-route-option-03">DHCPv6 Route Options</a>,” draft-ietf-mif-dhcpv6-route-option-03 (work in progress), September 2011 (<a href="http://www.ietf.org/internet-drafts/draft-ietf-mif-dhcpv6-route-option-03.txt">TXT</a>).</td></tr>
|
||||
<tr><td class="author-text" valign="top"><a name="I-D.ietf-dhc-dhcpv6-ldra">[I-D.ietf-dhc-dhcpv6-ldra]</a></td>
|
||||
<td class="author-text">Miles, D., Ooghe, S., Dec, W., Krishnan, S., and A. Kavanagh, “<a href="http://tools.ietf.org/html/draft-ietf-dhc-dhcpv6-ldra-03">Lightweight DHCPv6 Relay Agent</a>,” draft-ietf-dhc-dhcpv6-ldra-03 (work in progress), October 2010 (<a href="http://www.ietf.org/internet-drafts/draft-ietf-dhc-dhcpv6-ldra-03.txt">TXT</a>).</td></tr>
|
||||
<tr><td class="author-text" valign="top"><a name="I-D.ietf-dhc-dhcpv6-relay-supplied-options">[I-D.ietf-dhc-dhcpv6-relay-supplied-options]</a></td>
|
||||
<td class="author-text">Lemon, T. and W. Wu, “<a href="http://tools.ietf.org/html/draft-ietf-dhc-dhcpv6-relay-supplied-options-06">Relay-Supplied DHCP Options</a>,” draft-ietf-dhc-dhcpv6-relay-supplied-options-06 (work in progress), May 2011 (<a href="http://www.ietf.org/internet-drafts/draft-ietf-dhc-dhcpv6-relay-supplied-options-06.txt">TXT</a>).</td></tr>
|
||||
<td class="author-text">Lemon, T. and W. Wu, “<a href="http://tools.ietf.org/html/draft-ietf-dhc-dhcpv6-relay-supplied-options-09">Relay-Supplied DHCP Options</a>,” draft-ietf-dhc-dhcpv6-relay-supplied-options-09 (work in progress), September 2011 (<a href="http://www.ietf.org/internet-drafts/draft-ietf-dhc-dhcpv6-relay-supplied-options-09.txt">TXT</a>).</td></tr>
|
||||
<tr><td class="author-text" valign="top"><a name="I-D.ietf-dhc-pd-exclude">[I-D.ietf-dhc-pd-exclude]</a></td>
|
||||
<td class="author-text">Korhonen, J., Savolainen, T., Krishnan, S., and O. Troan, “<a href="http://tools.ietf.org/html/draft-ietf-dhc-pd-exclude-01">Prefix Exclude Option for DHCPv6-based Prefix Delegation</a>,” draft-ietf-dhc-pd-exclude-01 (work in progress), January 2011 (<a href="http://www.ietf.org/internet-drafts/draft-ietf-dhc-pd-exclude-01.txt">TXT</a>).</td></tr>
|
||||
<tr><td class="author-text" valign="top"><a name="I-D.ietf-dhc-secure-dhcpv6">[I-D.ietf-dhc-secure-dhcpv6]</a></td>
|
||||
|
190
external/bsd/dhcp/dist/doc/References.txt
vendored
190
external/bsd/dhcp/dist/doc/References.txt
vendored
@ -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]
|
||||
|
||||
|
11
external/bsd/dhcp/dist/doc/References.xml
vendored
11
external/bsd/dhcp/dist/doc/References.xml
vendored
@ -1,6 +1,6 @@
|
||||
<?xml version='1.0' ?>
|
||||
|
||||
<!-- Id: References.xml,v 1.4.24.3 2011-07-05 16:57:20 sar Exp -->
|
||||
<!-- Id: References.xml,v 1.4.24.4 2012/01/05 00:02:51 sar Exp -->
|
||||
|
||||
<?rfc private="ISC-DHCP-REFERENCES" ?>
|
||||
|
||||
@ -92,6 +92,8 @@
|
||||
'http://xml.resource.org/public/rfc/bibxml/reference.RFC.4702.xml'>
|
||||
<!ENTITY rfc4703 PUBLIC ''
|
||||
'http://xml.resource.org/public/rfc/bibxml/reference.RFC.4703.xml'>
|
||||
<!ENTITY rfc5453 PUBLIC ''
|
||||
'http://xml.resource.org/public/rfc/bibxml/reference.RFC.5453.xml'>
|
||||
]>
|
||||
|
||||
|
||||
@ -133,7 +135,7 @@
|
||||
</address>
|
||||
</author>
|
||||
|
||||
<date day="20" month="May" year="2011"/>
|
||||
<date day="04" month="January" year="2012"/>
|
||||
|
||||
<keyword>ISC</keyword>
|
||||
<keyword>DHCP</keyword>
|
||||
@ -610,6 +612,10 @@
|
||||
|
||||
<t>Precisely how to correctly support the above conundrums has not
|
||||
quite yet been settled, so support is incomplete.</t>
|
||||
|
||||
<t><xref target="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.</t>
|
||||
</section>
|
||||
|
||||
<section title="DHCPv6 Options References">
|
||||
@ -760,6 +766,7 @@
|
||||
<?rfc include='http://xml.resource.org/public/rfc/bibxml/reference.RFC.4704'?>
|
||||
<?rfc include='http://xml.resource.org/public/rfc/bibxml/reference.RFC.4994'?>
|
||||
<?rfc include='http://xml.resource.org/public/rfc/bibxml/reference.RFC.5007'?>
|
||||
<?rfc include='http://xml.resource.org/public/rfc/bibxml/reference.RFC.5453'?>
|
||||
<?rfc include='http://xml.resource.org/public/rfc/bibxml/reference.RFC.5460'?>
|
||||
<?rfc include='http://xml.resource.org/public/rfc/bibxml3/reference.I-D.ietf-mif-dhcpv6-route-option'?>
|
||||
<?rfc include='http://xml.resource.org/public/rfc/bibxml3/reference.I-D.ietf-dhc-dhcpv6-ldra'?>
|
||||
|
1792
external/bsd/dhcp/dist/doc/devel/doxyfile.in
vendored
Normal file
1792
external/bsd/dhcp/dist/doc/devel/doxyfile.in
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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")
|
||||
|
2
external/bsd/dhcp/dist/dst/Makefile.in
vendored
2
external/bsd/dhcp/dist/dst/Makefile.in
vendored
@ -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@
|
||||
|
22
external/bsd/dhcp/dist/dst/dst_api.c
vendored
22
external/bsd/dhcp/dist/dst/dst_api.c
vendored
@ -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);
|
||||
|
21
external/bsd/dhcp/dist/dst/dst_support.c
vendored
21
external/bsd/dhcp/dist/dst/dst_support.c
vendored
@ -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
|
||||
|
35
external/bsd/dhcp/dist/dst/hmac_link.c
vendored
35
external/bsd/dhcp/dist/dst/hmac_link.c
vendored
@ -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';
|
||||
|
46
external/bsd/dhcp/dist/dst/prandom.c
vendored
46
external/bsd/dhcp/dist/dst/prandom.c
vendored
@ -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++;
|
||||
|
2
external/bsd/dhcp/dist/includes/Makefile.in
vendored
2
external/bsd/dhcp/dist/includes/Makefile.in
vendored
@ -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@
|
||||
|
@ -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_
|
||||
|
@ -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_
|
||||
|
20
external/bsd/dhcp/dist/includes/cdefs.h
vendored
20
external/bsd/dhcp/dist/includes/cdefs.h
vendored
@ -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__ */
|
||||
|
6
external/bsd/dhcp/dist/includes/config.h.in
vendored
6
external/bsd/dhcp/dist/includes/config.h.in
vendored
@ -91,6 +91,9 @@
|
||||
/* Define to 1 if you have the <unistd.h> 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
|
||||
|
||||
|
7
external/bsd/dhcp/dist/includes/dhcp.h
vendored
7
external/bsd/dhcp/dist/includes/dhcp.h
vendored
@ -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). */
|
||||
|
9
external/bsd/dhcp/dist/includes/dhctoken.h
vendored
9
external/bsd/dhcp/dist/includes/dhctoken.h
vendored
@ -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 <sys/cdefs.h>
|
||||
__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 && \
|
||||
|
4
external/bsd/dhcp/dist/includes/heap.h
vendored
4
external/bsd/dhcp/dist/includes/heap.h
vendored
@ -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
|
||||
|
@ -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 <sys/cdefs.h>
|
||||
__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 *, ...)
|
||||
|
50
external/bsd/dhcp/dist/includes/site.h
vendored
50
external/bsd/dhcp/dist/includes/site.h
vendored
@ -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 */
|
||||
|
4
external/bsd/dhcp/dist/includes/t_api.h
vendored
4
external/bsd/dhcp/dist/includes/t_api.h
vendored
@ -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
|
||||
|
2
external/bsd/dhcp/dist/omapip/Makefile.in
vendored
2
external/bsd/dhcp/dist/omapip/Makefile.in
vendored
@ -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@
|
||||
|
10
external/bsd/dhcp/dist/omapip/alloc.c
vendored
10
external/bsd/dhcp/dist/omapip/alloc.c
vendored
@ -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 <sys/cdefs.h>
|
||||
__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
|
||||
}
|
||||
|
11
external/bsd/dhcp/dist/omapip/buffer.c
vendored
11
external/bsd/dhcp/dist/omapip/buffer.c
vendored
@ -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 <sys/cdefs.h>
|
||||
__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;
|
||||
|
35
external/bsd/dhcp/dist/omapip/connection.c
vendored
35
external/bsd/dhcp/dist/omapip/connection.c
vendored
@ -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 <sys/cdefs.h>
|
||||
__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;
|
||||
|
8
external/bsd/dhcp/dist/omapip/handle.c
vendored
8
external/bsd/dhcp/dist/omapip/handle.c
vendored
@ -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 <sys/cdefs.h>
|
||||
__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));
|
||||
}
|
||||
|
6
external/bsd/dhcp/dist/omapip/iscprint.c
vendored
6
external/bsd/dhcp/dist/omapip/iscprint.c
vendored
@ -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)
|
||||
|
22
external/bsd/dhcp/dist/omapip/listener.c
vendored
22
external/bsd/dhcp/dist/omapip/listener.c
vendored
@ -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 <sys/cdefs.h>
|
||||
__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;
|
||||
}
|
||||
|
38
external/bsd/dhcp/dist/omapip/protocol.c
vendored
38
external/bsd/dhcp/dist/omapip/protocol.c
vendored
@ -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 <sys/cdefs.h>
|
||||
__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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
17
external/bsd/dhcp/dist/omapip/support.c
vendored
17
external/bsd/dhcp/dist/omapip/support.c
vendored
@ -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 <sys/cdefs.h>
|
||||
__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;
|
||||
|
19
external/bsd/dhcp/dist/omapip/trace.c
vendored
19
external/bsd/dhcp/dist/omapip/trace.c
vendored
@ -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 <sys/cdefs.h>
|
||||
__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 <omapip/omapip_p.h>
|
||||
@ -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 */
|
||||
|
2
external/bsd/dhcp/dist/relay/Makefile.in
vendored
2
external/bsd/dhcp/dist/relay/Makefile.in
vendored
@ -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@
|
||||
|
10
external/bsd/dhcp/dist/relay/dhcrelay.8
vendored
10
external/bsd/dhcp/dist/relay/dhcrelay.8
vendored
@ -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
|
||||
|
8
external/bsd/dhcp/dist/server/Makefile.am
vendored
8
external/bsd/dhcp/dist/server/Makefile.am
vendored
@ -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 \
|
||||
|
202
external/bsd/dhcp/dist/server/Makefile.in
vendored
202
external/bsd/dhcp/dist/server/Makefile.in
vendored
@ -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.
|
||||
|
63
external/bsd/dhcp/dist/server/bootp.c
vendored
63
external/bsd/dhcp/dist/server/bootp.c
vendored
@ -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 <sys/cdefs.h>
|
||||
__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 <errno.h>
|
||||
@ -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)
|
||||
|
9
external/bsd/dhcp/dist/server/class.c
vendored
9
external/bsd/dhcp/dist/server/class.c
vendored
@ -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 <sys/cdefs.h>
|
||||
__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);
|
||||
|
182
external/bsd/dhcp/dist/server/confpars.c
vendored
182
external/bsd/dhcp/dist/server/confpars.c
vendored
@ -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 <sys/cdefs.h>
|
||||
__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);
|
||||
}
|
||||
|
34
external/bsd/dhcp/dist/server/db.c
vendored
34
external/bsd/dhcp/dist/server/db.c
vendored
@ -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 <sys/cdefs.h>
|
||||
__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 <ctype.h>
|
||||
#include <errno.h>
|
||||
|
||||
#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
|
||||
|
290
external/bsd/dhcp/dist/server/dhcp.c
vendored
290
external/bsd/dhcp/dist/server/dhcp.c
vendored
@ -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 <sys/cdefs.h>
|
||||
__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 <errno.h>
|
||||
@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
94
external/bsd/dhcp/dist/server/dhcpd.8
vendored
94
external/bsd/dhcp/dist/server/dhcpd.8
vendored
@ -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.
|
||||
|
13
external/bsd/dhcp/dist/server/dhcpd.c
vendored
13
external/bsd/dhcp/dist/server/dhcpd.c
vendored
@ -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 <sys/cdefs.h>
|
||||
__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;
|
||||
|
465
external/bsd/dhcp/dist/server/dhcpd.conf.5
vendored
465
external/bsd/dhcp/dist/server/dhcpd.conf.5
vendored
File diff suppressed because it is too large
Load Diff
104
external/bsd/dhcp/dist/server/dhcpd.conf.example
vendored
Normal file
104
external/bsd/dhcp/dist/server/dhcpd.conf.example
vendored
Normal file
@ -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;
|
||||
}
|
||||
}
|
4
external/bsd/dhcp/dist/server/dhcpd.leases.5
vendored
4
external/bsd/dhcp/dist/server/dhcpd.leases.5
vendored
@ -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
|
||||
|
84
external/bsd/dhcp/dist/server/failover.c
vendored
84
external/bsd/dhcp/dist/server/failover.c
vendored
@ -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 <sys/cdefs.h>
|
||||
__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 <omapip/omapip_p.h>
|
||||
|
||||
@ -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)
|
||||
|
4
external/bsd/dhcp/dist/server/ldap.c
vendored
4
external/bsd/dhcp/dist/server/ldap.c
vendored
@ -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);
|
||||
|
88
external/bsd/dhcp/dist/server/mdb.c
vendored
88
external/bsd/dhcp/dist/server/mdb.c
vendored
@ -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 <sys/cdefs.h>
|
||||
__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)) {
|
||||
|
68
external/bsd/dhcp/dist/server/omapi.c
vendored
68
external/bsd/dhcp/dist/server/omapi.c
vendored
@ -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 <sys/cdefs.h>
|
||||
__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. */
|
||||
|
||||
|
51
external/bsd/dhcp/dist/server/salloc.c
vendored
51
external/bsd/dhcp/dist/server/salloc.c
vendored
@ -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 <sys/cdefs.h>
|
||||
__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 <omapip/omapip_p.h>
|
||||
@ -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
|
||||
|
5
external/bsd/dhcp/dist/server/tests/Atffile
vendored
Normal file
5
external/bsd/dhcp/dist/server/tests/Atffile
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
Content-Type: application/X-atf-atffile; version="1"
|
||||
|
||||
prop: test-suite = dhcp4
|
||||
|
||||
tp-glob: *_unittests
|
54
external/bsd/dhcp/dist/server/tests/Makefile.am
vendored
Normal file
54
external/bsd/dhcp/dist/server/tests/Makefile.am
vendored
Normal file
@ -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)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user