2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-09-03 15:56:00 +00:00

[master] Merge branch 'rt25901_atf'

Conflicts:
	configure
This commit is contained in:
Tomek Mrugalski
2012-08-14 15:20:46 +02:00
39 changed files with 5487 additions and 1424 deletions

4
.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
*.o
bind
doc/html
.deps

View File

@@ -19,7 +19,8 @@ EXTRA_DIST = RELNOTES LICENSE \
doc/ja_JP.eucJP/dhcp-eval.5 doc/ja_JP.eucJP/dhcp-options.5 \
doc/examples/dhclient-dhcpv6.conf doc/examples/dhcpd-dhcpv6.conf \
util/bindvar.sh \
bind/Makefile bind/bind.tar.gz bind/version.tmp
bind/Makefile bind/bind.tar.gz bind/version.tmp \
common/tests/Atffile server/tests/Atffile
SUBDIRS = bind includes tests common dst omapip client dhcpctl relay server

View File

@@ -33,7 +33,8 @@ POST_UNINSTALL = :
subdir = .
DIST_COMMON = README $(am__configure_deps) $(nobase_include_HEADERS) \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/configure depcomp install-sh missing
$(top_srcdir)/configure $(top_srcdir)/doc/devel/doxyfile.in \
depcomp install-sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -42,7 +43,7 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/includes/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_FILES = doc/devel/doxyfile
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
@@ -79,6 +80,8 @@ distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
ATF_CFLAGS = @ATF_CFLAGS@
ATF_LDFLAGS = @ATF_LDFLAGS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
@@ -185,7 +188,8 @@ EXTRA_DIST = RELNOTES LICENSE \
doc/ja_JP.eucJP/dhcp-eval.5 doc/ja_JP.eucJP/dhcp-options.5 \
doc/examples/dhclient-dhcpv6.conf doc/examples/dhcpd-dhcpv6.conf \
util/bindvar.sh \
bind/Makefile bind/bind.tar.gz bind/version.tmp
bind/Makefile bind/bind.tar.gz bind/version.tmp \
common/tests/Atffile server/tests/Atffile
SUBDIRS = bind includes tests common dst omapip client dhcpctl relay server
nobase_include_HEADERS = dhcpctl/dhcpctl.h
@@ -216,6 +220,8 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
doc/devel/doxyfile: $(top_builddir)/config.status $(top_srcdir)/doc/devel/doxyfile.in
cd $(top_builddir) && $(SHELL) ./config.status $@
install-nobase_includeHEADERS: $(nobase_include_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"

View File

@@ -77,6 +77,8 @@ CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
ATF_CFLAGS = @ATF_CFLAGS@
ATF_LDFLAGS = @ATF_LDFLAGS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@

View File

@@ -10,4 +10,8 @@ libdhcp_a_SOURCES = alloc.c bpf.c comapi.c conflex.c ctrace.c discover.c \
man_MANS = dhcp-eval.5 dhcp-options.5
EXTRA_DIST = $(man_MANS)
SUBDIRS = tests
# We want to build this directory first, before descending into tests subdir.
# The reason is that ideally the tests should link existing objects from this
# directory. That eliminates any discrepancies between tested code and
# production code. Sadly, we are not there yet.
SUBDIRS = . tests

View File

@@ -82,6 +82,8 @@ DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
ATF_CFLAGS = @ATF_CFLAGS@
ATF_LDFLAGS = @ATF_LDFLAGS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
@@ -182,7 +184,12 @@ libdhcp_a_SOURCES = alloc.c bpf.c comapi.c conflex.c ctrace.c discover.c \
man_MANS = dhcp-eval.5 dhcp-options.5
EXTRA_DIST = $(man_MANS)
SUBDIRS = tests
# We want to build this directory first, before descending into tests subdir.
# The reason is that ideally the tests should link existing objects from this
# directory. That eliminates any discrepancies between tested code and
# production code. Sadly, we are not there yet.
SUBDIRS = . tests
all: all-recursive
.SUFFIXES:

5
common/tests/Atffile Normal file
View File

@@ -0,0 +1,5 @@
Content-Type: application/X-atf-atffile; version="1"
prop: test-suite = dhcp4
tp-glob: *_unittest

View File

@@ -1,11 +1,22 @@
AM_CPPFLAGS = -I../..
SUBDIRS = .
check_PROGRAMS = test_alloc
AM_CPPFLAGS = $(ATF_CFLAGS) -std=c99 -I$(top_srcdir)/includes
TESTS = test_alloc
ATF_TESTS =
test_alloc_SOURCES = test_alloc.c
test_alloc_LDADD = ../libdhcp.a ../../tests/libt_api.a \
if HAVE_ATF
ATF_TESTS += alloc_unittest
alloc_unittest_SOURCES = test_alloc.c $(top_srcdir)/tests/t_api_dhcp.c
alloc_unittest_LDADD = $(ATF_LDFLAGS)
alloc_unittest_LDADD += ../libdhcp.a \
../../omapip/libomapi.a ../../bind/lib/libdns.a \
../../bind/lib/libisc.a
endif
check: $(ATF_TESTS)
atf-run | atf-report
check_PROGRAMS = $(ATF_TESTS)

View File

@@ -29,8 +29,8 @@ POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
check_PROGRAMS = test_alloc$(EXEEXT)
TESTS = test_alloc$(EXEEXT)
@HAVE_ATF_TRUE@am__append_1 = alloc_unittest
check_PROGRAMS = $(am__EXEEXT_2)
subdir = common/tests
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -40,11 +40,17 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/includes/config.h
CONFIG_CLEAN_FILES =
am_test_alloc_OBJECTS = test_alloc.$(OBJEXT)
test_alloc_OBJECTS = $(am_test_alloc_OBJECTS)
test_alloc_DEPENDENCIES = ../libdhcp.a ../../tests/libt_api.a \
../../omapip/libomapi.a ../../bind/lib/libdns.a \
../../bind/lib/libisc.a
@HAVE_ATF_TRUE@am__EXEEXT_1 = alloc_unittest$(EXEEXT)
am__EXEEXT_2 = $(am__EXEEXT_1)
am__alloc_unittest_SOURCES_DIST = test_alloc.c \
$(top_srcdir)/tests/t_api_dhcp.c
@HAVE_ATF_TRUE@am_alloc_unittest_OBJECTS = test_alloc.$(OBJEXT) \
@HAVE_ATF_TRUE@ t_api_dhcp.$(OBJEXT)
alloc_unittest_OBJECTS = $(am_alloc_unittest_OBJECTS)
am__DEPENDENCIES_1 =
@HAVE_ATF_TRUE@alloc_unittest_DEPENDENCIES = $(am__DEPENDENCIES_1) \
@HAVE_ATF_TRUE@ ../libdhcp.a ../../omapip/libomapi.a \
@HAVE_ATF_TRUE@ ../../bind/lib/libdns.a ../../bind/lib/libisc.a
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/includes
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -52,13 +58,25 @@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(test_alloc_SOURCES)
DIST_SOURCES = $(test_alloc_SOURCES)
SOURCES = $(alloc_unittest_SOURCES)
DIST_SOURCES = $(am__alloc_unittest_SOURCES_DIST)
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
install-html-recursive install-info-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
ATF_CFLAGS = @ATF_CFLAGS@
ATF_LDFLAGS = @ATF_LDFLAGS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
@@ -148,13 +166,14 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AM_CPPFLAGS = -I../..
test_alloc_SOURCES = test_alloc.c
test_alloc_LDADD = ../libdhcp.a ../../tests/libt_api.a \
../../omapip/libomapi.a ../../bind/lib/libdns.a \
../../bind/lib/libisc.a
all: all-am
SUBDIRS = .
AM_CPPFLAGS = $(ATF_CFLAGS) -std=c99 -I$(top_srcdir)/includes
ATF_TESTS = $(am__append_1)
@HAVE_ATF_TRUE@alloc_unittest_SOURCES = test_alloc.c $(top_srcdir)/tests/t_api_dhcp.c
@HAVE_ATF_TRUE@alloc_unittest_LDADD = $(ATF_LDFLAGS) ../libdhcp.a \
@HAVE_ATF_TRUE@ ../../omapip/libomapi.a ../../bind/lib/libdns.a \
@HAVE_ATF_TRUE@ ../../bind/lib/libisc.a
all: all-recursive
.SUFFIXES:
.SUFFIXES: .c .o .obj
@@ -190,9 +209,9 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
clean-checkPROGRAMS:
-test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS)
test_alloc$(EXEEXT): $(test_alloc_OBJECTS) $(test_alloc_DEPENDENCIES)
@rm -f test_alloc$(EXEEXT)
$(LINK) $(test_alloc_OBJECTS) $(test_alloc_LDADD) $(LIBS)
alloc_unittest$(EXEEXT): $(alloc_unittest_OBJECTS) $(alloc_unittest_DEPENDENCIES)
@rm -f alloc_unittest$(EXEEXT)
$(LINK) $(alloc_unittest_OBJECTS) $(alloc_unittest_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -200,6 +219,7 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_api_dhcp.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_alloc.Po@am__quote@
.c.o:
@@ -216,6 +236,90 @@ distclean-compile:
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
t_api_dhcp.o: $(top_srcdir)/tests/t_api_dhcp.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT t_api_dhcp.o -MD -MP -MF $(DEPDIR)/t_api_dhcp.Tpo -c -o t_api_dhcp.o `test -f '$(top_srcdir)/tests/t_api_dhcp.c' || echo '$(srcdir)/'`$(top_srcdir)/tests/t_api_dhcp.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/t_api_dhcp.Tpo $(DEPDIR)/t_api_dhcp.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/tests/t_api_dhcp.c' object='t_api_dhcp.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o t_api_dhcp.o `test -f '$(top_srcdir)/tests/t_api_dhcp.c' || echo '$(srcdir)/'`$(top_srcdir)/tests/t_api_dhcp.c
t_api_dhcp.obj: $(top_srcdir)/tests/t_api_dhcp.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT t_api_dhcp.obj -MD -MP -MF $(DEPDIR)/t_api_dhcp.Tpo -c -o t_api_dhcp.obj `if test -f '$(top_srcdir)/tests/t_api_dhcp.c'; then $(CYGPATH_W) '$(top_srcdir)/tests/t_api_dhcp.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/tests/t_api_dhcp.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/t_api_dhcp.Tpo $(DEPDIR)/t_api_dhcp.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/tests/t_api_dhcp.c' object='t_api_dhcp.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o t_api_dhcp.obj `if test -f '$(top_srcdir)/tests/t_api_dhcp.c'; then $(CYGPATH_W) '$(top_srcdir)/tests/t_api_dhcp.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/tests/t_api_dhcp.c'; fi`
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
$(RECURSIVE_CLEAN_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
@@ -226,10 +330,23 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
@@ -242,7 +359,7 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -263,79 +380,6 @@ GTAGS:
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \
srcdir=$(srcdir); export srcdir; \
list=' $(TESTS) '; \
if test -n "$$list"; then \
for tst in $$list; do \
if test -f ./$$tst; then dir=./; \
elif test -f $$tst; then dir=; \
else dir="$(srcdir)/"; fi; \
if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*$$ws$$tst$$ws*) \
xpass=`expr $$xpass + 1`; \
failed=`expr $$failed + 1`; \
echo "XPASS: $$tst"; \
;; \
*) \
echo "PASS: $$tst"; \
;; \
esac; \
elif test $$? -ne 77; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*$$ws$$tst$$ws*) \
xfail=`expr $$xfail + 1`; \
echo "XFAIL: $$tst"; \
;; \
*) \
failed=`expr $$failed + 1`; \
echo "FAIL: $$tst"; \
;; \
esac; \
else \
skip=`expr $$skip + 1`; \
echo "SKIP: $$tst"; \
fi; \
done; \
if test "$$failed" -eq 0; then \
if test "$$xfail" -eq 0; then \
banner="All $$all tests passed"; \
else \
banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
fi; \
else \
if test "$$xpass" -eq 0; then \
banner="$$failed of $$all tests failed"; \
else \
banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
fi; \
fi; \
dashes="$$banner"; \
skipped=""; \
if test "$$skip" -ne 0; then \
skipped="($$skip tests were not run)"; \
test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$skipped"; \
fi; \
report=""; \
if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
report="Please report to $(PACKAGE_BUGREPORT)"; \
test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$report"; \
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
echo "$$dashes"; \
echo "$$banner"; \
test -z "$$skipped" || echo "$$skipped"; \
test -z "$$report" || echo "$$report"; \
echo "$$dashes"; \
test "$$failed" -eq 0; \
else :; fi
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
@@ -362,21 +406,38 @@ distdir: $(DISTFILES)
|| exit 1; \
fi; \
done
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
distdir=`$(am__cd) $(distdir) && pwd`; \
top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$top_distdir" \
distdir="$$distdir/$$subdir" \
am__remove_distdir=: \
am__skip_length_check=: \
distdir) \
|| exit 1; \
fi; \
done
check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: check-am
check: check-recursive
all-am: Makefile
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
@@ -392,78 +453,83 @@ distclean-generic:
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean: clean-recursive
clean-am: clean-checkPROGRAMS clean-generic mostlyclean-am
distclean: distclean-am
distclean: distclean-recursive
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi: dvi-recursive
dvi-am:
html: html-am
html: html-recursive
info: info-am
info: info-recursive
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi: install-dvi-recursive
install-exec-am:
install-html: install-html-am
install-html: install-html-recursive
install-info: install-info-am
install-info: install-info-recursive
install-man:
install-pdf: install-pdf-am
install-pdf: install-pdf-recursive
install-ps: install-ps-am
install-ps: install-ps-recursive
installcheck-am:
maintainer-clean: maintainer-clean-am
maintainer-clean: maintainer-clean-recursive
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf: pdf-recursive
pdf-am:
ps: ps-am
ps: ps-recursive
ps-am:
uninstall-am:
.MAKE: install-am install-strip
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
install-strip
.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
clean-checkPROGRAMS clean-generic ctags distclean \
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am check check-am clean clean-checkPROGRAMS \
clean-generic ctags ctags-recursive distclean \
distclean-compile distclean-generic distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
uninstall-am
installcheck installcheck-am installdirs installdirs-am \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
tags tags-recursive uninstall uninstall-am
check: $(ATF_TESTS)
atf-run | atf-report
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@@ -1,4 +1,6 @@
/*
* Copyright (c) 2007,2009,2012 by Internet Systems Consortium, Inc. ("ISC")
*
* We test the functions provided in alloc.c here. These are very
* basic functions, and it is very important that they work correctly.
*
@@ -19,479 +21,381 @@
* hard to fix for example), then
*/
/* TODO: dmalloc() test */
/** @TODO: dmalloc() test */
#include "config.h"
#include "t_api.h"
#include <atf-c.h>
#include "dhcpd.h"
static void test_buffer_allocate(void);
static void test_buffer_reference(void);
static void test_buffer_dereference(void);
static void test_data_string_forget(void);
static void test_data_string_forget_nobuf(void);
static void test_data_string_copy(void);
static void test_data_string_copy_nobuf(void);
ATF_TC(buffer_allocate);
/*
* T_testlist is a list of tests that are invoked.
*/
testspec_t T_testlist[] = {
{ test_buffer_allocate,
"buffer_allocate()" },
{ test_buffer_reference,
"buffer_reference()" },
{ test_buffer_dereference,
"buffer_dereference()" },
{ test_data_string_forget,
"data_string_forget()" },
{ test_data_string_forget_nobuf,
"data_string_forget(), no buffer" },
{ test_data_string_copy,
"data_string_copy()" },
{ test_data_string_copy_nobuf,
"data_string_copy(), no buffer" },
{ NULL, NULL }
};
static void
test_buffer_allocate(void) {
static const char *test_desc =
"buffer_allocate basic test";
struct buffer *buf;
t_assert("buffer_allocate", 1, T_REQUIRED, "%s", test_desc);
/*
* Check a 0-length buffer.
*/
buf = NULL;
if (!buffer_allocate(&buf, 0, MDL)) {
t_info("failed on 0-len buffer\n");
t_result(T_FAIL);
return;
}
if (!buffer_dereference(&buf, MDL)) {
t_info("buffer_dereference() failed\n");
t_result(T_FAIL);
return;
}
if (buf != NULL) {
t_info("buffer_dereference() did not NULL-out buffer\n");
t_result(T_FAIL);
return;
}
/*
* Check an actual buffer.
*/
buf = NULL;
if (!buffer_allocate(&buf, 100, MDL)) {
t_info("failed on allocate\n");
t_result(T_FAIL);
return;
}
if (!buffer_dereference(&buf, MDL)) {
t_info("buffer_dereference() failed\n");
t_result(T_FAIL);
return;
}
if (buf != NULL) {
t_info("buffer_dereference() did not NULL-out buffer\n");
t_result(T_FAIL);
return;
}
/*
* Okay, we're happy.
*/
t_result(T_PASS);
ATF_TC_HEAD(buffer_allocate, tc) {
atf_tc_set_md_var(tc, "descr", "buffer_allocate basic test");
}
static void
test_buffer_reference(void) {
static const char *test_desc =
"buffer_reference basic test";
int result = T_PASS;
ATF_TC_BODY(buffer_allocate, tc) {
struct buffer *buf = 0;
struct buffer *a, *b;
/*
* Check a 0-length buffer.
*/
buf = NULL;
if (!buffer_allocate(&buf, 0, MDL)) {
atf_tc_fail("failed on 0-len buffer");
}
if (!buffer_dereference(&buf, MDL)) {
atf_tc_fail("buffer_dereference() failed");
}
if (buf != NULL) {
atf_tc_fail("buffer_dereference() did not NULL-out buffer");
}
t_assert("buffer_reference", 1, T_REQUIRED, "%s", test_desc);
/*
* Check an actual buffer.
*/
buf = NULL;
if (!buffer_allocate(&buf, 100, MDL)) {
atf_tc_fail("failed on allocate 100 bytes\n");
}
if (!buffer_dereference(&buf, MDL)) {
atf_tc_fail("buffer_dereference() failed");
}
if (buf != NULL) {
atf_tc_fail("buffer_dereference() did not NULL-out buffer");
}
/*
* Create a buffer.
*/
a = NULL;
if (!buffer_allocate(&a, 100, MDL)) {
t_info("failed on allocate\n");
t_result(T_FAIL);
return;
}
/*
* Confirm buffer_reference() doesn't work if we pass in NULL.
*
* TODO: we should confirm we get an error message here.
*/
if (buffer_reference(NULL, a, MDL)) {
t_info("succeeded on an error input\n");
t_result(T_FAIL);
return;
}
/*
* TODO: we should confirm we get an error message if we pass
* a non-NULL target.
*/
/*
* Confirm we work under normal circumstances.
*/
b = NULL;
if (!buffer_reference(&b, a, MDL)) {
t_info("buffer_reference() failed\n");
t_result(T_FAIL);
return;
}
if (b != a) {
t_info("incorrect pointer\n");
result = T_FAIL;
}
if (b->refcnt != 2) {
t_info("incorrect refcnt\n");
result = T_FAIL;
}
/*
* Clean up.
*/
if (!buffer_dereference(&b, MDL)) {
t_info("buffer_dereference() failed\n");
t_result(T_FAIL);
return;
}
if (!buffer_dereference(&a, MDL)) {
t_info("buffer_dereference() failed\n");
t_result(T_FAIL);
return;
}
t_result(result);
/*
* Okay, we're happy.
*/
atf_tc_pass();
}
static void
test_buffer_dereference(void) {
static const char *test_desc =
"buffer_dereference basic test";
ATF_TC(buffer_reference);
struct buffer *a, *b;
t_assert("buffer_dereference", 1, T_REQUIRED, "%s", test_desc);
/*
* Confirm buffer_dereference() doesn't work if we pass in NULL.
*
* TODO: we should confirm we get an error message here.
*/
if (buffer_dereference(NULL, MDL)) {
t_info("succeeded on an error input\n");
t_result(T_FAIL);
return;
}
/*
* Confirm buffer_dereference() doesn't work if we pass in
* a pointer to NULL.
*
* TODO: we should confirm we get an error message here.
*/
a = NULL;
if (buffer_dereference(&a, MDL)) {
t_info("succeeded on an error input\n");
t_result(T_FAIL);
return;
}
/*
* Confirm we work under normal circumstances.
*/
a = NULL;
if (!buffer_allocate(&a, 100, MDL)) {
t_info("failed on allocate\n");
t_result(T_FAIL);
return;
}
if (!buffer_dereference(&a, MDL)) {
t_info("buffer_dereference() failed\n");
t_result(T_FAIL);
return;
}
if (a != NULL) {
t_info("non-null buffer after buffer_dereference()\n");
t_result(T_FAIL);
return;
}
/*
* Confirm we get an error from negative refcnt.
*
* TODO: we should confirm we get an error message here.
*/
a = NULL;
if (!buffer_allocate(&a, 100, MDL)) {
t_info("failed on allocate\n");
t_result(T_FAIL);
return;
}
b = NULL;
if (!buffer_reference(&b, a, MDL)) {
t_info("buffer_reference() failed\n");
t_result(T_FAIL);
return;
}
a->refcnt = 0; /* purposely set to invalid value */
if (buffer_dereference(&a, MDL)) {
t_info("buffer_dereference() succeeded on error input\n");
t_result(T_FAIL);
return;
}
a->refcnt = 2;
if (!buffer_dereference(&b, MDL)) {
t_info("buffer_dereference() failed\n");
t_result(T_FAIL);
return;
}
if (!buffer_dereference(&a, MDL)) {
t_info("buffer_dereference() failed\n");
t_result(T_FAIL);
return;
}
t_result(T_PASS);
ATF_TC_HEAD(buffer_reference, tc) {
atf_tc_set_md_var(tc, "descr", "buffer_reference basic test");
}
static void
test_data_string_forget(void) {
static const char *test_desc =
"data_string_forget basic test";
int result = T_PASS;
ATF_TC_BODY(buffer_reference, tc) {
struct buffer *buf;
struct data_string a;
const char *str = "Lorem ipsum dolor sit amet turpis duis.";
struct buffer *a, *b;
t_assert("data_string_forget", 1, T_REQUIRED, "%s", test_desc);
/*
* Create a buffer.
*/
a = NULL;
if (!buffer_allocate(&a, 100, MDL)) {
atf_tc_fail("failed on allocate 100 bytes");
}
/*
* Create the string we want to forget.
*/
memset(&a, 0, sizeof(a));
a.len = strlen(str);
buf = NULL;
if (!buffer_allocate(&buf, a.len, MDL)) {
t_info("out of memory\n");
t_result(T_FAIL);
return;
}
if (!buffer_reference(&a.buffer, buf, MDL)) {
t_info("buffer_reference() failed\n");
t_result(T_FAIL);
return;
}
a.data = a.buffer->data;
memcpy(a.buffer->data, str, a.len);
/**
* Confirm buffer_reference() doesn't work if we pass in NULL.
*
* @TODO: we should confirm we get an error message here.
*/
if (buffer_reference(NULL, a, MDL)) {
atf_tc_fail("succeeded on an error input");
}
/*
* Forget and confirm we've forgotten.
*/
data_string_forget(&a, MDL);
/**
* @TODO: we should confirm we get an error message if we pass
* a non-NULL target.
*/
if (a.len != 0) {
t_info("incorrect length\n");
result = T_FAIL;
}
if (a.data != NULL) {
t_info("incorrect data\n");
result = T_FAIL;
}
if (a.terminated) {
t_info("incorrect terminated\n");
result = T_FAIL;
}
if (a.buffer != NULL) {
t_info("incorrect buffer\n");
result = T_FAIL;
}
if (buf->refcnt != 1) {
t_info("too many references to buf\n");
result = T_FAIL;
}
/*
* Confirm we work under normal circumstances.
*/
b = NULL;
if (!buffer_reference(&b, a, MDL)) {
atf_tc_fail("buffer_reference() failed");
}
/*
* Clean up buffer.
*/
if (!buffer_dereference(&buf, MDL)) {
t_info("buffer_reference() failed\n");
t_result(T_FAIL);
return;
}
if (b != a) {
atf_tc_fail("incorrect pointer returned");
}
if (b->refcnt != 2) {
atf_tc_fail("incorrect refcnt");
}
/*
* Clean up.
*/
if (!buffer_dereference(&b, MDL)) {
atf_tc_fail("buffer_dereference() failed");
}
if (!buffer_dereference(&a, MDL)) {
atf_tc_fail("buffer_dereference() failed");
}
t_result(result);
}
static void
test_data_string_forget_nobuf(void) {
static const char *test_desc =
"data_string_forget test, data_string without buffer";
int result = T_PASS;
struct data_string a;
const char *str = "Lorem ipsum dolor sit amet massa nunc.";
ATF_TC(buffer_dereference);
t_assert("data_string_forget, no buffer", 1, T_REQUIRED, "%s", test_desc);
/*
* Create the string we want to forget.
*/
memset(&a, 0, sizeof(a));
a.len = strlen(str);
a.data = (const unsigned char *)str;
a.terminated = 1;
/*
* Forget and confirm we've forgotten.
*/
data_string_forget(&a, MDL);
if (a.len != 0) {
t_info("incorrect length\n");
result = T_FAIL;
}
if (a.data != NULL) {
t_info("incorrect data\n");
result = T_FAIL;
}
if (a.terminated) {
t_info("incorrect terminated\n");
result = T_FAIL;
}
if (a.buffer != NULL) {
t_info("incorrect buffer\n");
result = T_FAIL;
}
t_result(result);
ATF_TC_HEAD(buffer_dereference, tc) {
atf_tc_set_md_var(tc, "descr", "buffer_dereference basic test");
}
static void
test_data_string_copy(void) {
static const char *test_desc =
"data_string_copy basic test";
int result = T_PASS;
ATF_TC_BODY(buffer_dereference, tc) {
struct buffer *a, *b;
struct data_string a, b;
const char *str = "Lorem ipsum dolor sit amet orci aliquam.";
/**
* Confirm buffer_dereference() doesn't work if we pass in NULL.
*
* TODO: we should confirm we get an error message here.
*/
if (buffer_dereference(NULL, MDL)) {
atf_tc_fail("succeeded on an error input");
}
t_assert("data_string_copy", 1, T_REQUIRED, "%s", test_desc);
/**
* Confirm buffer_dereference() doesn't work if we pass in
* a pointer to NULL.
*
* @TODO: we should confirm we get an error message here.
*/
a = NULL;
if (buffer_dereference(&a, MDL)) {
atf_tc_fail("succeeded on an error input");
}
/*
* Confirm we work under normal circumstances.
*/
a = NULL;
if (!buffer_allocate(&a, 100, MDL)) {
atf_tc_fail("failed on allocate");
}
if (!buffer_dereference(&a, MDL)) {
atf_tc_fail("buffer_dereference() failed");
}
if (a != NULL) {
atf_tc_fail("non-null buffer after buffer_dereference()");
}
/*
* Create the string we want to copy.
*/
memset(&a, 0, sizeof(a));
a.len = strlen(str);
if (!buffer_allocate(&a.buffer, a.len, MDL)) {
t_info("out of memory\n");
t_result(T_FAIL);
return;
}
a.data = a.buffer->data;
memcpy(a.buffer->data, str, a.len);
/*
* Copy the string, and confirm it works.
*/
memset(&b, 0, sizeof(b));
data_string_copy(&b, &a, MDL);
if (b.len != a.len) {
t_info("incorrect length\n");
result = T_FAIL;
}
if (b.data != a.data) {
t_info("incorrect data\n");
result = T_FAIL;
}
if (b.terminated != a.terminated) {
t_info("incorrect terminated\n");
result = T_FAIL;
}
if (b.buffer != a.buffer) {
t_info("incorrect buffer\n");
result = T_FAIL;
}
/*
* Clean up.
*/
data_string_forget(&b, MDL);
data_string_forget(&a, MDL);
t_result(result);
/**
* Confirm we get an error from negative refcnt.
*
* @TODO: we should confirm we get an error message here.
*/
a = NULL;
if (!buffer_allocate(&a, 100, MDL)) {
atf_tc_fail("failed on allocate");
}
b = NULL;
if (!buffer_reference(&b, a, MDL)) {
atf_tc_fail("buffer_reference() failed");
}
a->refcnt = 0; /* purposely set to invalid value */
if (buffer_dereference(&a, MDL)) {
atf_tc_fail("buffer_dereference() succeeded on error input");
}
a->refcnt = 2;
if (!buffer_dereference(&b, MDL)) {
atf_tc_fail("buffer_dereference() failed");
}
if (!buffer_dereference(&a, MDL)) {
atf_tc_fail("buffer_dereference() failed");
}
}
static void
test_data_string_copy_nobuf(void) {
static const char *test_desc =
"data_string_copy test, data_string without buffer";
int result = T_PASS;
ATF_TC(data_string_forget);
struct data_string a, b;
const char *str = "Lorem ipsum dolor sit amet cras amet.";
t_assert("data_string_copy, no buffer", 1, T_REQUIRED, "%s",
test_desc);
/*
* Create the string we want to copy.
*/
memset(&a, 0, sizeof(a));
a.len = strlen(str);
a.data = (const unsigned char *)str;
a.terminated = 1;
/*
* Copy the string, and confirm it works.
*/
memset(&b, 0, sizeof(b));
data_string_copy(&b, &a, MDL);
if (b.len != a.len) {
t_info("incorrect length\n");
result = T_FAIL;
}
if (b.data != a.data) {
t_info("incorrect data\n");
result = T_FAIL;
}
if (b.terminated != a.terminated) {
t_info("incorrect terminated\n");
result = T_FAIL;
}
if (b.buffer != a.buffer) {
t_info("incorrect buffer\n");
result = T_FAIL;
}
/*
* Clean up.
*/
data_string_forget(&b, MDL);
data_string_forget(&a, MDL);
t_result(result);
ATF_TC_HEAD(data_string_forget, tc) {
atf_tc_set_md_var(tc, "descr", "data_string_forget basic test");
}
ATF_TC_BODY(data_string_forget, tc) {
struct buffer *buf;
struct data_string a;
const char *str = "Lorem ipsum dolor sit amet turpis duis.";
/*
* Create the string we want to forget.
*/
memset(&a, 0, sizeof(a));
a.len = strlen(str);
buf = NULL;
if (!buffer_allocate(&buf, a.len, MDL)) {
atf_tc_fail("out of memory");
}
if (!buffer_reference(&a.buffer, buf, MDL)) {
atf_tc_fail("buffer_reference() failed");
}
a.data = a.buffer->data;
memcpy(a.buffer->data, str, a.len);
/*
* Forget and confirm we've forgotten.
*/
data_string_forget(&a, MDL);
if (a.len != 0) {
atf_tc_fail("incorrect length");
}
if (a.data != NULL) {
atf_tc_fail("incorrect data");
}
if (a.terminated) {
atf_tc_fail("incorrect terminated");
}
if (a.buffer != NULL) {
atf_tc_fail("incorrect buffer");
}
if (buf->refcnt != 1) {
atf_tc_fail("too many references to buf");
}
/*
* Clean up buffer.
*/
if (!buffer_dereference(&buf, MDL)) {
atf_tc_fail("buffer_reference() failed");
}
}
ATF_TC(data_string_forget_nobuf);
ATF_TC_HEAD(data_string_forget_nobuf, tc) {
atf_tc_set_md_var(tc, "descr", "data_string_forget test, "
"data_string without buffer");
}
ATF_TC_BODY(data_string_forget_nobuf, tc) {
struct data_string a;
const char *str = "Lorem ipsum dolor sit amet massa nunc.";
/*
* Create the string we want to forget.
*/
memset(&a, 0, sizeof(a));
a.len = strlen(str);
a.data = (const unsigned char *)str;
a.terminated = 1;
/*
* Forget and confirm we've forgotten.
*/
data_string_forget(&a, MDL);
if (a.len != 0) {
atf_tc_fail("incorrect length");
}
if (a.data != NULL) {
atf_tc_fail("incorrect data");
}
if (a.terminated) {
atf_tc_fail("incorrect terminated");
}
if (a.buffer != NULL) {
atf_tc_fail("incorrect buffer");
}
}
ATF_TC(data_string_copy);
ATF_TC_HEAD(data_string_copy, tc) {
atf_tc_set_md_var(tc, "descr", "data_string_copy basic test");
}
ATF_TC_BODY(data_string_copy, tc) {
struct data_string a, b;
const char *str = "Lorem ipsum dolor sit amet orci aliquam.";
/*
* Create the string we want to copy.
*/
memset(&a, 0, sizeof(a));
a.len = strlen(str);
if (!buffer_allocate(&a.buffer, a.len, MDL)) {
atf_tc_fail("out of memory");
}
a.data = a.buffer->data;
memcpy(a.buffer->data, str, a.len);
/*
* Copy the string, and confirm it works.
*/
memset(&b, 0, sizeof(b));
data_string_copy(&b, &a, MDL);
if (b.len != a.len) {
atf_tc_fail("incorrect length");
}
if (b.data != a.data) {
atf_tc_fail("incorrect data");
}
if (b.terminated != a.terminated) {
atf_tc_fail("incorrect terminated");
}
if (b.buffer != a.buffer) {
atf_tc_fail("incorrect buffer");
}
/*
* Clean up.
*/
data_string_forget(&b, MDL);
data_string_forget(&a, MDL);
}
ATF_TC(data_string_copy_nobuf);
ATF_TC_HEAD(data_string_copy_nobuf, tc) {
atf_tc_set_md_var(tc, "descr", "data_string_copy test, "
"data_string without buffer");
}
ATF_TC_BODY(data_string_copy_nobuf, tc) {
struct data_string a, b;
const char *str = "Lorem ipsum dolor sit amet cras amet.";
/*
* Create the string we want to copy.
*/
memset(&a, 0, sizeof(a));
a.len = strlen(str);
a.data = (const unsigned char *)str;
a.terminated = 1;
/*
* Copy the string, and confirm it works.
*/
memset(&b, 0, sizeof(b));
data_string_copy(&b, &a, MDL);
if (b.len != a.len) {
atf_tc_fail("incorrect length");
}
if (b.data != a.data) {
atf_tc_fail("incorrect data");
}
if (b.terminated != a.terminated) {
atf_tc_fail("incorrect terminated");
}
if (b.buffer != a.buffer) {
atf_tc_fail("incorrect buffer");
}
/*
* Clean up.
*/
data_string_forget(&b, MDL);
data_string_forget(&a, MDL);
}
ATF_TP_ADD_TCS(tp)
{
ATF_TP_ADD_TC(tp, buffer_allocate);
ATF_TP_ADD_TC(tp, buffer_reference);
ATF_TP_ADD_TC(tp, buffer_dereference);
ATF_TP_ADD_TC(tp, data_string_forget);
ATF_TP_ADD_TC(tp, data_string_forget_nobuf);
ATF_TP_ADD_TC(tp, data_string_copy);
ATF_TP_ADD_TC(tp, data_string_copy_nobuf);
return (atf_no_error());
}

View File

@@ -50,7 +50,8 @@ AC_DEFINE_UNQUOTED([DHCP_BYTE_ORDER], [$byte_order],
# Optional compile-time DEBUGging.
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],
[create a debug-only version of the software (default is no).]))
[create a debug-only version of the software (default is no).]),
[enable_debug=yes],[enable_debug=no])
# This is very much off by default.
if test "$enable_debug" = "yes" ; then
AC_DEFINE([DEBUG], [1],
@@ -168,6 +169,44 @@ if test "$enable_use_sockets" = "yes"; then
[Define to 1 to use the standard BSD socket API.])
fi
# Testing section
atf_path="no"
AC_ARG_WITH([atf],
AC_HELP_STRING([--with-atf=PATH],
[specify location where atf was installed]),
[atf_path="$withval"])
if test "$atf_path" != "no" ; then
# Config path for pkg-config
atf_pcp=""
if test "$atf_path" != "yes" ; then
if test -f $atf_path/lib/pkgconfig/atf-c.pc ; then
atf_pcp=$atf_path/lib/pkgconfig
fi
else
# Not specified, try some common paths
atf_dirs="/usr /usr/local /usr/pkg /opt /opt/local"
for d in $atf_dirs
do
if test -f $d/lib/pkgconfig/atf-c.pc ; then
atf_pcp=$d/lib/pkgconfig
fi
done
fi
if test "$atf_pcp" = "" ; then
AC_MSG_ERROR([Unable to find atf files in location specified])
else
ATF_CFLAGS="`PKG_CONFIG_PATH=$atf_pcp pkg-config --cflags atf-c` -DUNIT_TEST"
ATF_LDFLAGS="`PKG_CONFIG_PATH=$atf_pcp pkg-config --libs atf-c`"
AC_SUBST(ATF_CFLAGS)
AC_SUBST(ATF_LDFLAGS)
fi
fi
AM_CONDITIONAL(HAVE_ATF, test "$atf_pcp" != "")
### Uncomment this once docs.lab.isc.org upgrades to automake 1.11
### AM_COND_IF([HAVE_ATF], [AC_DEFINE([HAVE_ATF], [1], [ATF framework specified?])])
###
### Path fun. Older versions of DHCP were installed in /usr/sbin, so we
### need to look there and potentially overwrite by default (but not if
@@ -597,6 +636,47 @@ AC_OUTPUT([
relay/Makefile
server/Makefile
tests/Makefile
server/tests/Makefile
doc/devel/doxyfile
])
sh util/bindvar.sh
cat > config.report << END
ISC DHCP source configure results:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Package:
Name: $PACKAGE_NAME
Version: $PACKAGE_VERSION
C Compiler: $CC
Flags:
DEFS: $DEFS
CFLAGS: $CFLAGS
Features:
debug: $enable_debug
failover: $enable_failover
execute: $enable_execute
Developer:
ATF unittests : $atf_path
END
# TODO: Add Perl system tests
if test "$atf_path" != "no"
then
echo "ATF_CFLAGS : $ATF_CFLAGS" >> config.report
echo "ATF_LDFLAGS : $ATF_LDFLAGS" >> config.report
echo
fi
cat config.report
echo
echo Now you can type "make" to build ISC DHCP
echo

View File

@@ -88,6 +88,8 @@ CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
ATF_CFLAGS = @ATF_CFLAGS@
ATF_LDFLAGS = @ATF_LDFLAGS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@

View File

@@ -27,3 +27,18 @@ References.txt: References.xml
References.html: References.xml
xml2html References.xml
devel:
mkdir -p html
doxygen devel/doxyfile > html/doxygen.log 2>html/doxygen-warnings.log
cppcheck:
mkdir -p html
cd .. && cppcheck --enable=all --inline-suppr \
-f -v -j 2 -i tests/ -i dhcp-*/ \
. 1> doc/html/cppcheck.log 2> doc/html/cppcheck-error.log
# cppcheck can be extended with list of suppressions.
# --suppressions-list=doc/cppcheck-skip.txt \
.PHONY: devel cppcheck

11
doc/devel/arch.dox Normal file
View File

@@ -0,0 +1,11 @@
/**
@page archSrv Server Architecture
@todo: Describe high level server architecture here.
@page archCli Client Architecture
@todo: Describe high level client architecture here.
*/

200
doc/devel/atf.dox Normal file
View File

@@ -0,0 +1,200 @@
/**
@page tests Testing
@section testsOverview Testing Overview
In DHCP, a unit test exercises a particular piece of code in
isolation. There is a separate unit test per module or API. Each unit
test lives in a directory beneath the code it is designed to exercise.
So, we (will eventually) have:
@verbatim
server/tests/
client/tests/
common/tests/
dhcpctl/tests/
...
@endverbatim
And so on.
Ideally each function would be invoked with every possible type of input, and
each branch of every function would be checked. In practice we try to be a bit
more pragmatic, and target the most basic operations, as well tricky code, and
areas we have seen bugs in the past.
We are using <a href="http://code.google.com/p/kyua/wiki/ATF">ATF (Automated
Test Framework)</a> as a framework to run our unittests.
@section testsAtf ATF unit-tests
ATF stands for Automated Test Framework, and is the framework used for unit
tests in ISC DHCP and BIND9. ATF sources can be downloaded from
http://code.google.com/p/kyua/wiki/ATF . ATF itself must be configured, compiled
and then installed to be available during the DHCP configure procedure. Please
follow INSTALL file supplied with ATF sources (it's essentially the typical
./configure && make && make install procedure).
The ATF successor, called Kyua, is being developed. As of August 2012, the
latest available release of Kyua is 0.5. It claims to offer feature parity with
ATF. Migration to Kyua may be planned some time in the future, but DHCP uses ATF
for now. Such an upgrade should be done in coordination with BIND. The latest
tested version of ATF that DHCP's unittests were run against is 0.15.
To build the unit-tests, use the following:
@verbatim
$ ./configure --with-atf
$ make
$ make check
@endverbatim
The following syntax is supported as well:
@verbatim
$ ./configure --with-atf=/path/to/your/atf/install
@endverbatim
but it seems to have troubles sometimes detecting ATF installation, at least
with ATF 0.14 and Mac OS X 10.6.8.
Each code directory (e.g. server/) that has unit-tests has a sub-directory
named tests (e.g. server/tests). You can execute "make check" in that
directory to run specific subset of tests.
Unit-tests are grouped into suites, each suite being a separate
executable. The typical way to run tests is:
@verbatim
$ atf-run | atf-report
@endverbatim
atf-run will read the Atffile in the current directory and execute all the tests
specified in it. Using atf-run - rather than calling the test binary directly -
has several major benefits. The main one is that atf-run is able to recover from
test segfault and continue execution from the next case onwards. Another is that
it is possible to specify a timeout for a test. atf-run will kill the test in
case of any infinite loops and will continue running next tests.
It is possible to run atf-run without passing its output to atf-report, but its
output is somewhat convoluted. That is useful in some situations, e.g. when one
wants to see test output.
It is possible to run test binary directly. The only required parameter is the
test case name. The binary will print out a warning that direct binary execution
is not recommended as it won't be able to recover from crash. However, such an
approach is convenient for running the test under the debugger.
@section testsAtfAdding Adding new unit-tests
There are a small number of unit-tests that are not ATF based. They will be
converted to ATF soon. Please do not use any other frameworks.
Sadly, the DHCP code was not written with unit-testing in mind: often a
non-standard approach is required for writing unit-tests. The existing code
often has many dependencies that make testing a single piece of code awkward to
unit test. For example, to test hash tables, one needs to also include the
OMAPI code. Rather than significantly refactoring the code (a huge task that
could take months), we decided to link whatever is needed in the tests. If
developing new test suite, it is recommended that you take a look at existing
tests and just copy them as a starting point.
In particular, the following
things should be done for adding new tests:
<b>1. Tests directory.</b> For each code component (server, client, common,
etc.) there should be a tests subdirectory. If it isn't there yet, then it must
be created. This can be done by:
a). Creating the directory:
@verbatim
$ mkdir $subdir/tests
$ cvs add tests
@endverbatim
b). Adding the subdirectory to the build system:
Add to $subdir/Makefile.am:
@verbatim
SUBDIRS = tests
@endverbatim
Add to the AC_OUTPUT macro in configure.ac:
@verbatim
subdir/tests/Makefile
@endverbatim
c. Create a Makefile.am in the new directory, something similar to this:
@verbatim
AM_CPPFLAGS = -I../..
check_PROGRAMS = test_foo
TESTS = test_foo
test_foo_SOURCES = test_foo.c
test_foo_LDADD = ../../tests/libt_api.a # plus others...
@endverbatim
See existing Makefile.am for examples, and the Automake documentation:
http://www.gnu.org/software/automake/manual/html_node/Tests.html
<b>2. Implement the test.</b> That typically means that you create a new file that will
hold test code. It is recommended you name it (tested_feature_name)_unittest.c
and put the file in specified tests directory. For example tests related to
hash tables used on the server side should be named
server/tests/hash_unittest.c. If in doubt, it is convenient to name the test
code after the file that holds tested code, e.g. server/mdb6.c is tested in
server/tests/mdb6_unittest.c.
The file server/tests/simple_unittest.c holds a template explaining the basic
layout of the ATF tests. There may be many test cases in a single *_unittest.c
file. Make sure that you register all your test cases using ATF_TP_ADD_TC()
macro, and try to minimize modifications to the tested code if possible. Keep in
mind that we are using modernized \ref codingGuidelines for test
development. You are advised to also look at atf-c-api(3) man page.
To add a new test, such as when a new module is added or when you want to start
testing existing code, you can copy the server/tests/simple_unittest.c as a new
new file, add the new file as a target in Makefile.am, and begin adding
tests. Reviewing that file is a good idea, even if you decide to write your test
from scratch, as it give you quick overview of the essential capabilities of the
ATF framework (how to write test, how to make checks, pass or fail test
etc.). Do not forget to add your new file to git via "git add
yourtest_unittest.c".
<b>3. Extend Makefile.am</b> to build your test. In particular, add your binary
name to ATF_TESTS. The tests directory will be built only in case where
ATF is enabled, using --with-atf during configure phase.
<b>4. Modify Atffile to include your new test</b>, if needed. Tests in the
specified directory must be registered in Atffile. See server/tests/Atffile for
an example. Currently every executable with name of the form *_unittest will be
executed automatically. If you followed naming convention proposed in a previous
step, your test will be included and will be included automatically.
<b>5. Enjoy your improved confidence in the code</b>, as you can run the tests after
any change you may want to do:
@verbatim
$ make check
@endverbatim
to run all tests for all components. See \ref atfTests section for more details
on running tests.
@section testsAtfCoding ATF Coding Guidelines
As the unit-test code creates an evironment that works under a different
regime than the production code, there are slight differences to standard
coding guidelines. In particular:
- The code is written using C99. Double slash comments are allowed.
- Please do not use tabs. Use 4 spaces for each indent level.
*/

12
doc/devel/contrib.dox Normal file
View File

@@ -0,0 +1,12 @@
/**
@page contrib Contributing to DHCP
@section contribDir 3rd party contributions in contrib/ directory
@todo: Describe contrib/ dir
@section codingGuidelines Coding Guidelines
@todo: (... if people want to contribute significant code)
*/

21
doc/devel/debug.dox Normal file
View File

@@ -0,0 +1,21 @@
/**
@page debug Debugging
This page enumerates various techniques useful for debugging ISC DHCP software.
@section debugTips Debugging Tips & Tricks
ISC DHCP code is somewhat convoluted. Due to extensive macros use, it is often
difficult to even find whole function, much less to understand what they
actually do. One way to find such a macro-defined function is to compile the
code with debugging symbols (-g), load the binary into gdb and set a breakpoint
for such a function. gdb will print out exact place in the code where the
function is defined. Presumably one will find a macro at that specific location.
For example to find where \ref lease_reference function is defined do:
@verbatim
gdb
file dhcpd
b lease_reference
@endverbatim
*/

1792
doc/devel/doxyfile.in Normal file

File diff suppressed because it is too large Load Diff

BIN
doc/devel/isc-logo.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

39
doc/devel/mainpage.dox Normal file
View File

@@ -0,0 +1,39 @@
/**
@mainpage
This is an ISC DHCP Developer's Guide. This documentation is intended for
developers, contributors and other programmers that are interested in
internal operation of the code.
To download the latest version of the software, please go to the
http://www.isc.org/software/dhcp website.
@section toc Table Of Contents
- @subpage tests
- @subpage testsOverview
- @subpage testsAtf
- @subpage testsAtfAdding
- @subpage testsAtfCoding
- @subpage qa
- @subpage qaTests
- @subpage cppcheck
- @subpage doxygen
- @subpage valgrind
- @subpage debug
Pages planned to be written:
- @subpage archSrv
- @subpage archCli
- @subpage omapi
- @subpage omapiIntro
- @subpage omapiC
- @subpage dhcpctl
- @subpage contrib
- @subpage contribDir
- @subpage codingGuidelines
Note: some of the links below may not work if corresponding logs are not available.<br/>
Doxygen: <a href="doxygen.log">[generation log]</a> <a href="doxygen-warnings.log">[errors and warnings]</a> <br/>
cppcheck: <a href="cppcheck.log">[generation log]</a> <a href="cppcheck-error.log">[errors and warnings]</a> <br/>
*/

15
doc/devel/omapi.dox Normal file
View File

@@ -0,0 +1,15 @@
/**
@page omapi OMAPI Interface
@section omapiIntro Introduction
@todo: Description of OMAPI and dhcpctl
@section omapiC Object Management API
@todo: Essentially omapi.3
@section dhcpctl dhcpctl Reference Guide
@todo: Essentially dhcpctl.3
*/

93
doc/devel/qa.dox Normal file
View File

@@ -0,0 +1,93 @@
/**
@page qa Quality Assurance
There is a wide scale effort in progress to improve the quality of the ISC
DHCP implementation. The following section describes the major aspects of
quality assurance that are being implemented. As this is a work in progress,
expect radical changes in this area.
@section qaTests ATF Unit-tests
See @ref tests Section for details description of ATF-based unit-tests.
@section cppcheck cppcheck tool
<a href="http://cppcheck.sourceforge.net/">cppcheck</a> is a static analysis tool
for C/C++ code. Unlike C/C++ compilers and many other analysis tools it does not
detect syntax errors in the code. Cppcheck primarily detects the types of bugs
that the compilers normally do not detect. To generate cppcheck report, you
must have cppcheck installed in your system. Generation is simple:
@verbatim
cd doc/
make cppcheck
@endverbatim
The log files will be stored in doc/html/cppcheck.log and
doc/html/cppcheck-error.log. While the former is useful for verifying that all
sources were checked, the latter is much more useful. It contains a list of
problems that were detected by cppcheck. The goal is to correct all problems
and make this an empty file.
In the unlikely event of cppcheck finding false positives it is possible to add
special comments formatted to instruct cppcheck to not report what it thinks is
an issue. make cppcheck target is configured to make cppcheck print out a
specific issue type reported. For example to disable the following error report:
@verbatim
bind/bind-9.8.1/bin/dnssec/dnssec-keygen.c:522: check_fail: Memory leak: algname (error,memleak)
@endverbatim
the following line could be added before line 522 in dnssec-keygen.c:
@verbatim
// cppcheck-suppress memleak
@endverbatim
Please consult cppcheck manual for details. It is section 6.2 "Inline
suppressions" in cppcheck 1.54 manual. Section number may change in later
versions.
@section doxygen Doxygen checks
ISC DHCP Developer's Guide (the documentation you are reading now) is
generated with doxygen. Doxygen is an open source tool for generating
source code documentation. It is available from
<a href="http://www.doxygen.org">www.doxygen.org</a> website. Once Doxygen
is installed, ISC DHCP documentation can be generated with:
@verbatim
cd doc
make devel
@endverbatim
Note that cppcheck (see @ref cppcheck Section) reports are linked from
Developer's Guide. It is useful to generate both.
@section systemTests System level tests
ISC is developing a comprehensive set of system level tests.
They are described by a separate document called DHCP Test Plan.
@section perfdhcp Performance tests using perfdhcp
ISC is also developing a performance measurement tool, called
perfdhcp. Its main purpose is to measure performance of DHCPv4 and
DHCPv6 servers. It is being developed as part of the BIND10 project.
See tests/tools/perfdhcp directory in BIND10 source code.
@section tahiTests Conformance tests using TAHI
<a href="http://tahi.org">TAHI project</a> developed an extensive suite of <a
href="http://tahi.org/logo/dhcpv6/">DHCPv6 conformance tests</a>. ISC plans to
deploy and run them periodically in the near future.
@section valgrind Memory correctness using valgrind
<a href="http://valgrind.org/">Valgrind</a> is a powerful tool for dynamic code
analysis. It allows running existing code (often even without recompiling) in a
special environment that tracks memory operations. In particular, it is able to
detect: memory leaks, buffer overflows, usage of uninitialized memory, double
frees and similar errors. We currently do not use valgrind in ISC DHCP testing,
but there are plans for starting to use it.
*/

View File

@@ -70,6 +70,8 @@ CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
ATF_CFLAGS = @ATF_CFLAGS@
ATF_LDFLAGS = @ATF_LDFLAGS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@

View File

@@ -56,6 +56,8 @@ CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
ATF_CFLAGS = @ATF_CFLAGS@
ATF_LDFLAGS = @ATF_LDFLAGS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@

View File

@@ -1,5 +1,8 @@
/* includes/config.h.in. Generated from configure.ac by autoheader. */
/* Define if building universal (internal helper macro) */
#undef AC_APPLE_UNIVERSAL_BUILD
/* Define to compile debug-only DHCP software. */
#undef DEBUG
@@ -121,6 +124,9 @@
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
@@ -139,22 +145,44 @@
/* Define to 1 to use the standard BSD socket API. */
#undef USE_SOCKETS
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif
/* Define to 1 to enable IPv4 packet info support. */
#undef USE_V4_PKTINFO
/* Version number of package */
#undef VERSION
/* Define to 1 if on AIX 3.
System headers sometimes define this.
We just want to avoid a redefinition error message. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
# undef WORDS_BIGENDIAN
# endif
#endif
/* Define to 1 if on MINIX. */
@@ -198,31 +226,20 @@
#undef _POSIX_SOURCE
/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef was allowed, the
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
#undef _UINT32_T
/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef was allowed, the
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
#undef _UINT64_T
/* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef was allowed, the
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
#undef _UINT8_T
/* Enable extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Define to the type of a signed integer type of width exactly 16 bits if
such a type exists and the standard includes do not define it. */
#undef int16_t

View File

@@ -85,6 +85,8 @@ CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
ATF_CFLAGS = @ATF_CFLAGS@
ATF_LDFLAGS = @ATF_LDFLAGS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@

View File

@@ -64,6 +64,8 @@ CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
ATF_CFLAGS = @ATF_CFLAGS@
ATF_LDFLAGS = @ATF_LDFLAGS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@

View File

@@ -1,3 +1,9 @@
# We want to build this directory first, before descending into tests subdir.
# The reason is that ideally the tests should link existing objects from this
# directory. That eliminates any discrepancies between tested code and
# production code. Sadly, we are not there yet.
SUBDIRS = . tests
AM_CPPFLAGS = -I.. -DLOCALSTATEDIR='"@localstatedir@"'
dist_sysconf_DATA = dhcpd.conf

View File

@@ -70,6 +70,13 @@ CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(dhcpd_SOURCES)
DIST_SOURCES = $(dhcpd_SOURCES)
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
install-html-recursive install-info-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
man5dir = $(mandir)/man5
man8dir = $(mandir)/man8
NROFF = nroff
@@ -82,11 +89,16 @@ am__vpath_adj = case $$p in \
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
dist_sysconfDATA_INSTALL = $(INSTALL_DATA)
DATA = $(dist_sysconf_DATA)
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
ATF_CFLAGS = @ATF_CFLAGS@
ATF_LDFLAGS = @ATF_LDFLAGS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
@@ -176,6 +188,12 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
# We want to build this directory first, before descending into tests subdir.
# The reason is that ideally the tests should link existing objects from this
# directory. That eliminates any discrepancies between tested code and
# production code. Sadly, we are not there yet.
SUBDIRS = . tests
AM_CPPFLAGS = -I.. -DLOCALSTATEDIR='"@localstatedir@"'
dist_sysconf_DATA = dhcpd.conf
dhcpd_SOURCES = dhcpd.c dhcp.c bootp.c confpars.c db.c class.c failover.c \
@@ -189,7 +207,7 @@ dhcpd_LDADD = ../common/libdhcp.a ../omapip/libomapi.a \
man_MANS = dhcpd.8 dhcpd.conf.5 dhcpd.leases.5
EXTRA_DIST = $(man_MANS)
all: all-am
all: all-recursive
.SUFFIXES:
.SUFFIXES: .c .o .obj
@@ -632,6 +650,76 @@ uninstall-dist_sysconfDATA:
rm -f "$(DESTDIR)$(sysconfdir)/$$f"; \
done
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
$(RECURSIVE_CLEAN_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
@@ -642,10 +730,23 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
@@ -658,7 +759,7 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -705,22 +806,40 @@ distdir: $(DISTFILES)
|| exit 1; \
fi; \
done
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
distdir=`$(am__cd) $(distdir) && pwd`; \
top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$top_distdir" \
distdir="$$distdir/$$subdir" \
am__remove_distdir=: \
am__skip_length_check=: \
distdir) \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
check: check-recursive
all-am: Makefile $(PROGRAMS) $(MANS) $(DATA)
installdirs:
installdirs: installdirs-recursive
installdirs-am:
for dir in "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(sysconfdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
@@ -736,58 +855,58 @@ distclean-generic:
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean: clean-recursive
clean-am: clean-generic clean-sbinPROGRAMS mostlyclean-am
distclean: distclean-am
distclean: distclean-recursive
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi: dvi-recursive
dvi-am:
html: html-am
html: html-recursive
info: info-am
info: info-recursive
info-am:
install-data-am: install-man
install-dvi: install-dvi-am
install-dvi: install-dvi-recursive
install-exec-am: install-dist_sysconfDATA install-sbinPROGRAMS
install-html: install-html-am
install-html: install-html-recursive
install-info: install-info-am
install-info: install-info-recursive
install-man: install-man5 install-man8
install-pdf: install-pdf-am
install-pdf: install-pdf-recursive
install-ps: install-ps-am
install-ps: install-ps-recursive
installcheck-am:
maintainer-clean: maintainer-clean-am
maintainer-clean: maintainer-clean-recursive
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf: pdf-recursive
pdf-am:
ps: ps-am
ps: ps-recursive
ps-am:
@@ -796,22 +915,25 @@ uninstall-am: uninstall-dist_sysconfDATA uninstall-man \
uninstall-man: uninstall-man5 uninstall-man8
.MAKE: install-am install-strip
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-sbinPROGRAMS ctags distclean distclean-compile \
distclean-generic distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dist_sysconfDATA install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-man5 install-man8 install-pdf install-pdf-am \
install-ps install-ps-am install-sbinPROGRAMS install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-dist_sysconfDATA uninstall-man \
uninstall-man5 uninstall-man8 uninstall-sbinPROGRAMS
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am check check-am clean clean-generic \
clean-sbinPROGRAMS ctags ctags-recursive distclean \
distclean-compile distclean-generic distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dist_sysconfDATA \
install-dvi install-dvi-am install-exec install-exec-am \
install-html install-html-am install-info install-info-am \
install-man install-man5 install-man8 install-pdf \
install-pdf-am install-ps install-ps-am install-sbinPROGRAMS \
install-strip installcheck installcheck-am installdirs \
installdirs-am maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
ps ps-am tags tags-recursive uninstall uninstall-am \
uninstall-dist_sysconfDATA uninstall-man uninstall-man5 \
uninstall-man8 uninstall-sbinPROGRAMS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View File

@@ -58,7 +58,9 @@ static const char url [] =
# undef group
#endif /* PARANOIA */
#ifndef UNIT_TEST
static void usage(void);
#endif
struct iaddr server_identifier;
int server_identifier_matched;
@@ -1200,7 +1202,7 @@ void postdb_startup (void)
}
/* Print usage message. */
#ifndef UNIT_TEST
static void
usage(void) {
log_info("%s %s", message, PACKAGE_VERSION);
@@ -1224,6 +1226,7 @@ usage(void) {
" [-pf pid-file] [--no-pid] [-s server]\n"
" [if0 [...ifN]]");
}
#endif
void lease_pinged (from, packet, length)
struct iaddr from;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2007-2012 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2007-2011 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
@@ -372,6 +372,8 @@ void
ia_remove_iasubopt(struct ia_xx *ia, struct iasubopt *iasubopt,
const char *file, int line) {
int i, j;
if (ia == NULL || iasubopt == NULL)
return;
for (i=0; i<ia->num_iasubopt; i++) {
if (ia->iasubopt[i] == iasubopt) {
@@ -1385,7 +1387,7 @@ release_lease6(struct ipv6_pool *pool, struct iasubopt *lease) {
* Create a prefix by hashing the input, and using that for
* the part subject to allocation.
*/
static void
void
build_prefix6(struct in6_addr *pref,
const struct in6_addr *net_start_pref,
int pool_bits, int pref_bits,
@@ -2120,665 +2122,4 @@ mark_interfaces_unavailable(void) {
}
}
#ifdef UNIT_TEST
#include <stdlib.h>
int
main(int argc, char *argv[]) {
struct iasubopt *iaaddr;
struct iasubopt *iaaddr_copy;
u_int32_t iaid;
struct ia_xx *ia_na;
struct ia_xx *ia_na_copy;
int i;
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;
/*
* Test 0: Basic iaaddr manipulation.
*/
iaaddr = NULL;
if (iasubopt_allocate(&iaaddr, MDL) != ISC_R_SUCCESS) {
printf("ERROR: iasubopt_allocate() %s:%d\n", MDL);
return 1;
}
if (iaaddr->state != FTS_FREE) {
printf("ERROR: bad state %s:%d\n", MDL);
return 1;
}
if (iaaddr->heap_index != -1) {
printf("ERROR: bad heap_index %s:%d\n", MDL);
return 1;
}
iaaddr_copy = NULL;
if (iasubopt_reference(&iaaddr_copy, iaaddr, MDL) != ISC_R_SUCCESS) {
printf("ERROR: iasubopt_reference() %s:%d\n", MDL);
return 1;
}
if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) {
printf("ERROR: iasubopt_reference() %s:%d\n", MDL);
return 1;
}
if (iasubopt_dereference(&iaaddr_copy, MDL) != ISC_R_SUCCESS) {
printf("ERROR: iasubopt_reference() %s:%d\n", MDL);
return 1;
}
/*
* Test 1: Error iaaddr manipulation.
*/
/* bogus allocate arguments */
if (iasubopt_allocate(NULL, MDL) != DHCP_R_INVALIDARG) {
printf("ERROR: iasubopt_allocate() %s:%d\n", MDL);
return 1;
}
iaaddr = (struct iasubopt *)1;
if (iasubopt_allocate(&iaaddr, MDL) != DHCP_R_INVALIDARG) {
printf("ERROR: iasubopt_allocate() %s:%d\n", MDL);
return 1;
}
/* bogus reference arguments */
iaaddr = NULL;
if (iasubopt_allocate(&iaaddr, MDL) != ISC_R_SUCCESS) {
printf("ERROR: iasubopt_allocate() %s:%d\n", MDL);
return 1;
}
if (iasubopt_reference(NULL, iaaddr, MDL) != DHCP_R_INVALIDARG) {
printf("ERROR: iasubopt_reference() %s:%d\n", MDL);
return 1;
}
iaaddr_copy = (struct iasubopt *)1;
if (iasubopt_reference(&iaaddr_copy, iaaddr,
MDL) != DHCP_R_INVALIDARG) {
printf("ERROR: iasubopt_reference() %s:%d\n", MDL);
return 1;
}
iaaddr_copy = NULL;
if (iasubopt_reference(&iaaddr_copy, NULL, MDL) != DHCP_R_INVALIDARG) {
printf("ERROR: iasubopt_reference() %s:%d\n", MDL);
return 1;
}
if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) {
printf("ERROR: iasubopt_reference() %s:%d\n", MDL);
return 1;
}
/* bogus dereference arguments */
if (iasubopt_dereference(NULL, MDL) != DHCP_R_INVALIDARG) {
printf("ERROR: iasubopt_dereference() %s:%d\n", MDL);
return 1;
}
iaaddr = NULL;
if (iasubopt_dereference(&iaaddr, MDL) != DHCP_R_INVALIDARG) {
printf("ERROR: iasubopt_dereference() %s:%d\n", MDL);
return 1;
}
/*
* Test 2: Basic ia_na manipulation.
*/
iaid = 666;
ia_na = NULL;
if (ia_allocate(&ia_na, iaid, "TestDUID", 8, MDL) != ISC_R_SUCCESS) {
printf("ERROR: ia_allocate() %s:%d\n", MDL);
return 1;
}
if (memcmp(ia_na->iaid_duid.data, &iaid, sizeof(iaid)) != 0) {
printf("ERROR: bad IAID_DUID %s:%d\n", MDL);
return 1;
}
if (memcmp(ia_na->iaid_duid.data+sizeof(iaid), "TestDUID", 8) != 0) {
printf("ERROR: bad IAID_DUID %s:%d\n", MDL);
return 1;
}
if (ia_na->num_iasubopt != 0) {
printf("ERROR: bad num_iasubopt %s:%d\n", MDL);
return 1;
}
ia_na_copy = NULL;
if (ia_reference(&ia_na_copy, ia_na, MDL) != ISC_R_SUCCESS) {
printf("ERROR: ia_reference() %s:%d\n", MDL);
return 1;
}
iaaddr = NULL;
if (iasubopt_allocate(&iaaddr, MDL) != ISC_R_SUCCESS) {
printf("ERROR: iasubopt_allocate() %s:%d\n", MDL);
return 1;
}
if (ia_add_iasubopt(ia_na, iaaddr, MDL) != ISC_R_SUCCESS) {
printf("ERROR: ia_add_iasubopt() %s:%d\n", MDL);
return 1;
}
ia_remove_iasubopt(ia_na, iaaddr, MDL);
if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) {
printf("ERROR: iasubopt_reference() %s:%d\n", MDL);
return 1;
}
if (ia_dereference(&ia_na, MDL) != ISC_R_SUCCESS) {
printf("ERROR: ia_dereference() %s:%d\n", MDL);
return 1;
}
if (ia_dereference(&ia_na_copy, MDL) != ISC_R_SUCCESS) {
printf("ERROR: ia_dereference() %s:%d\n", MDL);
return 1;
}
/*
* Test 3: lots of iaaddr in our ia_na
*/
/* lots of iaaddr that we delete */
iaid = 666;
ia_na = NULL;
if (ia_allocate(&ia_na, iaid, "TestDUID", 8, MDL) != ISC_R_SUCCESS) {
printf("ERROR: ia_allocate() %s:%d\n", MDL);
return 1;
}
for (i=0; i<100; i++) {
iaaddr = NULL;
if (iasubopt_allocate(&iaaddr, MDL) != ISC_R_SUCCESS) {
printf("ERROR: iasubopt_allocate() %s:%d\n", MDL);
return 1;
}
if (ia_add_iasubopt(ia_na, iaaddr, MDL) != ISC_R_SUCCESS) {
printf("ERROR: ia_add_iasubopt() %s:%d\n", MDL);
return 1;
}
if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) {
printf("ERROR: iasubopt_reference() %s:%d\n", MDL);
return 1;
}
}
for (i=0; i<100; i++) {
iaaddr = ia_na->iasubopt[random() % ia_na->num_iasubopt];
ia_remove_iasubopt(ia_na, iaaddr, MDL);
}
if (ia_dereference(&ia_na, MDL) != ISC_R_SUCCESS) {
printf("ERROR: ia_dereference() %s:%d\n", MDL);
return 1;
}
/* lots of iaaddr, let dereference cleanup */
iaid = 666;
ia_na = NULL;
if (ia_allocate(&ia_na, iaid, "TestDUID", 8, MDL) != ISC_R_SUCCESS) {
printf("ERROR: ia_allocate() %s:%d\n", MDL);
return 1;
}
for (i=0; i<100; i++) {
iaaddr = NULL;
if (iasubopt_allocate(&iaaddr, MDL) != ISC_R_SUCCESS) {
printf("ERROR: iasubopt_allocate() %s:%d\n", MDL);
return 1;
}
if (ia_add_iasubopt(ia_na, iaaddr, MDL) != ISC_R_SUCCESS) {
printf("ERROR: ia_add_iasubopt() %s:%d\n", MDL);
return 1;
}
if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) {
printf("ERROR: iasubopt_reference() %s:%d\n", MDL);
return 1;
}
}
if (ia_dereference(&ia_na, MDL) != ISC_R_SUCCESS) {
printf("ERROR: ia_dereference() %s:%d\n", MDL);
return 1;
}
/*
* Test 4: Errors in ia_na.
*/
/* bogus allocate arguments */
if (ia_allocate(NULL, 123, "", 0, MDL) != DHCP_R_INVALIDARG) {
printf("ERROR: ia_allocate() %s:%d\n", MDL);
return 1;
}
ia_na = (struct ia_na *)1;
if (ia_allocate(&ia_na, 456, "", 0, MDL) != DHCP_R_INVALIDARG) {
printf("ERROR: ia_allocate() %s:%d\n", MDL);
return 1;
}
/* bogus reference arguments */
iaid = 666;
ia_na = NULL;
if (ia_allocate(&ia_na, iaid, "TestDUID", 8, MDL) != ISC_R_SUCCESS) {
printf("ERROR: ia_allocate() %s:%d\n", MDL);
return 1;
}
if (ia_reference(NULL, ia_na, MDL) != DHCP_R_INVALIDARG) {
printf("ERROR: ia_reference() %s:%d\n", MDL);
return 1;
}
ia_na_copy = (struct ia_na *)1;
if (ia_reference(&ia_na_copy, ia_na, MDL) != DHCP_R_INVALIDARG) {
printf("ERROR: ia_reference() %s:%d\n", MDL);
return 1;
}
ia_na_copy = NULL;
if (ia_reference(&ia_na_copy, NULL, MDL) != DHCP_R_INVALIDARG) {
printf("ERROR: ia_reference() %s:%d\n", MDL);
return 1;
}
if (ia_dereference(&ia_na, MDL) != ISC_R_SUCCESS) {
printf("ERROR: ia_dereference() %s:%d\n", MDL);
return 1;
}
/* bogus dereference arguments */
if (ia_dereference(NULL, MDL) != DHCP_R_INVALIDARG) {
printf("ERROR: ia_dereference() %s:%d\n", MDL);
return 1;
}
/* bogus remove */
iaid = 666;
ia_na = NULL;
if (ia_allocate(&ia_na, iaid, "TestDUID", 8, MDL) != ISC_R_SUCCESS) {
printf("ERROR: ia_allocate() %s:%d\n", MDL);
return 1;
}
ia_remove_iasubopt(ia_na, NULL, MDL);
if (ia_dereference(&ia_na, MDL) != ISC_R_SUCCESS) {
printf("ERROR: ia_dereference() %s:%d\n", MDL);
return 1;
}
/*
* Test 5: Basic ipv6_pool manipulation.
*/
/* allocate, reference */
inet_pton(AF_INET6, "1:2:3:4::", &addr);
pool = NULL;
if (ipv6_pool_allocate(&pool, 0, &addr, 64, 128, MDL) != ISC_R_SUCCESS) {
printf("ERROR: ipv6_pool_allocate() %s:%d\n", MDL);
return 1;
}
if (pool->num_active != 0) {
printf("ERROR: bad num_active %s:%d\n", MDL);
return 1;
}
if (pool->bits != 64) {
printf("ERROR: bad bits %s:%d\n", MDL);
return 1;
}
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) {
printf("ERROR: bad start_addr %s:%d\n", MDL);
return 1;
}
pool_copy = NULL;
if (ipv6_pool_reference(&pool_copy, pool, MDL) != ISC_R_SUCCESS) {
printf("ERROR: ipv6_pool_reference() %s:%d\n", MDL);
return 1;
}
/* create_lease6, renew_lease6, expire_lease6 */
uid = "client0";
memset(&ds, 0, sizeof(ds));
ds.len = strlen(uid);
if (!buffer_allocate(&ds.buffer, ds.len, MDL)) {
printf("Out of memory\n");
return 1;
}
ds.data = ds.buffer->data;
memcpy((char *)ds.data, uid, ds.len);
if (create_lease6(pool, &iaaddr,
&attempts, &ds, 1) != ISC_R_SUCCESS) {
printf("ERROR: create_lease6() %s:%d\n", MDL);
return 1;
}
if (pool->num_inactive != 1) {
printf("ERROR: bad num_inactive %s:%d\n", MDL);
return 1;
}
if (renew_lease6(pool, iaaddr) != ISC_R_SUCCESS) {
printf("ERROR: renew_lease6() %s:%d\n", MDL);
return 1;
}
if (pool->num_active != 1) {
printf("ERROR: bad num_active %s:%d\n", MDL);
return 1;
}
expired_iaaddr = NULL;
if (expire_lease6(&expired_iaaddr, pool, 0) != ISC_R_SUCCESS) {
printf("ERROR: expire_lease6() %s:%d\n", MDL);
return 1;
}
if (expired_iaaddr != NULL) {
printf("ERROR: should not have expired a lease %s:%d\n", MDL);
return 1;
}
if (pool->num_active != 1) {
printf("ERROR: bad num_active %s:%d\n", MDL);
return 1;
}
if (expire_lease6(&expired_iaaddr, pool, 1000) != ISC_R_SUCCESS) {
printf("ERROR: expire_lease6() %s:%d\n", MDL);
return 1;
}
if (expired_iaaddr == NULL) {
printf("ERROR: should have expired a lease %s:%d\n", MDL);
return 1;
}
if (iasubopt_dereference(&expired_iaaddr, MDL) != ISC_R_SUCCESS) {
printf("ERROR: iasubopt_dereference() %s:%d\n", MDL);
return 1;
}
if (pool->num_active != 0) {
printf("ERROR: bad num_active %s:%d\n", MDL);
return 1;
}
if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) {
printf("ERROR: iasubopt_dereference() %s:%d\n", MDL);
return 1;
}
/* release_lease6, decline_lease6 */
if (create_lease6(pool, &iaaddr, &attempts,
&ds, 1) != ISC_R_SUCCESS) {
printf("ERROR: create_lease6() %s:%d\n", MDL);
return 1;
}
if (renew_lease6(pool, iaaddr) != ISC_R_SUCCESS) {
printf("ERROR: renew_lease6() %s:%d\n", MDL);
return 1;
}
if (pool->num_active != 1) {
printf("ERROR: bad num_active %s:%d\n", MDL);
return 1;
}
if (release_lease6(pool, iaaddr) != ISC_R_SUCCESS) {
printf("ERROR: decline_lease6() %s:%d\n", MDL);
return 1;
}
if (pool->num_active != 0) {
printf("ERROR: bad num_active %s:%d\n", MDL);
return 1;
}
if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) {
printf("ERROR: iasubopt_dereference() %s:%d\n", MDL);
return 1;
}
if (create_lease6(pool, &iaaddr, &attempts,
&ds, 1) != ISC_R_SUCCESS) {
printf("ERROR: create_lease6() %s:%d\n", MDL);
return 1;
}
if (renew_lease6(pool, iaaddr) != ISC_R_SUCCESS) {
printf("ERROR: renew_lease6() %s:%d\n", MDL);
return 1;
}
if (pool->num_active != 1) {
printf("ERROR: bad num_active %s:%d\n", MDL);
return 1;
}
if (decline_lease6(pool, iaaddr) != ISC_R_SUCCESS) {
printf("ERROR: decline_lease6() %s:%d\n", MDL);
return 1;
}
if (pool->num_active != 1) {
printf("ERROR: bad num_active %s:%d\n", MDL);
return 1;
}
if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) {
printf("ERROR: iasubopt_dereference() %s:%d\n", MDL);
return 1;
}
/* dereference */
if (ipv6_pool_dereference(&pool, MDL) != ISC_R_SUCCESS) {
printf("ERROR: ipv6_pool_reference() %s:%d\n", MDL);
return 1;
}
if (ipv6_pool_dereference(&pool_copy, MDL) != ISC_R_SUCCESS) {
printf("ERROR: ipv6_pool_reference() %s:%d\n", MDL);
return 1;
}
/*
* Test 6: Error ipv6_pool manipulation
*/
if (ipv6_pool_allocate(NULL, 0, &addr,
64, 128, MDL) != DHCP_R_INVALIDARG) {
printf("ERROR: ipv6_pool_allocate() %s:%d\n", MDL);
return 1;
}
pool = (struct ipv6_pool *)1;
if (ipv6_pool_allocate(&pool, 0, &addr,
64, 128, MDL) != DHCP_R_INVALIDARG) {
printf("ERROR: ipv6_pool_allocate() %s:%d\n", MDL);
return 1;
}
if (ipv6_pool_reference(NULL, pool, MDL) != DHCP_R_INVALIDARG) {
printf("ERROR: ipv6_pool_reference() %s:%d\n", MDL);
return 1;
}
pool_copy = (struct ipv6_pool *)1;
if (ipv6_pool_reference(&pool_copy, pool, MDL) != DHCP_R_INVALIDARG) {
printf("ERROR: ipv6_pool_reference() %s:%d\n", MDL);
return 1;
}
pool_copy = NULL;
if (ipv6_pool_reference(&pool_copy, NULL, MDL) != DHCP_R_INVALIDARG) {
printf("ERROR: ipv6_pool_reference() %s:%d\n", MDL);
return 1;
}
if (ipv6_pool_dereference(NULL, MDL) != DHCP_R_INVALIDARG) {
printf("ERROR: ipv6_pool_dereference() %s:%d\n", MDL);
return 1;
}
if (ipv6_pool_dereference(&pool_copy, MDL) != DHCP_R_INVALIDARG) {
printf("ERROR: ipv6_pool_dereference() %s:%d\n", MDL);
return 1;
}
/*
* Test 7: order of expiration
*/
pool = NULL;
if (ipv6_pool_allocate(&pool, 0, &addr, 64, 128, MDL) != ISC_R_SUCCESS) {
printf("ERROR: ipv6_pool_allocate() %s:%d\n", MDL);
return 1;
}
for (i=10; i<100; i+=10) {
if (create_lease6(pool, &iaaddr, &attempts,
&ds, i) != ISC_R_SUCCESS) {
printf("ERROR: create_lease6() %s:%d\n", MDL);
return 1;
}
if (renew_lease6(pool, iaaddr) != ISC_R_SUCCESS) {
printf("ERROR: renew_lease6() %s:%d\n", MDL);
return 1;
}
if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) {
printf("ERROR: iasubopt_dereference() %s:%d\n", MDL);
return 1;
}
if (pool->num_active != (i / 10)) {
printf("ERROR: bad num_active %s:%d\n", MDL);
return 1;
}
}
if (pool->num_active != 9) {
printf("ERROR: bad num_active %s:%d\n", MDL);
return 1;
}
for (i=10; i<100; i+=10) {
if (expire_lease6(&expired_iaaddr,
pool, 1000) != ISC_R_SUCCESS) {
printf("ERROR: expire_lease6() %s:%d\n", MDL);
return 1;
}
if (expired_iaaddr == NULL) {
printf("ERROR: should have expired a lease %s:%d\n",
MDL);
return 1;
}
if (pool->num_active != (9 - (i / 10))) {
printf("ERROR: bad num_active %s:%d\n", MDL);
return 1;
}
if (expired_iaaddr->hard_lifetime_end_time != i) {
printf("ERROR: bad hard_lifetime_end_time %s:%d\n",
MDL);
return 1;
}
if (iasubopt_dereference(&expired_iaaddr, MDL) !=
ISC_R_SUCCESS) {
printf("ERROR: iasubopt_dereference() %s:%d\n", MDL);
return 1;
}
}
if (pool->num_active != 0) {
printf("ERROR: bad num_active %s:%d\n", MDL);
return 1;
}
expired_iaaddr = NULL;
if (expire_lease6(&expired_iaaddr, pool, 1000) != ISC_R_SUCCESS) {
printf("ERROR: expire_lease6() %s:%d\n", MDL);
return 1;
}
if (ipv6_pool_dereference(&pool, MDL) != ISC_R_SUCCESS) {
printf("ERROR: ipv6_pool_dereference() %s:%d\n", MDL);
return 1;
}
/*
* Test 8: small pool
*/
pool = NULL;
addr.s6_addr[14] = 0x81;
if (ipv6_pool_allocate(&pool, 0, &addr, 127, 128, MDL) != ISC_R_SUCCESS) {
printf("ERROR: ipv6_pool_allocate() %s:%d\n", MDL);
return 1;
}
if (create_lease6(pool, &iaaddr, &attempts,
&ds, 42) != ISC_R_SUCCESS) {
printf("ERROR: create_lease6() %s:%d\n", MDL);
return 1;
}
if (renew_lease6(pool, iaaddr) != ISC_R_SUCCESS) {
printf("ERROR: renew_lease6() %s:%d\n", MDL);
return 1;
}
if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) {
printf("ERROR: iasubopt_dereference() %s:%d\n", MDL);
return 1;
}
if (create_lease6(pool, &iaaddr, &attempts,
&ds, 11) != ISC_R_SUCCESS) {
printf("ERROR: create_lease6() %s:%d\n", MDL);
return 1;
}
if (renew_lease6(pool, iaaddr) != ISC_R_SUCCESS) {
printf("ERROR: renew_lease6() %s:%d\n", MDL);
return 1;
}
if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) {
printf("ERROR: iasubopt_dereference() %s:%d\n", MDL);
return 1;
}
if (create_lease6(pool, &iaaddr, &attempts,
&ds, 11) != ISC_R_NORESOURCES) {
printf("ERROR: create_lease6() %s:%d\n", MDL);
return 1;
}
if (ipv6_pool_dereference(&pool, MDL) != ISC_R_SUCCESS) {
printf("ERROR: ipv6_pool_dereference() %s:%d\n", MDL);
return 1;
}
addr.s6_addr[14] = 0;
/*
* Test 9: functions across all pools
*/
pool = NULL;
if (ipv6_pool_allocate(&pool, 0, &addr, 64, 128, MDL) != ISC_R_SUCCESS) {
printf("ERROR: ipv6_pool_allocate() %s:%d\n", MDL);
return 1;
}
if (add_ipv6_pool(pool) != ISC_R_SUCCESS) {
printf("ERROR: add_ipv6_pool() %s:%d\n", MDL);
return 1;
}
if (ipv6_pool_dereference(&pool, MDL) != ISC_R_SUCCESS) {
printf("ERROR: ipv6_pool_dereference() %s:%d\n", MDL);
return 1;
}
pool = NULL;
if (find_ipv6_pool(&pool, 0, &addr) != ISC_R_SUCCESS) {
printf("ERROR: find_ipv6_pool() %s:%d\n", MDL);
return 1;
}
if (ipv6_pool_dereference(&pool, MDL) != ISC_R_SUCCESS) {
printf("ERROR: ipv6_pool_dereference() %s:%d\n", MDL);
return 1;
}
inet_pton(AF_INET6, "1:2:3:4:ffff:ffff:ffff:ffff", &addr);
pool = NULL;
if (find_ipv6_pool(&pool, 0, &addr) != ISC_R_SUCCESS) {
printf("ERROR: find_ipv6_pool() %s:%d\n", MDL);
return 1;
}
if (ipv6_pool_dereference(&pool, MDL) != ISC_R_SUCCESS) {
printf("ERROR: ipv6_pool_dereference() %s:%d\n", MDL);
return 1;
}
inet_pton(AF_INET6, "1:2:3:5::", &addr);
pool = NULL;
if (find_ipv6_pool(&pool, 0, &addr) != ISC_R_NOTFOUND) {
printf("ERROR: find_ipv6_pool() %s:%d\n", MDL);
return 1;
}
inet_pton(AF_INET6, "1:2:3:3:ffff:ffff:ffff:ffff", &addr);
pool = NULL;
if (find_ipv6_pool(&pool, 0, &addr) != ISC_R_NOTFOUND) {
printf("ERROR: find_ipv6_pool() %s:%d\n", MDL);
return 1;
}
/* iaid = 666;
ia_na = NULL;
if (ia_allocate(&ia_na, iaid, "TestDUID", 8, MDL) != ISC_R_SUCCESS) {
printf("ERROR: ia_allocate() %s:%d\n", MDL);
return 1;
}*/
{
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);
}
}
printf("SUCCESS: all tests passed (ignore any warning messages)\n");
return 0;
}
#endif
/* unittest moved to server/tests/mdb6_unittest.c */

5
server/tests/Atffile Normal file
View File

@@ -0,0 +1,5 @@
Content-Type: application/X-atf-atffile; version="1"
prop: test-suite = dhcp4
tp-glob: *_unittests

49
server/tests/Makefile.am Normal file
View File

@@ -0,0 +1,49 @@
SUBDIRS = .
AM_CPPFLAGS = $(ATF_CFLAGS) -DUNIT_TEST -I$(top_srcdir)/includes
AM_CPPFLAGS += -std=c99 -I$(top_srcdir)/bind/include -I$(top_srcdir)
AM_CPPFLAGS += -DLOCALSTATEDIR='"."' -Wno-unused-function -Wno-error=unused-variable
# for autotools debugging only
info:
@echo "ATF_CFLAGS=$(ATF_CFLAGS)"
@echo "ATF_LDFLAGS=$(ATF_LDFLAGS)"
@echo "ATF_LIBS=$(ATF_LIBS)"
DHCPSRC = ../dhcp.c ../bootp.c ../confpars.c ../db.c ../class.c \
../failover.c ../omapi.c ../mdb.c ../stables.c ../salloc.c \
../ddns.c ../dhcpleasequery.c ../dhcpv6.c ../mdb6.c \
../ldap.c ../ldap_casa.c ../dhcpd.c
DHCPLIBS = $(top_builddir)/common/libdhcp.a $(top_builddir)/omapip/libomapi.a \
$(top_builddir)/dhcpctl/libdhcpctl.a $(top_builddir)/bind/lib/libdns.a \
$(top_builddir)/bind/lib/libisc.a
ATF_TESTS =
TESTS =
if HAVE_ATF
check: $(ATF_TESTS)
atf-run | atf-report
ATF_TESTS += dhcpd_unittests legacy_unittests hash_unittests
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)
endif
check_PROGRAMS = $(ATF_TESTS) $(TESTS)

915
server/tests/Makefile.in Normal file
View File

@@ -0,0 +1,915 @@
# Makefile.in generated by automake 1.10.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
TESTS =
@HAVE_ATF_TRUE@am__append_1 = dhcpd_unittests legacy_unittests hash_unittests
check_PROGRAMS = $(am__EXEEXT_2) $(am__EXEEXT_3)
subdir = server/tests
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/includes/config.h
CONFIG_CLEAN_FILES =
@HAVE_ATF_TRUE@am__EXEEXT_1 = dhcpd_unittests$(EXEEXT) \
@HAVE_ATF_TRUE@ legacy_unittests$(EXEEXT) \
@HAVE_ATF_TRUE@ hash_unittests$(EXEEXT)
am__EXEEXT_2 = $(am__EXEEXT_1)
am__EXEEXT_3 =
am__dhcpd_unittests_SOURCES_DIST = ../dhcp.c ../bootp.c ../confpars.c \
../db.c ../class.c ../failover.c ../omapi.c ../mdb.c \
../stables.c ../salloc.c ../ddns.c ../dhcpleasequery.c \
../dhcpv6.c ../mdb6.c ../ldap.c ../ldap_casa.c ../dhcpd.c \
simple_unittest.c
am__objects_1 = dhcp.$(OBJEXT) bootp.$(OBJEXT) confpars.$(OBJEXT) \
db.$(OBJEXT) class.$(OBJEXT) failover.$(OBJEXT) \
omapi.$(OBJEXT) mdb.$(OBJEXT) stables.$(OBJEXT) \
salloc.$(OBJEXT) ddns.$(OBJEXT) dhcpleasequery.$(OBJEXT) \
dhcpv6.$(OBJEXT) mdb6.$(OBJEXT) ldap.$(OBJEXT) \
ldap_casa.$(OBJEXT) dhcpd.$(OBJEXT)
@HAVE_ATF_TRUE@am_dhcpd_unittests_OBJECTS = $(am__objects_1) \
@HAVE_ATF_TRUE@ simple_unittest.$(OBJEXT)
dhcpd_unittests_OBJECTS = $(am_dhcpd_unittests_OBJECTS)
am__DEPENDENCIES_1 =
@HAVE_ATF_TRUE@dhcpd_unittests_DEPENDENCIES = $(am__DEPENDENCIES_1) \
@HAVE_ATF_TRUE@ $(DHCPLIBS)
dhcpd_unittests_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(dhcpd_unittests_LDFLAGS) $(LDFLAGS) -o $@
am__hash_unittests_SOURCES_DIST = ../dhcp.c ../bootp.c ../confpars.c \
../db.c ../class.c ../failover.c ../omapi.c ../mdb.c \
../stables.c ../salloc.c ../ddns.c ../dhcpleasequery.c \
../dhcpv6.c ../mdb6.c ../ldap.c ../ldap_casa.c ../dhcpd.c \
hash_unittest.c
@HAVE_ATF_TRUE@am_hash_unittests_OBJECTS = $(am__objects_1) \
@HAVE_ATF_TRUE@ hash_unittest.$(OBJEXT)
hash_unittests_OBJECTS = $(am_hash_unittests_OBJECTS)
@HAVE_ATF_TRUE@hash_unittests_DEPENDENCIES = $(DHCPLIBS) \
@HAVE_ATF_TRUE@ $(am__DEPENDENCIES_1)
am__legacy_unittests_SOURCES_DIST = ../dhcp.c ../bootp.c ../confpars.c \
../db.c ../class.c ../failover.c ../omapi.c ../mdb.c \
../stables.c ../salloc.c ../ddns.c ../dhcpleasequery.c \
../dhcpv6.c ../mdb6.c ../ldap.c ../ldap_casa.c ../dhcpd.c \
mdb6_unittest.c
@HAVE_ATF_TRUE@am_legacy_unittests_OBJECTS = $(am__objects_1) \
@HAVE_ATF_TRUE@ mdb6_unittest.$(OBJEXT)
legacy_unittests_OBJECTS = $(am_legacy_unittests_OBJECTS)
@HAVE_ATF_TRUE@legacy_unittests_DEPENDENCIES = $(DHCPLIBS) \
@HAVE_ATF_TRUE@ $(am__DEPENDENCIES_1)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/includes
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(dhcpd_unittests_SOURCES) $(hash_unittests_SOURCES) \
$(legacy_unittests_SOURCES)
DIST_SOURCES = $(am__dhcpd_unittests_SOURCES_DIST) \
$(am__hash_unittests_SOURCES_DIST) \
$(am__legacy_unittests_SOURCES_DIST)
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
install-html-recursive install-info-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
ATF_CFLAGS = @ATF_CFLAGS@
ATF_LDFLAGS = @ATF_LDFLAGS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDAP_CFLAGS = @LDAP_CFLAGS@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_prefix_program = @ac_prefix_program@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
builddir = @builddir@
byte_order = @byte_order@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = .
AM_CPPFLAGS = $(ATF_CFLAGS) -DUNIT_TEST -I$(top_srcdir)/includes \
-std=c99 -I$(top_srcdir)/bind/include -I$(top_srcdir) \
-DLOCALSTATEDIR='"."' -Wno-unused-function \
-Wno-error=unused-variable
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)
all: all-recursive
.SUFFIXES:
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign server/tests/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign server/tests/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
clean-checkPROGRAMS:
-test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS)
dhcpd_unittests$(EXEEXT): $(dhcpd_unittests_OBJECTS) $(dhcpd_unittests_DEPENDENCIES)
@rm -f dhcpd_unittests$(EXEEXT)
$(dhcpd_unittests_LINK) $(dhcpd_unittests_OBJECTS) $(dhcpd_unittests_LDADD) $(LIBS)
hash_unittests$(EXEEXT): $(hash_unittests_OBJECTS) $(hash_unittests_DEPENDENCIES)
@rm -f hash_unittests$(EXEEXT)
$(LINK) $(hash_unittests_OBJECTS) $(hash_unittests_LDADD) $(LIBS)
legacy_unittests$(EXEEXT): $(legacy_unittests_OBJECTS) $(legacy_unittests_DEPENDENCIES)
@rm -f legacy_unittests$(EXEEXT)
$(LINK) $(legacy_unittests_OBJECTS) $(legacy_unittests_LDADD) $(LIBS)
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)/mdb.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mdb6.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mdb6_unittest.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/omapi.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/salloc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple_unittest.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stables.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
dhcp.o: ../dhcp.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dhcp.o -MD -MP -MF $(DEPDIR)/dhcp.Tpo -c -o dhcp.o `test -f '../dhcp.c' || echo '$(srcdir)/'`../dhcp.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dhcp.Tpo $(DEPDIR)/dhcp.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../dhcp.c' object='dhcp.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dhcp.o `test -f '../dhcp.c' || echo '$(srcdir)/'`../dhcp.c
dhcp.obj: ../dhcp.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dhcp.obj -MD -MP -MF $(DEPDIR)/dhcp.Tpo -c -o dhcp.obj `if test -f '../dhcp.c'; then $(CYGPATH_W) '../dhcp.c'; else $(CYGPATH_W) '$(srcdir)/../dhcp.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dhcp.Tpo $(DEPDIR)/dhcp.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../dhcp.c' object='dhcp.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dhcp.obj `if test -f '../dhcp.c'; then $(CYGPATH_W) '../dhcp.c'; else $(CYGPATH_W) '$(srcdir)/../dhcp.c'; fi`
bootp.o: ../bootp.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bootp.o -MD -MP -MF $(DEPDIR)/bootp.Tpo -c -o bootp.o `test -f '../bootp.c' || echo '$(srcdir)/'`../bootp.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/bootp.Tpo $(DEPDIR)/bootp.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../bootp.c' object='bootp.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bootp.o `test -f '../bootp.c' || echo '$(srcdir)/'`../bootp.c
bootp.obj: ../bootp.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bootp.obj -MD -MP -MF $(DEPDIR)/bootp.Tpo -c -o bootp.obj `if test -f '../bootp.c'; then $(CYGPATH_W) '../bootp.c'; else $(CYGPATH_W) '$(srcdir)/../bootp.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/bootp.Tpo $(DEPDIR)/bootp.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../bootp.c' object='bootp.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bootp.obj `if test -f '../bootp.c'; then $(CYGPATH_W) '../bootp.c'; else $(CYGPATH_W) '$(srcdir)/../bootp.c'; fi`
confpars.o: ../confpars.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT confpars.o -MD -MP -MF $(DEPDIR)/confpars.Tpo -c -o confpars.o `test -f '../confpars.c' || echo '$(srcdir)/'`../confpars.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/confpars.Tpo $(DEPDIR)/confpars.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../confpars.c' object='confpars.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o confpars.o `test -f '../confpars.c' || echo '$(srcdir)/'`../confpars.c
confpars.obj: ../confpars.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT confpars.obj -MD -MP -MF $(DEPDIR)/confpars.Tpo -c -o confpars.obj `if test -f '../confpars.c'; then $(CYGPATH_W) '../confpars.c'; else $(CYGPATH_W) '$(srcdir)/../confpars.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/confpars.Tpo $(DEPDIR)/confpars.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../confpars.c' object='confpars.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o confpars.obj `if test -f '../confpars.c'; then $(CYGPATH_W) '../confpars.c'; else $(CYGPATH_W) '$(srcdir)/../confpars.c'; fi`
db.o: ../db.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT db.o -MD -MP -MF $(DEPDIR)/db.Tpo -c -o db.o `test -f '../db.c' || echo '$(srcdir)/'`../db.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/db.Tpo $(DEPDIR)/db.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../db.c' object='db.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o db.o `test -f '../db.c' || echo '$(srcdir)/'`../db.c
db.obj: ../db.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT db.obj -MD -MP -MF $(DEPDIR)/db.Tpo -c -o db.obj `if test -f '../db.c'; then $(CYGPATH_W) '../db.c'; else $(CYGPATH_W) '$(srcdir)/../db.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/db.Tpo $(DEPDIR)/db.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../db.c' object='db.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o db.obj `if test -f '../db.c'; then $(CYGPATH_W) '../db.c'; else $(CYGPATH_W) '$(srcdir)/../db.c'; fi`
class.o: ../class.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT class.o -MD -MP -MF $(DEPDIR)/class.Tpo -c -o class.o `test -f '../class.c' || echo '$(srcdir)/'`../class.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/class.Tpo $(DEPDIR)/class.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../class.c' object='class.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o class.o `test -f '../class.c' || echo '$(srcdir)/'`../class.c
class.obj: ../class.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT class.obj -MD -MP -MF $(DEPDIR)/class.Tpo -c -o class.obj `if test -f '../class.c'; then $(CYGPATH_W) '../class.c'; else $(CYGPATH_W) '$(srcdir)/../class.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/class.Tpo $(DEPDIR)/class.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../class.c' object='class.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o class.obj `if test -f '../class.c'; then $(CYGPATH_W) '../class.c'; else $(CYGPATH_W) '$(srcdir)/../class.c'; fi`
failover.o: ../failover.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT failover.o -MD -MP -MF $(DEPDIR)/failover.Tpo -c -o failover.o `test -f '../failover.c' || echo '$(srcdir)/'`../failover.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/failover.Tpo $(DEPDIR)/failover.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../failover.c' object='failover.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o failover.o `test -f '../failover.c' || echo '$(srcdir)/'`../failover.c
failover.obj: ../failover.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT failover.obj -MD -MP -MF $(DEPDIR)/failover.Tpo -c -o failover.obj `if test -f '../failover.c'; then $(CYGPATH_W) '../failover.c'; else $(CYGPATH_W) '$(srcdir)/../failover.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/failover.Tpo $(DEPDIR)/failover.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../failover.c' object='failover.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o failover.obj `if test -f '../failover.c'; then $(CYGPATH_W) '../failover.c'; else $(CYGPATH_W) '$(srcdir)/../failover.c'; fi`
omapi.o: ../omapi.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT omapi.o -MD -MP -MF $(DEPDIR)/omapi.Tpo -c -o omapi.o `test -f '../omapi.c' || echo '$(srcdir)/'`../omapi.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/omapi.Tpo $(DEPDIR)/omapi.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../omapi.c' object='omapi.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o omapi.o `test -f '../omapi.c' || echo '$(srcdir)/'`../omapi.c
omapi.obj: ../omapi.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT omapi.obj -MD -MP -MF $(DEPDIR)/omapi.Tpo -c -o omapi.obj `if test -f '../omapi.c'; then $(CYGPATH_W) '../omapi.c'; else $(CYGPATH_W) '$(srcdir)/../omapi.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/omapi.Tpo $(DEPDIR)/omapi.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../omapi.c' object='omapi.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o omapi.obj `if test -f '../omapi.c'; then $(CYGPATH_W) '../omapi.c'; else $(CYGPATH_W) '$(srcdir)/../omapi.c'; fi`
mdb.o: ../mdb.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mdb.o -MD -MP -MF $(DEPDIR)/mdb.Tpo -c -o mdb.o `test -f '../mdb.c' || echo '$(srcdir)/'`../mdb.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/mdb.Tpo $(DEPDIR)/mdb.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../mdb.c' object='mdb.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mdb.o `test -f '../mdb.c' || echo '$(srcdir)/'`../mdb.c
mdb.obj: ../mdb.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mdb.obj -MD -MP -MF $(DEPDIR)/mdb.Tpo -c -o mdb.obj `if test -f '../mdb.c'; then $(CYGPATH_W) '../mdb.c'; else $(CYGPATH_W) '$(srcdir)/../mdb.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/mdb.Tpo $(DEPDIR)/mdb.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../mdb.c' object='mdb.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mdb.obj `if test -f '../mdb.c'; then $(CYGPATH_W) '../mdb.c'; else $(CYGPATH_W) '$(srcdir)/../mdb.c'; fi`
stables.o: ../stables.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stables.o -MD -MP -MF $(DEPDIR)/stables.Tpo -c -o stables.o `test -f '../stables.c' || echo '$(srcdir)/'`../stables.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/stables.Tpo $(DEPDIR)/stables.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../stables.c' object='stables.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stables.o `test -f '../stables.c' || echo '$(srcdir)/'`../stables.c
stables.obj: ../stables.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stables.obj -MD -MP -MF $(DEPDIR)/stables.Tpo -c -o stables.obj `if test -f '../stables.c'; then $(CYGPATH_W) '../stables.c'; else $(CYGPATH_W) '$(srcdir)/../stables.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/stables.Tpo $(DEPDIR)/stables.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../stables.c' object='stables.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stables.obj `if test -f '../stables.c'; then $(CYGPATH_W) '../stables.c'; else $(CYGPATH_W) '$(srcdir)/../stables.c'; fi`
salloc.o: ../salloc.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT salloc.o -MD -MP -MF $(DEPDIR)/salloc.Tpo -c -o salloc.o `test -f '../salloc.c' || echo '$(srcdir)/'`../salloc.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/salloc.Tpo $(DEPDIR)/salloc.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../salloc.c' object='salloc.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o salloc.o `test -f '../salloc.c' || echo '$(srcdir)/'`../salloc.c
salloc.obj: ../salloc.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT salloc.obj -MD -MP -MF $(DEPDIR)/salloc.Tpo -c -o salloc.obj `if test -f '../salloc.c'; then $(CYGPATH_W) '../salloc.c'; else $(CYGPATH_W) '$(srcdir)/../salloc.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/salloc.Tpo $(DEPDIR)/salloc.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../salloc.c' object='salloc.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o salloc.obj `if test -f '../salloc.c'; then $(CYGPATH_W) '../salloc.c'; else $(CYGPATH_W) '$(srcdir)/../salloc.c'; fi`
ddns.o: ../ddns.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ddns.o -MD -MP -MF $(DEPDIR)/ddns.Tpo -c -o ddns.o `test -f '../ddns.c' || echo '$(srcdir)/'`../ddns.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ddns.Tpo $(DEPDIR)/ddns.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../ddns.c' object='ddns.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ddns.o `test -f '../ddns.c' || echo '$(srcdir)/'`../ddns.c
ddns.obj: ../ddns.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ddns.obj -MD -MP -MF $(DEPDIR)/ddns.Tpo -c -o ddns.obj `if test -f '../ddns.c'; then $(CYGPATH_W) '../ddns.c'; else $(CYGPATH_W) '$(srcdir)/../ddns.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ddns.Tpo $(DEPDIR)/ddns.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../ddns.c' object='ddns.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ddns.obj `if test -f '../ddns.c'; then $(CYGPATH_W) '../ddns.c'; else $(CYGPATH_W) '$(srcdir)/../ddns.c'; fi`
dhcpleasequery.o: ../dhcpleasequery.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dhcpleasequery.o -MD -MP -MF $(DEPDIR)/dhcpleasequery.Tpo -c -o dhcpleasequery.o `test -f '../dhcpleasequery.c' || echo '$(srcdir)/'`../dhcpleasequery.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dhcpleasequery.Tpo $(DEPDIR)/dhcpleasequery.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../dhcpleasequery.c' object='dhcpleasequery.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dhcpleasequery.o `test -f '../dhcpleasequery.c' || echo '$(srcdir)/'`../dhcpleasequery.c
dhcpleasequery.obj: ../dhcpleasequery.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dhcpleasequery.obj -MD -MP -MF $(DEPDIR)/dhcpleasequery.Tpo -c -o dhcpleasequery.obj `if test -f '../dhcpleasequery.c'; then $(CYGPATH_W) '../dhcpleasequery.c'; else $(CYGPATH_W) '$(srcdir)/../dhcpleasequery.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dhcpleasequery.Tpo $(DEPDIR)/dhcpleasequery.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../dhcpleasequery.c' object='dhcpleasequery.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dhcpleasequery.obj `if test -f '../dhcpleasequery.c'; then $(CYGPATH_W) '../dhcpleasequery.c'; else $(CYGPATH_W) '$(srcdir)/../dhcpleasequery.c'; fi`
dhcpv6.o: ../dhcpv6.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dhcpv6.o -MD -MP -MF $(DEPDIR)/dhcpv6.Tpo -c -o dhcpv6.o `test -f '../dhcpv6.c' || echo '$(srcdir)/'`../dhcpv6.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dhcpv6.Tpo $(DEPDIR)/dhcpv6.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../dhcpv6.c' object='dhcpv6.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dhcpv6.o `test -f '../dhcpv6.c' || echo '$(srcdir)/'`../dhcpv6.c
dhcpv6.obj: ../dhcpv6.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dhcpv6.obj -MD -MP -MF $(DEPDIR)/dhcpv6.Tpo -c -o dhcpv6.obj `if test -f '../dhcpv6.c'; then $(CYGPATH_W) '../dhcpv6.c'; else $(CYGPATH_W) '$(srcdir)/../dhcpv6.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dhcpv6.Tpo $(DEPDIR)/dhcpv6.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../dhcpv6.c' object='dhcpv6.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dhcpv6.obj `if test -f '../dhcpv6.c'; then $(CYGPATH_W) '../dhcpv6.c'; else $(CYGPATH_W) '$(srcdir)/../dhcpv6.c'; fi`
mdb6.o: ../mdb6.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mdb6.o -MD -MP -MF $(DEPDIR)/mdb6.Tpo -c -o mdb6.o `test -f '../mdb6.c' || echo '$(srcdir)/'`../mdb6.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/mdb6.Tpo $(DEPDIR)/mdb6.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../mdb6.c' object='mdb6.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mdb6.o `test -f '../mdb6.c' || echo '$(srcdir)/'`../mdb6.c
mdb6.obj: ../mdb6.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mdb6.obj -MD -MP -MF $(DEPDIR)/mdb6.Tpo -c -o mdb6.obj `if test -f '../mdb6.c'; then $(CYGPATH_W) '../mdb6.c'; else $(CYGPATH_W) '$(srcdir)/../mdb6.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/mdb6.Tpo $(DEPDIR)/mdb6.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../mdb6.c' object='mdb6.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mdb6.obj `if test -f '../mdb6.c'; then $(CYGPATH_W) '../mdb6.c'; else $(CYGPATH_W) '$(srcdir)/../mdb6.c'; fi`
ldap.o: ../ldap.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ldap.o -MD -MP -MF $(DEPDIR)/ldap.Tpo -c -o ldap.o `test -f '../ldap.c' || echo '$(srcdir)/'`../ldap.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ldap.Tpo $(DEPDIR)/ldap.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../ldap.c' object='ldap.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ldap.o `test -f '../ldap.c' || echo '$(srcdir)/'`../ldap.c
ldap.obj: ../ldap.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ldap.obj -MD -MP -MF $(DEPDIR)/ldap.Tpo -c -o ldap.obj `if test -f '../ldap.c'; then $(CYGPATH_W) '../ldap.c'; else $(CYGPATH_W) '$(srcdir)/../ldap.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ldap.Tpo $(DEPDIR)/ldap.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../ldap.c' object='ldap.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ldap.obj `if test -f '../ldap.c'; then $(CYGPATH_W) '../ldap.c'; else $(CYGPATH_W) '$(srcdir)/../ldap.c'; fi`
ldap_casa.o: ../ldap_casa.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ldap_casa.o -MD -MP -MF $(DEPDIR)/ldap_casa.Tpo -c -o ldap_casa.o `test -f '../ldap_casa.c' || echo '$(srcdir)/'`../ldap_casa.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ldap_casa.Tpo $(DEPDIR)/ldap_casa.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../ldap_casa.c' object='ldap_casa.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ldap_casa.o `test -f '../ldap_casa.c' || echo '$(srcdir)/'`../ldap_casa.c
ldap_casa.obj: ../ldap_casa.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ldap_casa.obj -MD -MP -MF $(DEPDIR)/ldap_casa.Tpo -c -o ldap_casa.obj `if test -f '../ldap_casa.c'; then $(CYGPATH_W) '../ldap_casa.c'; else $(CYGPATH_W) '$(srcdir)/../ldap_casa.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ldap_casa.Tpo $(DEPDIR)/ldap_casa.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../ldap_casa.c' object='ldap_casa.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ldap_casa.obj `if test -f '../ldap_casa.c'; then $(CYGPATH_W) '../ldap_casa.c'; else $(CYGPATH_W) '$(srcdir)/../ldap_casa.c'; fi`
dhcpd.o: ../dhcpd.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dhcpd.o -MD -MP -MF $(DEPDIR)/dhcpd.Tpo -c -o dhcpd.o `test -f '../dhcpd.c' || echo '$(srcdir)/'`../dhcpd.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dhcpd.Tpo $(DEPDIR)/dhcpd.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../dhcpd.c' object='dhcpd.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dhcpd.o `test -f '../dhcpd.c' || echo '$(srcdir)/'`../dhcpd.c
dhcpd.obj: ../dhcpd.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dhcpd.obj -MD -MP -MF $(DEPDIR)/dhcpd.Tpo -c -o dhcpd.obj `if test -f '../dhcpd.c'; then $(CYGPATH_W) '../dhcpd.c'; else $(CYGPATH_W) '$(srcdir)/../dhcpd.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dhcpd.Tpo $(DEPDIR)/dhcpd.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../dhcpd.c' object='dhcpd.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dhcpd.obj `if test -f '../dhcpd.c'; then $(CYGPATH_W) '../dhcpd.c'; else $(CYGPATH_W) '$(srcdir)/../dhcpd.c'; fi`
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
$(RECURSIVE_CLEAN_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \
srcdir=$(srcdir); export srcdir; \
list=' $(TESTS) '; \
if test -n "$$list"; then \
for tst in $$list; do \
if test -f ./$$tst; then dir=./; \
elif test -f $$tst; then dir=; \
else dir="$(srcdir)/"; fi; \
if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*$$ws$$tst$$ws*) \
xpass=`expr $$xpass + 1`; \
failed=`expr $$failed + 1`; \
echo "XPASS: $$tst"; \
;; \
*) \
echo "PASS: $$tst"; \
;; \
esac; \
elif test $$? -ne 77; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*$$ws$$tst$$ws*) \
xfail=`expr $$xfail + 1`; \
echo "XFAIL: $$tst"; \
;; \
*) \
failed=`expr $$failed + 1`; \
echo "FAIL: $$tst"; \
;; \
esac; \
else \
skip=`expr $$skip + 1`; \
echo "SKIP: $$tst"; \
fi; \
done; \
if test "$$failed" -eq 0; then \
if test "$$xfail" -eq 0; then \
banner="All $$all tests passed"; \
else \
banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
fi; \
else \
if test "$$xpass" -eq 0; then \
banner="$$failed of $$all tests failed"; \
else \
banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
fi; \
fi; \
dashes="$$banner"; \
skipped=""; \
if test "$$skip" -ne 0; then \
skipped="($$skip tests were not run)"; \
test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$skipped"; \
fi; \
report=""; \
if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
report="Please report to $(PACKAGE_BUGREPORT)"; \
test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$report"; \
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
echo "$$dashes"; \
echo "$$banner"; \
test -z "$$skipped" || echo "$$skipped"; \
test -z "$$report" || echo "$$report"; \
echo "$$dashes"; \
test "$$failed" -eq 0; \
else :; fi
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
distdir=`$(am__cd) $(distdir) && pwd`; \
top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$top_distdir" \
distdir="$$distdir/$$subdir" \
am__remove_distdir=: \
am__skip_length_check=: \
distdir) \
|| exit 1; \
fi; \
done
check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: check-recursive
all-am: Makefile
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-checkPROGRAMS clean-generic mostlyclean-am
distclean: distclean-recursive
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
info-am:
install-data-am:
install-dvi: install-dvi-recursive
install-exec-am:
install-html: install-html-recursive
install-info: install-info-recursive
install-man:
install-pdf: install-pdf-recursive
install-ps: install-ps-recursive
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am:
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
install-strip
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am check check-TESTS check-am clean \
clean-checkPROGRAMS clean-generic ctags ctags-recursive \
distclean distclean-compile distclean-generic distclean-tags \
distdir dvi dvi-am html html-am info info-am install \
install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
installdirs-am maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
ps ps-am tags tags-recursive uninstall uninstall-am
# for autotools debugging only
info:
@echo "ATF_CFLAGS=$(ATF_CFLAGS)"
@echo "ATF_LDFLAGS=$(ATF_LDFLAGS)"
@echo "ATF_LIBS=$(ATF_LIBS)"
@HAVE_ATF_TRUE@check: $(ATF_TESTS)
@HAVE_ATF_TRUE@ atf-run | atf-report
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@@ -0,0 +1,603 @@
/*
* 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));
}
/* 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);
}
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);
ATF_TP_ADD_TC(tp, uid_hash_rt29851);
return (atf_no_error());
}

View File

@@ -0,0 +1,715 @@
/*
* 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);
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;
/*
* Test 0: Basic iaaddr manipulation.
*/
iaaddr = NULL;
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);
}
iaaddr_copy = NULL;
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);
}
}
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;
/* 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);
}
}
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;
/*
* Test 2: Basic ia_na manipulation.
*/
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\n", MDL);
}
if (memcmp(ia_na->iaid_duid.data, &iaid, sizeof(iaid)) != 0) {
atf_tc_fail("ERROR: bad IAID_DUID %s:%d\n", MDL);
}
if (memcmp(ia_na->iaid_duid.data+sizeof(iaid), "TestDUID", 8) != 0) {
atf_tc_fail("ERROR: bad IAID_DUID %s:%d\n", MDL);
}
if (ia_na->num_iasubopt != 0) {
atf_tc_fail("ERROR: bad num_iasubopt %s:%d\n", MDL);
}
ia_na_copy = NULL;
if (ia_reference(&ia_na_copy, ia_na, MDL) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: ia_reference() %s:%d\n", MDL);
}
iaaddr = NULL;
if (iasubopt_allocate(&iaaddr, MDL) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: iasubopt_allocate() %s:%d\n", MDL);
}
if (ia_add_iasubopt(ia_na, iaaddr, MDL) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: ia_add_iasubopt() %s:%d\n", MDL);
}
ia_remove_iasubopt(ia_na, iaaddr, MDL);
if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: iasubopt_reference() %s:%d\n", MDL);
}
if (ia_dereference(&ia_na, MDL) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: ia_dereference() %s:%d\n", MDL);
}
if (ia_dereference(&ia_na_copy, MDL) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: ia_dereference() %s:%d\n", MDL);
}
}
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;
/*
* Test 3: lots of iaaddr in our ia_na
*/
/* 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\n", 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\n", MDL);
}
if (ia_add_iasubopt(ia_na, iaaddr, MDL) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: ia_add_iasubopt() %s:%d\n", MDL);
}
if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: iasubopt_reference() %s:%d\n", 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\n", 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\n", 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\n", MDL);
}
if (ia_add_iasubopt(ia_na, iaaddr, MDL) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: ia_add_iasubopt() %s:%d\n", MDL);
}
if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: iasubopt_reference() %s:%d\n", MDL);
}
}
if (ia_dereference(&ia_na, MDL) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: ia_dereference() %s:%d\n", MDL);
}
}
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;
/*
* Test 4: Errors in ia_na.
*/
/* bogus allocate arguments */
if (ia_allocate(NULL, 123, "", 0, MDL) != DHCP_R_INVALIDARG) {
atf_tc_fail("ERROR: ia_allocate() %s:%d\n", 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\n", 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\n", MDL);
}
if (ia_reference(NULL, ia_na, MDL) != DHCP_R_INVALIDARG) {
atf_tc_fail("ERROR: ia_reference() %s:%d\n", 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\n", MDL);
}
ia_na_copy = NULL;
if (ia_reference(&ia_na_copy, NULL, MDL) != DHCP_R_INVALIDARG) {
atf_tc_fail("ERROR: ia_reference() %s:%d\n", MDL);
}
if (ia_dereference(&ia_na, MDL) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: ia_dereference() %s:%d\n", MDL);
}
/* bogus dereference arguments */
if (ia_dereference(NULL, MDL) != DHCP_R_INVALIDARG) {
atf_tc_fail("ERROR: ia_dereference() %s:%d\n", 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\n", 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\n", MDL);
}
}
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;
/*
* Test 5: Basic ipv6_pool manipulation.
*/
/* allocate, reference */
inet_pton(AF_INET6, "1:2:3:4::", &addr);
pool = NULL;
if (ipv6_pool_allocate(&pool, 0, &addr, 64, 128, MDL) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: ipv6_pool_allocate() %s:%d\n", MDL);
}
if (pool->num_active != 0) {
atf_tc_fail("ERROR: bad num_active %s:%d\n", MDL);
}
if (pool->bits != 64) {
atf_tc_fail("ERROR: bad bits %s:%d\n", 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\n", MDL);
}
pool_copy = NULL;
if (ipv6_pool_reference(&pool_copy, pool, MDL) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: ipv6_pool_reference() %s:%d\n", MDL);
}
/* create_lease6, renew_lease6, expire_lease6 */
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\n");
}
ds.data = ds.buffer->data;
memcpy((char *)ds.data, uid, ds.len);
if (create_lease6(pool, &iaaddr,
&attempts, &ds, 1) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: create_lease6() %s:%d\n", MDL);
}
if (pool->num_inactive != 1) {
atf_tc_fail("ERROR: bad num_inactive %s:%d\n", MDL);
}
if (renew_lease6(pool, iaaddr) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: renew_lease6() %s:%d\n", MDL);
}
if (pool->num_active != 1) {
atf_tc_fail("ERROR: bad num_active %s:%d\n", MDL);
}
expired_iaaddr = NULL;
if (expire_lease6(&expired_iaaddr, pool, 0) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: expire_lease6() %s:%d\n", MDL);
}
if (expired_iaaddr != NULL) {
atf_tc_fail("ERROR: should not have expired a lease %s:%d\n", MDL);
}
if (pool->num_active != 1) {
atf_tc_fail("ERROR: bad num_active %s:%d\n", MDL);
}
if (expire_lease6(&expired_iaaddr, pool, 1000) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: expire_lease6() %s:%d\n", MDL);
}
if (expired_iaaddr == NULL) {
atf_tc_fail("ERROR: should have expired a lease %s:%d\n", MDL);
}
if (iasubopt_dereference(&expired_iaaddr, MDL) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: iasubopt_dereference() %s:%d\n", MDL);
}
if (pool->num_active != 0) {
atf_tc_fail("ERROR: bad num_active %s:%d\n", MDL);
}
if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: iasubopt_dereference() %s:%d\n", MDL);
}
/* release_lease6, decline_lease6 */
if (create_lease6(pool, &iaaddr, &attempts,
&ds, 1) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: create_lease6() %s:%d\n", MDL);
}
if (renew_lease6(pool, iaaddr) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: renew_lease6() %s:%d\n", MDL);
}
if (pool->num_active != 1) {
atf_tc_fail("ERROR: bad num_active %s:%d\n", MDL);
}
if (release_lease6(pool, iaaddr) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: decline_lease6() %s:%d\n", MDL);
}
if (pool->num_active != 0) {
atf_tc_fail("ERROR: bad num_active %s:%d\n", MDL);
}
if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: iasubopt_dereference() %s:%d\n", MDL);
}
if (create_lease6(pool, &iaaddr, &attempts,
&ds, 1) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: create_lease6() %s:%d\n", MDL);
}
if (renew_lease6(pool, iaaddr) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: renew_lease6() %s:%d\n", MDL);
}
if (pool->num_active != 1) {
atf_tc_fail("ERROR: bad num_active %s:%d\n", MDL);
}
if (decline_lease6(pool, iaaddr) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: decline_lease6() %s:%d\n", MDL);
}
if (pool->num_active != 1) {
atf_tc_fail("ERROR: bad num_active %s:%d\n", MDL);
}
if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: iasubopt_dereference() %s:%d\n", MDL);
}
/* dereference */
if (ipv6_pool_dereference(&pool, MDL) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: ipv6_pool_reference() %s:%d\n", MDL);
}
if (ipv6_pool_dereference(&pool_copy, MDL) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: ipv6_pool_reference() %s:%d\n", MDL);
}
}
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;
/*
* Test 6: Error ipv6_pool manipulation
*/
if (ipv6_pool_allocate(NULL, 0, &addr,
64, 128, MDL) != DHCP_R_INVALIDARG) {
atf_tc_fail("ERROR: ipv6_pool_allocate() %s:%d\n", MDL);
}
pool = (struct ipv6_pool *)1;
if (ipv6_pool_allocate(&pool, 0, &addr,
64, 128, MDL) != DHCP_R_INVALIDARG) {
atf_tc_fail("ERROR: ipv6_pool_allocate() %s:%d\n", MDL);
}
if (ipv6_pool_reference(NULL, pool, MDL) != DHCP_R_INVALIDARG) {
atf_tc_fail("ERROR: ipv6_pool_reference() %s:%d\n", 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\n", MDL);
}
pool_copy = NULL;
if (ipv6_pool_reference(&pool_copy, NULL, MDL) != DHCP_R_INVALIDARG) {
atf_tc_fail("ERROR: ipv6_pool_reference() %s:%d\n", MDL);
}
if (ipv6_pool_dereference(NULL, MDL) != DHCP_R_INVALIDARG) {
atf_tc_fail("ERROR: ipv6_pool_dereference() %s:%d\n", MDL);
}
if (ipv6_pool_dereference(&pool_copy, MDL) != DHCP_R_INVALIDARG) {
atf_tc_fail("ERROR: ipv6_pool_dereference() %s:%d\n", MDL);
}
}
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;
struct data_string ds;
struct iasubopt *expired_iaaddr;
unsigned int attempts;
/*
* Test 7: order of expiration
*/
pool = NULL;
if (ipv6_pool_allocate(&pool, 0, &addr, 64, 128, MDL) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: ipv6_pool_allocate() %s:%d\n", 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\n", MDL);
}
if (renew_lease6(pool, iaaddr) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: renew_lease6() %s:%d\n", MDL);
}
if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: iasubopt_dereference() %s:%d\n", MDL);
}
if (pool->num_active != (i / 10)) {
atf_tc_fail("ERROR: bad num_active %s:%d\n", MDL);
}
}
if (pool->num_active != 9) {
atf_tc_fail("ERROR: bad num_active %s:%d\n", 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\n", MDL);
}
if (expired_iaaddr == NULL) {
atf_tc_fail("ERROR: should have expired a lease %s:%d\n",
MDL);
}
if (pool->num_active != (9 - (i / 10))) {
atf_tc_fail("ERROR: bad num_active %s:%d\n", MDL);
}
if (expired_iaaddr->hard_lifetime_end_time != i) {
atf_tc_fail("ERROR: bad hard_lifetime_end_time %s:%d\n",
MDL);
}
if (iasubopt_dereference(&expired_iaaddr, MDL) !=
ISC_R_SUCCESS) {
atf_tc_fail("ERROR: iasubopt_dereference() %s:%d\n", MDL);
}
}
if (pool->num_active != 0) {
atf_tc_fail("ERROR: bad num_active %s:%d\n", MDL);
}
expired_iaaddr = NULL;
if (expire_lease6(&expired_iaaddr, pool, 1000) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: expire_lease6() %s:%d\n", MDL);
}
if (ipv6_pool_dereference(&pool, MDL) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: ipv6_pool_dereference() %s:%d\n", MDL);
}
}
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;
struct data_string ds;
unsigned int attempts;
/*
* Test 8: small pool
*/
pool = NULL;
addr.s6_addr[14] = 0x81;
if (ipv6_pool_allocate(&pool, 0, &addr, 127, 128, MDL) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: ipv6_pool_allocate() %s:%d\n", MDL);
}
if (create_lease6(pool, &iaaddr, &attempts,
&ds, 42) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: create_lease6() %s:%d\n", MDL);
}
if (renew_lease6(pool, iaaddr) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: renew_lease6() %s:%d\n", MDL);
}
if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: iasubopt_dereference() %s:%d\n", MDL);
}
if (create_lease6(pool, &iaaddr, &attempts,
&ds, 11) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: create_lease6() %s:%d\n", MDL);
}
if (renew_lease6(pool, iaaddr) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: renew_lease6() %s:%d\n", MDL);
}
if (iasubopt_dereference(&iaaddr, MDL) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: iasubopt_dereference() %s:%d\n", MDL);
}
if (create_lease6(pool, &iaaddr, &attempts,
&ds, 11) != ISC_R_NORESOURCES) {
atf_tc_fail("ERROR: create_lease6() %s:%d\n", MDL);
}
if (ipv6_pool_dereference(&pool, MDL) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: ipv6_pool_dereference() %s:%d\n", MDL);
}
addr.s6_addr[14] = 0;
}
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;
/*
* Test 9: functions across all pools
*/
pool = NULL;
if (ipv6_pool_allocate(&pool, 0, &addr, 64, 128, MDL) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: ipv6_pool_allocate() %s:%d\n", MDL);
}
if (add_ipv6_pool(pool) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: add_ipv6_pool() %s:%d\n", MDL);
}
if (ipv6_pool_dereference(&pool, MDL) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: ipv6_pool_dereference() %s:%d\n", MDL);
}
pool = NULL;
if (find_ipv6_pool(&pool, 0, &addr) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: find_ipv6_pool() %s:%d\n", MDL);
}
if (ipv6_pool_dereference(&pool, MDL) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: ipv6_pool_dereference() %s:%d\n", MDL);
}
inet_pton(AF_INET6, "1:2:3:4:ffff:ffff:ffff:ffff", &addr);
pool = NULL;
if (find_ipv6_pool(&pool, 0, &addr) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: find_ipv6_pool() %s:%d\n", MDL);
}
if (ipv6_pool_dereference(&pool, MDL) != ISC_R_SUCCESS) {
atf_tc_fail("ERROR: ipv6_pool_dereference() %s:%d\n", MDL);
}
inet_pton(AF_INET6, "1:2:3:5::", &addr);
pool = NULL;
if (find_ipv6_pool(&pool, 0, &addr) != ISC_R_NOTFOUND) {
atf_tc_fail("ERROR: find_ipv6_pool() %s:%d\n", MDL);
}
inet_pton(AF_INET6, "1:2:3:3:ffff:ffff:ffff:ffff", &addr);
pool = NULL;
if (find_ipv6_pool(&pool, 0, &addr) != ISC_R_NOTFOUND) {
atf_tc_fail("ERROR: find_ipv6_pool() %s:%d\n", 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\n", 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, small_pool);
ATF_TP_ADD_TC(tp, many_pools);
return (atf_no_error());
}

View File

@@ -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());
}

View File

@@ -1,153 +1,63 @@
Introduction
------------
That is only a brief overview of tests in ISC DHCP. For more thorough
description, see ISC DHCP Developer's Guide. You can generate it, by
having Doxygen installed and doing:
cd doc
make devel
and then opening doc/html/index.html
Tests Overview
--------------
In DHCP, a unit test exercises a particular piece of code in
isolation. There is a separate unit test per module or API. Each unit
test lives in a directory beneath the code it is designed to exercise.
So, we have:
So, we (will eventually) have:
server/tests/
client/tests/
common/tests/
dhcpctl/tests/
And so on.
Ideally each function would be invoked with every possible type of
input, and each branch of every function would be checked. In practice
we try to be a bit more pragmatic, and target the most basic
operations, as well tricky code, and areas we have seen bugs in the
past.
We are using ATF (Automated Test Framework) as a framework to run our
unittests. See ISC DHCP Developer's Guide for much more thorough
description of unit-test and ATF framework in general.
Running Unit Tests
------------------
In order to run the unit tests for DHCP, use:
In order to run the unit tests for DHCP, enable ATF support during configure:
$ ./configure --with-atf
And then use:
$ make check
This will run all of the unit tests.
This will run all of the unit tests. Make sure that ATF is actually
installed and that you have atf-run and atf-report tool in your PATH.
You can run a single test by going to the appropriate test directory
and invoking the test directly:
$ cd common/tests
$ make test_alloc
$ ./test_alloc
$ cd server/tests
$ atf-run | atf-report
There are also a number of options that you can use when running a
test. To see these, use the "-u" flag on the program.
test. See atf-run and atf-report documentation.
Adding a New Unit Test
----------------------
To add an additional test to an existing test program, you must create
a function for the new test in the C source file:
static void
mynewtest(void) {
static const char *test_desc = "describe the test";
t_assert("mynewtest", 1, T_REQUIRED, test_desc);
/* ... test code ... */
t_result(T_PASS);
}
Then add this function to the T_testlist[] array in the file:
testspec_t T_testlist[] = {
...
{ mynewtest, "some new test" },
{ NULL, NULL }
};
Then you should be able to compile and run your new test.
See ISC DHCP Developer's Guide.
Adding a New Unit Test Program
------------------------------
To add a new program, such as when a new module is added, you can copy
the "unit_test_sample.c" file (in this directory) to a new name, add
the new file as a target in Makefile.am, and begin adding tests. Do
not forget to add it to CVS via "cvs add".
If there is no "tests" directory for a given subdirectory, then one
must be created. This can be done by:
1. Creating the directory:
$ mkdir $subdir/tests
$ cvs add tests
2. Adding the subdirectory to the build system:
Add to $subdir/Makefile.am:
SUBDIRS = tests
Add to the AC_OUTPUT macro in configure.ac:
$subdir/tests/Makefile
3. Create a Makefile.am in the new directory, something like this:
AM_CPPFLAGS = -I../..
check_PROGRAMS = test_foo
TESTS = test_foo
test_foo_SOURCES = test_foo.c
test_foo_LDADD = ../../tests/libt_api.a # plus others...
See existing Makefile.am for examples, and the Automake documentation:
http://www.gnu.org/software/automake/manual/html_node/Tests.html
Support Functions
-----------------
Here are a few of the most useful functions defined in t_api that you
can use in testing:
void
t_assert(const char *component, int anum, int class,
const char *what, ...);
The name of this function is slightly misleading. It
actually just prints out an error message in the test
output.
void
t_info(const char *format, ...);
Prints out a message in the test output. You should
include "\n" at the end.
void
t_result(int result);
Prints out the result in the test output. You should
use one of the constants for this:
T_PASS
T_FAIL
T_UNRESOLVED
T_UNSUPPORTED
T_UNTESTED
T_THREADONLY
Additional Testing
------------------
Other static or runtime testing is always an option. For instance, you
can use valgrind to check for memory leaks.
$Id: HOWTO-unit-test,v 1.2 2007/11/16 11:04:12 shane Exp $
See ISC DHCP Developer's Guide.

View File

@@ -58,6 +58,8 @@ CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
ATF_CFLAGS = @ATF_CFLAGS@
ATF_LDFLAGS = @ATF_LDFLAGS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@