From db031fd1374a8230e2ff51743e32eaaabccdc98f Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Tue, 20 Sep 2016 09:50:39 +1000 Subject: [PATCH 1/7] handle bind/bind9 being a git repo --- util/bind.sh | 54 +++++++++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/util/bind.sh b/util/bind.sh index f1ceaa50..a66f8a64 100644 --- a/util/bind.sh +++ b/util/bind.sh @@ -97,34 +97,40 @@ case $# in ;; esac -# Delete all previous bind stuff -rm -rf bind +if test -d bind/bind9/.git +then + cp util/Makefile.git bind/Makefile.in + cd bind/bind9 + git checkout $BINDTAG && git pull +else + # Delete all previous bind stuff + rm -rf bind -# Make and move to our directory for all things bind -mkdir $binddir -cp util/Makefile.bind.in bind/Makefile.in -cd $binddir + # Make and move to our directory for all things bind + mkdir $binddir + cp util/Makefile.bind.in bind/Makefile.in + cd $binddir -# Get the bind version file and move it to version.tmp -git archive --format tar $remote $BINDTAG version | tar xf - -mv version version.tmp + # Get the bind version file and move it to version.tmp + git archive --format tar $remote $BINDTAG version | tar xf - + mv version version.tmp -# Get the bind release kit shell script -git archive --format tar $remote master:util/ | tar xf - kit.sh + # Get the bind release kit shell script + git archive --format tar $remote master:util/ | tar xf - kit.sh -# Create the bind tarball, which has the side effect of -# setting up the bind directory we will use for building -# the export libraries -echo Creating tarball for $BINDTAG -sh kit.sh $remote $SNAP $BINDTAG $binddir + # Create the bind tarball, which has the side effect of + # setting up the bind directory we will use for building + # the export libraries + echo Creating tarball for $BINDTAG + sh kit.sh $remote $SNAP $BINDTAG $binddir -. ./version.tmp + . ./version.tmp -version=${MAJORVER}.${MINORVER}.${PATCHVER}${RELEASETYPE}${RELEASEVER} -bindsrcdir=bind-$version -mm=${MAJORVER}.${MINORVER} - -# move the tar file to a known place for use by the make dist command -echo Moving tar file to bind.tar.gz for distribution -mv bind-${mm}*.tar.gz bind.tar.gz + version=${MAJORVER}.${MINORVER}.${PATCHVER}${RELEASETYPE}${RELEASEVER} + bindsrcdir=bind-$version + mm=${MAJORVER}.${MINORVER} + # move the tar file to a known place for use by the make dist command + echo Moving tar file to bind.tar.gz for distribution + mv bind-${mm}*.tar.gz bind.tar.gz +fi From 38f8f6039785c5819dfa44bab7dc841764e17603 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Wed, 21 Sep 2016 09:31:40 +1000 Subject: [PATCH 2/7] add util/Makefile.git; fix server name; handle tags as well as branches; clean out bind/lib and bind/include --- util/Makefile.git | 85 +++++++++++++++++++++++++++++++++++++++++++++++ util/bind.sh | 7 ++-- 2 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 util/Makefile.git diff --git a/util/Makefile.git b/util/Makefile.git new file mode 100644 index 00000000..d681b387 --- /dev/null +++ b/util/Makefile.git @@ -0,0 +1,85 @@ +# +# Copyright (C) 2009-2012 Internet Systems Consortium, Inc. ("ISC") +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH +# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, +# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. + +# $Id: Makefile.bind,v 1.8 2012/04/05 22:16:47 sar Exp $ + +# bindvar.tmp is constructed by configure, it has the paths for +# if GMAKE is blank the shell script couldn't find a gmake to use. +# binddir= +# GMAKE= +include ./bindvar.tmp + +bindsrcdir=bind9 + +all: +# Extract the source from the tarball, if it hasn't been already. + @if test -d ${bindsrcdir} ; then \ + echo ${bindsrcdir} already unpacked... ; \ + else \ + gunzip -c bind.tar.gz | tar xf - ; \ + fi + + @if test -z "${GMAKE}"; then \ + echo "unable to find gmake" 1>&2 ; \ + exit 1; \ + fi + +# Configure the export libraries +# Currently disable the epoll and devpoll options as they don't interact +# well with the DHCP code. +# If the top-level Bind Makefile exists we skip the configuration step +# as we assume it's done and won't change. Doing a make clean will +# reset things if necessary. + @if test -f ${bindsrcdir}/Makefile ; then \ + echo Bind export libraries already configured ; \ + else \ + echo Configuring BIND Export libraries for DHCP. ; \ + rm -rf ./lib ./include ./configure.log ./build.log ./install.log ; \ + (cd ${bindsrcdir} && ./configure --disable-kqueue --disable-epoll --disable-devpoll --without-openssl --without-libxml2 --enable-exportlib --enable-threads=no --with-export-includedir=${binddir}/include --with-export-libdir=${binddir}/lib --with-gssapi=no > ${binddir}/configure.log); \ + fi + +# Build and install the export libraries +# No need to do anything if we already have something installed. + @if test -d ${binddir}/lib ; then \ + echo Bind export libraries already installed ; \ + else \ + echo Building BIND Export libraries - this takes some time. ;\ + (cd ${bindsrcdir}/lib/export ; \ + echo building in `pwd` ; \ + MAKE=${GMAKE} ${GMAKE} > ${binddir}/build.log) ; \ + \ + echo Installing BIND Export libraries to ${binddir}. ; \ + (cd ${bindsrcdir}/lib/export ; \ + MAKE=${GMAKE} ${GMAKE} install > ${binddir}/install.log) ; \ + fi + +clean: + @echo Cleaning BIND export library. + (cd ${bindsrcdir}; make -k clean ) + rm -rf ./lib ./include ./configure.log ./build.log \ + ./install.log + +# Include the following so that this Makefile is happy when the parent +# tries to use them. + +distdir: + +distclean: + +install: + +check: + +uninstall: diff --git a/util/bind.sh b/util/bind.sh index a66f8a64..494e2399 100644 --- a/util/bind.sh +++ b/util/bind.sh @@ -27,7 +27,7 @@ topdir=`pwd` binddir=$topdir/bind -remote=--remote=cvs.isc.org:/proj/git/prod/bind9.git +remote=--remote=repo.isc.org:/proj/git/prod/bind9.git case "${1:-}" in --remote=*) @@ -100,8 +100,11 @@ esac if test -d bind/bind9/.git then cp util/Makefile.git bind/Makefile.in + rm -rf bind/include bind/lib cd bind/bind9 - git checkout $BINDTAG && git pull + test -f Makefile && make distclean + git fetch + git checkout $BINDTAG && test -n "${noSNAP}" && git merge --ff-only else # Delete all previous bind stuff rm -rf bind From c87db1b1f687038e75e737070c238d881086f541 Mon Sep 17 00:00:00 2001 From: Francis Dupont Date: Fri, 23 Sep 2016 23:14:56 +0200 Subject: [PATCH 3/7] Rebased to post #43227 --- Makefile.am | 2 +- Makefile.in | 2 +- RELNOTES | 24 +++++- common/parse.c | 2 +- common/print.c | 24 ++++-- common/tests/misc_unittest.c | 64 +++++++++++++++ configure | 151 ++++++++++++++++++++++++++++------- configure.ac | 112 +++++++++++++++++++------- util/Makefile.bind.in | 42 ++++------ util/Makefile.git | 85 -------------------- util/bind.sh | 2 +- util/bindvar.sh | 46 ----------- 12 files changed, 331 insertions(+), 225 deletions(-) delete mode 100644 util/Makefile.git delete mode 100644 util/bindvar.sh diff --git a/Makefile.am b/Makefile.am index 1f31e6a2..2371e1de 100644 --- a/Makefile.am +++ b/Makefile.am @@ -22,7 +22,7 @@ EXTRA_DIST = RELNOTES LICENSE \ doc/examples/dhclient-dhcpv6.conf doc/examples/dhcpd-dhcpv6.conf \ doc/devel/arch.dox doc/devel/atf.dox doc/devel/contrib.dox \ doc/devel/debug.dox doc/devel/isc-logo.jpg doc/devel/mainpage.dox \ - doc/devel/omapi.dox doc/devel/qa.dox util/bindvar.sh \ + doc/devel/omapi.dox doc/devel/qa.dox \ bind/Makefile.in bind/bind.tar.gz bind/version.tmp \ common/tests/Atffile server/tests/Atffile diff --git a/Makefile.in b/Makefile.in index b914a836..2dac656d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -362,7 +362,7 @@ EXTRA_DIST = RELNOTES LICENSE \ doc/examples/dhclient-dhcpv6.conf doc/examples/dhcpd-dhcpv6.conf \ doc/devel/arch.dox doc/devel/atf.dox doc/devel/contrib.dox \ doc/devel/debug.dox doc/devel/isc-logo.jpg doc/devel/mainpage.dox \ - doc/devel/omapi.dox doc/devel/qa.dox util/bindvar.sh \ + doc/devel/omapi.dox doc/devel/qa.dox \ bind/Makefile.in bind/bind.tar.gz bind/version.tmp \ common/tests/Atffile server/tests/Atffile diff --git a/RELNOTES b/RELNOTES index 3b1ed215..f02df24b 100644 --- a/RELNOTES +++ b/RELNOTES @@ -63,9 +63,31 @@ by Eric Young (eay@cryptsoft.com). - Removed an extraneous expression in omapi socket callback function. Prior to this change, the logic was techinically incorrect but other factors ensured the outcome itself was correct. This change was made primarily - for code clarity. + for code clarity. Thanks to Ganesh Pinjala for bringing the issue to our + attention. [ISC-Bugs #42834] +- Corrected a bug which could cause the server to sporadically crash while + loading lease files with the lease-id-format is set to "hex". Our thanks + to Jay Ford, University of Iowa for reporting the issue. + [ISC-Bugs #43185] + +- Pass configure arguments which begin with an upper case letter, e.g. + CFLAGS, to the embedded bind configure, so it is no longer required + to use environment variables to get the same effect. + [ISC-Bugs #35143] + +- Added --enable-kqueue, --enable-epoll, --enable-devpoll and a more + general --with-bind-extra-config to pass extra options to the + embedded bind configure. Note we had mixed experiences with this + so it is at the user risk, i.e., they are NOT SUPPORTED yet. + [ISC-Bugs #20890] + +- Changed the way the embedded bind Makefile is updated by configure. + The only user visible side effect is that --with-libbind now requires + either "no" or an (absolute) path, i.e. "yes" is no longer valid. + [ISC-Bugs #43227] + Changes since 4.3.0 (bug fixes) - Tidy up several small tickets. diff --git a/common/parse.c b/common/parse.c index 22e7d582..b8ccf9df 100644 --- a/common/parse.c +++ b/common/parse.c @@ -98,7 +98,7 @@ void skip_to_rbrace (cfile, brace_count) enum dhcp_token token; const char *val; -#if defined (DEBUG_TOKEN) +#if defined (DEBUG_TOKENS) log_error("skip_to_rbrace: %d\n", brace_count); #endif do { diff --git a/common/print.c b/common/print.c index a694fedd..ce368c4d 100644 --- a/common/print.c +++ b/common/print.c @@ -383,15 +383,27 @@ void print_hex_only (len, data, limit, buf) unsigned limit; char *buf; { - unsigned i; + char *bufptr = buf; + int byte = 0; - if ((buf == NULL) || (limit < 3)) + if (data == NULL || bufptr == NULL || limit == 0) { return; - - for (i = 0; (i < limit / 3) && (i < len); i++) { - sprintf(&buf[i*3], "%02x:", data[i]); } - buf[(i * 3) - 1] = 0; + + if (((len == 0) || ((len * 3) > limit))) { + *bufptr = 0x0; + return; + } + + for ( ; byte < len; ++byte) { + if (byte > 0) { + *bufptr++ = ':'; + } + + sprintf(bufptr, "%02x", data[byte]); + bufptr += 2; + } + return; } diff --git a/common/tests/misc_unittest.c b/common/tests/misc_unittest.c index 6cefa6e7..0f9b80cf 100644 --- a/common/tests/misc_unittest.c +++ b/common/tests/misc_unittest.c @@ -153,6 +153,69 @@ ATF_TC_BODY(find_percent_adv, tc) return; } +ATF_TC(print_hex_only); + +ATF_TC_HEAD(print_hex_only, tc) +{ + atf_tc_set_md_var(tc, "descr", "Verify hex data formatting."); +} + +/* This test exercises the print_hex_only function + */ +ATF_TC_BODY(print_hex_only, tc) +{ + unsigned char data[] = {0xaa,0xbb,0xcc,0xdd}; + char* ref = "aa:bb:cc:dd"; + char buf[14]; + memset(buf, 'x', sizeof(buf)); + int data_len = sizeof(data); + int expected_len = 12; + + /* Proper input values should produce proper result */ + print_hex_only (data_len, data, expected_len, buf); + if (strlen(buf) != strlen(ref)) { + atf_tc_fail("len of result is wrong"); + } + + if (strcmp(buf, ref)) { + atf_tc_fail("result doesn't match ref"); + } + + /* Make sure we didn't overrun the buffer */ + if (buf[expected_len] != 'x') { + atf_tc_fail("data over run detected"); + } + + /* Buffer == null doesn't crash */ + print_hex_only (data_len, data, expected_len, NULL); + + /* Limit == 0 doesn't write (or crash) */ + *buf = '-'; + print_hex_only (data_len, data, 0, buf); + if (*buf != '-') { + atf_tc_fail("limit of zero, altered buffer"); + } + + /* data == NULL doesn't write (or crash) */ + print_hex_only (data_len, NULL, expected_len, buf); + if (*buf != '-') { + atf_tc_fail("limit of zero, altered buffer"); + } + + /* Limit too small should produce zero length string */ + *buf = '-'; + print_hex_only (data_len, data, expected_len - 1, buf); + if (*buf != 0x0) { + atf_tc_fail("limit too small should have failed"); + } + + /* Data length of 0 should produce zero length string */ + *buf = '-'; + print_hex_only (0, data, expected_len, buf); + if (*buf != 0x0) { + atf_tc_fail("limit too small should have failed"); + } +} /* This macro defines main() method that will call specified test cases. tp and simple_test_case names can be whatever you want @@ -161,6 +224,7 @@ ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, find_percent_basic); ATF_TP_ADD_TC(tp, find_percent_adv); + ATF_TP_ADD_TC(tp, print_hex_only); return (atf_no_error()); } diff --git a/configure b/configure index 4f4552f0..bb7c6b88 100755 --- a/configure +++ b/configure @@ -627,8 +627,11 @@ LTLIBOBJS LIBOBJS LDAP_CFLAGS LDAP_LIBS +BINDBUILD +BINDBIND BINDSRCDIR BINDDIR +BINDIOMUX ac_prefix_program DISTCHECK_ATF_CONFIGURE_FLAG HAVE_ATF_FALSE @@ -773,6 +776,10 @@ with_cli6_pid_file with_relay_pid_file with_relay6_pid_file with_randomdev +enable_kqueue +enable_epoll +enable_devpoll +with_bind_extra_config with_libbind with_ldap with_ldapcrypto @@ -1437,6 +1444,9 @@ Optional Features: --enable-log-pid Include PIDs in syslog messages (default is no). --enable-binary-leases enable support for binary insertion of leases (default is no) + --enable-kqueue use BSD kqueue (default is no) + --enable-epoll use Linux epoll (default is no) + --enable-devpoll use /dev/poll (default is no) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -1473,8 +1483,10 @@ Optional Packages: File for dhcrelay6 process information (default is LOCALSTATEDIR/run/dhcrelay6.pid) --with-randomdev=PATH Path for random device (default is /dev/random) - --with-libbind=PATH bind includes and libraries are in PATH (default is - ./bind) + --with-bind-extra-config + configure bind librairies with some extra options + (default is none) + --with-libbind=PATH bind includes and libraries are in PATH --with-ldap enable OpenLDAP support in dhcpd (default is no) --with-ldapcrypto enable OpenLDAP crypto support in dhcpd (default is no) @@ -4475,6 +4487,19 @@ BINDCONFIG= if test "$cross_compiling" = "yes"; then BINDCONFIG="--host=$host" fi +# Pass CFLAGS and co. $ac_configure_args looks like "'arg1' 'arg2' ..." +# and as there can be a space inside an argument some magic is required. +# This sets $1 ... $N to my_configure_args, arg1 ... argN +eval "set my_configure_args $ac_configure_args" +# remove my_configure_args, i.e., the guard against empty $ac_configure_args +shift +# iterate on arguments and copying 'arg' when it begins by an upper case +for a +do + case $a in + [A-Z]*) BINDCONFIG="$BINDCONFIG '$a'" ;; + esac +done if test "$cross_compiling" = "yes"; then CROSS_COMPILING_TRUE= @@ -5657,8 +5682,8 @@ fi fi if test ! -x $ATF_BIN/atf-run -o ! -x $ATF_BIN/atf-report ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: atf-run,atf-report not found, assuming they are in your path" >&5 -$as_echo "$as_me: WARNING: atf-run,atf-report not found, assuming they are in your path" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: atf-run/atf-report not found, assuming they are in your path" >&5 +$as_echo "$as_me: WARNING: atf-run/atf-report not found, assuming they are in your path" >&2;} fi @@ -6722,6 +6747,65 @@ fi BINDCONFIG="$BINDCONFIG --with-randomdev=$use_randomdev" fi +BINDIOMUX="--disable-kqueue --disable-epoll --disable-devpoll" +# check kqueue/epoll/devpoll alternative to select +# Check whether --enable-kqueue was given. +if test "${enable_kqueue+set}" = set; then : + enableval=$enable_kqueue; want_kqueue="$enableval" +else + want_kqueue="no" +fi + +if test "$want_kqueue" = "yes"; then + BINDIOMUX="--enable-kqueue" + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: --enable-kqueue is not supported: it may lead to issues such as server looping" >&5 +$as_echo "$as_me: WARNING: --enable-kqueue is not supported: it may lead to issues such as server looping" >&2;} +fi +# Check whether --enable-epoll was given. +if test "${enable_epoll+set}" = set; then : + enableval=$enable_epoll; want_epoll="$enableval" +else + want_epoll="no" +fi + +if test "$want_epoll" = "yes"; then + BINDIOMUX="--enable-epoll" + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: --enable-epoll is not supported: it may lead to issues such as server looping" >&5 +$as_echo "$as_me: WARNING: --enable-epoll is not supported: it may lead to issues such as server looping" >&2;} +fi +# Check whether --enable-devpoll was given. +if test "${enable_devpoll+set}" = set; then : + enableval=$enable_devpoll; want_devpoll="$enableval" +else + want_devpoll="no" +fi + +if test "$want_devpoll" = "yes"; then + BINDIOMUX="--enable-devpoll" + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: --enable-devpoll is not supported: it may lead to issues such as server looping" >&5 +$as_echo "$as_me: WARNING: --enable-devpoll is not supported: it may lead to issues such as server looping" >&2;} +fi + + +# general extra bind configure arguments + +# Check whether --with-bind-extra-config was given. +if test "${with_bind_extra_config+set}" = set; then : + withval=$with_bind_extra_config; use_xbindconfig="$withval" +else + use_xbindconfig="" +fi + +case "$use_xbindconfig" in +yes|no|'') + ;; +*) + BINDCONFIG="$BINDCONFIG $use_xbindconfig" + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Most options to bind configure are not supported when used by ISC DHCP" >&5 +$as_echo "$as_me: WARNING: Most options to bind configure are not supported when used by ISC DHCP" >&2;} + ;; +esac + # see if there is a "sa_len" field in our interface information structure ac_fn_c_check_member "$LINENO" "struct sockaddr" "sa_len" "ac_cv_member_struct_sockaddr_sa_len" "#include " @@ -6822,8 +6906,11 @@ $as_echo "#define VLAN_TCI_PRESENT 1" >>confdefs.h fi +# bind/Makefile.in is not from automake so we need 2 sets of variables BINDDIR= BINDSRCDIR= +BINDBIND= +BINDBUILD= # Check whether --with-libbind was given. if test "${with_libbind+set}" = set; then : @@ -6834,31 +6921,47 @@ fi case "$use_libbind" in yes) - BINDDIR="\${top_srcdir}/bind" - BINDSRCDIR="\${top_srcdir}/bind" + as_fn_error $? "PATH is required in --with-libbind=PATH" "$LINENO" 5 ;; no) BINDDIR="\${top_srcdir}/bind" BINDSRCDIR="\${top_srcdir}/bind" + my_abs_srcdir=`cd $srcdir && pwd` + BINDBIND="${my_abs_srcdir}/bind" + if test ! -d "$srcdir/bind"; then + as_fn_error $? "Where to find or build bind includes and libraries must be specified" "$LINENO" 5 + fi + if test -d "$srcdir/bind/bind9"; then + BINDBUILD="${my_abs_srcdir}/bind/bind9" + else + if test ! -f "$srcdir/bind/version.tmp"; then + as_fn_error $? "Cannot find $srcdir/bind/version.tmp" "$LINENO" 5 + fi + . "$srcdir/bind/version.tmp" + bindversion=${MAJORVER}.${MINORVER}.${PATCHVER}${RELEASETYPE}${RELEASEVER} + BINDBUILD="${my_abs_srcdir}/bind/bind-$bindversion" + fi + ac_config_files="$ac_config_files $srcdir/bind/Makefile" + ;; *) - BINDDIR="$use_libbind" - if test ! -d "$srcdir/bind"; then - # no bind directory, create it with a fake Makefile.in - # (AC_CONFIG_FILES and top Makefile refer to it so - # it must exits) - mkdir $srcdir/bind - cat > $srcdir/bind/Makefile.in << EOF -# placeholder -all check clean distclean distdir install uninstall: - -EOF + if test ! -d "$use_libbind"; then + as_fn_error $? "Cannot find bind directory at $use_libbind" "$LINENO" 5 fi + if test ! -d "$use_libbind/include"; then + as_fn_error $? "Cannot find bind includes at $use_libbind/include" "$LINENO" 5 + fi + if test ! -d "$use_libbind/lib"; then + as_fn_error $? "Cannot find bind libraries at $use_libbind/lib" "$LINENO" 5 + fi + BINDDIR="$use_libbind" ;; esac + + # OpenLDAP support. # Check whether --with-ldap was given. @@ -7240,7 +7343,7 @@ $as_echo "#define FLEXIBLE_ARRAY_MEMBER /**/" >>confdefs.h fi -ac_config_files="$ac_config_files Makefile $srcdir/bind/Makefile client/Makefile client/tests/Makefile common/Makefile common/tests/Makefile dhcpctl/Makefile includes/Makefile omapip/Makefile relay/Makefile server/Makefile tests/Makefile tests/unittest.sh server/tests/Makefile doc/devel/doxyfile" +ac_config_files="$ac_config_files Makefile client/Makefile client/tests/Makefile common/Makefile common/tests/Makefile dhcpctl/Makefile includes/Makefile omapip/Makefile relay/Makefile server/Makefile tests/Makefile tests/unittest.sh server/tests/Makefile doc/devel/doxyfile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -7986,8 +8089,8 @@ do case $ac_config_target in "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "includes/config.h") CONFIG_HEADERS="$CONFIG_HEADERS includes/config.h" ;; - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "$srcdir/bind/Makefile") CONFIG_FILES="$CONFIG_FILES $srcdir/bind/Makefile" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "client/Makefile") CONFIG_FILES="$CONFIG_FILES client/Makefile" ;; "client/tests/Makefile") CONFIG_FILES="$CONFIG_FILES client/tests/Makefile" ;; "common/Makefile") CONFIG_FILES="$CONFIG_FILES common/Makefile" ;; @@ -8697,16 +8800,6 @@ else DHCP_VERSIONS="DHCPv4" fi -(cd $srcdir - sh util/bindvar.sh - if test $? -ne 0; then - as_fn_error $? "*** util/bindvar.sh failed" "$LINENO" 5 - fi -) -if test $? -ne 0; then - exit $? -fi - cat > config.report << END ISC DHCP source configure results: diff --git a/configure.ac b/configure.ac index 8b58835c..f5345550 100644 --- a/configure.ac +++ b/configure.ac @@ -37,6 +37,19 @@ BINDCONFIG= if test "$cross_compiling" = "yes"; then BINDCONFIG="--host=$host" fi +# Pass CFLAGS and co. $ac_configure_args looks like "'arg1' 'arg2' ..." +# and as there can be a space inside an argument some magic is required. +# This sets $1 ... $N to my_configure_args, arg1 ... argN +eval "set my_configure_args $ac_configure_args" +# remove my_configure_args, i.e., the guard against empty $ac_configure_args +shift +# iterate on arguments and copying 'arg' when it begins by an upper case +for a +do + case $a in + [[A-Z]]*) BINDCONFIG="$BINDCONFIG '$a'" ;; + esac +done AC_SUBST(BINDCONFIG) AM_CONDITIONAL(CROSS_COMPILING, test "$cross_compiling" = "yes") @@ -295,7 +308,7 @@ elif test "$atf_path" != "no" ; then fi if test ! -x $ATF_BIN/atf-run -o ! -x $ATF_BIN/atf-report ; then - AC_MSG_WARN([atf-run,atf-report not found, assuming they are in your path]) + AC_MSG_WARN([atf-run/atf-report not found, assuming they are in your path]) fi AC_SUBST(ATF_CFLAGS) @@ -631,6 +644,45 @@ else BINDCONFIG="$BINDCONFIG --with-randomdev=$use_randomdev" fi +BINDIOMUX="--disable-kqueue --disable-epoll --disable-devpoll" +# check kqueue/epoll/devpoll alternative to select +AC_ARG_ENABLE(kqueue, + AS_HELP_STRING([--enable-kqueue],[use BSD kqueue (default is no)]), + want_kqueue="$enableval", want_kqueue="no") +if test "$want_kqueue" = "yes"; then + BINDIOMUX="--enable-kqueue" + AC_MSG_WARN([--enable-kqueue is not supported: it may lead to issues such as server looping]) +fi +AC_ARG_ENABLE(epoll, + AS_HELP_STRING([--enable-epoll],[use Linux epoll (default is no)]), + want_epoll="$enableval", want_epoll="no") +if test "$want_epoll" = "yes"; then + BINDIOMUX="--enable-epoll" + AC_MSG_WARN([--enable-epoll is not supported: it may lead to issues such as server looping]) +fi +AC_ARG_ENABLE(devpoll, + AS_HELP_STRING([--enable-devpoll],[use /dev/poll (default is no)]), + want_devpoll="$enableval", want_devpoll="no") +if test "$want_devpoll" = "yes"; then + BINDIOMUX="--enable-devpoll" + AC_MSG_WARN([--enable-devpoll is not supported: it may lead to issues such as server looping]) +fi +AC_SUBST(BINDIOMUX) + +# general extra bind configure arguments +AC_ARG_WITH(bind-extra-config, + AS_HELP_STRING([--with-bind-extra-config],[configure bind librairies + with some extra options (default is none)]), + use_xbindconfig="$withval", use_xbindconfig="") +case "$use_xbindconfig" in +yes|no|'') + ;; +*) + BINDCONFIG="$BINDCONFIG $use_xbindconfig" + AC_MSG_WARN([Most options to bind configure are not supported when used by ISC DHCP]) + ;; +esac + # see if there is a "sa_len" field in our interface information structure AC_CHECK_MEMBER(struct sockaddr.sa_len, AC_DEFINE([HAVE_SA_LEN], [], @@ -679,38 +731,55 @@ AC_CHECK_MEMBER(struct tpacket_auxdata.tp_vlan_tci, [AC_DEFINE([VLAN_TCI_PRESENT], [1], [tpacket_auxdata.tp_vlan_tci present])] ,, [#include ]) +# bind/Makefile.in is not from automake so we need 2 sets of variables BINDDIR= BINDSRCDIR= +BINDBIND= +BINDBUILD= AC_ARG_WITH(libbind, - AS_HELP_STRING([--with-libbind=PATH],[bind includes and libraries are in PATH - (default is ./bind)]), + AS_HELP_STRING([--with-libbind=PATH],[bind includes and libraries are in PATH]), use_libbind="$withval", use_libbind="no") case "$use_libbind" in yes) - BINDDIR="\${top_srcdir}/bind" - BINDSRCDIR="\${top_srcdir}/bind" + AC_MSG_ERROR([PATH is required in --with-libbind=PATH]) ;; no) BINDDIR="\${top_srcdir}/bind" BINDSRCDIR="\${top_srcdir}/bind" + my_abs_srcdir=`cd $srcdir && pwd` + BINDBIND="${my_abs_srcdir}/bind" + if test ! -d "$srcdir/bind"; then + AC_MSG_ERROR([Where to find or build bind includes and libraries must be specified]) + fi + if test -d "$srcdir/bind/bind9"; then + BINDBUILD="${my_abs_srcdir}/bind/bind9" + else + if test ! -f "$srcdir/bind/version.tmp"; then + AC_MSG_ERROR([Cannot find $srcdir/bind/version.tmp]) + fi + . "$srcdir/bind/version.tmp" + bindversion=${MAJORVER}.${MINORVER}.${PATCHVER}${RELEASETYPE}${RELEASEVER} + BINDBUILD="${my_abs_srcdir}/bind/bind-$bindversion" + fi + AC_CONFIG_FILES([$srcdir/bind/Makefile]) ;; *) - BINDDIR="$use_libbind" - if test ! -d "$srcdir/bind"; then - # no bind directory, create it with a fake Makefile.in - # (AC_CONFIG_FILES and top Makefile refer to it so - # it must exits) - mkdir $srcdir/bind - cat > $srcdir/bind/Makefile.in << EOF -# placeholder -all check clean distclean distdir install uninstall: - -EOF + if test ! -d "$use_libbind"; then + AC_MSG_ERROR([Cannot find bind directory at $use_libbind]) fi + if test ! -d "$use_libbind/include"; then + AC_MSG_ERROR([Cannot find bind includes at $use_libbind/include]) + fi + if test ! -d "$use_libbind/lib"; then + AC_MSG_ERROR([Cannot find bind libraries at $use_libbind/lib]) + fi + BINDDIR="$use_libbind" ;; esac AC_SUBST(BINDDIR) AC_SUBST(BINDSRCDIR) +AC_SUBST(BINDBIND) +AC_SUBST(BINDBUILD) # OpenLDAP support. AC_ARG_WITH(ldap, @@ -805,7 +874,6 @@ AC_C_FLEXIBLE_ARRAY_MEMBER AC_CONFIG_FILES([ Makefile - $srcdir/bind/Makefile client/Makefile client/tests/Makefile common/Makefile @@ -830,16 +898,6 @@ else DHCP_VERSIONS="DHCPv4" fi -(cd $srcdir - sh util/bindvar.sh - if test $? -ne 0; then - AC_MSG_ERROR([*** util/bindvar.sh failed]) - fi -) -if test $? -ne 0; then - exit $? -fi - cat > config.report << END ISC DHCP source configure results: diff --git a/util/Makefile.bind.in b/util/Makefile.bind.in index 495e3919..95880347 100644 --- a/util/Makefile.bind.in +++ b/util/Makefile.bind.in @@ -15,22 +15,15 @@ # Configure and build the bind libraries for use by DHCP -include ./version.tmp -version=${MAJORVER}.${MINORVER}.${PATCHVER}${RELEASETYPE}${RELEASEVER} +binddir=@BINDBIND@ +bindsrcdir=@BINDBUILD@ -# bindvar.tmp is constructed by configure, it has the paths for bind -# if GMAKE is blank the shell script couldn't find a gmake to use. -# binddir= -# GMAKE= -include ./bindvar.tmp - -bindsrcdir=bind-${version} - -bindconfig = --disable-kqueue --disable-epoll --disable-devpoll \ - --without-openssl --without-libxml2 --enable-exportlib \ - --with-gssapi=no --enable-threads=no @BINDCONFIG@ \ +bindconfig = --without-openssl --without-libxml2 \ + --without-gssapi --disable-threads \ + --enable-exportlib \ --with-export-includedir=${binddir}/include \ - --with-export-libdir=${binddir}/lib + --with-export-libdir=${binddir}/lib \ + @BINDIOMUX@ @BINDCONFIG@ --enable-full-report @BIND_ATF_FALSE@cleandirs = ./lib ./include @BIND_ATF_TRUE@cleandirs = ./lib ./include ./atf @@ -47,11 +40,6 @@ bind1: gunzip -c bind.tar.gz | tar xf - ; \ fi - @if test -z "${GMAKE}"; then \ - echo "unable to find gmake" 1>&2 ; \ - exit 1; \ - fi - # Configure the export libraries # Currently disable the epoll, devpoll and kqueue options as they # don't interact well with the DHCP code. @@ -74,7 +62,7 @@ atf: else \ echo Building ATF support ; \ (cd ${bindsrcdir}/unit; \ - MAKE=${GMAKE} ${GMAKE} atf > ${binddir}/build.log ; \ + $(MAKE) atf > ${binddir}/build.log ; \ cp -rp atf ${binddir}) ; \ fi @@ -90,11 +78,11 @@ bind2-noguest: echo Building BIND Export libraries - this takes some time. ;\ (cd ${bindsrcdir}/lib/export ; \ echo building in `pwd` ; \ - MAKE=${GMAKE} ${GMAKE} >> ${binddir}/build.log) ; \ + $(MAKE) >> ${binddir}/build.log) ; \ \ echo Installing BIND Export libraries to ${binddir}. ; \ (cd ${bindsrcdir}/lib/export ; \ - MAKE=${GMAKE} ${GMAKE} install > ${binddir}/install.log) ; \ + $(MAKE) install > ${binddir}/install.log) ; \ fi bind2-hostgen: @@ -104,16 +92,16 @@ bind2-hostgen: echo Bind export libraries already installed ; \ else \ echo Building BIND Export libraries - this takes some time. ;\ - (cd ${bindsrcdir}/lib/export/dns ; \ - echo building gen using ${BUILD_CC} in `pwd` ; \ - MAKE=${GMAKE} ${GMAKE} CC=${BUILD_CC} CFLAGS=${BUILD_CFLAGS} CPPFLAGS=${BUILD_CPPFLAGS} LDFLAGS=${BUILD_LDFLAGS} LIBS=${BUILD_LIBS} gen >> ${binddir}/build.log) ; \ + (cd ${bindsrcdir}/lib/export/dns ; \ + echo building gen using ${BUILD_CC} in `pwd` ; \ + $(MAKE) CC=${BUILD_CC} CFLAGS=${BUILD_CFLAGS} CPPFLAGS=${BUILD_CPPFLAGS} LDFLAGS=${BUILD_LDFLAGS} LIBS=${BUILD_LIBS} gen >> ${binddir}/build.log) ; \ (cd ${bindsrcdir}/lib/export ; \ echo building in `pwd` ; \ - MAKE=${GMAKE} ${GMAKE} >> ${binddir}/build.log) ; \ + $(MAKE) >> ${binddir}/build.log) ; \ \ echo Installing BIND Export libraries to ${binddir}. ; \ (cd ${bindsrcdir}/lib/export ; \ - MAKE=${GMAKE} ${GMAKE} install > ${binddir}/install.log) ; \ + $(MAKE) install > ${binddir}/install.log) ; \ fi clean: diff --git a/util/Makefile.git b/util/Makefile.git deleted file mode 100644 index d681b387..00000000 --- a/util/Makefile.git +++ /dev/null @@ -1,85 +0,0 @@ -# -# Copyright (C) 2009-2012 Internet Systems Consortium, Inc. ("ISC") -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. - -# $Id: Makefile.bind,v 1.8 2012/04/05 22:16:47 sar Exp $ - -# bindvar.tmp is constructed by configure, it has the paths for -# if GMAKE is blank the shell script couldn't find a gmake to use. -# binddir= -# GMAKE= -include ./bindvar.tmp - -bindsrcdir=bind9 - -all: -# Extract the source from the tarball, if it hasn't been already. - @if test -d ${bindsrcdir} ; then \ - echo ${bindsrcdir} already unpacked... ; \ - else \ - gunzip -c bind.tar.gz | tar xf - ; \ - fi - - @if test -z "${GMAKE}"; then \ - echo "unable to find gmake" 1>&2 ; \ - exit 1; \ - fi - -# Configure the export libraries -# Currently disable the epoll and devpoll options as they don't interact -# well with the DHCP code. -# If the top-level Bind Makefile exists we skip the configuration step -# as we assume it's done and won't change. Doing a make clean will -# reset things if necessary. - @if test -f ${bindsrcdir}/Makefile ; then \ - echo Bind export libraries already configured ; \ - else \ - echo Configuring BIND Export libraries for DHCP. ; \ - rm -rf ./lib ./include ./configure.log ./build.log ./install.log ; \ - (cd ${bindsrcdir} && ./configure --disable-kqueue --disable-epoll --disable-devpoll --without-openssl --without-libxml2 --enable-exportlib --enable-threads=no --with-export-includedir=${binddir}/include --with-export-libdir=${binddir}/lib --with-gssapi=no > ${binddir}/configure.log); \ - fi - -# Build and install the export libraries -# No need to do anything if we already have something installed. - @if test -d ${binddir}/lib ; then \ - echo Bind export libraries already installed ; \ - else \ - echo Building BIND Export libraries - this takes some time. ;\ - (cd ${bindsrcdir}/lib/export ; \ - echo building in `pwd` ; \ - MAKE=${GMAKE} ${GMAKE} > ${binddir}/build.log) ; \ - \ - echo Installing BIND Export libraries to ${binddir}. ; \ - (cd ${bindsrcdir}/lib/export ; \ - MAKE=${GMAKE} ${GMAKE} install > ${binddir}/install.log) ; \ - fi - -clean: - @echo Cleaning BIND export library. - (cd ${bindsrcdir}; make -k clean ) - rm -rf ./lib ./include ./configure.log ./build.log \ - ./install.log - -# Include the following so that this Makefile is happy when the parent -# tries to use them. - -distdir: - -distclean: - -install: - -check: - -uninstall: diff --git a/util/bind.sh b/util/bind.sh index 494e2399..13f6fb36 100644 --- a/util/bind.sh +++ b/util/bind.sh @@ -99,7 +99,7 @@ esac if test -d bind/bind9/.git then - cp util/Makefile.git bind/Makefile.in + cp util/Makefile.bind.in bind/Makefile.in rm -rf bind/include bind/lib cd bind/bind9 test -f Makefile && make distclean diff --git a/util/bindvar.sh b/util/bindvar.sh deleted file mode 100644 index 184a4cc0..00000000 --- a/util/bindvar.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2009,2015 Internet Systems Consortium, Inc. ("ISC") -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. - -# $Id: bindvar.sh,v 1.2 2009/12/02 20:43:52 sar Exp $ - -# Create a file with the base directory and gmake path for -# use by the bind/Makefile, we do this to minimize portability -# concerns. - -# Bind requires a GNU style make to compile, if we can't find one -# exit with a non-zero status, otherwise exit with success (i.e. 0) - -binddir=`pwd` -gmake= -for x in gmake gnumake make; do - if $x --version 2>/dev/null | grep GNU > /dev/null; then - gmake=$x - break; - fi -done - -if [ -z $gmake ] -then - echo "$0: Building Bind requires a GNU style make tool and none were found in your path. We tried gmake, gnumake, and make." - exit 1 -fi - -cat < bind/bindvar.tmp -binddir=$binddir/bind -GMAKE=$gmake -EOF - -exit 0 From 4b9147439e0e378c0dfb91b89c4f29fa688b2f11 Mon Sep 17 00:00:00 2001 From: Francis Dupont Date: Sat, 24 Sep 2016 16:02:57 +0200 Subject: [PATCH 4/7] Updated RELNOTES --- RELNOTES | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/RELNOTES b/RELNOTES index f02df24b..b17793b5 100644 --- a/RELNOTES +++ b/RELNOTES @@ -88,6 +88,15 @@ by Eric Young (eay@cryptsoft.com). either "no" or an (absolute) path, i.e. "yes" is no longer valid. [ISC-Bugs #43227] +- Added the support of git repositories in the util/bind.sh script. + When you build ISC DHCP from a git repo, i.e., without a bind + directory populated as in release distribution file, you may now + create the bind directory, change to it and clone the private + (repo.isc.org/proj/git/prod/bind9.git) or the public + (https://github.com/mirroring/bind9.git) git repository into + bind/bind9 and after invoke the util/bind.sh script as usual. + [ISC-Bugs #43236] + Changes since 4.3.0 (bug fixes) - Tidy up several small tickets. From d163c8f7a2180bf87a202d9c6ccda926f930baac Mon Sep 17 00:00:00 2001 From: Thomas Markwalder Date: Tue, 27 Sep 2016 13:52:50 -0400 Subject: [PATCH 5/7] [rt43236] Minor wording changes in RELNOTES --- RELNOTES | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/RELNOTES b/RELNOTES index b17793b5..599fde6a 100644 --- a/RELNOTES +++ b/RELNOTES @@ -88,13 +88,13 @@ by Eric Young (eay@cryptsoft.com). either "no" or an (absolute) path, i.e. "yes" is no longer valid. [ISC-Bugs #43227] -- Added the support of git repositories in the util/bind.sh script. - When you build ISC DHCP from a git repo, i.e., without a bind - directory populated as in release distribution file, you may now +- Added the support for git repositories in the util/bind.sh script. + When you build ISC DHCP from a git repo, i.e., without a "bind" + directory populated as in the release distribution file, you may now create the bind directory, change to it and clone the private (repo.isc.org/proj/git/prod/bind9.git) or the public (https://github.com/mirroring/bind9.git) git repository into - bind/bind9 and after invoke the util/bind.sh script as usual. + bind/bind9 and then invoke the util/bind.sh script as usual. [ISC-Bugs #43236] Changes since 4.3.0 (bug fixes) From 290a761329bf395e3908b1b85709bbfcdfaf22df Mon Sep 17 00:00:00 2001 From: Francis Dupont Date: Wed, 28 Sep 2016 09:14:27 +0200 Subject: [PATCH 6/7] Changed public repo --- RELNOTES | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELNOTES b/RELNOTES index 599fde6a..dce637ff 100644 --- a/RELNOTES +++ b/RELNOTES @@ -93,7 +93,7 @@ by Eric Young (eay@cryptsoft.com). directory populated as in the release distribution file, you may now create the bind directory, change to it and clone the private (repo.isc.org/proj/git/prod/bind9.git) or the public - (https://github.com/mirroring/bind9.git) git repository into + (https://source.isc.org/git/bind9.git) git repository into bind/bind9 and then invoke the util/bind.sh script as usual. [ISC-Bugs #43236] From fe16ba39e7411a110c0f623b2160d5bad4b816d2 Mon Sep 17 00:00:00 2001 From: Francis Dupont Date: Wed, 28 Sep 2016 15:45:25 +0200 Subject: [PATCH 7/7] Added HEAD to "git merge --ff-only" for old gits --- util/bind.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util/bind.sh b/util/bind.sh index 13f6fb36..54f5778a 100644 --- a/util/bind.sh +++ b/util/bind.sh @@ -104,7 +104,8 @@ then cd bind/bind9 test -f Makefile && make distclean git fetch - git checkout $BINDTAG && test -n "${noSNAP}" && git merge --ff-only + git checkout $BINDTAG && test -n "${noSNAP}" && \ + git merge --ff-only HEAD else # Delete all previous bind stuff rm -rf bind