Commit 4e7a8f75 authored by Stephen Morris's avatar Stephen Morris

[2342] Merge branch 'master' into trac2342

Conflicts:
	doc/devel/mainpage.dox
	src/lib/dhcp/Makefile.am
	src/lib/dhcp/lease_mgr.cc
	src/lib/dhcp/lease_mgr.h
	src/lib/dhcp/tests/Makefile.am
	src/lib/dhcp/tests/lease_mgr_unittest.cc

A number of other files were modified to resolve incompatibilities
in the way lease managers were created, and to promote the dummy
"memfile" lease manager to a fully-fledged lease manager with
unit tests.
parents fb185ed8 51adf02f
501. [func] tomek
Added DHCPv6 allocation engine, now used in the processing of DHCPv6
messages.
(Trac #2414, git b3526430f02aa3dc3273612524d23137b8f1fe87)
500. [bug] jinmei
Corrected the autoconf example in the examples directory so it can
use the configured path to Boost to check availability of the BIND 10
library. Previously the sample configure script could fail if
Boost is installed in an uncommon place. Also, it now provides a
helper m4 function and example usage for embedding the library
path to executable (using linker options like -Wl,-R) to help
minimize post-build hassles.
(Trac #2356, git 36514ddc884c02a063e166d44319467ce6fb1d8f)
499. [func] team
The b10-auth 'loadzone' command now uses the internal thread
introduced in 495 to (re)load a zone in the background, so that
query processing isn't blocked while loading a zone.
(Trac #2213, git 686594e391c645279cc4a95e0e0020d1c01fba7e)
498. [func] marcin
Implemented DHCPv6 option values configuration using configuration
manager. In order to set values for data fields carried by the
particular option, user specifies the string of hexadecimal digits
that is in turn converted to binary data and stored into option buffer.
More user friendly way of option content specification is planned.
(Trac #2318, git e75c686cd9c14f4d6c2a242a0a0853314704fee9)
497. [bug] jinmei
Fixed several issues in isc-sysinfo:
- make sure it doesn't report a negative value for free memory
size (this happened on FreeBSD, but can possibly occur on other
BSD variants)
- correctly identifies the SMP support in kernel on FreeBSD
- print more human readable uptime as well as the time in seconds
(Trac #2297, git 59a449f506948e2371ffa87dcd19059388bd1657)
496. [func] tomek
DHCPv6 Allocation Engine implemented. It allows address allocation
from the configured subnets/pools. It currently features a single
allocator: IterativeAllocator, which assigns addresses iteratively.
Other allocators (hashed, random) are planned.
(Trac #2324, git 8aa188a10298e3a55b725db36502a99d2a8d638a)
495. [func] team
b10-auth now handles reconfiguration of data sources in
background using a separate thread. This means even if the new
configuration includes a large amount of data to be loaded into
memory (very large zones and/or a very large number of zones),
the reconfiguration doesn't block query handling.
(Multiple Trac tickets up to #2211)
494. [bug] jinmei
Fixed a problem that shutting down BIND 10 kept some of the
processes alive. It was two-fold: when the main bind10 process
started as a root, started b10-sockcreator with the privilege, and
then dropped the privilege, the bind10 process cannot kill the
sockcreator via signal any more (when it has to), but it kept
sending the signal and didn't stop. Also, when running on Python
3.1 (or older), the sockcreator had some additional file
descriptor open, which prevented it from exiting even after the
bind10 process terminated. Now the bind10 process simply gives up
killing a subprocess if it fails due to lack of permission, and it
makes sure the socket creator is spawned without any unnecessary
FDs open.
(Trac #1858, git 405d85c8a0042ba807a3a123611ff383c4081ee1)
493. [build] jinmei
Fixed build failure with newer versions of clang++. These
versions are stricter regarding "unused variable" and "unused
(driver) arguments" warnings, and cause fatal build error
with -Werror. The affected versions of clang++ include Apple's
customized version 4.1 included in Xcode 4.5.1. So this fix
will solve build errors for Mac OS X that uses newer versions of
Xcode.
(Trac #2340, git 55be177fc4f7537143ab6ef5a728bd44bdf9d783,
3e2a372012e633d017a97029d13894e743199741 and commits before it
with [2340] in the commit log)
492. [func] tomek
libdhcpsrv: The DHCP Configuration Manager is now able to store
information about IPv4 subnets and pools. It is still not possible
......@@ -27,7 +107,7 @@
488. [build] jinmei
On configure, changed the search order for Python executable.
It first ties more specific file names such as "python3.2" before
It first tries more specific file names such as "python3.2" before
more generic "python3". This will prevent configure failure on
Mac OS X that installs Python3 via recent versions of Homebrew.
(Trac #2339, git 88db890d8d1c64de49be87f03c24a2021bcf63da)
......
ACLOCAL_AMFLAGS = -I m4macros ${ACLOCAL_FLAGS}
ACLOCAL_AMFLAGS = -I m4macros -I examples/m4 ${ACLOCAL_FLAGS}
# ^^^^^^^^ This has to be the first line and cannot come later in this
# Makefile.am due to some bork in some versions of autotools.
......
......@@ -12,6 +12,20 @@ AC_CONFIG_MACRO_DIR([m4macros])
# Checks for programs.
AC_PROG_CXX
# Enable low-performing debugging facilities? This option optionally
# enables some debugging aids that perform slowly and hence aren't built
# by default.
AC_ARG_ENABLE([debug],
AS_HELP_STRING([--enable-debug],
[enable debugging (default is no)]),
[case "${enableval}" in
yes) debug_enabled=yes ;;
no) debug_enabled=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
esac],[debug_enabled=no])
AM_CONDITIONAL([DEBUG_ENABLED], [test x$debug_enabled = xyes])
AM_COND_IF([DEBUG_ENABLED], [AC_DEFINE([ENABLE_DEBUG], [1], [Enable low-performing debugging facilities?])])
# Libtool configuration
#
......@@ -50,25 +64,9 @@ AM_CONDITIONAL(USE_CLANGPP, test "X${CLANGPP}" = "Xyes")
# Linker options
# check -R and -Wl,-R rather than gcc specific -rpath to be as portable
# as possible.
AC_MSG_CHECKING([whether -R flag is available in linker])
LDFLAGS_SAVED="$LDFLAGS"
LDFLAGS="$LDFLAGS -R/usr/lib"
AC_TRY_LINK([],[],
[ AC_MSG_RESULT(yes)
rpath_flag=-R
],[ AC_MSG_RESULT(no)
AC_MSG_CHECKING([whether -Wl,-R flag is available in linker])
LDFLAGS="$LDFLAGS_SAVED -Wl,-R"
AC_TRY_LINK([], [],
[ AC_MSG_RESULT(yes)
rpath_flag=-Wl,-R
],[ AC_MSG_RESULT(no)
rpath_flag=no
])
])
LDFLAGS=$LDFLAGS_SAVED
# check -R, "-Wl,-R" or -rpath (we share the AX function defined in
# examples/m4)
AX_ISC_RPATH
# Compiler dependent settings: define some mandatory CXXFLAGS here.
# We also use a separate variable B10_CXXFLAGS. This will (and should) be
......@@ -203,6 +201,10 @@ case "$host" in
CPPFLAGS="$CPPFLAGS -D_XPG4_2 -D__EXTENSIONS__"
# "now" binding is necessary to prevent deadlocks in C++ static initialization code
LDFLAGS="$LDFLAGS -z now"
# Destroying locked mutexes, condition variables being waited
# on, etc. are undefined behavior on Solaris, so we set it as
# such here.
AC_DEFINE([HAS_UNDEFINED_PTHREAD_BEHAVIOR], [1], [Does this platform have some undefined pthreads behavior?])
;;
*-apple-darwin*)
# Starting with OSX 10.7 (Lion) we must choose which IPv6 API to use
......@@ -314,10 +316,10 @@ fi
# modules, we embed the path to the modules when possible. We do this even
# when the path is known in the common operational environment (e.g. when
# it's stored in a common "hint" file) for simplicity.
if test $rpath_flag != no; then
if test "x$ISC_RPATH_FLAG" != "x"; then
python_rpath=
for flag in ${PYTHON_LDFLAGS}; do
python_rpath="${python_rpath} `echo $flag | sed -ne "s/^\(\-L\)/${rpath_flag}/p"`"
python_rpath="${python_rpath} `echo $flag | sed -ne "s/^\(\-L\)/${ISC_RPATH_FLAG}/p"`"
done
PYTHON_LDFLAGS="${PYTHON_LDFLAGS} ${python_rpath}"
fi
......@@ -683,10 +685,10 @@ for flag in ${BOTAN_LIBS}; do
done
# See python_rpath for some info on why we do this
if test $rpath_flag != no; then
if test "x$ISC_RPATH_FLAG" != "x"; then
BOTAN_RPATH=
for flag in ${BOTAN_LIBS}; do
BOTAN_RPATH="${BOTAN_RPATH} `echo $flag | sed -ne "s/^\(\-L\)/${rpath_flag}/p"`"
BOTAN_RPATH="${BOTAN_RPATH} `echo $flag | sed -ne "s/^\(\-L\)/${ISC_RPATH_FLAG}/p"`"
done
AC_SUBST(BOTAN_RPATH)
......@@ -1121,6 +1123,13 @@ AM_COND_IF([ENABLE_LOGGER_CHECKS], [AC_DEFINE([ENABLE_LOGGER_CHECKS], [1], [Chec
AC_PATH_PROG(VALGRIND, valgrind, no)
AM_CONDITIONAL(HAVE_VALGRIND, test "x$VALGRIND" != "xno")
# Also check for valgrind headers
# We could consider adding them to the source code tree, as this
# is the encouraged method of using them; they are BSD-licensed.
# However, until we find that this is a problem, we just use
# the system-provided ones, if available
AC_CHECK_HEADERS(valgrind/valgrind.h, [AC_DEFINE([HAVE_VALGRIND_HEADERS], [1], [Check valgrind headers])])
found_valgrind="not found"
if test "x$VALGRIND" != "xno"; then
found_valgrind="found"
......@@ -1159,6 +1168,7 @@ AC_CONFIG_FILES([Makefile
src/bin/bindctl/Makefile
src/bin/bindctl/tests/Makefile
src/bin/cfgmgr/Makefile
src/bin/cfgmgr/local_plugins/Makefile
src/bin/cfgmgr/plugins/Makefile
src/bin/cfgmgr/plugins/tests/Makefile
src/bin/cfgmgr/tests/Makefile
......@@ -1327,6 +1337,7 @@ AC_OUTPUT([doc/version.ent
src/bin/zonemgr/tests/zonemgr_test
src/bin/zonemgr/run_b10-zonemgr.sh
src/bin/sysinfo/sysinfo.py
src/bin/sysinfo/run_sysinfo.sh
src/bin/stats/stats.py
src/bin/stats/stats_httpd.py
src/bin/bind10/bind10_src.py
......@@ -1405,6 +1416,7 @@ AC_OUTPUT([doc/version.ent
chmod +x src/bin/loadzone/run_loadzone.sh
chmod +x src/bin/loadzone/tests/correct/correct_test.sh
chmod +x src/bin/loadzone/tests/error/error_test.sh
chmod +x src/bin/sysinfo/run_sysinfo.sh
chmod +x src/bin/usermgr/run_b10-cmdctl-usermgr.sh
chmod +x src/bin/msgq/run_msgq.sh
chmod +x src/bin/msgq/tests/msgq_test
......@@ -1480,6 +1492,7 @@ Features:
$enable_features
Developer:
Enable Debugging: $debug_enabled
Google Tests: $enable_gtest
Valgrind: $found_valgrind
C++ Code Coverage: $USE_LCOV
......
......@@ -580,7 +580,7 @@ INPUT = ../src/lib/exceptions ../src/lib/cc \
../src/lib/testutils ../src/lib/cache ../src/lib/server_common/ \
../src/bin/sockcreator/ ../src/lib/util/ ../src/lib/util/io/ \
../src/lib/util/threads/ ../src/lib/resolve ../src/lib/acl \
../src/bin/dhcp6 ../src/lib/dhcp ../src/bin/dhcp4 \
../src/lib/statistics ../src/bin/dhcp6 ../src/lib/dhcp ../src/bin/dhcp4 \
../tests/tools/perfdhcp devel
# This tag can be used to specify the character encoding of the source files
......
......@@ -57,76 +57,4 @@
* that does not support msgq. That is useful for embedded environments.
* It may also be useful in validation.
*
* @page libdhcp libdhcp++
*
* @section libdhcpIntro Libdhcp++ Library Introduction
*
* libdhcp++ is an all-purpose DHCP-manipulation library, written in
* C++. It offers packet parsing and assembly, DHCPv4 and DHCPv6
* options parsing and ssembly, interface detection (currently on
* Linux systems only) and socket operations. Following classes are
* implemented:
*
* - isc::dhcp::Pkt4 - represents DHCPv4 packet.
* - isc::dhcp::Pkt6 - represents DHCPv6 packet.
*
* There are two pointer types defined: Pkt4Ptr and Pkt6Ptr. They are
* smart pointer and are using boost::shared_ptr. There are not const
* versions defined, as we assume that hooks can modify any aspect of
* the packet at almost any stage of processing.
*
* Both packets use collection of Option objects to represent DHCPv4
* and DHCPv6 options. The base class -- Option -- can be used to
* represent generic option that contains collection of
* bytes. Depending on if the option is instantiated as v4 or v6
* option, it will adjust its header (DHCPv4 options use 1 octet for
* type and 1 octet for length, while DHCPv6 options use 2 bytes for
* each).
*
* There are many specialized classes that are intended to handle options with
* specific content:
* - isc::dhcp::Option4AddrLst -- DHCPv4 option, contains one or more IPv4 addresses;
* - isc::dhcp::Option6AddrLst -- DHCPv6 option, contains one or more IPv6 addresses;
* - isc::dhcp::Option6IAAddr -- DHCPv6 option, represents IAADDR_OPTION (an option that
* contains IPv6 address with extra parameters);
* - isc::dhcp::Option6IA -- DHCPv6 option used to store IA_NA and its suboptions.
*
* All options can store sub-options (i.e. options that are stored within option
* rather than in a message directly). This functionality is commonly used in
* DHCPv6, but is rarely used in DHCPv4. isc::dhcp::Option::addOption(),
* isc::dhcp::Option::delOption(), isc::dhcp::Option::getOption() can be used
* for that purpose.
*
* @section libdhcpIfaceMgr Interface Manager
*
* Interface Manager (or IfaceMgr) is an abstraction layer about low-level
* network operations. In particlar, it provides information about existing
* network interfaces See isc::dhcp::IfaceMgr::Iface class and
* isc::dhcp::IfaceMgr::detectIfaces() and isc::dhcp::IfaceMgr::getIface().
*
* Currently there is interface detection is implemented in Linux only. There
* are plans to implement such support for other OSes, but they remain low
* priority for now.
*
* Generic parts of the code are isc::dhcp::IfaceMgr class in
* src/lib/dhcp/iface_mgr.cc file. OS-specific code is located in separate
* files, e.g. iface_mgr_linux.cc. Such separation should be maintained when
* additional code will be developed.
*
* For systems that interface detection is not supported on, there is a stub
* mechanism implemented. It assumes that interface name is read from a text
* file. This is a temporary solution and will be removed as soon as proper
* interface detection is implemented. It is not going to be developed further.
* To use this feature, store interfaces.txt file. It uses a simple syntax.
* Each line represents an interface name, followed by IPv4 or IPv6 address
* that follows it. This is usually link-local IPv6 address that the server
* should bind to. In theory this mechanism also supports IPv4, but it was
* never tested. The code currently supports only a single interface defined
* that way.
*
* Another useful methods are dedicated to transmission
* (isc::dhcp::IfaceMgr::send(), 2 overloads) and reception
* (isc::dhcp::IfaceMgr::receive4() and isc::dhcp::IfaceMgr::receive6()).
* Note that receive4() and receive6() methods may return NULL, e.g.
* when timeout is reached or if dhcp daemon receives a signal.
*/
\ No newline at end of file
......@@ -29,6 +29,10 @@
* - @subpage libdhcp
* - @subpage libdhcpIntro
* - @subpage libdhcpIfaceMgr
* - @subpage libdhcpsrv
* - @subpage leasemgr
* - @subpage cfgmgr
* - @subpage allocengine
* - @subpage dhcp-database-backends
* - @subpage perfdhcpInternals
*
......
......@@ -30,3 +30,18 @@ to the configure.ac file:
sinclude(m4/ax_boost_include.m4)
sinclude(m4/ax_isc_bind10.m4)
(and same for other m4 files as they are added under m4/)
On some systems, espeically if you have installed the BIND 10
libraries in an uncommon path, programs linked with the BIND 10
library may not work at run time due to the "missing" shared library.
Normally, you should be able to avoid this problem by making sure
to invoking the program explicitly specifying the path to the library,
e.g., "LD_LIBRARY_PATH=/usr/local/lib/bind10 ./my_bind10_app", or
you may not even notice the issue if you have installed BIND 10
library in a common library path on your system (sometimes you may
still need to run ldconfig(8) beforehand). Another option is to embed
the path to the library in your program. While this approach is
controversial, and some people rather choose the alternatives, we
provide a helper tool in case you want to use this option: see the
lines using BIND10_RPATH in the sample configure.ac file of this
directory.
......@@ -14,7 +14,21 @@ AC_LANG([C++])
# Checks for BIND 10 headers and libraries
AX_ISC_BIND10
# For the example host program, we require the BIND 10 DNS library
# We use -R, -rpath etc so the resulting program will be more likekly to
# "just work" by default. Embedding a specific library path is a controversial
# practice, though; if you don't like it you can remove the following setting.
if test "x$BIND10_RPATH" != "x"; then
LDFLAGS="$LDFLAGS $BIND10_RPATH"
fi
# For the example host program, we require some socket API library
# and the BIND 10 DNS library.
# In practice, these are specific to Solaris, but wouldn't do any harm for
# others except for the checking overhead.
AC_SEARCH_LIBS(inet_pton, [nsl])
AC_SEARCH_LIBS(recvfrom, [socket])
if test "x$BIND10_DNS_LIB" = "x"; then
AC_MSG_ERROR([unable to find BIND 10 DNS library needed to build 'host'])
fi
......
......@@ -34,7 +34,7 @@ if test -z "$with_boost_include"; then
fi
done
fi
CPPFLAGS_SAVES="$CPPFLAGS"
CPPFLAGS_SAVED="$CPPFLAGS"
if test "${boost_include_path}" ; then
BOOST_CPPFLAGS="-I${boost_include_path}"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
......@@ -57,7 +57,7 @@ AC_TRY_COMPILE([
CPPFLAGS_BOOST_THREADCONF="-DBOOST_DISABLE_THREADS=1"],
[AC_MSG_RESULT(yes)])
CPPFLAGS="$CPPFLAGS_SAVES $CPPFLAGS_BOOST_THREADCONF"
CPPFLAGS="$CPPFLAGS_SAVED $CPPFLAGS_BOOST_THREADCONF"
AC_SUBST(BOOST_CPPFLAGS)
AC_LANG_RESTORE
......
dnl @synopsis AX_BIND10
dnl @synopsis AX_ISC_BIND10
dnl
dnl @summary figure out how to build C++ programs using ISC BIND 10 libraries
dnl
......@@ -20,9 +20,18 @@ dnl Checks for other BIND 10 module libraries are option, as not all
dnl applications need all libraries. The main configure.ac can handle any
dnl missing library as fatal by checking whether the corresponding
dnl BIND10_xxx_LIB is defined.
dnl
dnl In addition, it sets the BIND10_RPATH variable to a usable linker option
dnl to embed the path to the BIND 10 library to the programs that are to be
dnl linked with the library. If the developer wants to use the option,
dnl it can be used as follows:
dnl if test "x$BIND10_RPATH" != "x"; then
dnl LDFLAGS="$LDFLAGS $BIND10_RPATH"
dnl fi
AC_DEFUN([AX_ISC_BIND10], [
AC_REQUIRE([AX_BOOST_INCLUDE])
AC_REQUIRE([AX_ISC_RPATH])
AC_LANG_SAVE
AC_LANG([C++])
......@@ -42,19 +51,20 @@ if test "$bind10_inc_path" = "no"; then
fi
done
fi
CPPFLAGS_SAVES="$CPPFLAGS"
CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" # boost headers will be used in buffer.h
if test "${bind10_inc_path}" != "no"; then
BIND10_CPPFLAGS="-I${bind10_inc_path}"
CPPFLAGS="$CPPFLAGS $BIND10_CPPFLAGS"
fi
AC_CHECK_HEADERS([util/buffer.h],,
AC_MSG_ERROR([Missing a commonly used BIND 10 header files]))
CPPFLAGS="$CPPFLAGS_SAVES"
AC_MSG_ERROR([Missing a commonly used BIND 10 header file]))
CPPFLAGS="$CPPFLAGS_SAVED"
AC_SUBST(BIND10_CPPFLAGS)
# Check for BIND10 libraries
CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BIND10_CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS $BIND10_CPPFLAGS"
AC_ARG_WITH(bind10-lib,
AS_HELP_STRING([--with-bind10-lib=PATH],
......@@ -70,21 +80,25 @@ fi
# make sure we have buildable libraries
AC_MSG_CHECKING([for BIND 10 common library])
BIND10_COMMON_LIB="-lb10-util -lb10-exceptions"
LDFLAGS="$LDFLAGS $BIND10_LDFLAGS"
LDFLAGS_SAVED="$LDFLAGS"
LDFLAGS_CHECK_COMMON="$LDFLAGS $BIND10_LDFLAGS"
LIBS_SAVED="$LIBS"
LIBS="$LIBS $BIND10_COMMON_LIB"
for d in $bind10_lib_dirs
do
LDFLAGS_SAVED="$LDFLAGS"
LDFLAGS="$LDFLAGS -L$d"
LDFLAGS="$LDFLAGS_CHECK_COMMON -L$d"
AC_TRY_LINK([
#include <util/buffer.h>
],[
isc::util::OutputBuffer buffer(0);
], [BIND10_LDFLAGS="-L${d}"])
], [BIND10_LDFLAGS="-L${d}"
if test "x$ISC_RPATH_FLAG" != "x"; then
BIND10_RPATH="${ISC_RPATH_FLAG}${d}"
fi
])
if test "x$BIND10_LDFLAGS" != "x"; then
break
fi
LDFLAGS="$LDFLAGS_SAVED"
done
if test "x$BIND10_LDFLAGS" != "x"; then
AC_MSG_RESULT(yes)
......@@ -94,7 +108,7 @@ else
fi
# restore LIBS once at this point
LIBS="$LIBS_SAVES"
LIBS="$LIBS_SAVED"
AC_SUBST(BIND10_LDFLAGS)
AC_SUBST(BIND10_COMMON_LIB)
......@@ -111,12 +125,12 @@ isc::dns::RRType rrtype(1);
], [BIND10_DNS_LIB="-lb10-dns++"
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)])
LIBS="$LIBS_SAVES"
LIBS="$LIBS_SAVED"
AC_SUBST(BIND10_DNS_LIB)
# Restore other flags
CPPFLAGS="$CPPFLAGS_SAVED"
LDFLAGS="$LDFLAGS_SAVES"
LDFLAGS="$LDFLAGS_SAVED"
AC_LANG_RESTORE
])dnl AX_ISC_BIND10