diff options
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/Atffile | 5 | ||||
-rw-r--r-- | server/tests/Makefile.am | 53 | ||||
-rw-r--r-- | server/tests/Makefile.in | 999 | ||||
-rw-r--r-- | server/tests/hash_unittest.c | 607 | ||||
-rw-r--r-- | server/tests/load_bal_unittest.c | 191 | ||||
-rw-r--r-- | server/tests/mdb6_unittest.c | 957 | ||||
-rw-r--r-- | server/tests/simple_unittest.c | 77 |
7 files changed, 2889 insertions, 0 deletions
diff --git a/server/tests/Atffile b/server/tests/Atffile new file mode 100644 index 0000000..b2fdc0f --- /dev/null +++ b/server/tests/Atffile @@ -0,0 +1,5 @@ +Content-Type: application/X-atf-atffile; version="1" + +prop: test-suite = dhcp4 + +tp-glob: *_unittests diff --git a/server/tests/Makefile.am b/server/tests/Makefile.am new file mode 100644 index 0000000..adde853 --- /dev/null +++ b/server/tests/Makefile.am @@ -0,0 +1,53 @@ +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 = +if HAVE_ATF + +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) + +check: $(ATF_TESTS) + sh ${top_srcdir}/tests/unittest.sh + +endif + +check_PROGRAMS = $(ATF_TESTS) diff --git a/server/tests/Makefile.in b/server/tests/Makefile.in new file mode 100644 index 0000000..8019f98 --- /dev/null +++ b/server/tests/Makefile.in @@ -0,0 +1,999 @@ +# Makefile.in generated by automake 1.14 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@HAVE_ATF_TRUE@am__append_1 = dhcpd_unittests legacy_unittests hash_unittests load_bal_unittests +check_PROGRAMS = $(am__EXEEXT_2) +subdir = server/tests +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(top_srcdir)/depcomp +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/includes/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +@HAVE_ATF_TRUE@am__EXEEXT_1 = dhcpd_unittests$(EXEEXT) \ +@HAVE_ATF_TRUE@ legacy_unittests$(EXEEXT) \ +@HAVE_ATF_TRUE@ hash_unittests$(EXEEXT) \ +@HAVE_ATF_TRUE@ load_bal_unittests$(EXEEXT) +am__EXEEXT_2 = $(am__EXEEXT_1) +am__dhcpd_unittests_SOURCES_DIST = ../dhcp.c ../bootp.c ../confpars.c \ + ../db.c ../class.c ../failover.c ../omapi.c ../mdb.c \ + ../stables.c ../salloc.c ../ddns.c ../dhcpleasequery.c \ + ../dhcpv6.c ../mdb6.c ../ldap.c ../ldap_casa.c ../dhcpd.c \ + simple_unittest.c +am__objects_1 = dhcp.$(OBJEXT) bootp.$(OBJEXT) confpars.$(OBJEXT) \ + db.$(OBJEXT) class.$(OBJEXT) failover.$(OBJEXT) \ + omapi.$(OBJEXT) mdb.$(OBJEXT) stables.$(OBJEXT) \ + salloc.$(OBJEXT) ddns.$(OBJEXT) dhcpleasequery.$(OBJEXT) \ + dhcpv6.$(OBJEXT) mdb6.$(OBJEXT) ldap.$(OBJEXT) \ + ldap_casa.$(OBJEXT) dhcpd.$(OBJEXT) +@HAVE_ATF_TRUE@am_dhcpd_unittests_OBJECTS = $(am__objects_1) \ +@HAVE_ATF_TRUE@ simple_unittest.$(OBJEXT) +dhcpd_unittests_OBJECTS = $(am_dhcpd_unittests_OBJECTS) +am__DEPENDENCIES_1 = +@HAVE_ATF_TRUE@dhcpd_unittests_DEPENDENCIES = $(am__DEPENDENCIES_1) \ +@HAVE_ATF_TRUE@ $(DHCPLIBS) +dhcpd_unittests_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(dhcpd_unittests_LDFLAGS) $(LDFLAGS) -o $@ +am__hash_unittests_SOURCES_DIST = ../dhcp.c ../bootp.c ../confpars.c \ + ../db.c ../class.c ../failover.c ../omapi.c ../mdb.c \ + ../stables.c ../salloc.c ../ddns.c ../dhcpleasequery.c \ + ../dhcpv6.c ../mdb6.c ../ldap.c ../ldap_casa.c ../dhcpd.c \ + hash_unittest.c +@HAVE_ATF_TRUE@am_hash_unittests_OBJECTS = $(am__objects_1) \ +@HAVE_ATF_TRUE@ hash_unittest.$(OBJEXT) +hash_unittests_OBJECTS = $(am_hash_unittests_OBJECTS) +@HAVE_ATF_TRUE@hash_unittests_DEPENDENCIES = $(DHCPLIBS) \ +@HAVE_ATF_TRUE@ $(am__DEPENDENCIES_1) +am__legacy_unittests_SOURCES_DIST = ../dhcp.c ../bootp.c ../confpars.c \ + ../db.c ../class.c ../failover.c ../omapi.c ../mdb.c \ + ../stables.c ../salloc.c ../ddns.c ../dhcpleasequery.c \ + ../dhcpv6.c ../mdb6.c ../ldap.c ../ldap_casa.c ../dhcpd.c \ + mdb6_unittest.c +@HAVE_ATF_TRUE@am_legacy_unittests_OBJECTS = $(am__objects_1) \ +@HAVE_ATF_TRUE@ mdb6_unittest.$(OBJEXT) +legacy_unittests_OBJECTS = $(am_legacy_unittests_OBJECTS) +@HAVE_ATF_TRUE@legacy_unittests_DEPENDENCIES = $(DHCPLIBS) \ +@HAVE_ATF_TRUE@ $(am__DEPENDENCIES_1) +am__load_bal_unittests_SOURCES_DIST = ../dhcp.c ../bootp.c \ + ../confpars.c ../db.c ../class.c ../failover.c ../omapi.c \ + ../mdb.c ../stables.c ../salloc.c ../ddns.c \ + ../dhcpleasequery.c ../dhcpv6.c ../mdb6.c ../ldap.c \ + ../ldap_casa.c ../dhcpd.c load_bal_unittest.c +@HAVE_ATF_TRUE@am_load_bal_unittests_OBJECTS = $(am__objects_1) \ +@HAVE_ATF_TRUE@ load_bal_unittest.$(OBJEXT) +load_bal_unittests_OBJECTS = $(am_load_bal_unittests_OBJECTS) +@HAVE_ATF_TRUE@load_bal_unittests_DEPENDENCIES = $(DHCPLIBS) \ +@HAVE_ATF_TRUE@ $(am__DEPENDENCIES_1) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/includes +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(dhcpd_unittests_SOURCES) $(hash_unittests_SOURCES) \ + $(legacy_unittests_SOURCES) $(load_bal_unittests_SOURCES) +DIST_SOURCES = $(am__dhcpd_unittests_SOURCES_DIST) \ + $(am__hash_unittests_SOURCES_DIST) \ + $(am__legacy_unittests_SOURCES_DIST) \ + $(am__load_bal_unittests_SOURCES_DIST) +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-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 \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +ATF_BIN = @ATF_BIN@ +ATF_CFLAGS = @ATF_CFLAGS@ +ATF_LDFLAGS = @ATF_LDFLAGS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDAP_CFLAGS = @LDAP_CFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_prefix_program = @ac_prefix_program@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +byte_order = @byte_order@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +SUBDIRS = . +AM_CPPFLAGS = $(ATF_CFLAGS) -DUNIT_TEST -I$(top_srcdir)/includes \ + -I$(top_srcdir)/bind/include -I$(top_srcdir) \ + -DLOCALSTATEDIR='"."' +EXTRA_DIST = Atffile +DHCPSRC = ../dhcp.c ../bootp.c ../confpars.c ../db.c ../class.c \ + ../failover.c ../omapi.c ../mdb.c ../stables.c ../salloc.c \ + ../ddns.c ../dhcpleasequery.c ../dhcpv6.c ../mdb6.c \ + ../ldap.c ../ldap_casa.c ../dhcpd.c + +DHCPLIBS = $(top_builddir)/common/libdhcp.a $(top_builddir)/omapip/libomapi.a \ + $(top_builddir)/dhcpctl/libdhcpctl.a $(top_builddir)/bind/lib/libdns.a \ + $(top_builddir)/bind/lib/libisc.a + +ATF_TESTS = $(am__append_1) +@HAVE_ATF_TRUE@dhcpd_unittests_SOURCES = $(DHCPSRC) simple_unittest.c +@HAVE_ATF_TRUE@dhcpd_unittests_LDADD = $(ATF_LDFLAGS) $(DHCPLIBS) +@HAVE_ATF_TRUE@dhcpd_unittests_LDFLAGS = $(AM_LDFLAGS) $(ATF_LDFLAGS) +@HAVE_ATF_TRUE@hash_unittests_SOURCES = $(DHCPSRC) hash_unittest.c +@HAVE_ATF_TRUE@hash_unittests_LDADD = $(DHCPLIBS) $(ATF_LDFLAGS) + +# This is a legacy unittest. It replaces main() with something that was in mdb6.c +@HAVE_ATF_TRUE@legacy_unittests_SOURCES = $(DHCPSRC) mdb6_unittest.c +@HAVE_ATF_TRUE@legacy_unittests_LDADD = $(DHCPLIBS) $(ATF_LDFLAGS) +@HAVE_ATF_TRUE@load_bal_unittests_SOURCES = $(DHCPSRC) load_bal_unittest.c +@HAVE_ATF_TRUE@load_bal_unittests_LDADD = $(DHCPLIBS) $(ATF_LDFLAGS) +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign server/tests/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign server/tests/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-checkPROGRAMS: + -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) + +dhcpd_unittests$(EXEEXT): $(dhcpd_unittests_OBJECTS) $(dhcpd_unittests_DEPENDENCIES) $(EXTRA_dhcpd_unittests_DEPENDENCIES) + @rm -f dhcpd_unittests$(EXEEXT) + $(AM_V_CCLD)$(dhcpd_unittests_LINK) $(dhcpd_unittests_OBJECTS) $(dhcpd_unittests_LDADD) $(LIBS) + +hash_unittests$(EXEEXT): $(hash_unittests_OBJECTS) $(hash_unittests_DEPENDENCIES) $(EXTRA_hash_unittests_DEPENDENCIES) + @rm -f hash_unittests$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(hash_unittests_OBJECTS) $(hash_unittests_LDADD) $(LIBS) + +legacy_unittests$(EXEEXT): $(legacy_unittests_OBJECTS) $(legacy_unittests_DEPENDENCIES) $(EXTRA_legacy_unittests_DEPENDENCIES) + @rm -f legacy_unittests$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(legacy_unittests_OBJECTS) $(legacy_unittests_LDADD) $(LIBS) + +load_bal_unittests$(EXEEXT): $(load_bal_unittests_OBJECTS) $(load_bal_unittests_DEPENDENCIES) $(EXTRA_load_bal_unittests_DEPENDENCIES) + @rm -f load_bal_unittests$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(load_bal_unittests_OBJECTS) $(load_bal_unittests_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bootp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/class.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/confpars.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/db.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddns.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dhcp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dhcpd.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dhcpleasequery.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dhcpv6.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/failover.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash_unittest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ldap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ldap_casa.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_bal_unittest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mdb.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mdb6.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mdb6_unittest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/omapi.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/salloc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple_unittest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stables.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +dhcp.o: ../dhcp.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dhcp.o -MD -MP -MF $(DEPDIR)/dhcp.Tpo -c -o dhcp.o `test -f '../dhcp.c' || echo '$(srcdir)/'`../dhcp.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dhcp.Tpo $(DEPDIR)/dhcp.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../dhcp.c' object='dhcp.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dhcp.o `test -f '../dhcp.c' || echo '$(srcdir)/'`../dhcp.c + +dhcp.obj: ../dhcp.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dhcp.obj -MD -MP -MF $(DEPDIR)/dhcp.Tpo -c -o dhcp.obj `if test -f '../dhcp.c'; then $(CYGPATH_W) '../dhcp.c'; else $(CYGPATH_W) '$(srcdir)/../dhcp.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dhcp.Tpo $(DEPDIR)/dhcp.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../dhcp.c' object='dhcp.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dhcp.obj `if test -f '../dhcp.c'; then $(CYGPATH_W) '../dhcp.c'; else $(CYGPATH_W) '$(srcdir)/../dhcp.c'; fi` + +bootp.o: ../bootp.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bootp.o -MD -MP -MF $(DEPDIR)/bootp.Tpo -c -o bootp.o `test -f '../bootp.c' || echo '$(srcdir)/'`../bootp.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/bootp.Tpo $(DEPDIR)/bootp.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../bootp.c' object='bootp.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bootp.o `test -f '../bootp.c' || echo '$(srcdir)/'`../bootp.c + +bootp.obj: ../bootp.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bootp.obj -MD -MP -MF $(DEPDIR)/bootp.Tpo -c -o bootp.obj `if test -f '../bootp.c'; then $(CYGPATH_W) '../bootp.c'; else $(CYGPATH_W) '$(srcdir)/../bootp.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/bootp.Tpo $(DEPDIR)/bootp.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../bootp.c' object='bootp.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bootp.obj `if test -f '../bootp.c'; then $(CYGPATH_W) '../bootp.c'; else $(CYGPATH_W) '$(srcdir)/../bootp.c'; fi` + +confpars.o: ../confpars.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT confpars.o -MD -MP -MF $(DEPDIR)/confpars.Tpo -c -o confpars.o `test -f '../confpars.c' || echo '$(srcdir)/'`../confpars.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/confpars.Tpo $(DEPDIR)/confpars.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../confpars.c' object='confpars.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o confpars.o `test -f '../confpars.c' || echo '$(srcdir)/'`../confpars.c + +confpars.obj: ../confpars.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT confpars.obj -MD -MP -MF $(DEPDIR)/confpars.Tpo -c -o confpars.obj `if test -f '../confpars.c'; then $(CYGPATH_W) '../confpars.c'; else $(CYGPATH_W) '$(srcdir)/../confpars.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/confpars.Tpo $(DEPDIR)/confpars.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../confpars.c' object='confpars.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o confpars.obj `if test -f '../confpars.c'; then $(CYGPATH_W) '../confpars.c'; else $(CYGPATH_W) '$(srcdir)/../confpars.c'; fi` + +db.o: ../db.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT db.o -MD -MP -MF $(DEPDIR)/db.Tpo -c -o db.o `test -f '../db.c' || echo '$(srcdir)/'`../db.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/db.Tpo $(DEPDIR)/db.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../db.c' object='db.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o db.o `test -f '../db.c' || echo '$(srcdir)/'`../db.c + +db.obj: ../db.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT db.obj -MD -MP -MF $(DEPDIR)/db.Tpo -c -o db.obj `if test -f '../db.c'; then $(CYGPATH_W) '../db.c'; else $(CYGPATH_W) '$(srcdir)/../db.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/db.Tpo $(DEPDIR)/db.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../db.c' object='db.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o db.obj `if test -f '../db.c'; then $(CYGPATH_W) '../db.c'; else $(CYGPATH_W) '$(srcdir)/../db.c'; fi` + +class.o: ../class.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT class.o -MD -MP -MF $(DEPDIR)/class.Tpo -c -o class.o `test -f '../class.c' || echo '$(srcdir)/'`../class.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/class.Tpo $(DEPDIR)/class.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../class.c' object='class.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o class.o `test -f '../class.c' || echo '$(srcdir)/'`../class.c + +class.obj: ../class.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT class.obj -MD -MP -MF $(DEPDIR)/class.Tpo -c -o class.obj `if test -f '../class.c'; then $(CYGPATH_W) '../class.c'; else $(CYGPATH_W) '$(srcdir)/../class.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/class.Tpo $(DEPDIR)/class.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../class.c' object='class.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o class.obj `if test -f '../class.c'; then $(CYGPATH_W) '../class.c'; else $(CYGPATH_W) '$(srcdir)/../class.c'; fi` + +failover.o: ../failover.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT failover.o -MD -MP -MF $(DEPDIR)/failover.Tpo -c -o failover.o `test -f '../failover.c' || echo '$(srcdir)/'`../failover.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/failover.Tpo $(DEPDIR)/failover.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../failover.c' object='failover.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o failover.o `test -f '../failover.c' || echo '$(srcdir)/'`../failover.c + +failover.obj: ../failover.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT failover.obj -MD -MP -MF $(DEPDIR)/failover.Tpo -c -o failover.obj `if test -f '../failover.c'; then $(CYGPATH_W) '../failover.c'; else $(CYGPATH_W) '$(srcdir)/../failover.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/failover.Tpo $(DEPDIR)/failover.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../failover.c' object='failover.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o failover.obj `if test -f '../failover.c'; then $(CYGPATH_W) '../failover.c'; else $(CYGPATH_W) '$(srcdir)/../failover.c'; fi` + +omapi.o: ../omapi.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT omapi.o -MD -MP -MF $(DEPDIR)/omapi.Tpo -c -o omapi.o `test -f '../omapi.c' || echo '$(srcdir)/'`../omapi.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/omapi.Tpo $(DEPDIR)/omapi.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../omapi.c' object='omapi.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o omapi.o `test -f '../omapi.c' || echo '$(srcdir)/'`../omapi.c + +omapi.obj: ../omapi.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT omapi.obj -MD -MP -MF $(DEPDIR)/omapi.Tpo -c -o omapi.obj `if test -f '../omapi.c'; then $(CYGPATH_W) '../omapi.c'; else $(CYGPATH_W) '$(srcdir)/../omapi.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/omapi.Tpo $(DEPDIR)/omapi.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../omapi.c' object='omapi.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o omapi.obj `if test -f '../omapi.c'; then $(CYGPATH_W) '../omapi.c'; else $(CYGPATH_W) '$(srcdir)/../omapi.c'; fi` + +mdb.o: ../mdb.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mdb.o -MD -MP -MF $(DEPDIR)/mdb.Tpo -c -o mdb.o `test -f '../mdb.c' || echo '$(srcdir)/'`../mdb.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mdb.Tpo $(DEPDIR)/mdb.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../mdb.c' object='mdb.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mdb.o `test -f '../mdb.c' || echo '$(srcdir)/'`../mdb.c + +mdb.obj: ../mdb.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mdb.obj -MD -MP -MF $(DEPDIR)/mdb.Tpo -c -o mdb.obj `if test -f '../mdb.c'; then $(CYGPATH_W) '../mdb.c'; else $(CYGPATH_W) '$(srcdir)/../mdb.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mdb.Tpo $(DEPDIR)/mdb.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../mdb.c' object='mdb.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mdb.obj `if test -f '../mdb.c'; then $(CYGPATH_W) '../mdb.c'; else $(CYGPATH_W) '$(srcdir)/../mdb.c'; fi` + +stables.o: ../stables.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stables.o -MD -MP -MF $(DEPDIR)/stables.Tpo -c -o stables.o `test -f '../stables.c' || echo '$(srcdir)/'`../stables.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/stables.Tpo $(DEPDIR)/stables.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../stables.c' object='stables.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stables.o `test -f '../stables.c' || echo '$(srcdir)/'`../stables.c + +stables.obj: ../stables.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stables.obj -MD -MP -MF $(DEPDIR)/stables.Tpo -c -o stables.obj `if test -f '../stables.c'; then $(CYGPATH_W) '../stables.c'; else $(CYGPATH_W) '$(srcdir)/../stables.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/stables.Tpo $(DEPDIR)/stables.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../stables.c' object='stables.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stables.obj `if test -f '../stables.c'; then $(CYGPATH_W) '../stables.c'; else $(CYGPATH_W) '$(srcdir)/../stables.c'; fi` + +salloc.o: ../salloc.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT salloc.o -MD -MP -MF $(DEPDIR)/salloc.Tpo -c -o salloc.o `test -f '../salloc.c' || echo '$(srcdir)/'`../salloc.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/salloc.Tpo $(DEPDIR)/salloc.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../salloc.c' object='salloc.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o salloc.o `test -f '../salloc.c' || echo '$(srcdir)/'`../salloc.c + +salloc.obj: ../salloc.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT salloc.obj -MD -MP -MF $(DEPDIR)/salloc.Tpo -c -o salloc.obj `if test -f '../salloc.c'; then $(CYGPATH_W) '../salloc.c'; else $(CYGPATH_W) '$(srcdir)/../salloc.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/salloc.Tpo $(DEPDIR)/salloc.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../salloc.c' object='salloc.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o salloc.obj `if test -f '../salloc.c'; then $(CYGPATH_W) '../salloc.c'; else $(CYGPATH_W) '$(srcdir)/../salloc.c'; fi` + +ddns.o: ../ddns.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ddns.o -MD -MP -MF $(DEPDIR)/ddns.Tpo -c -o ddns.o `test -f '../ddns.c' || echo '$(srcdir)/'`../ddns.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ddns.Tpo $(DEPDIR)/ddns.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../ddns.c' object='ddns.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ddns.o `test -f '../ddns.c' || echo '$(srcdir)/'`../ddns.c + +ddns.obj: ../ddns.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ddns.obj -MD -MP -MF $(DEPDIR)/ddns.Tpo -c -o ddns.obj `if test -f '../ddns.c'; then $(CYGPATH_W) '../ddns.c'; else $(CYGPATH_W) '$(srcdir)/../ddns.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ddns.Tpo $(DEPDIR)/ddns.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../ddns.c' object='ddns.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ddns.obj `if test -f '../ddns.c'; then $(CYGPATH_W) '../ddns.c'; else $(CYGPATH_W) '$(srcdir)/../ddns.c'; fi` + +dhcpleasequery.o: ../dhcpleasequery.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dhcpleasequery.o -MD -MP -MF $(DEPDIR)/dhcpleasequery.Tpo -c -o dhcpleasequery.o `test -f '../dhcpleasequery.c' || echo '$(srcdir)/'`../dhcpleasequery.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dhcpleasequery.Tpo $(DEPDIR)/dhcpleasequery.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../dhcpleasequery.c' object='dhcpleasequery.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dhcpleasequery.o `test -f '../dhcpleasequery.c' || echo '$(srcdir)/'`../dhcpleasequery.c + +dhcpleasequery.obj: ../dhcpleasequery.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dhcpleasequery.obj -MD -MP -MF $(DEPDIR)/dhcpleasequery.Tpo -c -o dhcpleasequery.obj `if test -f '../dhcpleasequery.c'; then $(CYGPATH_W) '../dhcpleasequery.c'; else $(CYGPATH_W) '$(srcdir)/../dhcpleasequery.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dhcpleasequery.Tpo $(DEPDIR)/dhcpleasequery.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../dhcpleasequery.c' object='dhcpleasequery.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dhcpleasequery.obj `if test -f '../dhcpleasequery.c'; then $(CYGPATH_W) '../dhcpleasequery.c'; else $(CYGPATH_W) '$(srcdir)/../dhcpleasequery.c'; fi` + +dhcpv6.o: ../dhcpv6.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dhcpv6.o -MD -MP -MF $(DEPDIR)/dhcpv6.Tpo -c -o dhcpv6.o `test -f '../dhcpv6.c' || echo '$(srcdir)/'`../dhcpv6.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dhcpv6.Tpo $(DEPDIR)/dhcpv6.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../dhcpv6.c' object='dhcpv6.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dhcpv6.o `test -f '../dhcpv6.c' || echo '$(srcdir)/'`../dhcpv6.c + +dhcpv6.obj: ../dhcpv6.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dhcpv6.obj -MD -MP -MF $(DEPDIR)/dhcpv6.Tpo -c -o dhcpv6.obj `if test -f '../dhcpv6.c'; then $(CYGPATH_W) '../dhcpv6.c'; else $(CYGPATH_W) '$(srcdir)/../dhcpv6.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dhcpv6.Tpo $(DEPDIR)/dhcpv6.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../dhcpv6.c' object='dhcpv6.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dhcpv6.obj `if test -f '../dhcpv6.c'; then $(CYGPATH_W) '../dhcpv6.c'; else $(CYGPATH_W) '$(srcdir)/../dhcpv6.c'; fi` + +mdb6.o: ../mdb6.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mdb6.o -MD -MP -MF $(DEPDIR)/mdb6.Tpo -c -o mdb6.o `test -f '../mdb6.c' || echo '$(srcdir)/'`../mdb6.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mdb6.Tpo $(DEPDIR)/mdb6.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../mdb6.c' object='mdb6.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mdb6.o `test -f '../mdb6.c' || echo '$(srcdir)/'`../mdb6.c + +mdb6.obj: ../mdb6.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mdb6.obj -MD -MP -MF $(DEPDIR)/mdb6.Tpo -c -o mdb6.obj `if test -f '../mdb6.c'; then $(CYGPATH_W) '../mdb6.c'; else $(CYGPATH_W) '$(srcdir)/../mdb6.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mdb6.Tpo $(DEPDIR)/mdb6.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../mdb6.c' object='mdb6.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mdb6.obj `if test -f '../mdb6.c'; then $(CYGPATH_W) '../mdb6.c'; else $(CYGPATH_W) '$(srcdir)/../mdb6.c'; fi` + +ldap.o: ../ldap.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ldap.o -MD -MP -MF $(DEPDIR)/ldap.Tpo -c -o ldap.o `test -f '../ldap.c' || echo '$(srcdir)/'`../ldap.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ldap.Tpo $(DEPDIR)/ldap.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../ldap.c' object='ldap.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ldap.o `test -f '../ldap.c' || echo '$(srcdir)/'`../ldap.c + +ldap.obj: ../ldap.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ldap.obj -MD -MP -MF $(DEPDIR)/ldap.Tpo -c -o ldap.obj `if test -f '../ldap.c'; then $(CYGPATH_W) '../ldap.c'; else $(CYGPATH_W) '$(srcdir)/../ldap.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ldap.Tpo $(DEPDIR)/ldap.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../ldap.c' object='ldap.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ldap.obj `if test -f '../ldap.c'; then $(CYGPATH_W) '../ldap.c'; else $(CYGPATH_W) '$(srcdir)/../ldap.c'; fi` + +ldap_casa.o: ../ldap_casa.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ldap_casa.o -MD -MP -MF $(DEPDIR)/ldap_casa.Tpo -c -o ldap_casa.o `test -f '../ldap_casa.c' || echo '$(srcdir)/'`../ldap_casa.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ldap_casa.Tpo $(DEPDIR)/ldap_casa.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../ldap_casa.c' object='ldap_casa.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ldap_casa.o `test -f '../ldap_casa.c' || echo '$(srcdir)/'`../ldap_casa.c + +ldap_casa.obj: ../ldap_casa.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ldap_casa.obj -MD -MP -MF $(DEPDIR)/ldap_casa.Tpo -c -o ldap_casa.obj `if test -f '../ldap_casa.c'; then $(CYGPATH_W) '../ldap_casa.c'; else $(CYGPATH_W) '$(srcdir)/../ldap_casa.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ldap_casa.Tpo $(DEPDIR)/ldap_casa.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../ldap_casa.c' object='ldap_casa.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ldap_casa.obj `if test -f '../ldap_casa.c'; then $(CYGPATH_W) '../ldap_casa.c'; else $(CYGPATH_W) '$(srcdir)/../ldap_casa.c'; fi` + +dhcpd.o: ../dhcpd.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dhcpd.o -MD -MP -MF $(DEPDIR)/dhcpd.Tpo -c -o dhcpd.o `test -f '../dhcpd.c' || echo '$(srcdir)/'`../dhcpd.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dhcpd.Tpo $(DEPDIR)/dhcpd.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../dhcpd.c' object='dhcpd.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dhcpd.o `test -f '../dhcpd.c' || echo '$(srcdir)/'`../dhcpd.c + +dhcpd.obj: ../dhcpd.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dhcpd.obj -MD -MP -MF $(DEPDIR)/dhcpd.Tpo -c -o dhcpd.obj `if test -f '../dhcpd.c'; then $(CYGPATH_W) '../dhcpd.c'; else $(CYGPATH_W) '$(srcdir)/../dhcpd.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dhcpd.Tpo $(DEPDIR)/dhcpd.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../dhcpd.c' object='dhcpd.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dhcpd.obj `if test -f '../dhcpd.c'; then $(CYGPATH_W) '../dhcpd.c'; else $(CYGPATH_W) '$(srcdir)/../dhcpd.c'; fi` + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + 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; \ + ($(am__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" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + 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 || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-checkPROGRAMS clean-generic mostlyclean-am + +distclean: distclean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(am__recursive_targets) check-am install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-am clean clean-checkPROGRAMS clean-generic cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ + ps ps-am tags tags-am uninstall uninstall-am + + +# for autotools debugging only +info: + @echo "ATF_CFLAGS=$(ATF_CFLAGS)" + @echo "ATF_LDFLAGS=$(ATF_LDFLAGS)" + @echo "ATF_LIBS=$(ATF_LIBS)" + +@HAVE_ATF_TRUE@check: $(ATF_TESTS) +@HAVE_ATF_TRUE@ sh ${top_srcdir}/tests/unittest.sh + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/server/tests/hash_unittest.c b/server/tests/hash_unittest.c new file mode 100644 index 0000000..565aeec --- /dev/null +++ b/server/tests/hash_unittest.c @@ -0,0 +1,607 @@ +/* + * Copyright (c) 2012 by Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Internet Systems Consortium, Inc. + * 950 Charter Street + * Redwood City, CA 94063 + * <info@isc.org> + * https://www.isc.org/ + * + */ + +#include "config.h" +#include <atf-c.h> +#include <omapip/omapip_p.h> +#include "dhcpd.h" + +/* + * The following structures are kept here for reference only. As hash functions + * are somewhat convoluted, they are copied here for the reference. Original + * location is specified. Keep in mind that it may change over time: + * + * copied from server/omapi.c:49 * + * omapi_object_type_t *dhcp_type_lease; + * omapi_object_type_t *dhcp_type_pool; + * omapi_object_type_t *dhcp_type_class; + * omapi_object_type_t *dhcp_type_subclass; + * omapi_object_type_t *dhcp_type_host; + * + * copied from server/salloc.c:138 + * OMAPI_OBJECT_ALLOC (lease, struct lease, dhcp_type_lease) + * OMAPI_OBJECT_ALLOC (class, struct class, dhcp_type_class) + * OMAPI_OBJECT_ALLOC (subclass, struct class, dhcp_type_subclass) + * OMAPI_OBJECT_ALLOC (pool, struct pool, dhcp_type_pool) + * OMAPI_OBJECT_ALLOC (host, struct host_decl, dhcp_type_host) + * + * copied from server/mdb.c:2686 + * HASH_FUNCTIONS(lease_ip, const unsigned char *, struct lease, lease_ip_hash_t, + * lease_reference, lease_dereference, do_ip4_hash) + * HASH_FUNCTIONS(lease_id, const unsigned char *, struct lease, lease_id_hash_t, + * lease_reference, lease_dereference, do_id_hash) + * HASH_FUNCTIONS (host, const unsigned char *, struct host_decl, host_hash_t, + * host_reference, host_dereference, do_string_hash) + * HASH_FUNCTIONS (class, const char *, struct class, class_hash_t, + * class_reference, class_dereference, do_string_hash) + * + * copied from server/mdb.c:46 + * host_hash_t *host_hw_addr_hash; + * host_hash_t *host_uid_hash; + * host_hash_t *host_name_hash; + * lease_id_hash_t *lease_uid_hash; + * lease_ip_hash_t *lease_ip_addr_hash; + * lease_id_hash_t *lease_hw_addr_hash; + */ + +/** + * @brief sets client-id field in host declaration + * + * @param host pointer to host declaration + * @param uid pointer to client-id data + * @param uid_len length of the client-id data + * + * @return 1 if successful, 0 otherwise + */ +int lease_set_clientid(struct host_decl *host, const unsigned char *uid, int uid_len) { + + /* clean-up this mess and set client-identifier in a sane way */ + int real_len = uid_len; + if (uid_len == 0) { + real_len = strlen((const char *)uid) + 1; + } + + memset(&host->client_identifier, 0, sizeof(host->client_identifier)); + host->client_identifier.len = uid_len; + if (!buffer_allocate(&host->client_identifier.buffer, real_len, MDL)) { + return 0; + } + host->client_identifier.data = host->client_identifier.buffer->data; + memcpy((char *)host->client_identifier.data, uid, real_len); + + return 1; +} + +/// @brief executes uid hash test for specified client-ids (2 hosts) +/// +/// Creates two host structures, adds first host to the uid hash, +/// then adds second host to the hash, then removes first host, +/// then removed the second. Many checks are performed during all +/// operations. +/// +/// @param clientid1 client-id of the first host +/// @param clientid1_len client-id1 length (may be 0 for strings) +/// @param clientid2 client-id of the second host +/// @param clientid2_len client-id2 length (may be 0 for strings) +void lease_hash_test_2hosts(unsigned char clientid1[], size_t clientid1_len, + unsigned char clientid2[], size_t clientid2_len) { + + printf("Checking hash operation for 2 hosts: clientid1-len=%lu" + "clientid2-len=%lu\n", (unsigned long) clientid1_len, + (unsigned long) clientid2_len); + + dhcp_db_objects_setup (); + dhcp_common_objects_setup (); + + /* check that there is actually zero hosts in the hash */ + /* @todo: host_hash_for_each() */ + + struct host_decl *host1 = 0, *host2 = 0; + struct host_decl *check = 0; + + /* === step 1: allocate hosts === */ + ATF_CHECK_MSG(host_allocate(&host1, MDL) == ISC_R_SUCCESS, + "Failed to allocate host"); + ATF_CHECK_MSG(host_allocate(&host2, MDL) == ISC_R_SUCCESS, + "Failed to allocate host"); + + ATF_CHECK_MSG(host_new_hash(&host_uid_hash, HOST_HASH_SIZE, MDL) != 0, + "Unable to create new hash"); + + ATF_CHECK_MSG(buffer_allocate(&host1->client_identifier.buffer, + clientid1_len, MDL) != 0, + "Can't allocate uid buffer for host1"); + + ATF_CHECK_MSG(buffer_allocate(&host2->client_identifier.buffer, + clientid2_len, MDL) != 0, + "Can't allocate uid buffer for host2"); + + /* setting up host1->client_identifier is actually not needed */ + /* + ATF_CHECK_MSG(lease_set_clientid(host1, clientid1, actual1_len) != 0, + "Failed to set client-id for host1"); + + ATF_CHECK_MSG(lease_set_clientid(host2, clientid2, actual2_len) != 0, + "Failed to set client-id for host2"); + */ + + ATF_CHECK_MSG(host1->refcnt == 1, "Invalid refcnt for host1"); + ATF_CHECK_MSG(host2->refcnt == 1, "Invalid refcnt for host2"); + + /* verify that our hosts are not in the hash yet */ + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid1, + clientid1_len, MDL) == 0, + "Host1 is not supposed to be in the uid_hash."); + + ATF_CHECK_MSG(!check, "Host1 is not supposed to be in the uid_hash."); + + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid2, + clientid2_len, MDL) == 0, + "Host2 is not supposed to be in the uid_hash."); + ATF_CHECK_MSG(!check, "Host2 is not supposed to be in the uid_hash."); + + + /* === step 2: add first host to the hash === */ + host_hash_add(host_uid_hash, clientid1, clientid1_len, host1, MDL); + + /* 2 pointers expected: ours (host1) and the one stored in hash */ + ATF_CHECK_MSG(host1->refcnt == 2, "Invalid refcnt for host1"); + /* 1 pointer expected: just ours (host2) */ + ATF_CHECK_MSG(host2->refcnt == 1, "Invalid refcnt for host2"); + + /* verify that host1 is really in the hash and the we can find it */ + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid1, + clientid1_len, MDL), + "Host1 was supposed to be in the uid_hash."); + ATF_CHECK_MSG(check, "Host1 was supposed to be in the uid_hash."); + + /* Hey! That's not the host we were looking for! */ + ATF_CHECK_MSG(check == host1, "Wrong host returned by host_hash_lookup"); + + /* 3 pointers: host1, (stored in hash), check */ + ATF_CHECK_MSG(host1->refcnt == 3, "Invalid refcnt for host1"); + + /* reference count should be increased because we not have a pointer */ + + host_dereference(&check, MDL); /* we don't need it now */ + + ATF_CHECK_MSG(check == NULL, "check pointer is supposed to be NULL"); + + /* 2 pointers: host1, (stored in hash) */ + ATF_CHECK_MSG(host1->refcnt == 2, "Invalid refcnt for host1"); + + /* verify that host2 is not in the hash */ + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid2, + clientid2_len, MDL) == 0, + "Host2 was not supposed to be in the uid_hash[2]."); + ATF_CHECK_MSG(check == NULL, "Host2 was not supposed to be in the hash."); + + + /* === step 3: add second hot to the hash === */ + host_hash_add(host_uid_hash, clientid2, clientid2_len, host2, MDL); + + /* 2 pointers expected: ours (host1) and the one stored in hash */ + ATF_CHECK_MSG(host2->refcnt == 2, "Invalid refcnt for host2"); + + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid2, + clientid2_len, MDL), + "Host2 was supposed to be in the uid_hash."); + ATF_CHECK_MSG(check, "Host2 was supposed to be in the uid_hash."); + + /* Hey! That's not the host we were looking for! */ + ATF_CHECK_MSG(check == host2, "Wrong host returned by host_hash_lookup"); + + /* 3 pointers: host1, (stored in hash), check */ + ATF_CHECK_MSG(host2->refcnt == 3, "Invalid refcnt for host1"); + + host_dereference(&check, MDL); /* we don't need it now */ + + /* now we have 2 hosts in the hash */ + + /* verify that host1 is still in the hash and the we can find it */ + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid1, + clientid1_len, MDL), + "Host1 was supposed to be in the uid_hash."); + ATF_CHECK_MSG(check, "Host1 was supposed to be in the uid_hash."); + + /* Hey! That's not the host we were looking for! */ + ATF_CHECK_MSG(check == host1, "Wrong host returned by host_hash_lookup"); + + /* 3 pointers: host1, (stored in hash), check */ + ATF_CHECK_MSG(host1->refcnt == 3, "Invalid refcnt for host1"); + + host_dereference(&check, MDL); /* we don't need it now */ + + + /** + * @todo check that there is actually two hosts in the hash. + * Use host_hash_for_each() for that. + */ + + /* === step 4: remove first host from the hash === */ + + /* delete host from hash */ + host_hash_delete(host_uid_hash, clientid1, clientid1_len, MDL); + + ATF_CHECK_MSG(host1->refcnt == 1, "Invalid refcnt for host1"); + ATF_CHECK_MSG(host2->refcnt == 2, "Invalid refcnt for host2"); + + /* verify that host1 is no longer in the hash */ + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid1, + clientid1_len, MDL) == 0, + "Host1 is not supposed to be in the uid_hash."); + ATF_CHECK_MSG(!check, "Host1 is not supposed to be in the uid_hash."); + + /* host2 should be still there, though */ + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid2, + clientid2_len, MDL), + "Host2 was supposed to still be in the uid_hash."); + host_dereference(&check, MDL); + + /* === step 5: remove second host from the hash === */ + host_hash_delete(host_uid_hash, clientid2, clientid2_len, MDL); + + ATF_CHECK_MSG(host1->refcnt == 1, "Invalid refcnt for host1"); + ATF_CHECK_MSG(host2->refcnt == 1, "Invalid refcnt for host2"); + + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid2, + clientid2_len, MDL) == 0, + "Host2 was not supposed to be in the uid_hash anymore."); + + host_dereference(&host1, MDL); + host_dereference(&host2, MDL); + + /* + * No easy way to check if the host object were actually released. + * We could run it in valgrind and check for memory leaks. + */ + +#if defined (DEBUG_MEMORY_LEAKAGE) && defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) + /* @todo: Should be called in cleanup */ + free_everything (); +#endif +} + +/// @brief executes uid hash test for specified client-ids (3 hosts) +/// +/// Creates three host structures, adds first host to the uid hash, +/// then adds second host to the hash, then removes first host, +/// then removed the second. Many checks are performed during all +/// operations. +/// +/// @param clientid1 client-id of the first host +/// @param clientid1_len client-id1 length (may be 0 for strings) +/// @param clientid2 client-id of the second host +/// @param clientid2_len client-id2 length (may be 0 for strings) +/// @param clientid3 client-id of the second host +/// @param clientid3_len client-id2 length (may be 0 for strings) +void lease_hash_test_3hosts(unsigned char clientid1[], size_t clientid1_len, + unsigned char clientid2[], size_t clientid2_len, + unsigned char clientid3[], size_t clientid3_len) { + + printf("Checking hash operation for 3 hosts: clientid1-len=%lu" + " clientid2-len=%lu clientid3-len=%lu\n", + (unsigned long) clientid1_len, (unsigned long) clientid2_len, + (unsigned long) clientid3_len); + + dhcp_db_objects_setup (); + dhcp_common_objects_setup (); + + /* check that there is actually zero hosts in the hash */ + /* @todo: host_hash_for_each() */ + + struct host_decl *host1 = 0, *host2 = 0, *host3 = 0; + struct host_decl *check = 0; + + /* === step 1: allocate hosts === */ + ATF_CHECK_MSG(host_allocate(&host1, MDL) == ISC_R_SUCCESS, + "Failed to allocate host"); + ATF_CHECK_MSG(host_allocate(&host2, MDL) == ISC_R_SUCCESS, + "Failed to allocate host"); + ATF_CHECK_MSG(host_allocate(&host3, MDL) == ISC_R_SUCCESS, + "Failed to allocate host"); + + ATF_CHECK_MSG(host_new_hash(&host_uid_hash, HOST_HASH_SIZE, MDL) != 0, + "Unable to create new hash"); + + ATF_CHECK_MSG(buffer_allocate(&host1->client_identifier.buffer, + clientid1_len, MDL) != 0, + "Can't allocate uid buffer for host1"); + ATF_CHECK_MSG(buffer_allocate(&host2->client_identifier.buffer, + clientid2_len, MDL) != 0, + "Can't allocate uid buffer for host2"); + ATF_CHECK_MSG(buffer_allocate(&host3->client_identifier.buffer, + clientid3_len, MDL) != 0, + "Can't allocate uid buffer for host3"); + + /* verify that our hosts are not in the hash yet */ + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid1, + clientid1_len, MDL) == 0, + "Host1 is not supposed to be in the uid_hash."); + + ATF_CHECK_MSG(!check, "Host1 is not supposed to be in the uid_hash."); + + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid2, + clientid2_len, MDL) == 0, + "Host2 is not supposed to be in the uid_hash."); + ATF_CHECK_MSG(!check, "Host2 is not supposed to be in the uid_hash."); + + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid3, + clientid3_len, MDL) == 0, + "Host3 is not supposed to be in the uid_hash."); + ATF_CHECK_MSG(!check, "Host3 is not supposed to be in the uid_hash."); + + /* === step 2: add hosts to the hash === */ + host_hash_add(host_uid_hash, clientid1, clientid1_len, host1, MDL); + host_hash_add(host_uid_hash, clientid2, clientid2_len, host2, MDL); + host_hash_add(host_uid_hash, clientid3, clientid3_len, host3, MDL); + + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid1, + clientid1_len, MDL), + "Host1 was supposed to be in the uid_hash."); + /* Hey! That's not the host we were looking for! */ + ATF_CHECK_MSG(check == host1, "Wrong host returned by host_hash_lookup"); + host_dereference(&check, MDL); /* we don't need it now */ + + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid2, + clientid2_len, MDL), + "Host2 was supposed to be in the uid_hash."); + ATF_CHECK_MSG(check, "Host2 was supposed to be in the uid_hash."); + /* Hey! That's not the host we were looking for! */ + ATF_CHECK_MSG(check == host2, "Wrong host returned by host_hash_lookup"); + host_dereference(&check, MDL); /* we don't need it now */ + + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid3, + clientid3_len, MDL), + "Host3 was supposed to be in the uid_hash."); + ATF_CHECK_MSG(check, "Host3 was supposed to be in the uid_hash."); + /* Hey! That's not the host we were looking for! */ + ATF_CHECK_MSG(check == host3, "Wrong host returned by host_hash_lookup"); + host_dereference(&check, MDL); /* we don't need it now */ + + /* === step 4: remove first host from the hash === */ + + /* delete host from hash */ + host_hash_delete(host_uid_hash, clientid1, clientid1_len, MDL); + + /* verify that host1 is no longer in the hash */ + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid1, + clientid1_len, MDL) == 0, + "Host1 is not supposed to be in the uid_hash."); + ATF_CHECK_MSG(!check, "Host1 is not supposed to be in the uid_hash."); + + /* host2 and host3 should be still there, though */ + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid2, + clientid2_len, MDL), + "Host2 was supposed to still be in the uid_hash."); + host_dereference(&check, MDL); + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid3, + clientid3_len, MDL), + "Host3 was supposed to still be in the uid_hash."); + host_dereference(&check, MDL); + + /* === step 5: remove second host from the hash === */ + host_hash_delete(host_uid_hash, clientid2, clientid2_len, MDL); + + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid2, + clientid2_len, MDL) == 0, + "Host2 was not supposed to be in the uid_hash anymore."); + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid3, + clientid3_len, MDL), + "Host3 was supposed to still be in the uid_hash."); + host_dereference(&check, MDL); + + /* === step 6: remove the last (third) host from the hash === */ + host_hash_delete(host_uid_hash, clientid3, clientid3_len, MDL); + + ATF_CHECK_MSG(host_hash_lookup(&check, host_uid_hash, clientid3, + clientid3_len, MDL) == 0, + "Host3 was not supposed to be in the uid_hash anymore."); + host_dereference(&check, MDL); + + + host_dereference(&host1, MDL); + host_dereference(&host2, MDL); + host_dereference(&host3, MDL); + + /* + * No easy way to check if the host object were actually released. + * We could run it in valgrind and check for memory leaks. + */ + +#if defined (DEBUG_MEMORY_LEAKAGE) && defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) + /* @todo: Should be called in cleanup */ + free_everything (); +#endif +} + +ATF_TC(lease_hash_basic_2hosts); + +ATF_TC_HEAD(lease_hash_basic_2hosts, tc) { + atf_tc_set_md_var(tc, "descr", "Basic lease hash tests"); + /* + * The following functions are tested: + * host_allocate(), host_new_hash(), buffer_allocate(), host_hash_lookup() + * host_hash_add(), host_hash_delete() + */ +} + +ATF_TC_BODY(lease_hash_basic_2hosts, tc) { + + unsigned char clientid1[] = { 0x1, 0x2, 0x3 }; + unsigned char clientid2[] = { 0xff, 0xfe }; + + lease_hash_test_2hosts(clientid1, sizeof(clientid1), + clientid2, sizeof(clientid2)); +} + + +ATF_TC(lease_hash_string_2hosts); + +ATF_TC_HEAD(lease_hash_string_2hosts, tc) { + atf_tc_set_md_var(tc, "descr", "string-based lease hash tests"); + /* + * The following functions are tested: + * host_allocate(), host_new_hash(), buffer_allocate(), host_hash_lookup() + * host_hash_add(), host_hash_delete() + */ +} + +ATF_TC_BODY(lease_hash_string_2hosts, tc) { + + unsigned char clientid1[] = "Alice"; + unsigned char clientid2[] = "Bob"; + + lease_hash_test_2hosts(clientid1, 0, clientid2, 0); +} + + +ATF_TC(lease_hash_negative1); + +ATF_TC_HEAD(lease_hash_negative1, tc) { + atf_tc_set_md_var(tc, "descr", "Negative tests for lease hash"); +} + +ATF_TC_BODY(lease_hash_negative1, tc) { + + unsigned char clientid1[] = { 0x1 }; + unsigned char clientid2[] = { 0x0 }; + + lease_hash_test_2hosts(clientid1, 0, clientid2, 1); +} + + + +ATF_TC(lease_hash_string_3hosts); +ATF_TC_HEAD(lease_hash_string_3hosts, tc) { + atf_tc_set_md_var(tc, "descr", "string-based lease hash tests"); + /* + * The following functions are tested: + * host_allocate(), host_new_hash(), buffer_allocate(), host_hash_lookup() + * host_hash_add(), host_hash_delete() + */ +} +ATF_TC_BODY(lease_hash_string_3hosts, tc) { + + unsigned char clientid1[] = "Alice"; + unsigned char clientid2[] = "Bob"; + unsigned char clientid3[] = "Charlie"; + + lease_hash_test_3hosts(clientid1, 0, clientid2, 0, clientid3, 0); +} + + +ATF_TC(lease_hash_basic_3hosts); +ATF_TC_HEAD(lease_hash_basic_3hosts, tc) { + atf_tc_set_md_var(tc, "descr", "Basic lease hash tests"); + /* + * The following functions are tested: + * host_allocate(), host_new_hash(), buffer_allocate(), host_hash_lookup() + * host_hash_add(), host_hash_delete() + */ +} +ATF_TC_BODY(lease_hash_basic_3hosts, tc) { + + unsigned char clientid1[] = { 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9 }; + unsigned char clientid2[] = { 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8 }; + unsigned char clientid3[] = { 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; + + lease_hash_test_3hosts(clientid1, sizeof(clientid1), + clientid2, sizeof(clientid2), + clientid3, sizeof(clientid3)); +} + +#if 0 +/* This test is disabled as we solved the issue by prohibiting + the code from using an improper client id earlier and restoring + the hash code to its previous state. As we may choose to + redo the hash code again this test hasn't been deleted. +*/ +/* this test is a direct reproduction of 29851 issue */ +ATF_TC(uid_hash_rt29851); + +ATF_TC_HEAD(uid_hash_rt29851, tc) { + atf_tc_set_md_var(tc, "descr", "Uid hash tests"); + + /* + * this test should last less than millisecond. If its execution + * is longer than 3 second, we hit infinite loop. + */ + atf_tc_set_md_var(tc, "timeout", "3"); +} + +ATF_TC_BODY(uid_hash_rt29851, tc) { + + unsigned char clientid1[] = { 0x0 }; + unsigned char clientid2[] = { 0x0 }; + unsigned char clientid3[] = { 0x0 }; + + int clientid1_len = 1; + int clientid2_len = 1; + int clientid3_len = 0; + + struct lease *lease1 = 0, *lease2 = 0, *lease3 = 0; + + dhcp_db_objects_setup (); + dhcp_common_objects_setup (); + + ATF_CHECK(lease_id_new_hash(&lease_uid_hash, LEASE_HASH_SIZE, MDL)); + + ATF_CHECK(lease_allocate (&lease1, MDL) == ISC_R_SUCCESS); + ATF_CHECK(lease_allocate (&lease2, MDL) == ISC_R_SUCCESS); + ATF_CHECK(lease_allocate (&lease3, MDL) == ISC_R_SUCCESS); + + lease1->uid = clientid1; + lease2->uid = clientid2; + lease3->uid = clientid3; + + lease1->uid_len = clientid1_len; + lease2->uid_len = clientid2_len; + lease3->uid_len = clientid3_len; + + uid_hash_add(lease1); + /* uid_hash_delete(lease2); // not necessary for actual issue repro */ + uid_hash_add(lease3); + + /* lease2->uid_len = 0; // not necessary for actual issue repro */ + /* uid_hash_delete(lease2); // not necessary for actual issue repro */ + /* uid_hash_delete(lease3); // not necessary for actual issue repro */ + uid_hash_delete(lease1); + + /* lease2->uid_len = 1; // not necessary for actual issue repro */ + uid_hash_add(lease1); + uid_hash_delete(lease2); +} +#endif + +ATF_TP_ADD_TCS(tp) { + ATF_TP_ADD_TC(tp, lease_hash_basic_2hosts); + ATF_TP_ADD_TC(tp, lease_hash_basic_3hosts); + ATF_TP_ADD_TC(tp, lease_hash_string_2hosts); + ATF_TP_ADD_TC(tp, lease_hash_string_3hosts); + ATF_TP_ADD_TC(tp, lease_hash_negative1); +#if 0 /* see comment in function */ + ATF_TP_ADD_TC(tp, uid_hash_rt29851); +#endif + return (atf_no_error()); +} diff --git a/server/tests/load_bal_unittest.c b/server/tests/load_bal_unittest.c new file mode 100644 index 0000000..1500f34 --- /dev/null +++ b/server/tests/load_bal_unittest.c @@ -0,0 +1,191 @@ +/* + * Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include <config.h> + +#include "dhcpd.h" + +#include <atf-c.h> + +/* + * Test the load balancing code. + * + * The two main variables are: + * packet => the "packet" being processed + * state => the "state" of the failover peer + * We only fill in the fields necessary for our testing + * packet->raw->secs => amount of time the client has been trying + * packet->raw->hlen => the length of the mac address of the client + * packet->raw->chaddr => the mac address of the client + * To simplify the tests the mac address will be only 1 byte long and + * not really matter. Instead the hba will be all 1s and the tests + * will use the primary/secondary flag to change the expected result. + * + * state->i_am => primary or secondary + * state->load_balance_max_secs => maxixum time for a client to be trying + * before the other peer responds + * set to 5 for these tests + * state->hba = array of hash buckets assigning the hash to primary or secondary + * set to all ones (all primary) for theses tests + */ + +ATF_TC(load_balance); + +ATF_TC_HEAD(load_balance, tc) +{ + atf_tc_set_md_var(tc, "descr", "This test case checks that " + "load balancing works."); +} + +ATF_TC_BODY(load_balance, tc) +{ + struct packet packet; + struct dhcp_packet raw; + dhcp_failover_state_t pstate, sstate; + u_int8_t hba[256]; + + memset(&packet, 0, sizeof(struct packet)); + memset(&raw, 0, sizeof(struct dhcp_packet)); + packet.raw = &raw; + raw.hlen = 1; + raw.chaddr[0] = 14; + + memset(hba, 0xFF, 256); + + /* primary state */ + memset(&pstate, 0, sizeof(dhcp_failover_state_t)); + pstate.i_am = primary; + pstate.load_balance_max_secs = 5; + pstate.hba = hba; + + /* secondary state, we can reuse the hba as it doesn't change */ + memset(&sstate, 0, sizeof(dhcp_failover_state_t)); + sstate.i_am = secondary; + sstate.load_balance_max_secs = 5; + sstate.hba = hba; + + /* Basic check, primary accepted, secondary not */ + raw.secs = htons(0); + if (load_balance_mine(&packet, &pstate) != 1) { + atf_tc_fail("ERROR: primary not accepted %s:%d", MDL); + } + + if (load_balance_mine(&packet, &sstate) != 0) { + atf_tc_fail("ERROR: secondary accepted %s:%d", MDL); + } + + + /* Timeout not exceeded, primary accepted, secondary not */ + raw.secs = htons(2); + if (load_balance_mine(&packet, &pstate) != 1) { + atf_tc_fail("ERROR: primary not accepted %s:%d", MDL); + } + + if (load_balance_mine(&packet, &sstate) != 0) { + atf_tc_fail("ERROR: secondary accepted %s:%d", MDL); + } + + /* Timeout exceeded, both accepted */ + raw.secs = htons(6); + if (load_balance_mine(&packet, &pstate) != 1) { + atf_tc_fail("ERROR: primary not accepted %s:%d", MDL); + } + + if (load_balance_mine(&packet, &sstate) != 1) { + atf_tc_fail("ERROR: secondary not accepted %s:%d", MDL); + } + + /* Timeout exeeded with a large value, both accepted */ + raw.secs = htons(257); + if (load_balance_mine(&packet, &pstate) != 1) { + atf_tc_fail("ERROR: primary not accepted %s:%d", MDL); + } + + if (load_balance_mine(&packet, &sstate) != 1) { + atf_tc_fail("ERROR: secondary not accepted %s:%d", MDL); + } + +} + +ATF_TC(load_balance_swap); + +ATF_TC_HEAD(load_balance_swap, tc) +{ + atf_tc_set_md_var(tc, "descr", "This test case checks that " + "load balancing works with byteswapping."); +} + +ATF_TC_BODY(load_balance_swap, tc) +{ +#if defined(SECS_BYTEORDER) + struct packet packet; + struct dhcp_packet raw; + dhcp_failover_state_t pstate, sstate; + u_int8_t hba[256]; + + memset(&packet, 0, sizeof(struct packet)); + memset(&raw, 0, sizeof(struct dhcp_packet)); + packet.raw = &raw; + raw.hlen = 1; + raw.chaddr[0] = 14; + + memset(hba, 0xFF, 256); + + /* primary state */ + memset(&pstate, 0, sizeof(dhcp_failover_state_t)); + pstate.i_am = primary; + pstate.load_balance_max_secs = 5; + pstate.hba = hba; + + /* secondary state, we can reuse the hba as it doesn't change */ + memset(&sstate, 0, sizeof(dhcp_failover_state_t)); + sstate.i_am = secondary; + sstate.load_balance_max_secs = 5; + sstate.hba = hba; + + /* Small byteswapped timeout, primary accepted, secondary not*/ + raw.secs = htons(256); + if (load_balance_mine(&packet, &pstate) != 1) { + atf_tc_fail("ERROR: primary not accepted %s:%d", MDL); + } + + if (load_balance_mine(&packet, &sstate) != 0) { + atf_tc_fail("ERROR: secondary accepted %s:%d", MDL); + } + + /* Large byteswapped timeout, both accepted*/ + raw.secs = htons(256 * 6); + if (load_balance_mine(&packet, &pstate) != 1) { + atf_tc_fail("ERROR: primary not accepted %s:%d", MDL); + } + + if (load_balance_mine(&packet, &sstate) != 1) { + atf_tc_fail("ERROR: secondary not accepted %s:%d", MDL); + } + +#else + atf_tc_skip("SECS_BYTEORDER not defined"); +#endif +} + + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, load_balance); + ATF_TP_ADD_TC(tp, load_balance_swap); + + return (atf_no_error()); +} diff --git a/server/tests/mdb6_unittest.c b/server/tests/mdb6_unittest.c new file mode 100644 index 0000000..56b4718 --- /dev/null +++ b/server/tests/mdb6_unittest.c @@ -0,0 +1,957 @@ +/* + * Copyright (C) 2007-2012 by Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include "config.h" + +#include <sys/types.h> +#include <time.h> +#include <netinet/in.h> + +#include <stdarg.h> +#include "dhcpd.h" +#include "omapip/omapip.h" +#include "omapip/hash.h" +#include <isc/md5.h> + +#include <atf-c.h> + +#include <stdlib.h> + +void build_prefix6(struct in6_addr *pref, const struct in6_addr *net_start_pref, + int pool_bits, int pref_bits, + const struct data_string *input); + +/* + * Basic iaaddr manipulation. + * Verify construction and referencing of an iaaddr. + */ + +ATF_TC(iaaddr_basic); +ATF_TC_HEAD(iaaddr_basic, tc) +{ + atf_tc_set_md_var(tc, "descr", "This test case checks that basic " + "IAADDR manipulation is possible."); +} +ATF_TC_BODY(iaaddr_basic, tc) +{ + struct iasubopt *iaaddr; + struct iasubopt *iaaddr_copy; + + /* set up dhcp globals */ + dhcp_context_create(); + + /* and other common arguments */ + iaaddr = NULL; + iaaddr_copy = NULL; + + /* tests */ + if (iasubopt_allocate(&iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_allocate() %s:%d", MDL); + } + if (iaaddr->state != FTS_FREE) { + atf_tc_fail("ERROR: bad state %s:%d", MDL); + } + if (iaaddr->heap_index != -1) { + atf_tc_fail("ERROR: bad heap_index %s:%d", MDL); + } + if (iasubopt_reference(&iaaddr_copy, iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_reference() %s:%d", MDL); + } + if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_reference() %s:%d", MDL); + } + if (iasubopt_dereference(&iaaddr_copy, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_reference() %s:%d", MDL); + } +} + +/* + * Basic iaaddr sanity checks. + * Verify that the iaaddr code does some sanity checking. + */ + +ATF_TC(iaaddr_negative); +ATF_TC_HEAD(iaaddr_negative, tc) +{ + atf_tc_set_md_var(tc, "descr", "This test case checks that IAADDR " + "option code can handle various negative scenarios."); +} +ATF_TC_BODY(iaaddr_negative, tc) +{ + struct iasubopt *iaaddr; + struct iasubopt *iaaddr_copy; + + /* set up dhcp globals */ + dhcp_context_create(); + + /* tests */ + /* bogus allocate arguments */ + if (iasubopt_allocate(NULL, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: iasubopt_allocate() %s:%d", MDL); + } + iaaddr = (struct iasubopt *)1; + if (iasubopt_allocate(&iaaddr, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: iasubopt_allocate() %s:%d", MDL); + } + + /* bogus reference arguments */ + iaaddr = NULL; + if (iasubopt_allocate(&iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_allocate() %s:%d", MDL); + } + if (iasubopt_reference(NULL, iaaddr, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: iasubopt_reference() %s:%d", MDL); + } + iaaddr_copy = (struct iasubopt *)1; + if (iasubopt_reference(&iaaddr_copy, iaaddr, + MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: iasubopt_reference() %s:%d", MDL); + } + iaaddr_copy = NULL; + if (iasubopt_reference(&iaaddr_copy, NULL, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: iasubopt_reference() %s:%d", MDL); + } + if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_reference() %s:%d", MDL); + } + + /* bogus dereference arguments */ + if (iasubopt_dereference(NULL, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: iasubopt_dereference() %s:%d", MDL); + } + iaaddr = NULL; + if (iasubopt_dereference(&iaaddr, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: iasubopt_dereference() %s:%d", MDL); + } +} + +/* + * Basic ia_na manipulation. + */ + +ATF_TC(ia_na_basic); +ATF_TC_HEAD(ia_na_basic, tc) +{ + atf_tc_set_md_var(tc, "descr", "This test case checks that IA_NA code can " + "handle various basic scenarios."); +} +ATF_TC_BODY(ia_na_basic, tc) +{ + uint32_t iaid; + struct ia_xx *ia_na; + struct ia_xx *ia_na_copy; + struct iasubopt *iaaddr; + + /* set up dhcp globals */ + dhcp_context_create(); + + /* and other common arguments */ + iaid = 666; + ia_na = NULL; + ia_na_copy = NULL; + iaaddr = NULL; + + /* tests */ + if (ia_allocate(&ia_na, iaid, "TestDUID", 8, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ia_allocate() %s:%d", MDL); + } + if (memcmp(ia_na->iaid_duid.data, &iaid, sizeof(iaid)) != 0) { + atf_tc_fail("ERROR: bad IAID_DUID %s:%d", MDL); + } + if (memcmp(ia_na->iaid_duid.data+sizeof(iaid), "TestDUID", 8) != 0) { + atf_tc_fail("ERROR: bad IAID_DUID %s:%d", MDL); + } + if (ia_na->num_iasubopt != 0) { + atf_tc_fail("ERROR: bad num_iasubopt %s:%d", MDL); + } + if (ia_reference(&ia_na_copy, ia_na, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ia_reference() %s:%d", MDL); + } + if (iasubopt_allocate(&iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_allocate() %s:%d", MDL); + } + if (ia_add_iasubopt(ia_na, iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ia_add_iasubopt() %s:%d", MDL); + } + ia_remove_iasubopt(ia_na, iaaddr, MDL); + if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_reference() %s:%d", MDL); + } + if (ia_dereference(&ia_na, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ia_dereference() %s:%d", MDL); + } + if (ia_dereference(&ia_na_copy, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ia_dereference() %s:%d", MDL); + } +} + +/* + * Lots of iaaddr in our ia_na. + * Create many iaaddrs and attach them to an ia_na + * then clean up by removing them one at a time and + * all at once by dereferencing the ia_na. + */ + +ATF_TC(ia_na_manyaddrs); +ATF_TC_HEAD(ia_na_manyaddrs, tc) +{ + atf_tc_set_md_var(tc, "descr", "This test case checks that IA_NA can " + "handle lots of addresses."); +} +ATF_TC_BODY(ia_na_manyaddrs, tc) +{ + uint32_t iaid; + struct ia_xx *ia_na; + struct iasubopt *iaaddr; + int i; + + /* set up dhcp globals */ + dhcp_context_create(); + + /* tests */ + /* lots of iaaddr that we delete */ + iaid = 666; + ia_na = NULL; + if (ia_allocate(&ia_na, iaid, "TestDUID", 8, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ia_allocate() %s:%d", MDL); + } + for (i=0; i<100; i++) { + iaaddr = NULL; + if (iasubopt_allocate(&iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_allocate() %s:%d", MDL); + } + if (ia_add_iasubopt(ia_na, iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ia_add_iasubopt() %s:%d", MDL); + } + if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_reference() %s:%d", MDL); + } + } + +#if 0 + for (i=0; i<100; i++) { + iaaddr = ia_na->iasubopt[random() % ia_na->num_iasubopt]; + ia_remove_iasubopt(ia_na, iaaddr, MDL); + /* TODO: valgrind reports problem here: Invalid read of size 8 + * Address 0x51e6258 is 56 bytes inside a block of size 88 free'd */ + } +#endif + if (ia_dereference(&ia_na, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ia_dereference() %s:%d", MDL); + } + + /* lots of iaaddr, let dereference cleanup */ + iaid = 666; + ia_na = NULL; + if (ia_allocate(&ia_na, iaid, "TestDUID", 8, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ia_allocate() %s:%d", MDL); + } + for (i=0; i<100; i++) { + iaaddr = NULL; + if (iasubopt_allocate(&iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_allocate() %s:%d", MDL); + } + if (ia_add_iasubopt(ia_na, iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ia_add_iasubopt() %s:%d", MDL); + } + if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_reference() %s:%d", MDL); + } + } + if (ia_dereference(&ia_na, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ia_dereference() %s:%d", MDL); + } +} + +/* + * Basic ia_na sanity checks. + * Verify that the ia_na code does some sanity checking. + */ + +ATF_TC(ia_na_negative); +ATF_TC_HEAD(ia_na_negative, tc) +{ + atf_tc_set_md_var(tc, "descr", "This test case checks that IA_NA option " + "code can handle various negative scenarios."); +} +ATF_TC_BODY(ia_na_negative, tc) +{ + uint32_t iaid; + struct ia_xx *ia_na; + struct ia_xx *ia_na_copy; + + /* set up dhcp globals */ + dhcp_context_create(); + + /* tests */ + /* bogus allocate arguments */ + if (ia_allocate(NULL, 123, "", 0, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: ia_allocate() %s:%d", MDL); + } + ia_na = (struct ia_xx *)1; + if (ia_allocate(&ia_na, 456, "", 0, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: ia_allocate() %s:%d", MDL); + } + + /* bogus reference arguments */ + iaid = 666; + ia_na = NULL; + if (ia_allocate(&ia_na, iaid, "TestDUID", 8, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ia_allocate() %s:%d", MDL); + } + if (ia_reference(NULL, ia_na, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: ia_reference() %s:%d", MDL); + } + ia_na_copy = (struct ia_xx *)1; + if (ia_reference(&ia_na_copy, ia_na, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: ia_reference() %s:%d", MDL); + } + ia_na_copy = NULL; + if (ia_reference(&ia_na_copy, NULL, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: ia_reference() %s:%d", MDL); + } + if (ia_dereference(&ia_na, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ia_dereference() %s:%d", MDL); + } + + /* bogus dereference arguments */ + if (ia_dereference(NULL, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: ia_dereference() %s:%d", MDL); + } + + /* bogus remove */ + iaid = 666; + ia_na = NULL; + if (ia_allocate(&ia_na, iaid, "TestDUID", 8, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ia_allocate() %s:%d", MDL); + } + ia_remove_iasubopt(ia_na, NULL, MDL); + if (ia_dereference(&ia_na, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ia_dereference() %s:%d", MDL); + } +} + +/* + * Basic ipv6_pool manipulation. + * Verify that basic pool operations work properly. + * The operations include creating a pool and creating, + * renewing, expiring, releasing and declining addresses. + */ + +ATF_TC(ipv6_pool_basic); +ATF_TC_HEAD(ipv6_pool_basic, tc) +{ + atf_tc_set_md_var(tc, "descr", "This test case checks that IPv6 pool " + "manipulation is possible."); +} +ATF_TC_BODY(ipv6_pool_basic, tc) +{ + struct iasubopt *iaaddr; + struct in6_addr addr; + struct ipv6_pool *pool; + struct ipv6_pool *pool_copy; + char addr_buf[INET6_ADDRSTRLEN]; + char *uid; + struct data_string ds; + struct iasubopt *expired_iaaddr; + unsigned int attempts; + + /* set up dhcp globals */ + dhcp_context_create(); + + /* and other common arguments */ + inet_pton(AF_INET6, "1:2:3:4::", &addr); + + uid = "client0"; + memset(&ds, 0, sizeof(ds)); + ds.len = strlen(uid); + if (!buffer_allocate(&ds.buffer, ds.len, MDL)) { + atf_tc_fail("Out of memory"); + } + ds.data = ds.buffer->data; + memcpy((char *)ds.data, uid, ds.len); + + /* tests */ + /* allocate, reference */ + pool = NULL; + if (ipv6_pool_allocate(&pool, D6O_IA_NA, &addr, + 64, 128, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ipv6_pool_allocate() %s:%d", MDL); + } + if (pool->num_active != 0) { + atf_tc_fail("ERROR: bad num_active %s:%d", MDL); + } + if (pool->bits != 64) { + atf_tc_fail("ERROR: bad bits %s:%d", MDL); + } + inet_ntop(AF_INET6, &pool->start_addr, addr_buf, sizeof(addr_buf)); + if (strcmp(inet_ntop(AF_INET6, &pool->start_addr, addr_buf, + sizeof(addr_buf)), "1:2:3:4::") != 0) { + atf_tc_fail("ERROR: bad start_addr %s:%d", MDL); + } + pool_copy = NULL; + if (ipv6_pool_reference(&pool_copy, pool, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ipv6_pool_reference() %s:%d", MDL); + } + + /* create_lease6, renew_lease6, expire_lease6 */ + iaaddr = NULL; + if (create_lease6(pool, &iaaddr, + &attempts, &ds, 1) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: create_lease6() %s:%d", MDL); + } + if (pool->num_inactive != 1) { + atf_tc_fail("ERROR: bad num_inactive %s:%d", MDL); + } + if (renew_lease6(pool, iaaddr) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: renew_lease6() %s:%d", MDL); + } + if (pool->num_active != 1) { + atf_tc_fail("ERROR: bad num_active %s:%d", MDL); + } + expired_iaaddr = NULL; + if (expire_lease6(&expired_iaaddr, pool, 0) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: expire_lease6() %s:%d", MDL); + } + if (expired_iaaddr != NULL) { + atf_tc_fail("ERROR: should not have expired a lease %s:%d", MDL); + } + if (pool->num_active != 1) { + atf_tc_fail("ERROR: bad num_active %s:%d", MDL); + } + if (expire_lease6(&expired_iaaddr, pool, 1000) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: expire_lease6() %s:%d", MDL); + } + if (expired_iaaddr == NULL) { + atf_tc_fail("ERROR: should have expired a lease %s:%d", MDL); + } + if (iasubopt_dereference(&expired_iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_dereference() %s:%d", MDL); + } + if (pool->num_active != 0) { + atf_tc_fail("ERROR: bad num_active %s:%d", MDL); + } + if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_dereference() %s:%d", MDL); + } + + /* release_lease6, decline_lease6 */ + if (create_lease6(pool, &iaaddr, &attempts, + &ds, 1) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: create_lease6() %s:%d", MDL); + } + if (renew_lease6(pool, iaaddr) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: renew_lease6() %s:%d", MDL); + } + if (pool->num_active != 1) { + atf_tc_fail("ERROR: bad num_active %s:%d", MDL); + } + if (release_lease6(pool, iaaddr) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: decline_lease6() %s:%d", MDL); + } + if (pool->num_active != 0) { + atf_tc_fail("ERROR: bad num_active %s:%d", MDL); + } + if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_dereference() %s:%d", MDL); + } + if (create_lease6(pool, &iaaddr, &attempts, + &ds, 1) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: create_lease6() %s:%d", MDL); + } + if (renew_lease6(pool, iaaddr) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: renew_lease6() %s:%d", MDL); + } + if (pool->num_active != 1) { + atf_tc_fail("ERROR: bad num_active %s:%d", MDL); + } + if (decline_lease6(pool, iaaddr) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: decline_lease6() %s:%d", MDL); + } + if (pool->num_active != 1) { + atf_tc_fail("ERROR: bad num_active %s:%d", MDL); + } + if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_dereference() %s:%d", MDL); + } + + /* dereference */ + if (ipv6_pool_dereference(&pool, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ipv6_pool_reference() %s:%d", MDL); + } + if (ipv6_pool_dereference(&pool_copy, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ipv6_pool_reference() %s:%d", MDL); + } +} + +/* + * Basic ipv6_pool sanity checks. + * Verify that the ipv6_pool code does some sanity checking. + */ + +ATF_TC(ipv6_pool_negative); +ATF_TC_HEAD(ipv6_pool_negative, tc) +{ + atf_tc_set_md_var(tc, "descr", "This test case checks that IPv6 pool " + "can handle negative cases."); +} +ATF_TC_BODY(ipv6_pool_negative, tc) +{ + struct in6_addr addr; + struct ipv6_pool *pool; + struct ipv6_pool *pool_copy; + + /* set up dhcp globals */ + dhcp_context_create(); + + /* and other common arguments */ + inet_pton(AF_INET6, "1:2:3:4::", &addr); + + /* tests */ + if (ipv6_pool_allocate(NULL, D6O_IA_NA, &addr, + 64, 128, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: ipv6_pool_allocate() %s:%d", MDL); + } + pool = (struct ipv6_pool *)1; + if (ipv6_pool_allocate(&pool, D6O_IA_NA, &addr, + 64, 128, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: ipv6_pool_allocate() %s:%d", MDL); + } + if (ipv6_pool_reference(NULL, pool, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: ipv6_pool_reference() %s:%d", MDL); + } + pool_copy = (struct ipv6_pool *)1; + if (ipv6_pool_reference(&pool_copy, pool, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: ipv6_pool_reference() %s:%d", MDL); + } + pool_copy = NULL; + if (ipv6_pool_reference(&pool_copy, NULL, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: ipv6_pool_reference() %s:%d", MDL); + } + if (ipv6_pool_dereference(NULL, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: ipv6_pool_dereference() %s:%d", MDL); + } + if (ipv6_pool_dereference(&pool_copy, MDL) != DHCP_R_INVALIDARG) { + atf_tc_fail("ERROR: ipv6_pool_dereference() %s:%d", MDL); + } +} + + +/* + * Order of expiration. + * Add several addresses to a pool and check that + * they expire in the proper order. + */ + +ATF_TC(expire_order); +ATF_TC_HEAD(expire_order, tc) +{ + atf_tc_set_md_var(tc, "descr", "This test case checks that order " + "of lease expiration is handled properly."); +} +ATF_TC_BODY(expire_order, tc) +{ + struct iasubopt *iaaddr; + struct ipv6_pool *pool; + struct in6_addr addr; + int i; + char *uid; + struct data_string ds; + struct iasubopt *expired_iaaddr; + unsigned int attempts; + + /* set up dhcp globals */ + dhcp_context_create(); + + /* and other common arguments */ + inet_pton(AF_INET6, "1:2:3:4::", &addr); + + uid = "client0"; + memset(&ds, 0, sizeof(ds)); + ds.len = strlen(uid); + if (!buffer_allocate(&ds.buffer, ds.len, MDL)) { + atf_tc_fail("Out of memory"); + } + ds.data = ds.buffer->data; + memcpy((char *)ds.data, uid, ds.len); + + iaaddr = NULL; + expired_iaaddr = NULL; + + /* tests */ + pool = NULL; + if (ipv6_pool_allocate(&pool, D6O_IA_NA, &addr, + 64, 128, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ipv6_pool_allocate() %s:%d", MDL); + } + + for (i=10; i<100; i+=10) { + if (create_lease6(pool, &iaaddr, &attempts, + &ds, i) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: create_lease6() %s:%d", MDL); + } + if (renew_lease6(pool, iaaddr) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: renew_lease6() %s:%d", MDL); + } + if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_dereference() %s:%d", MDL); + } + if (pool->num_active != (i / 10)) { + atf_tc_fail("ERROR: bad num_active %s:%d", MDL); + } + } + if (pool->num_active != 9) { + atf_tc_fail("ERROR: bad num_active %s:%d", MDL); + } + + for (i=10; i<100; i+=10) { + if (expire_lease6(&expired_iaaddr, + pool, 1000) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: expire_lease6() %s:%d", MDL); + } + if (expired_iaaddr == NULL) { + atf_tc_fail("ERROR: should have expired a lease %s:%d", + MDL); + } + if (pool->num_active != (9 - (i / 10))) { + atf_tc_fail("ERROR: bad num_active %s:%d", MDL); + } + if (expired_iaaddr->hard_lifetime_end_time != i) { + atf_tc_fail("ERROR: bad hard_lifetime_end_time %s:%d", + MDL); + } + if (iasubopt_dereference(&expired_iaaddr, MDL) != + ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_dereference() %s:%d", MDL); + } + } + if (pool->num_active != 0) { + atf_tc_fail("ERROR: bad num_active %s:%d", MDL); + } + expired_iaaddr = NULL; + if (expire_lease6(&expired_iaaddr, pool, 1000) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: expire_lease6() %s:%d", MDL); + } + if (ipv6_pool_dereference(&pool, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ipv6_pool_dereference() %s:%d", MDL); + } +} + +/* + * Reduce the expiration period of a lease. + * This test reduces the expiration period of + * a lease to verify we process reductions + * properly. + */ +ATF_TC(expire_order_reduce); +ATF_TC_HEAD(expire_order_reduce, tc) +{ + atf_tc_set_md_var(tc, "descr", "This test case checks that reducing " + "the expiration time of a lease works properly."); +} +ATF_TC_BODY(expire_order_reduce, tc) +{ + struct iasubopt *iaaddr1, *iaaddr2; + struct ipv6_pool *pool; + struct in6_addr addr; + char *uid; + struct data_string ds; + struct iasubopt *expired_iaaddr; + unsigned int attempts; + + /* set up dhcp globals */ + dhcp_context_create(); + + /* and other common arguments */ + inet_pton(AF_INET6, "1:2:3:4::", &addr); + + uid = "client0"; + memset(&ds, 0, sizeof(ds)); + ds.len = strlen(uid); + if (!buffer_allocate(&ds.buffer, ds.len, MDL)) { + atf_tc_fail("Out of memory"); + } + ds.data = ds.buffer->data; + memcpy((char *)ds.data, uid, ds.len); + + pool = NULL; + iaaddr1 = NULL; + iaaddr2 = NULL; + expired_iaaddr = NULL; + + /* + * Add two leases iaaddr1 with expire time of 200 + * and iaaddr2 with expire time of 300. Then update + * iaaddr2 to expire in 100 instead. This should cause + * iaaddr2 to move with the hash list. + */ + /* create pool and add iaaddr1 and iaaddr2 */ + if (ipv6_pool_allocate(&pool, D6O_IA_NA, &addr, + 64, 128, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ipv6_pool_allocate() %s:%d", MDL); + } + if (create_lease6(pool, &iaaddr1, &attempts, &ds, 200) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: create_lease6() %s:%d", MDL); + } + if (renew_lease6(pool, iaaddr1) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: renew_lease6() %s:%d", MDL); + } + if (create_lease6(pool, &iaaddr2, &attempts, &ds, 300) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: create_lease6() %s:%d", MDL); + } + if (renew_lease6(pool, iaaddr2) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: renew_lease6() %s:%d", MDL); + } + + /* verify pool */ + if (pool->num_active != 2) { + atf_tc_fail("ERROR: bad num_active %s:%d", MDL); + } + + /* reduce lease for iaaddr2 */ + iaaddr2->soft_lifetime_end_time = 100; + if (renew_lease6(pool, iaaddr2) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: renew_lease6() %s:%d", MDL); + } + + /* expire a lease, it should be iaaddr2 with an expire time of 100 */ + if (expire_lease6(&expired_iaaddr, pool, 1000) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: expire_lease6() %s:%d", MDL); + } + if (expired_iaaddr == NULL) { + atf_tc_fail("ERROR: should have expired a lease %s:%d", MDL); + } + if (expired_iaaddr != iaaddr2) { + atf_tc_fail("Error: incorrect lease expired %s:%d", MDL); + } + if (expired_iaaddr->hard_lifetime_end_time != 100) { + atf_tc_fail("ERROR: bad hard_lifetime_end_time %s:%d", MDL); + } + if (iasubopt_dereference(&expired_iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_dereference() %s:%d", MDL); + } + + /* expire a lease, it should be iaaddr1 with an expire time of 200 */ + if (expire_lease6(&expired_iaaddr, pool, 1000) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: expire_lease6() %s:%d", MDL); + } + if (expired_iaaddr == NULL) { + atf_tc_fail("ERROR: should have expired a lease %s:%d", MDL); + } + if (expired_iaaddr != iaaddr1) { + atf_tc_fail("Error: incorrect lease expired %s:%d", MDL); + } + if (expired_iaaddr->hard_lifetime_end_time != 200) { + atf_tc_fail("ERROR: bad hard_lifetime_end_time %s:%d", MDL); + } + if (iasubopt_dereference(&expired_iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_dereference() %s:%d", MDL); + } + + /* cleanup */ + if (iasubopt_dereference(&iaaddr1, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_dereference() %s:%d", MDL); + } + if (iasubopt_dereference(&iaaddr2, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_dereference() %s:%d", MDL); + } + if (ipv6_pool_dereference(&pool, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ipv6_pool_dereference() %s:%d", MDL); + } +} + +/* + * Small pool. + * check that a small pool behaves properly. + */ + +ATF_TC(small_pool); +ATF_TC_HEAD(small_pool, tc) +{ + atf_tc_set_md_var(tc, "descr", "This test case checks that small pool " + "is handled properly."); +} +ATF_TC_BODY(small_pool, tc) +{ + struct in6_addr addr; + struct ipv6_pool *pool; + struct iasubopt *iaaddr; + char *uid; + struct data_string ds; + unsigned int attempts; + + /* set up dhcp globals */ + dhcp_context_create(); + + /* and other common arguments */ + inet_pton(AF_INET6, "1:2:3:4::", &addr); + addr.s6_addr[14] = 0x81; + + uid = "client0"; + memset(&ds, 0, sizeof(ds)); + ds.len = strlen(uid); + if (!buffer_allocate(&ds.buffer, ds.len, MDL)) { + atf_tc_fail("Out of memory"); + } + ds.data = ds.buffer->data; + memcpy((char *)ds.data, uid, ds.len); + + pool = NULL; + iaaddr = NULL; + + /* tests */ + if (ipv6_pool_allocate(&pool, D6O_IA_NA, &addr, + 127, 128, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ipv6_pool_allocate() %s:%d", MDL); + } + + if (create_lease6(pool, &iaaddr, &attempts, + &ds, 42) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: create_lease6() %s:%d", MDL); + } + if (renew_lease6(pool, iaaddr) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: renew_lease6() %s:%d", MDL); + } + if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_dereference() %s:%d", MDL); + } + if (create_lease6(pool, &iaaddr, &attempts, + &ds, 11) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: create_lease6() %s:%d", MDL); + } + if (renew_lease6(pool, iaaddr) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: renew_lease6() %s:%d", MDL); + } + if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: iasubopt_dereference() %s:%d", MDL); + } + if (create_lease6(pool, &iaaddr, &attempts, + &ds, 11) != ISC_R_NORESOURCES) { + atf_tc_fail("ERROR: create_lease6() %s:%d", MDL); + } + if (ipv6_pool_dereference(&pool, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ipv6_pool_dereference() %s:%d", MDL); + } +} + +/* + * Address to pool mapping. + * Verify that we find the proper pool for an address + * or don't find a pool if we don't have one for the given + * address. + */ +ATF_TC(many_pools); +ATF_TC_HEAD(many_pools, tc) +{ + atf_tc_set_md_var(tc, "descr", "This test case checks that functions " + "across all pools are working correctly."); +} +ATF_TC_BODY(many_pools, tc) +{ + struct in6_addr addr; + struct ipv6_pool *pool; + + /* set up dhcp globals */ + dhcp_context_create(); + + /* and other common arguments */ + inet_pton(AF_INET6, "1:2:3:4::", &addr); + + /* tests */ + + pool = NULL; + if (ipv6_pool_allocate(&pool, D6O_IA_NA, &addr, + 64, 128, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ipv6_pool_allocate() %s:%d", MDL); + } + if (add_ipv6_pool(pool) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: add_ipv6_pool() %s:%d", MDL); + } + if (ipv6_pool_dereference(&pool, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ipv6_pool_dereference() %s:%d", MDL); + } + pool = NULL; + if (find_ipv6_pool(&pool, D6O_IA_NA, &addr) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: find_ipv6_pool() %s:%d", MDL); + } + if (ipv6_pool_dereference(&pool, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ipv6_pool_dereference() %s:%d", MDL); + } + inet_pton(AF_INET6, "1:2:3:4:ffff:ffff:ffff:ffff", &addr); + pool = NULL; + if (find_ipv6_pool(&pool, D6O_IA_NA, &addr) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: find_ipv6_pool() %s:%d", MDL); + } + if (ipv6_pool_dereference(&pool, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ipv6_pool_dereference() %s:%d", MDL); + } + inet_pton(AF_INET6, "1:2:3:5::", &addr); + pool = NULL; + if (find_ipv6_pool(&pool, D6O_IA_NA, &addr) != ISC_R_NOTFOUND) { + atf_tc_fail("ERROR: find_ipv6_pool() %s:%d", MDL); + } + inet_pton(AF_INET6, "1:2:3:3:ffff:ffff:ffff:ffff", &addr); + pool = NULL; + if (find_ipv6_pool(&pool, D6O_IA_NA, &addr) != ISC_R_NOTFOUND) { + atf_tc_fail("ERROR: find_ipv6_pool() %s:%d", MDL); + } + +/* iaid = 666; + ia_na = NULL; + if (ia_allocate(&ia_na, iaid, "TestDUID", 8, MDL) != ISC_R_SUCCESS) { + atf_tc_fail("ERROR: ia_allocate() %s:%d", MDL); + }*/ + + { + struct in6_addr r; + struct data_string ds; + u_char data[16]; + char buf[64]; + int i, j; + + memset(&ds, 0, sizeof(ds)); + memset(data, 0xaa, sizeof(data)); + ds.len = 16; + ds.data = data; + + inet_pton(AF_INET6, "3ffe:501:ffff:100::", &addr); + for (i = 32; i < 42; i++) + for (j = i + 1; j < 49; j++) { + memset(&r, 0, sizeof(r)); + memset(buf, 0, 64); + build_prefix6(&r, &addr, i, j, &ds); + inet_ntop(AF_INET6, &r, buf, 64); + printf("%d,%d-> %s/%d\n", i, j, buf, j); + } + } +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, iaaddr_basic); + ATF_TP_ADD_TC(tp, iaaddr_negative); + ATF_TP_ADD_TC(tp, ia_na_basic); + ATF_TP_ADD_TC(tp, ia_na_manyaddrs); + ATF_TP_ADD_TC(tp, ia_na_negative); + ATF_TP_ADD_TC(tp, ipv6_pool_basic); + ATF_TP_ADD_TC(tp, ipv6_pool_negative); + ATF_TP_ADD_TC(tp, expire_order); + ATF_TP_ADD_TC(tp, expire_order_reduce); + ATF_TP_ADD_TC(tp, small_pool); + ATF_TP_ADD_TC(tp, many_pools); + + return (atf_no_error()); +} diff --git a/server/tests/simple_unittest.c b/server/tests/simple_unittest.c new file mode 100644 index 0000000..e6d04b9 --- /dev/null +++ b/server/tests/simple_unittest.c @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include <config.h> +#include <atf-c.h> + +/* That is an example ATF test case, tailored to ISC DHCP sources. + For detailed description with examples, see man 3 atf-c-api. */ + +/* this macro defines a name of a test case. Typical test case constists + of an initial test declaration (ATF_TC()) followed by 3 phases: + + - Initialization: ATF_TC_HEAD() + - Main body: ATF_TC_BODY() + - Cleanup: ATF_TC_CLEANUP() + + In many cases initialization or cleanup are not needed. Use + ATF_TC_WITHOUT_HEAD() or ATF_TC_WITH_CLEANUP() as needed. */ +ATF_TC(simple_test_case); + + +ATF_TC_HEAD(simple_test_case, tc) +{ + atf_tc_set_md_var(tc, "descr", "This test case is a simple DHCP test."); +} +ATF_TC_BODY(simple_test_case, tc) +{ + int condition = 1; + int this_is_linux = 1; + /* Failing condition will fail the test, but the code + itself will continue */ + ATF_CHECK( 2 > 1 ); + + /* assert style check. Test will abort if the condition is not met. */ + ATF_REQUIRE( 5 > 4 ); + + ATF_CHECK_EQ(4, 2 + 2); /* Non-fatal test. */ + ATF_REQUIRE_EQ(4, 2 + 2); /* Fatal test. */ + + /* tests can also explicitly report test result */ + if (!condition) { + atf_tc_fail("Condition not met!"); /* Explicit failure. */ + } + + if (!this_is_linux) { + atf_tc_skip("Skipping test. This Linux-only test."); + } + + if (condition && this_is_linux) { + /* no extra comments for pass needed. It just passed. */ + atf_tc_pass(); + } + +} + +/* This macro defines main() method that will call specified + test cases. tp and simple_test_case names can be whatever you want + as long as it is a valid variable identifier. */ +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, simple_test_case); + + return (atf_no_error()); +} |