diff options
Diffstat (limited to 'src/hooks/dhcp/run_script')
21 files changed, 6951 insertions, 0 deletions
diff --git a/src/hooks/dhcp/run_script/Makefile.am b/src/hooks/dhcp/run_script/Makefile.am new file mode 100644 index 0000000..310ac9b --- /dev/null +++ b/src/hooks/dhcp/run_script/Makefile.am @@ -0,0 +1,87 @@ +SUBDIRS = . libloadtests tests + +AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib +AM_CPPFLAGS += $(BOOST_INCLUDES) +AM_CXXFLAGS = $(KEA_CXXFLAGS) + +# Ensure that the message file and doxygen file is included in the distribution +EXTRA_DIST = run_script_messages.mes +EXTRA_DIST += run_script.dox + +CLEANFILES = *.gcno *.gcda + +# convenience archive + +noinst_LTLIBRARIES = librun_script.la + +librun_script_la_SOURCES = run_script_callouts.cc +librun_script_la_SOURCES += run_script.cc run_script.h +librun_script_la_SOURCES += run_script_log.cc run_script_log.h +librun_script_la_SOURCES += run_script_messages.cc run_script_messages.h +librun_script_la_SOURCES += version.cc + +librun_script_la_CXXFLAGS = $(AM_CXXFLAGS) +librun_script_la_CPPFLAGS = $(AM_CPPFLAGS) + +# install the shared object into $(libdir)/kea/hooks +lib_hooksdir = $(libdir)/kea/hooks +lib_hooks_LTLIBRARIES = libdhcp_run_script.la + +libdhcp_run_script_la_SOURCES = +libdhcp_run_script_la_LDFLAGS = $(AM_LDFLAGS) +libdhcp_run_script_la_LDFLAGS += -avoid-version -export-dynamic -module +libdhcp_run_script_la_LIBADD = librun_script.la +libdhcp_run_script_la_LIBADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la +libdhcp_run_script_la_LIBADD += $(top_builddir)/src/lib/process/libkea-process.la +libdhcp_run_script_la_LIBADD += $(top_builddir)/src/lib/eval/libkea-eval.la +libdhcp_run_script_la_LIBADD += $(top_builddir)/src/lib/dhcp_ddns/libkea-dhcp_ddns.la +libdhcp_run_script_la_LIBADD += $(top_builddir)/src/lib/stats/libkea-stats.la +libdhcp_run_script_la_LIBADD += $(top_builddir)/src/lib/config/libkea-cfgclient.la +libdhcp_run_script_la_LIBADD += $(top_builddir)/src/lib/http/libkea-http.la +libdhcp_run_script_la_LIBADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la +libdhcp_run_script_la_LIBADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la +libdhcp_run_script_la_LIBADD += $(top_builddir)/src/lib/database/libkea-database.la +libdhcp_run_script_la_LIBADD += $(top_builddir)/src/lib/cc/libkea-cc.la +libdhcp_run_script_la_LIBADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la +libdhcp_run_script_la_LIBADD += $(top_builddir)/src/lib/dns/libkea-dns++.la +libdhcp_run_script_la_LIBADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la +libdhcp_run_script_la_LIBADD += $(top_builddir)/src/lib/log/libkea-log.la +libdhcp_run_script_la_LIBADD += $(top_builddir)/src/lib/util/libkea-util.la +libdhcp_run_script_la_LIBADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la +libdhcp_run_script_la_LIBADD += $(LOG4CPLUS_LIBS) +libdhcp_run_script_la_LIBADD += $(CRYPTO_LIBS) +libdhcp_run_script_la_LIBADD += $(BOOST_LIBS) + +# If we want to get rid of all generated messages files, we need to use +# make maintainer-clean. The proper way to introduce custom commands for +# that operation is to define maintainer-clean-local target. However, +# make maintainer-clean also removes Makefile, so running configure script +# is required. To make it easy to rebuild messages without going through +# reconfigure, a new target messages-clean has been added. +maintainer-clean-local: + rm -f run_script_messages.h run_script_messages.cc + +# To regenerate messages files, one can do: +# +# make messages-clean +# make messages +# +# This is needed only when a .mes file is modified. +messages-clean: maintainer-clean-local + +if GENERATE_MESSAGES + +# Define rule to build logging source files from message file +messages: run_script_messages.h run_script_messages.cc + @echo Message files regenerated + +run_script_messages.h run_script_messages.cc: run_script_messages.mes + $(top_builddir)/src/lib/log/compiler/kea-msg-compiler $(top_srcdir)/src/hooks/dhcp/run_script/run_script_messages.mes + +else + +messages run_script_messages.h run_script_messages.cc: + @echo Messages generation disabled. Configure with --enable-generate-messages to enable it. + +endif + diff --git a/src/hooks/dhcp/run_script/Makefile.in b/src/hooks/dhcp/run_script/Makefile.in new file mode 100644 index 0000000..e078739 --- /dev/null +++ b/src/hooks/dhcp/run_script/Makefile.in @@ -0,0 +1,1040 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/hooks/dhcp/run_script +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4macros/ax_boost_for_kea.m4 \ + $(top_srcdir)/m4macros/ax_cpp11.m4 \ + $(top_srcdir)/m4macros/ax_crypto.m4 \ + $(top_srcdir)/m4macros/ax_find_library.m4 \ + $(top_srcdir)/m4macros/ax_gssapi.m4 \ + $(top_srcdir)/m4macros/ax_gtest.m4 \ + $(top_srcdir)/m4macros/ax_isc_rpath.m4 \ + $(top_srcdir)/m4macros/ax_sysrepo.m4 \ + $(top_srcdir)/m4macros/libtool.m4 \ + $(top_srcdir)/m4macros/ltoptions.m4 \ + $(top_srcdir)/m4macros/ltsugar.m4 \ + $(top_srcdir)/m4macros/ltversion.m4 \ + $(top_srcdir)/m4macros/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(lib_hooksdir)" +LTLIBRARIES = $(lib_hooks_LTLIBRARIES) $(noinst_LTLIBRARIES) +am__DEPENDENCIES_1 = +libdhcp_run_script_la_DEPENDENCIES = librun_script.la \ + $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la \ + $(top_builddir)/src/lib/process/libkea-process.la \ + $(top_builddir)/src/lib/eval/libkea-eval.la \ + $(top_builddir)/src/lib/dhcp_ddns/libkea-dhcp_ddns.la \ + $(top_builddir)/src/lib/stats/libkea-stats.la \ + $(top_builddir)/src/lib/config/libkea-cfgclient.la \ + $(top_builddir)/src/lib/http/libkea-http.la \ + $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la \ + $(top_builddir)/src/lib/hooks/libkea-hooks.la \ + $(top_builddir)/src/lib/database/libkea-database.la \ + $(top_builddir)/src/lib/cc/libkea-cc.la \ + $(top_builddir)/src/lib/asiolink/libkea-asiolink.la \ + $(top_builddir)/src/lib/dns/libkea-dns++.la \ + $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la \ + $(top_builddir)/src/lib/log/libkea-log.la \ + $(top_builddir)/src/lib/util/libkea-util.la \ + $(top_builddir)/src/lib/exceptions/libkea-exceptions.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +am_libdhcp_run_script_la_OBJECTS = +libdhcp_run_script_la_OBJECTS = $(am_libdhcp_run_script_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libdhcp_run_script_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(libdhcp_run_script_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +librun_script_la_LIBADD = +am_librun_script_la_OBJECTS = librun_script_la-run_script_callouts.lo \ + librun_script_la-run_script.lo \ + librun_script_la-run_script_log.lo \ + librun_script_la-run_script_messages.lo \ + librun_script_la-version.lo +librun_script_la_OBJECTS = $(am_librun_script_la_OBJECTS) +librun_script_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(librun_script_la_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/librun_script_la-run_script.Plo \ + ./$(DEPDIR)/librun_script_la-run_script_callouts.Plo \ + ./$(DEPDIR)/librun_script_la-run_script_log.Plo \ + ./$(DEPDIR)/librun_script_la-run_script_messages.Plo \ + ./$(DEPDIR)/librun_script_la-version.Plo +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libdhcp_run_script_la_SOURCES) $(librun_script_la_SOURCES) +DIST_SOURCES = $(libdhcp_run_script_la_SOURCES) \ + $(librun_script_la_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir distdir-am +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +ASCIIDOC = @ASCIIDOC@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BOOST_INCLUDES = @BOOST_INCLUDES@ +BOOST_LIBS = @BOOST_LIBS@ +BOTAN_TOOL = @BOTAN_TOOL@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONTRIB_DIR = @CONTRIB_DIR@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CRYPTO_CFLAGS = @CRYPTO_CFLAGS@ +CRYPTO_INCLUDES = @CRYPTO_INCLUDES@ +CRYPTO_LDFLAGS = @CRYPTO_LDFLAGS@ +CRYPTO_LIBS = @CRYPTO_LIBS@ +CRYPTO_PACKAGE = @CRYPTO_PACKAGE@ +CRYPTO_RPATH = @CRYPTO_RPATH@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DISTCHECK_BOOST_CONFIGURE_FLAG = @DISTCHECK_BOOST_CONFIGURE_FLAG@ +DISTCHECK_CONTRIB_CONFIGURE_FLAG = @DISTCHECK_CONTRIB_CONFIGURE_FLAG@ +DISTCHECK_CRYPTO_CONFIGURE_FLAG = @DISTCHECK_CRYPTO_CONFIGURE_FLAG@ +DISTCHECK_GTEST_CONFIGURE_FLAG = @DISTCHECK_GTEST_CONFIGURE_FLAG@ +DISTCHECK_KEA_SHELL_CONFIGURE_FLAG = @DISTCHECK_KEA_SHELL_CONFIGURE_FLAG@ +DISTCHECK_LOG4CPLUS_CONFIGURE_FLAG = @DISTCHECK_LOG4CPLUS_CONFIGURE_FLAG@ +DISTCHECK_PERFDHCP_CONFIGURE_FLAG = @DISTCHECK_PERFDHCP_CONFIGURE_FLAG@ +DISTCHECK_PREMIUM_CONFIGURE_FLAG = @DISTCHECK_PREMIUM_CONFIGURE_FLAG@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GENHTML = @GENHTML@ +GREP = @GREP@ +GSSAPI_CFLAGS = @GSSAPI_CFLAGS@ +GSSAPI_LIBS = @GSSAPI_LIBS@ +GTEST_CONFIG = @GTEST_CONFIG@ +GTEST_INCLUDES = @GTEST_INCLUDES@ +GTEST_LDADD = @GTEST_LDADD@ +GTEST_LDFLAGS = @GTEST_LDFLAGS@ +GTEST_SOURCE = @GTEST_SOURCE@ +HAVE_SYSREPO = @HAVE_SYSREPO@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KEA_CXXFLAGS = @KEA_CXXFLAGS@ +KEA_SRCID = @KEA_SRCID@ +KRB5_CONFIG = @KRB5_CONFIG@ +LCOV = @LCOV@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOG4CPLUS_INCLUDES = @LOG4CPLUS_INCLUDES@ +LOG4CPLUS_LIBS = @LOG4CPLUS_LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MYSQL_CPPFLAGS = @MYSQL_CPPFLAGS@ +MYSQL_LIBS = @MYSQL_LIBS@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +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@ +PACKAGE_VERSION_TYPE = @PACKAGE_VERSION_TYPE@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PDFLATEX = @PDFLATEX@ +PERL = @PERL@ +PGSQL_CPPFLAGS = @PGSQL_CPPFLAGS@ +PGSQL_LIBS = @PGSQL_LIBS@ +PKGPYTHONDIR = @PKGPYTHONDIR@ +PKG_CONFIG = @PKG_CONFIG@ +PLANTUML = @PLANTUML@ +PREMIUM_DIR = @PREMIUM_DIR@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SEP = @SEP@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SPHINXBUILD = @SPHINXBUILD@ +SRPD_PLUGINS_PATH = @SRPD_PLUGINS_PATH@ +SR_REPO_PATH = @SR_REPO_PATH@ +STRIP = @STRIP@ +SYSREPOCPP_VERSION = @SYSREPOCPP_VERSION@ +SYSREPO_CPPFLAGS = @SYSREPO_CPPFLAGS@ +SYSREPO_INCLUDEDIR = @SYSREPO_INCLUDEDIR@ +SYSREPO_LIBS = @SYSREPO_LIBS@ +SYSREPO_VERSION = @SYSREPO_VERSION@ +USE_LCOV = @USE_LCOV@ +VALGRIND = @VALGRIND@ +VERSION = @VERSION@ +WARNING_GCC_44_STRICT_ALIASING_CFLAG = @WARNING_GCC_44_STRICT_ALIASING_CFLAG@ +YACC = @YACC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +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 = . libloadtests tests +AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib \ + $(BOOST_INCLUDES) +AM_CXXFLAGS = $(KEA_CXXFLAGS) + +# Ensure that the message file and doxygen file is included in the distribution +EXTRA_DIST = run_script_messages.mes run_script.dox +CLEANFILES = *.gcno *.gcda + +# convenience archive +noinst_LTLIBRARIES = librun_script.la +librun_script_la_SOURCES = run_script_callouts.cc run_script.cc \ + run_script.h run_script_log.cc run_script_log.h \ + run_script_messages.cc run_script_messages.h version.cc +librun_script_la_CXXFLAGS = $(AM_CXXFLAGS) +librun_script_la_CPPFLAGS = $(AM_CPPFLAGS) + +# install the shared object into $(libdir)/kea/hooks +lib_hooksdir = $(libdir)/kea/hooks +lib_hooks_LTLIBRARIES = libdhcp_run_script.la +libdhcp_run_script_la_SOURCES = +libdhcp_run_script_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version \ + -export-dynamic -module +libdhcp_run_script_la_LIBADD = librun_script.la \ + $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la \ + $(top_builddir)/src/lib/process/libkea-process.la \ + $(top_builddir)/src/lib/eval/libkea-eval.la \ + $(top_builddir)/src/lib/dhcp_ddns/libkea-dhcp_ddns.la \ + $(top_builddir)/src/lib/stats/libkea-stats.la \ + $(top_builddir)/src/lib/config/libkea-cfgclient.la \ + $(top_builddir)/src/lib/http/libkea-http.la \ + $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la \ + $(top_builddir)/src/lib/hooks/libkea-hooks.la \ + $(top_builddir)/src/lib/database/libkea-database.la \ + $(top_builddir)/src/lib/cc/libkea-cc.la \ + $(top_builddir)/src/lib/asiolink/libkea-asiolink.la \ + $(top_builddir)/src/lib/dns/libkea-dns++.la \ + $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la \ + $(top_builddir)/src/lib/log/libkea-log.la \ + $(top_builddir)/src/lib/util/libkea-util.la \ + $(top_builddir)/src/lib/exceptions/libkea-exceptions.la \ + $(LOG4CPLUS_LIBS) $(CRYPTO_LIBS) $(BOOST_LIBS) +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .cc .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/hooks/dhcp/run_script/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/hooks/dhcp/run_script/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__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +install-lib_hooksLTLIBRARIES: $(lib_hooks_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(lib_hooks_LTLIBRARIES)'; test -n "$(lib_hooksdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(lib_hooksdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(lib_hooksdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(lib_hooksdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(lib_hooksdir)"; \ + } + +uninstall-lib_hooksLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_hooks_LTLIBRARIES)'; test -n "$(lib_hooksdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(lib_hooksdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(lib_hooksdir)/$$f"; \ + done + +clean-lib_hooksLTLIBRARIES: + -test -z "$(lib_hooks_LTLIBRARIES)" || rm -f $(lib_hooks_LTLIBRARIES) + @list='$(lib_hooks_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libdhcp_run_script.la: $(libdhcp_run_script_la_OBJECTS) $(libdhcp_run_script_la_DEPENDENCIES) $(EXTRA_libdhcp_run_script_la_DEPENDENCIES) + $(AM_V_CCLD)$(libdhcp_run_script_la_LINK) -rpath $(lib_hooksdir) $(libdhcp_run_script_la_OBJECTS) $(libdhcp_run_script_la_LIBADD) $(LIBS) + +librun_script.la: $(librun_script_la_OBJECTS) $(librun_script_la_DEPENDENCIES) $(EXTRA_librun_script_la_DEPENDENCIES) + $(AM_V_CXXLD)$(librun_script_la_LINK) $(librun_script_la_OBJECTS) $(librun_script_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librun_script_la-run_script.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librun_script_la-run_script_callouts.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librun_script_la-run_script_log.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librun_script_la-run_script_messages.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librun_script_la-version.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.cc.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cc.lo: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< + +librun_script_la-run_script_callouts.lo: run_script_callouts.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librun_script_la_CPPFLAGS) $(CPPFLAGS) $(librun_script_la_CXXFLAGS) $(CXXFLAGS) -MT librun_script_la-run_script_callouts.lo -MD -MP -MF $(DEPDIR)/librun_script_la-run_script_callouts.Tpo -c -o librun_script_la-run_script_callouts.lo `test -f 'run_script_callouts.cc' || echo '$(srcdir)/'`run_script_callouts.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/librun_script_la-run_script_callouts.Tpo $(DEPDIR)/librun_script_la-run_script_callouts.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='run_script_callouts.cc' object='librun_script_la-run_script_callouts.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librun_script_la_CPPFLAGS) $(CPPFLAGS) $(librun_script_la_CXXFLAGS) $(CXXFLAGS) -c -o librun_script_la-run_script_callouts.lo `test -f 'run_script_callouts.cc' || echo '$(srcdir)/'`run_script_callouts.cc + +librun_script_la-run_script.lo: run_script.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librun_script_la_CPPFLAGS) $(CPPFLAGS) $(librun_script_la_CXXFLAGS) $(CXXFLAGS) -MT librun_script_la-run_script.lo -MD -MP -MF $(DEPDIR)/librun_script_la-run_script.Tpo -c -o librun_script_la-run_script.lo `test -f 'run_script.cc' || echo '$(srcdir)/'`run_script.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/librun_script_la-run_script.Tpo $(DEPDIR)/librun_script_la-run_script.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='run_script.cc' object='librun_script_la-run_script.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librun_script_la_CPPFLAGS) $(CPPFLAGS) $(librun_script_la_CXXFLAGS) $(CXXFLAGS) -c -o librun_script_la-run_script.lo `test -f 'run_script.cc' || echo '$(srcdir)/'`run_script.cc + +librun_script_la-run_script_log.lo: run_script_log.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librun_script_la_CPPFLAGS) $(CPPFLAGS) $(librun_script_la_CXXFLAGS) $(CXXFLAGS) -MT librun_script_la-run_script_log.lo -MD -MP -MF $(DEPDIR)/librun_script_la-run_script_log.Tpo -c -o librun_script_la-run_script_log.lo `test -f 'run_script_log.cc' || echo '$(srcdir)/'`run_script_log.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/librun_script_la-run_script_log.Tpo $(DEPDIR)/librun_script_la-run_script_log.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='run_script_log.cc' object='librun_script_la-run_script_log.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librun_script_la_CPPFLAGS) $(CPPFLAGS) $(librun_script_la_CXXFLAGS) $(CXXFLAGS) -c -o librun_script_la-run_script_log.lo `test -f 'run_script_log.cc' || echo '$(srcdir)/'`run_script_log.cc + +librun_script_la-run_script_messages.lo: run_script_messages.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librun_script_la_CPPFLAGS) $(CPPFLAGS) $(librun_script_la_CXXFLAGS) $(CXXFLAGS) -MT librun_script_la-run_script_messages.lo -MD -MP -MF $(DEPDIR)/librun_script_la-run_script_messages.Tpo -c -o librun_script_la-run_script_messages.lo `test -f 'run_script_messages.cc' || echo '$(srcdir)/'`run_script_messages.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/librun_script_la-run_script_messages.Tpo $(DEPDIR)/librun_script_la-run_script_messages.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='run_script_messages.cc' object='librun_script_la-run_script_messages.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librun_script_la_CPPFLAGS) $(CPPFLAGS) $(librun_script_la_CXXFLAGS) $(CXXFLAGS) -c -o librun_script_la-run_script_messages.lo `test -f 'run_script_messages.cc' || echo '$(srcdir)/'`run_script_messages.cc + +librun_script_la-version.lo: version.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librun_script_la_CPPFLAGS) $(CPPFLAGS) $(librun_script_la_CXXFLAGS) $(CXXFLAGS) -MT librun_script_la-version.lo -MD -MP -MF $(DEPDIR)/librun_script_la-version.Tpo -c -o librun_script_la-version.lo `test -f 'version.cc' || echo '$(srcdir)/'`version.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/librun_script_la-version.Tpo $(DEPDIR)/librun_script_la-version.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='version.cc' object='librun_script_la-version.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librun_script_la_CPPFLAGS) $(CPPFLAGS) $(librun_script_la_CXXFLAGS) $(CXXFLAGS) -c -o librun_script_la-version.lo `test -f 'version.cc' || echo '$(srcdir)/'`version.cc + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(LTLIBRARIES) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(lib_hooksdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-lib_hooksLTLIBRARIES clean-libtool \ + clean-noinstLTLIBRARIES mostlyclean-am + +distclean: distclean-recursive + -rm -f ./$(DEPDIR)/librun_script_la-run_script.Plo + -rm -f ./$(DEPDIR)/librun_script_la-run_script_callouts.Plo + -rm -f ./$(DEPDIR)/librun_script_la-run_script_log.Plo + -rm -f ./$(DEPDIR)/librun_script_la-run_script_messages.Plo + -rm -f ./$(DEPDIR)/librun_script_la-version.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: install-lib_hooksLTLIBRARIES + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f ./$(DEPDIR)/librun_script_la-run_script.Plo + -rm -f ./$(DEPDIR)/librun_script_la-run_script_callouts.Plo + -rm -f ./$(DEPDIR)/librun_script_la-run_script_log.Plo + -rm -f ./$(DEPDIR)/librun_script_la-run_script_messages.Plo + -rm -f ./$(DEPDIR)/librun_script_la-version.Plo + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic \ + maintainer-clean-local + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-lib_hooksLTLIBRARIES + +.MAKE: $(am__recursive_targets) install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ + am--depfiles check check-am clean clean-generic \ + clean-lib_hooksLTLIBRARIES clean-libtool \ + clean-noinstLTLIBRARIES cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-libtool \ + 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-lib_hooksLTLIBRARIES 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 \ + maintainer-clean-local mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am \ + uninstall-lib_hooksLTLIBRARIES + +.PRECIOUS: Makefile + + +# If we want to get rid of all generated messages files, we need to use +# make maintainer-clean. The proper way to introduce custom commands for +# that operation is to define maintainer-clean-local target. However, +# make maintainer-clean also removes Makefile, so running configure script +# is required. To make it easy to rebuild messages without going through +# reconfigure, a new target messages-clean has been added. +maintainer-clean-local: + rm -f run_script_messages.h run_script_messages.cc + +# To regenerate messages files, one can do: +# +# make messages-clean +# make messages +# +# This is needed only when a .mes file is modified. +messages-clean: maintainer-clean-local + +# Define rule to build logging source files from message file +@GENERATE_MESSAGES_TRUE@messages: run_script_messages.h run_script_messages.cc +@GENERATE_MESSAGES_TRUE@ @echo Message files regenerated + +@GENERATE_MESSAGES_TRUE@run_script_messages.h run_script_messages.cc: run_script_messages.mes +@GENERATE_MESSAGES_TRUE@ $(top_builddir)/src/lib/log/compiler/kea-msg-compiler $(top_srcdir)/src/hooks/dhcp/run_script/run_script_messages.mes + +@GENERATE_MESSAGES_FALSE@messages run_script_messages.h run_script_messages.cc: +@GENERATE_MESSAGES_FALSE@ @echo Messages generation disabled. Configure with --enable-generate-messages to enable it. + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/hooks/dhcp/run_script/libloadtests/Makefile.am b/src/hooks/dhcp/run_script/libloadtests/Makefile.am new file mode 100644 index 0000000..439045a --- /dev/null +++ b/src/hooks/dhcp/run_script/libloadtests/Makefile.am @@ -0,0 +1,60 @@ +SUBDIRS = . + +AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib +AM_CPPFLAGS += -I$(top_builddir)/src/hooks/dhcp/run_script -I$(top_srcdir)/src/hooks/dhcp/run_script +AM_CPPFLAGS += $(BOOST_INCLUDES) +AM_CPPFLAGS += -DLIBRUN_SCRIPT_SO=\"$(abs_top_builddir)/src/hooks/dhcp/run_script/.libs/libdhcp_run_script.so\" +AM_CPPFLAGS += -DRUN_SCRIPT_TEST_SH=\"$(abs_top_builddir)/src/hooks/dhcp/run_script/tests/run_script_test.sh\" +AM_CPPFLAGS += -DINSTALL_PROG=\"$(abs_top_srcdir)/install-sh\" + +AM_CXXFLAGS = $(KEA_CXXFLAGS) + +if USE_STATIC_LINK +AM_LDFLAGS = -static +endif + +# Unit test data files need to get installed. +EXTRA_DIST = + +CLEANFILES = *.gcno *.gcda + +# TESTS_ENVIRONMENT = $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND) +LOG_COMPILER = $(LIBTOOL) +AM_LOG_FLAGS = --mode=execute + +TESTS = +if HAVE_GTEST +TESTS += run_script_unittests + +run_script_unittests_SOURCES = run_unittests.cc +run_script_unittests_SOURCES += load_unload_unittests.cc + +run_script_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES) $(LOG4CPLUS_INCLUDES) + +run_script_unittests_LDFLAGS = $(AM_LDFLAGS) $(CRYPTO_LDFLAGS) $(GTEST_LDFLAGS) + +run_script_unittests_CXXFLAGS = $(AM_CXXFLAGS) + +run_script_unittests_LDADD = $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/process/libkea-process.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/eval/libkea-eval.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/dhcp_ddns/libkea-dhcp_ddns.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/config/libkea-cfgclient.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/http/libkea-http.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/database/libkea-database.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/dns/libkea-dns++.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/log/libkea-log.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la +run_script_unittests_LDADD += $(LOG4CPLUS_LIBS) +run_script_unittests_LDADD += $(CRYPTO_LIBS) +run_script_unittests_LDADD += $(BOOST_LIBS) +run_script_unittests_LDADD += $(GTEST_LDADD) +endif +noinst_PROGRAMS = $(TESTS) diff --git a/src/hooks/dhcp/run_script/libloadtests/Makefile.in b/src/hooks/dhcp/run_script/libloadtests/Makefile.in new file mode 100644 index 0000000..5897e99 --- /dev/null +++ b/src/hooks/dhcp/run_script/libloadtests/Makefile.in @@ -0,0 +1,1014 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +TESTS = $(am__EXEEXT_1) +@HAVE_GTEST_TRUE@am__append_1 = run_script_unittests +noinst_PROGRAMS = $(am__EXEEXT_2) +subdir = src/hooks/dhcp/run_script/libloadtests +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4macros/ax_boost_for_kea.m4 \ + $(top_srcdir)/m4macros/ax_cpp11.m4 \ + $(top_srcdir)/m4macros/ax_crypto.m4 \ + $(top_srcdir)/m4macros/ax_find_library.m4 \ + $(top_srcdir)/m4macros/ax_gssapi.m4 \ + $(top_srcdir)/m4macros/ax_gtest.m4 \ + $(top_srcdir)/m4macros/ax_isc_rpath.m4 \ + $(top_srcdir)/m4macros/ax_sysrepo.m4 \ + $(top_srcdir)/m4macros/libtool.m4 \ + $(top_srcdir)/m4macros/ltoptions.m4 \ + $(top_srcdir)/m4macros/ltsugar.m4 \ + $(top_srcdir)/m4macros/ltversion.m4 \ + $(top_srcdir)/m4macros/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +@HAVE_GTEST_TRUE@am__EXEEXT_1 = run_script_unittests$(EXEEXT) +am__EXEEXT_2 = $(am__EXEEXT_1) +PROGRAMS = $(noinst_PROGRAMS) +am__run_script_unittests_SOURCES_DIST = run_unittests.cc \ + load_unload_unittests.cc +@HAVE_GTEST_TRUE@am_run_script_unittests_OBJECTS = \ +@HAVE_GTEST_TRUE@ run_script_unittests-run_unittests.$(OBJEXT) \ +@HAVE_GTEST_TRUE@ run_script_unittests-load_unload_unittests.$(OBJEXT) +run_script_unittests_OBJECTS = $(am_run_script_unittests_OBJECTS) +am__DEPENDENCIES_1 = +@HAVE_GTEST_TRUE@run_script_unittests_DEPENDENCIES = $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/process/libkea-process.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/eval/libkea-eval.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/dhcp_ddns/libkea-dhcp_ddns.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/stats/libkea-stats.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/config/libkea-cfgclient.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/http/libkea-http.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/hooks/libkea-hooks.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/database/libkea-database.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/cc/libkea-cc.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/asiolink/libkea-asiolink.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/dns/libkea-dns++.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/log/libkea-log.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/util/libkea-util.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/exceptions/libkea-exceptions.la \ +@HAVE_GTEST_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ +@HAVE_GTEST_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +run_script_unittests_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(run_script_unittests_CXXFLAGS) $(CXXFLAGS) \ + $(run_script_unittests_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = \ + ./$(DEPDIR)/run_script_unittests-load_unload_unittests.Po \ + ./$(DEPDIR)/run_script_unittests-run_unittests.Po +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +SOURCES = $(run_script_unittests_SOURCES) +DIST_SOURCES = $(am__run_script_unittests_SOURCES_DIST) +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir distdir-am +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__tty_colors_dummy = \ + mgn= red= grn= lgn= blu= brg= std=; \ + am__color_tests=no +am__tty_colors = { \ + $(am__tty_colors_dummy); \ + if test "X$(AM_COLOR_TESTS)" = Xno; then \ + am__color_tests=no; \ + elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ + am__color_tests=yes; \ + elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ + am__color_tests=yes; \ + fi; \ + if test $$am__color_tests = yes; then \ + red='[0;31m'; \ + grn='[0;32m'; \ + lgn='[1;32m'; \ + blu='[1;34m'; \ + mgn='[0;35m'; \ + brg='[1m'; \ + std='[m'; \ + fi; \ +} +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +ASCIIDOC = @ASCIIDOC@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BOOST_INCLUDES = @BOOST_INCLUDES@ +BOOST_LIBS = @BOOST_LIBS@ +BOTAN_TOOL = @BOTAN_TOOL@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONTRIB_DIR = @CONTRIB_DIR@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CRYPTO_CFLAGS = @CRYPTO_CFLAGS@ +CRYPTO_INCLUDES = @CRYPTO_INCLUDES@ +CRYPTO_LDFLAGS = @CRYPTO_LDFLAGS@ +CRYPTO_LIBS = @CRYPTO_LIBS@ +CRYPTO_PACKAGE = @CRYPTO_PACKAGE@ +CRYPTO_RPATH = @CRYPTO_RPATH@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DISTCHECK_BOOST_CONFIGURE_FLAG = @DISTCHECK_BOOST_CONFIGURE_FLAG@ +DISTCHECK_CONTRIB_CONFIGURE_FLAG = @DISTCHECK_CONTRIB_CONFIGURE_FLAG@ +DISTCHECK_CRYPTO_CONFIGURE_FLAG = @DISTCHECK_CRYPTO_CONFIGURE_FLAG@ +DISTCHECK_GTEST_CONFIGURE_FLAG = @DISTCHECK_GTEST_CONFIGURE_FLAG@ +DISTCHECK_KEA_SHELL_CONFIGURE_FLAG = @DISTCHECK_KEA_SHELL_CONFIGURE_FLAG@ +DISTCHECK_LOG4CPLUS_CONFIGURE_FLAG = @DISTCHECK_LOG4CPLUS_CONFIGURE_FLAG@ +DISTCHECK_PERFDHCP_CONFIGURE_FLAG = @DISTCHECK_PERFDHCP_CONFIGURE_FLAG@ +DISTCHECK_PREMIUM_CONFIGURE_FLAG = @DISTCHECK_PREMIUM_CONFIGURE_FLAG@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GENHTML = @GENHTML@ +GREP = @GREP@ +GSSAPI_CFLAGS = @GSSAPI_CFLAGS@ +GSSAPI_LIBS = @GSSAPI_LIBS@ +GTEST_CONFIG = @GTEST_CONFIG@ +GTEST_INCLUDES = @GTEST_INCLUDES@ +GTEST_LDADD = @GTEST_LDADD@ +GTEST_LDFLAGS = @GTEST_LDFLAGS@ +GTEST_SOURCE = @GTEST_SOURCE@ +HAVE_SYSREPO = @HAVE_SYSREPO@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KEA_CXXFLAGS = @KEA_CXXFLAGS@ +KEA_SRCID = @KEA_SRCID@ +KRB5_CONFIG = @KRB5_CONFIG@ +LCOV = @LCOV@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOG4CPLUS_INCLUDES = @LOG4CPLUS_INCLUDES@ +LOG4CPLUS_LIBS = @LOG4CPLUS_LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MYSQL_CPPFLAGS = @MYSQL_CPPFLAGS@ +MYSQL_LIBS = @MYSQL_LIBS@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +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@ +PACKAGE_VERSION_TYPE = @PACKAGE_VERSION_TYPE@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PDFLATEX = @PDFLATEX@ +PERL = @PERL@ +PGSQL_CPPFLAGS = @PGSQL_CPPFLAGS@ +PGSQL_LIBS = @PGSQL_LIBS@ +PKGPYTHONDIR = @PKGPYTHONDIR@ +PKG_CONFIG = @PKG_CONFIG@ +PLANTUML = @PLANTUML@ +PREMIUM_DIR = @PREMIUM_DIR@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SEP = @SEP@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SPHINXBUILD = @SPHINXBUILD@ +SRPD_PLUGINS_PATH = @SRPD_PLUGINS_PATH@ +SR_REPO_PATH = @SR_REPO_PATH@ +STRIP = @STRIP@ +SYSREPOCPP_VERSION = @SYSREPOCPP_VERSION@ +SYSREPO_CPPFLAGS = @SYSREPO_CPPFLAGS@ +SYSREPO_INCLUDEDIR = @SYSREPO_INCLUDEDIR@ +SYSREPO_LIBS = @SYSREPO_LIBS@ +SYSREPO_VERSION = @SYSREPO_VERSION@ +USE_LCOV = @USE_LCOV@ +VALGRIND = @VALGRIND@ +VERSION = @VERSION@ +WARNING_GCC_44_STRICT_ALIASING_CFLAG = @WARNING_GCC_44_STRICT_ALIASING_CFLAG@ +YACC = @YACC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +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 = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib \ + -I$(top_builddir)/src/hooks/dhcp/run_script \ + -I$(top_srcdir)/src/hooks/dhcp/run_script $(BOOST_INCLUDES) \ + -DLIBRUN_SCRIPT_SO=\"$(abs_top_builddir)/src/hooks/dhcp/run_script/.libs/libdhcp_run_script.so\" \ + -DRUN_SCRIPT_TEST_SH=\"$(abs_top_builddir)/src/hooks/dhcp/run_script/tests/run_script_test.sh\" \ + -DINSTALL_PROG=\"$(abs_top_srcdir)/install-sh\" +AM_CXXFLAGS = $(KEA_CXXFLAGS) +@USE_STATIC_LINK_TRUE@AM_LDFLAGS = -static + +# Unit test data files need to get installed. +EXTRA_DIST = +CLEANFILES = *.gcno *.gcda + +# TESTS_ENVIRONMENT = $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND) +LOG_COMPILER = $(LIBTOOL) +AM_LOG_FLAGS = --mode=execute +@HAVE_GTEST_TRUE@run_script_unittests_SOURCES = run_unittests.cc \ +@HAVE_GTEST_TRUE@ load_unload_unittests.cc +@HAVE_GTEST_TRUE@run_script_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES) $(LOG4CPLUS_INCLUDES) +@HAVE_GTEST_TRUE@run_script_unittests_LDFLAGS = $(AM_LDFLAGS) $(CRYPTO_LDFLAGS) $(GTEST_LDFLAGS) +@HAVE_GTEST_TRUE@run_script_unittests_CXXFLAGS = $(AM_CXXFLAGS) +@HAVE_GTEST_TRUE@run_script_unittests_LDADD = $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/process/libkea-process.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/eval/libkea-eval.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/dhcp_ddns/libkea-dhcp_ddns.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/stats/libkea-stats.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/config/libkea-cfgclient.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/http/libkea-http.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/hooks/libkea-hooks.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/database/libkea-database.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/cc/libkea-cc.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/asiolink/libkea-asiolink.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/dns/libkea-dns++.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/log/libkea-log.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/util/libkea-util.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/exceptions/libkea-exceptions.la \ +@HAVE_GTEST_TRUE@ $(LOG4CPLUS_LIBS) $(CRYPTO_LIBS) \ +@HAVE_GTEST_TRUE@ $(BOOST_LIBS) $(GTEST_LDADD) +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .cc .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/hooks/dhcp/run_script/libloadtests/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/hooks/dhcp/run_script/libloadtests/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__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +run_script_unittests$(EXEEXT): $(run_script_unittests_OBJECTS) $(run_script_unittests_DEPENDENCIES) $(EXTRA_run_script_unittests_DEPENDENCIES) + @rm -f run_script_unittests$(EXEEXT) + $(AM_V_CXXLD)$(run_script_unittests_LINK) $(run_script_unittests_OBJECTS) $(run_script_unittests_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run_script_unittests-load_unload_unittests.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run_script_unittests-run_unittests.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.cc.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cc.lo: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< + +run_script_unittests-run_unittests.o: run_unittests.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_script_unittests_CPPFLAGS) $(CPPFLAGS) $(run_script_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_script_unittests-run_unittests.o -MD -MP -MF $(DEPDIR)/run_script_unittests-run_unittests.Tpo -c -o run_script_unittests-run_unittests.o `test -f 'run_unittests.cc' || echo '$(srcdir)/'`run_unittests.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_script_unittests-run_unittests.Tpo $(DEPDIR)/run_script_unittests-run_unittests.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='run_unittests.cc' object='run_script_unittests-run_unittests.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_script_unittests_CPPFLAGS) $(CPPFLAGS) $(run_script_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_script_unittests-run_unittests.o `test -f 'run_unittests.cc' || echo '$(srcdir)/'`run_unittests.cc + +run_script_unittests-run_unittests.obj: run_unittests.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_script_unittests_CPPFLAGS) $(CPPFLAGS) $(run_script_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_script_unittests-run_unittests.obj -MD -MP -MF $(DEPDIR)/run_script_unittests-run_unittests.Tpo -c -o run_script_unittests-run_unittests.obj `if test -f 'run_unittests.cc'; then $(CYGPATH_W) 'run_unittests.cc'; else $(CYGPATH_W) '$(srcdir)/run_unittests.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_script_unittests-run_unittests.Tpo $(DEPDIR)/run_script_unittests-run_unittests.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='run_unittests.cc' object='run_script_unittests-run_unittests.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_script_unittests_CPPFLAGS) $(CPPFLAGS) $(run_script_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_script_unittests-run_unittests.obj `if test -f 'run_unittests.cc'; then $(CYGPATH_W) 'run_unittests.cc'; else $(CYGPATH_W) '$(srcdir)/run_unittests.cc'; fi` + +run_script_unittests-load_unload_unittests.o: load_unload_unittests.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_script_unittests_CPPFLAGS) $(CPPFLAGS) $(run_script_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_script_unittests-load_unload_unittests.o -MD -MP -MF $(DEPDIR)/run_script_unittests-load_unload_unittests.Tpo -c -o run_script_unittests-load_unload_unittests.o `test -f 'load_unload_unittests.cc' || echo '$(srcdir)/'`load_unload_unittests.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_script_unittests-load_unload_unittests.Tpo $(DEPDIR)/run_script_unittests-load_unload_unittests.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='load_unload_unittests.cc' object='run_script_unittests-load_unload_unittests.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_script_unittests_CPPFLAGS) $(CPPFLAGS) $(run_script_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_script_unittests-load_unload_unittests.o `test -f 'load_unload_unittests.cc' || echo '$(srcdir)/'`load_unload_unittests.cc + +run_script_unittests-load_unload_unittests.obj: load_unload_unittests.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_script_unittests_CPPFLAGS) $(CPPFLAGS) $(run_script_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_script_unittests-load_unload_unittests.obj -MD -MP -MF $(DEPDIR)/run_script_unittests-load_unload_unittests.Tpo -c -o run_script_unittests-load_unload_unittests.obj `if test -f 'load_unload_unittests.cc'; then $(CYGPATH_W) 'load_unload_unittests.cc'; else $(CYGPATH_W) '$(srcdir)/load_unload_unittests.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_script_unittests-load_unload_unittests.Tpo $(DEPDIR)/run_script_unittests-load_unload_unittests.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='load_unload_unittests.cc' object='run_script_unittests-load_unload_unittests.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_script_unittests_CPPFLAGS) $(CPPFLAGS) $(run_script_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_script_unittests-load_unload_unittests.obj `if test -f 'load_unload_unittests.cc'; then $(CYGPATH_W) 'load_unload_unittests.cc'; else $(CYGPATH_W) '$(srcdir)/load_unload_unittests.cc'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + $(am__tty_colors); \ + 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 $(AM_TESTS_FD_REDIRECT); then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + col=$$red; res=XPASS; \ + ;; \ + *) \ + col=$$grn; res=PASS; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xfail=`expr $$xfail + 1`; \ + col=$$lgn; res=XFAIL; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + col=$$red; res=FAIL; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + col=$$blu; res=SKIP; \ + fi; \ + echo "$${col}$$res$${std}: $$tst"; \ + done; \ + if test "$$all" -eq 1; then \ + tests="test"; \ + All=""; \ + else \ + tests="tests"; \ + All="All "; \ + fi; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="$$All$$all $$tests passed"; \ + else \ + if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ + 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 \ + if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ + banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + if test "$$skip" -eq 1; then \ + skipped="($$skip test was not run)"; \ + else \ + skipped="($$skip tests were not run)"; \ + fi; \ + 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`; \ + if test "$$failed" -eq 0; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + fi; \ + echo "$${col}$$dashes$${std}"; \ + echo "$${col}$$banner$${std}"; \ + test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \ + test -z "$$report" || echo "$${col}$$report$${std}"; \ + echo "$${col}$$dashes$${std}"; \ + test "$$failed" -eq 0; \ + else :; fi + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-recursive +all-am: Makefile $(PROGRAMS) +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-recursive + -rm -f ./$(DEPDIR)/run_script_unittests-load_unload_unittests.Po + -rm -f ./$(DEPDIR)/run_script_unittests-run_unittests.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f ./$(DEPDIR)/run_script_unittests-load_unload_unittests.Po + -rm -f ./$(DEPDIR)/run_script_unittests-run_unittests.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(am__recursive_targets) check-am install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ + am--depfiles check check-TESTS check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS cscopelist-am ctags \ + ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool 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 mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/hooks/dhcp/run_script/libloadtests/load_unload_unittests.cc b/src/hooks/dhcp/run_script/libloadtests/load_unload_unittests.cc new file mode 100644 index 0000000..b924b8d --- /dev/null +++ b/src/hooks/dhcp/run_script/libloadtests/load_unload_unittests.cc @@ -0,0 +1,120 @@ +// Copyright (C) 2019-2021 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +/// @file This file contains tests which exercise the load and unload +/// functions in the flexible option hook library. In order to test the load +/// function, one must be able to pass it hook library parameters. The +/// the only way to populate these parameters is by actually loading the +/// library via HooksManager::loadLibraries(). + +#include <config.h> + +#include <cc/data.h> +#include <hooks/hooks_manager.h> + +#include <gtest/gtest.h> +#include <errno.h> + +using namespace std; +using namespace isc; +using namespace isc::hooks; +using namespace isc::data; + +namespace { + +/// @brief Test fixture for testing loading and unloading the RunScript library. +class LibLoadTest : public ::testing::Test { +public: + /// @brief Constructor + LibLoadTest() { + reset(); + } + + /// @brief Destructor + /// + /// Removes files that may be left over from previous tests + virtual ~LibLoadTest() { + reset(); + } + + /// @brief Removes files that may be left over from previous tests + virtual void reset() { + HooksManager::unloadLibraries(); + } + + /// @brief Add library to the collection of tested libraries. + /// + /// @param lib The name of the lib added. + /// @param params The parameters of the library. + void addLib(const string& lib, ConstElementPtr params) { + libraries_.push_back(make_pair(lib, params)); + } + + /// @brief Load libraries. + /// + /// @return True if loading succeeded, false otherwise. + bool loadLibs() { + return (HooksManager::loadLibraries(libraries_)); + } + + /// @brief Unload libraries. + /// + /// @return True if unloading succeeded, false otherwise. + bool unloadLibs() { + return (HooksManager::unloadLibraries()); + } + + /// @brief The collection of libraries to be loaded. + HookLibsCollection libraries_; +}; + +// Simple test that checks the library can be loaded and unloaded several times. +TEST_F(LibLoadTest, validLoad) { + // Prepare parameters for the callout parameters library. + ElementPtr params = Element::createMap(); + ElementPtr name = Element::create(RUN_SCRIPT_TEST_SH); + params->set("name", name); + ElementPtr sync = Element::create(false); + params->set("sync", sync); + + addLib(LIBRUN_SCRIPT_SO, params); + + EXPECT_TRUE(loadLibs()); + EXPECT_NO_THROW(unloadLibs()); + + EXPECT_TRUE(loadLibs()); + EXPECT_NO_THROW(unloadLibs()); +} + +// Simple test that checks the library can not be loaded if using wrong +// parameters. +TEST_F(LibLoadTest, invalidLoad) { + // Prepare parameters for the callout parameters library. + ElementPtr params = Element::createMap(); + addLib(LIBRUN_SCRIPT_SO, params); + + // The name parameter is mandatory. + EXPECT_FALSE(loadLibs()); + + // Use invalid name parameter type. + ElementPtr name = Element::create(false); + params->set("name", name); + EXPECT_FALSE(loadLibs()); + + // Use invalid name parameter. + name = Element::create("script_name.sh"); + params->set("name", name); + EXPECT_FALSE(loadLibs()); + + // Use valid name parameter type but use invalid sync parameter type. + name = Element::create(RUN_SCRIPT_TEST_SH); + params->set("name", name); + ElementPtr sync = Element::create("data"); + params->set("sync", sync); + EXPECT_FALSE(loadLibs()); +} + +} // end of anonymous namespace diff --git a/src/hooks/dhcp/run_script/libloadtests/run_unittests.cc b/src/hooks/dhcp/run_script/libloadtests/run_unittests.cc new file mode 100644 index 0000000..1b4d40c --- /dev/null +++ b/src/hooks/dhcp/run_script/libloadtests/run_unittests.cc @@ -0,0 +1,19 @@ +// Copyright (C) 2021 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include <config.h> + +#include <log/logger_support.h> +#include <gtest/gtest.h> + +int +main(int argc, char* argv[]) { + ::testing::InitGoogleTest(&argc, argv); + isc::log::initLogger(); + int result = RUN_ALL_TESTS(); + + return (result); +} diff --git a/src/hooks/dhcp/run_script/run_script.cc b/src/hooks/dhcp/run_script/run_script.cc new file mode 100644 index 0000000..ab710f1 --- /dev/null +++ b/src/hooks/dhcp/run_script/run_script.cc @@ -0,0 +1,457 @@ +// Copyright (C) 2021 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include <config.h> + +#include <run_script.h> + +using namespace isc::asiolink; +using namespace isc::data; +using namespace isc::hooks; +using namespace isc::util; +using namespace isc::dhcp; +using namespace std; + +namespace isc { +namespace run_script { + +IOServicePtr RunScriptImpl::io_service_; + +RunScriptImpl::RunScriptImpl() : name_(), sync_(false) { +} + +void +RunScriptImpl::configure(LibraryHandle& handle) { + ConstElementPtr name = handle.getParameter("name"); + if (!name) { + isc_throw(NotFound, "The 'name' parameter is mandatory"); + } + if (name->getType() != Element::string) { + isc_throw(InvalidParameter, "The 'name' parameter must be a string"); + } + try { + ProcessSpawn process(IOServicePtr(), name->stringValue()); + } catch (const isc::Exception& ex) { + isc_throw(InvalidParameter, "Invalid 'name' parameter: " << ex.what()); + } + setName(name->stringValue()); + ConstElementPtr sync = handle.getParameter("sync"); + if (sync) { + if (sync->getType() != Element::boolean) { + isc_throw(InvalidParameter, "The 'sync' parameter must be a boolean"); + } + setSync(sync->boolValue()); + } +} + +void +RunScriptImpl::runScript(const ProcessArgs& args, const ProcessEnvVars& vars) { + ProcessSpawn process(getIOService(), name_, args, vars); + process.spawn(true); +} + +void +RunScriptImpl::extractBoolean(ProcessEnvVars& vars, + const bool value, + const string& prefix, + const string& suffix) { + string data; + if (value) { + data = "true"; + } else { + data = "false"; + } + string exported_data = prefix + suffix + "=" + data; + vars.push_back(exported_data); +} + +void +RunScriptImpl::extractInteger(ProcessEnvVars& vars, + const uint64_t value, + const string& prefix, + const string& suffix) { + string exported_data = prefix + suffix + "=" + boost::lexical_cast<string>(value); + vars.push_back(exported_data); +} + +void +RunScriptImpl::extractString(ProcessEnvVars& vars, + const string& value, + const string& prefix, + const string& suffix) { + string exported_data = prefix + suffix + "=" + value; + vars.push_back(exported_data); +} + +void +RunScriptImpl::extractHWAddr(ProcessEnvVars& vars, + const HWAddrPtr& hwaddr, + const string& prefix, + const string& suffix) { + if (hwaddr) { + RunScriptImpl::extractString(vars, hwaddr->toText(false), prefix, suffix); + RunScriptImpl::extractInteger(vars, hwaddr->htype_, prefix + "_TYPE", suffix); + } else { + RunScriptImpl::extractString(vars, "", prefix, suffix); + RunScriptImpl::extractString(vars, "", prefix + "_TYPE", suffix); + } +} + +void +RunScriptImpl::extractDUID(ProcessEnvVars& vars, + const DuidPtr duid, + const string& prefix, + const string& suffix) { + if (duid) { + RunScriptImpl::extractString(vars, duid->toText(), + prefix, suffix); + } else { + RunScriptImpl::extractString(vars, "", prefix, suffix); + } +} + +void +RunScriptImpl::extractOption(ProcessEnvVars& vars, + const OptionPtr option, + const string& prefix, + const string& suffix) { + if (option) { + RunScriptImpl::extractString(vars, option->toHexString(), + prefix + "_OPTION_" + + boost::lexical_cast<string>(option->getType()), + suffix); + } +} + +void +RunScriptImpl::extractSubOption(ProcessEnvVars& vars, + const OptionPtr option, + uint16_t code, + const string& prefix, + const string& suffix) { + if (option) { + RunScriptImpl::extractOption(vars, option->getOption(code), + prefix + "_OPTION_" + + boost::lexical_cast<string>(option->getType()) + + "_SUB", suffix); + } +} + +void +RunScriptImpl::extractOptionIA(ProcessEnvVars& vars, + const Option6IAPtr option6IA, + const string& prefix, + const string& suffix) { + if (option6IA) { + RunScriptImpl::extractInteger(vars, option6IA->getIAID(), + prefix + "_IAID", suffix); + RunScriptImpl::extractInteger(vars, option6IA->getType(), + prefix + "_IA_TYPE", suffix); + RunScriptImpl::extractInteger(vars, option6IA->getT1(), + prefix + "_IA_T1", suffix); + RunScriptImpl::extractInteger(vars, option6IA->getT2(), + prefix + "_IA_T2", suffix); + } else { + RunScriptImpl::extractString(vars, "", prefix + "_IAID", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_IA_TYPE", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_IA_T1", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_IA_T2", suffix); + } +} + +void +RunScriptImpl::extractSubnet4(ProcessEnvVars& vars, + const Subnet4Ptr subnet4, + const string& prefix, + const string& suffix) { + if (subnet4) { + RunScriptImpl::extractInteger(vars, subnet4->getID(), + prefix + "_ID", suffix); + RunScriptImpl::extractString(vars, subnet4->toText(), + prefix + "_NAME", suffix); + auto prefix_data = subnet4->get(); + RunScriptImpl::extractString(vars, prefix_data.first.toText(), + prefix + "_PREFIX", suffix); + RunScriptImpl::extractInteger(vars, prefix_data.second, + prefix + "_PREFIX_LEN", suffix); + } else { + RunScriptImpl::extractString(vars, "", prefix + "_ID", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_NAME", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_PREFIX", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_PREFIX_LEN", suffix); + } +} + +void +RunScriptImpl::extractSubnet6(ProcessEnvVars& vars, + const Subnet6Ptr subnet6, + const string& prefix, + const string& suffix) { + if (subnet6) { + RunScriptImpl::extractInteger(vars, subnet6->getID(), + prefix + "_ID", suffix); + RunScriptImpl::extractString(vars, subnet6->toText(), + prefix + "_NAME", suffix); + auto prefix_data = subnet6->get(); + RunScriptImpl::extractString(vars, prefix_data.first.toText(), + prefix + "_PREFIX", suffix); + RunScriptImpl::extractInteger(vars, prefix_data.second, + prefix + "_PREFIX_LEN", suffix); + } else { + RunScriptImpl::extractString(vars, "", prefix + "_ID", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_NAME", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_PREFIX", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_PREFIX_LEN", suffix); + } +} + +void +RunScriptImpl::extractLease4(ProcessEnvVars& vars, + const Lease4Ptr& lease4, + const string& prefix, + const string& suffix) { + if (lease4) { + RunScriptImpl::extractString(vars, lease4->addr_.toText(), + prefix + "_ADDRESS", suffix); + RunScriptImpl::extractInteger(vars, static_cast<uint64_t>(lease4->cltt_), + prefix + "_CLTT", suffix); + RunScriptImpl::extractString(vars, lease4->hostname_, + prefix + "_HOSTNAME", suffix); + RunScriptImpl::extractHWAddr(vars, lease4->hwaddr_, + prefix + "_HWADDR", suffix); + RunScriptImpl::extractString(vars, Lease4::statesToText(lease4->state_), + prefix + "_STATE", suffix); + RunScriptImpl::extractInteger(vars, lease4->subnet_id_, + prefix + "_SUBNET_ID", suffix); + RunScriptImpl::extractInteger(vars, lease4->valid_lft_, + prefix + "_VALID_LIFETIME", suffix); + RunScriptImpl::extractDUID(vars, lease4->client_id_, + prefix + "_CLIENT_ID", suffix); + } else { + RunScriptImpl::extractString(vars, "", prefix + "_ADDRESS", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_CLTT", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_HOSTNAME", suffix); + RunScriptImpl::extractHWAddr(vars, HWAddrPtr(), prefix + "_HWADDR", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_STATE", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_SUBNET_ID", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_VALID_LIFETIME", suffix); + RunScriptImpl::extractDUID(vars, DuidPtr(), prefix + "_CLIENT_ID", suffix); + } +} + +void +RunScriptImpl::extractLease6(ProcessEnvVars& vars, + const Lease6Ptr& lease6, + const string& prefix, + const string& suffix) { + if (lease6) { + RunScriptImpl::extractString(vars, lease6->addr_.toText(), + prefix + "_ADDRESS", suffix); + RunScriptImpl::extractInteger(vars, static_cast<uint64_t>(lease6->cltt_), + prefix + "_CLTT", suffix); + RunScriptImpl::extractString(vars, lease6->hostname_, + prefix + "_HOSTNAME", suffix); + RunScriptImpl::extractHWAddr(vars, lease6->hwaddr_, + prefix + "_HWADDR", suffix); + RunScriptImpl::extractString(vars, Lease6::statesToText(lease6->state_), + prefix + "_STATE", suffix); + RunScriptImpl::extractInteger(vars, lease6->subnet_id_, + prefix + "_SUBNET_ID", suffix); + RunScriptImpl::extractInteger(vars, lease6->valid_lft_, + prefix + "_VALID_LIFETIME", suffix); + RunScriptImpl::extractDUID(vars, lease6->duid_, + prefix + "_DUID", suffix); + RunScriptImpl::extractInteger(vars, lease6->iaid_, + prefix + "_IAID", suffix); + RunScriptImpl::extractInteger(vars, lease6->preferred_lft_, + prefix + "_PREFERRED_LIFETIME", suffix); + RunScriptImpl::extractInteger(vars, lease6->prefixlen_, + prefix + "_PREFIX_LEN", suffix); + RunScriptImpl::extractString(vars, Lease::typeToText(lease6->type_), + prefix + "_TYPE", suffix); + } else { + RunScriptImpl::extractString(vars, "", prefix + "_ADDRESS", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_CLTT", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_HOSTNAME", suffix); + RunScriptImpl::extractHWAddr(vars, HWAddrPtr(), prefix + "_HWADDR", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_STATE", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_SUBNET_ID", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_VALID_LIFETIME", suffix); + RunScriptImpl::extractDUID(vars, DuidPtr(), prefix + "_DUID", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_IAID", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_PREFERRED_LIFETIME", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_PREFIX_LEN", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_TYPE", suffix); + } +} + +void +RunScriptImpl::extractLeases4(ProcessEnvVars& vars, + const Lease4CollectionPtr& leases4, + const string& prefix, + const string& suffix) { + if (leases4) { + RunScriptImpl::extractInteger(vars, leases4->size(), + prefix + "_SIZE", suffix); + for (size_t i = 0; i < leases4->size(); ++i) { + RunScriptImpl::extractLease4(vars, leases4->at(i), + prefix + "_AT" + + boost::lexical_cast<string>(i), + suffix); + } + } else { + RunScriptImpl::extractString(vars, "0", prefix + "_SIZE", suffix); + } +} + +void +RunScriptImpl::extractLeases6(ProcessEnvVars& vars, + const Lease6CollectionPtr& leases6, + const string& prefix, + const string& suffix) { + if (leases6) { + RunScriptImpl::extractInteger(vars, leases6->size(), + prefix + "_SIZE", suffix); + for (size_t i = 0; i < leases6->size(); ++i) { + RunScriptImpl::extractLease6(vars, leases6->at(i), + prefix + "_AT" + + boost::lexical_cast<string>(i), + suffix); + } + } else { + RunScriptImpl::extractString(vars, "0", prefix + "_SIZE", suffix); + } +} + +void +RunScriptImpl::extractPkt4(ProcessEnvVars& vars, + const Pkt4Ptr& pkt4, + const string& prefix, + const string& suffix) { + if (pkt4) { + RunScriptImpl::extractString(vars, pkt4->getName(pkt4->getType()), + prefix + "_TYPE", suffix); + RunScriptImpl::extractInteger(vars, pkt4->getTransid(), + prefix + "_TXID", suffix); + RunScriptImpl::extractString(vars, pkt4->getLocalAddr().toText(), + prefix + "_LOCAL_ADDR", suffix); + RunScriptImpl::extractInteger(vars, pkt4->getLocalPort(), + prefix + "_LOCAL_PORT", suffix); + RunScriptImpl::extractString(vars, pkt4->getRemoteAddr().toText(), + prefix + "_REMOTE_ADDR", suffix); + RunScriptImpl::extractInteger(vars, pkt4->getRemotePort(), + prefix + "_REMOTE_PORT", suffix); + RunScriptImpl::extractInteger(vars, pkt4->getIndex(), + prefix + "_IFACE_INDEX", suffix); + RunScriptImpl::extractString(vars, pkt4->getIface(), + prefix + "_IFACE_NAME", suffix); + RunScriptImpl::extractInteger(vars, pkt4->getHops(), + prefix + "_HOPS", suffix); + RunScriptImpl::extractInteger(vars, pkt4->getSecs(), + prefix + "_SECS", suffix); + RunScriptImpl::extractInteger(vars, pkt4->getFlags(), + prefix + "_FLAGS", suffix); + RunScriptImpl::extractString(vars, pkt4->getCiaddr().toText(), + prefix + "_CIADDR", suffix); + RunScriptImpl::extractString(vars, pkt4->getSiaddr().toText(), + prefix + "_SIADDR", suffix); + RunScriptImpl::extractString(vars, pkt4->getYiaddr().toText(), + prefix + "_YIADDR", suffix); + RunScriptImpl::extractString(vars, pkt4->getGiaddr().toText(), + prefix + "_GIADDR", suffix); + RunScriptImpl::extractBoolean(vars, pkt4->isRelayed(), + prefix + "_RELAYED", suffix); + RunScriptImpl::extractHWAddr(vars, pkt4->getHWAddr(), + prefix + "_HWADDR", suffix); + RunScriptImpl::extractHWAddr(vars, pkt4->getLocalHWAddr(), + prefix + "_LOCAL_HWADDR", suffix); + RunScriptImpl::extractHWAddr(vars, pkt4->getRemoteHWAddr(), + prefix + "_REMOTE_HWADDR", suffix); + RunScriptImpl::extractOption(vars, + pkt4->getOption(DHO_DHCP_AGENT_OPTIONS), + prefix, suffix); + RunScriptImpl::extractSubOption(vars, + pkt4->getOption(DHO_DHCP_AGENT_OPTIONS), + RAI_OPTION_AGENT_CIRCUIT_ID, + prefix, suffix); + RunScriptImpl::extractSubOption(vars, + pkt4->getOption(DHO_DHCP_AGENT_OPTIONS), + RAI_OPTION_REMOTE_ID, + prefix, suffix); + } else { + RunScriptImpl::extractString(vars, "", prefix + "_TYPE", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_TXID", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_LOCAL_ADDR", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_LOCAL_PORT", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_REMOTE_ADDR", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_REMOTE_PORT", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_IFACE_INDEX", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_IFACE_NAME", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_HOPS", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_SECS", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_FLAGS", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_CIADDR", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_SIADDR", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_YIADDR", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_GIADDR", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_RELAYED", suffix); + RunScriptImpl::extractHWAddr(vars, HWAddrPtr(), + prefix + "_HWADDR", suffix); + RunScriptImpl::extractHWAddr(vars, HWAddrPtr(), + prefix + "_LOCAL_HWADDR", suffix); + RunScriptImpl::extractHWAddr(vars, HWAddrPtr(), + prefix + "_REMOTE_HWADDR", suffix); + } +} + +void +RunScriptImpl::extractPkt6(ProcessEnvVars& vars, + const Pkt6Ptr& pkt6, + const string& prefix, + const string& suffix) { + if (pkt6) { + RunScriptImpl::extractString(vars, pkt6->getName(pkt6->getType()), + prefix + "_TYPE", suffix); + RunScriptImpl::extractInteger(vars, pkt6->getTransid(), + prefix + "_TXID", suffix); + RunScriptImpl::extractString(vars, pkt6->getLocalAddr().toText(), + prefix + "_LOCAL_ADDR", suffix); + RunScriptImpl::extractInteger(vars, pkt6->getLocalPort(), + prefix + "_LOCAL_PORT", suffix); + RunScriptImpl::extractString(vars, pkt6->getRemoteAddr().toText(), + prefix + "_REMOTE_ADDR", suffix); + RunScriptImpl::extractInteger(vars, pkt6->getRemotePort(), + prefix + "_REMOTE_PORT", suffix); + RunScriptImpl::extractInteger(vars, pkt6->getIndex(), + prefix + "_IFACE_INDEX", suffix); + RunScriptImpl::extractString(vars, pkt6->getIface(), + prefix + "_IFACE_NAME", suffix); + RunScriptImpl::extractHWAddr(vars, pkt6->getRemoteHWAddr(), + prefix + "_REMOTE_HWADDR", suffix); + string proto_data = (pkt6->getProto() == Pkt6::UDP ? "UDP" : "TCP"); + RunScriptImpl::extractString(vars, proto_data, + prefix + "_PROTO", suffix); + RunScriptImpl::extractDUID(vars, pkt6->getClientId(), + prefix + "_CLIENT_ID", suffix); + } else { + RunScriptImpl::extractString(vars, "", prefix + "_TYPE", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_TXID", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_LOCAL_ADDR", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_LOCAL_PORT", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_REMOTE_ADDR", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_REMOTE_PORT", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_IFACE_INDEX", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_IFACE_NAME", suffix); + RunScriptImpl::extractHWAddr(vars, HWAddrPtr(), + prefix + "_REMOTE_HWADDR", suffix); + RunScriptImpl::extractString(vars, "", prefix + "_PROTO", suffix); + RunScriptImpl::extractDUID(vars, DuidPtr(), + prefix + "_CLIENT_ID", suffix); + } +} + +} // namespace run_script +} // namespace isc diff --git a/src/hooks/dhcp/run_script/run_script.dox b/src/hooks/dhcp/run_script/run_script.dox new file mode 100644 index 0000000..3fbcd12 --- /dev/null +++ b/src/hooks/dhcp/run_script/run_script.dox @@ -0,0 +1,673 @@ +// Copyright (C) 2021 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +/** + +@page libdhcp_run_script Kea Run Script Hooks Library + +@section libdhcp_run_scriptIntro Introduction + +Welcome to Kea Run Script Hooks Library. This documentation is addressed to +developers who are interested in the internal operation of the Run Script +library. This file provides information needed to understand and +perhaps extend this library. + +This documentation is stand-alone: you should have read and understood +the <a href="https://reports.kea.isc.org/dev_guide/">Kea +Developer's Guide</a> and in particular its section about hooks. + +@section libdhcp_run_scriptUser Now To Use libdhcp_run_script +## Introduction +libdhcp_run_script is a hooks library which allows an external script to +be run on specific hook points. + +## Configuring the DHCPv4 and DHCPv6 Modules + +It must be configured as a hook library for the desired DHCP server +modules. Note that the Run Script library is installed alongside the +Kea libraries in "<install-dir>/lib" where <install-dir> is determined +by the --prefix option of the configure script. It defaults to +"/usr/local". + +Configuring kea-dhcp4 to load the Run Script library could be done with +the following Kea4 configuration: + +@code +"Dhcp4": { + "hooks-libraries": [ + { "library": "/usr/local/lib/libdhcp_run_script.so", + "parameters": { + "name": "/full_path_to/script_name.sh", + "sync": false + } + }, + ... + ] +} +@endcode + +Configuring kea-dhcp6 to load the Run Script library could be done with +the following Kea6 configuration: + +@code +"Dhcp6": { + "hooks-libraries": [ + { "library": "/usr/local/lib/libdhcp_run_script.so", + "parameters": { + "name": "/full_path_to/script_name.sh", + "sync": false + } + }, + ... + ] +} +@endcode + +The parameters contain the 'name' which indicates the full path to the external +script to be called on each hookpoint, and also the 'sync' option to be able +to wait synchronously for the script to finish execution. +If the 'sync' parameter is false, then the script will be launched and Kea +will not wait for the execution to finish, causing all the OUT parameters of +the script (including next step) to be ignored. + +The script inherits all privileges from the server which calls it. + +Currently the functionality underneath 'sync' parameter is not implemented +and enabling synchronous calls to external script is not supported. + +## Internal operation + +The first function called in @ref load() located in the +run_script_callouts.cc. It checks if the necessary parameter is passed and +decodes the option configurations. @ref unload() free the configuration. + +Kea engine checks if the library has functions that match known hook +point names. This library has several such functions: @ref lease4_renew, +@ref lease4_expire, @ref lease4_recover, @ref leases4_committed, +@ref lease4_release, @ref lease4_decline, @ref lease6_renew, +@ref lease6_rebind, @ref lease6_expire, @ref lease6_recover, +@ref leases6_committed, @ref lease6_release, @ref lease6_decline located +in run_script_callouts.cc. + +Each hook point extracts the Kea internal data and exports it as string +environment variables. These parameters are shared with the target script +using the child process environment. +The only parameter passed to the call of the target script is the name of +the hook point. + +An example of a script implementing all hook points is presented below. + +@code +#!/bin/bash + +unknown_handle() { + echo "Unhandled function call ${*}" + exit 123 +} + +lease4_renew () { + ... +} + +lease4_expire () { + ... +} + +lease4_recover () { + ... +} + +leases4_committed () { + ... +} + +lease4_release () { + ... +} + +lease4_decline () { + ... +} + +lease6_renew () { + ... +} + +lease6_rebind () { + ... +} + +lease6_expire () { + ... +} + +lease6_recover () { + ... +} + +leases6_committed () { + ... +} + +lease6_release () { + ... +} + +lease6_decline () { + ... +} + +case "$1" in + "lease4_renew") + lease4_renew + ;; + "lease4_expire") + lease4_expire + ;; + "lease4_recover") + lease4_recover + ;; + "leases4_committed") + leases4_committed + ;; + "lease4_release") + lease4_release + ;; + "lease4_decline") + lease4_decline + ;; + "lease6_renew") + lease6_renew + ;; + "lease6_rebind") + lease6_rebind + ;; + "lease6_expire") + lease6_expire + ;; + "lease6_recover") + lease6_recover + ;; + "leases6_committed") + leases6_committed + ;; + "lease6_release") + lease6_release + ;; + "lease6_decline") + lease6_decline + ;; + *) + unknown_handle "${@}" + ;; +esac + +@endcode + +Available parameters for each hook points are presented below. + +lease4_renew + +@code + +QUERY4_TYPE +QUERY4_TXID +QUERY4_LOCAL_ADDR +QUERY4_LOCAL_PORT +QUERY4_REMOTE_ADDR +QUERY4_REMOTE_PORT +QUERY4_IFACE_INDEX +QUERY4_IFACE_NAME +QUERY4_HOPS +QUERY4_SECS +QUERY4_FLAGS +QUERY4_CIADDR +QUERY4_SIADDR +QUERY4_YIADDR +QUERY4_GIADDR +QUERY4_RELAYED +QUERY4_HWADDR +QUERY4_HWADDR_TYPE +QUERY4_LOCAL_HWADDR +QUERY4_LOCAL_HWADDR_TYPE +QUERY4_REMOTE_HWADDR +QUERY4_REMOTE_HWADDR_TYPE +QUERY4_OPTION_82 +QUERY4_OPTION_82_SUB_OPTION_1 +QUERY4_OPTION_82_SUB_OPTION_2 +SUBNET4_ID +SUBNET4_NAME +SUBNET4_PREFIX +SUBNET4_PREFIX_LEN +PKT4_CLIENT_ID +PKT4_HWADDR +PKT4_HWADDR_TYPE +LEASE4_ADDRESS +LEASE4_CLTT +LEASE4_HOSTNAME +LEASE4_HWADDR +LEASE4_HWADDR_TYPE +LEASE4_STATE +LEASE4_SUBNET_ID +LEASE4_VALID_LIFETIME +LEASE4_CLIENT_ID + +@endcode + +lease4_expire + +@code + +LEASE4_ADDRESS +LEASE4_CLTT +LEASE4_HOSTNAME +LEASE4_HWADDR +LEASE4_HWADDR_TYPE +LEASE4_STATE +LEASE4_SUBNET_ID +LEASE4_VALID_LIFETIME +LEASE4_CLIENT_ID +REMOVE_LEASE + +@endcode + +lease4_recover + +@code + +LEASE4_ADDRESS +LEASE4_CLTT +LEASE4_HOSTNAME +LEASE4_HWADDR +LEASE4_HWADDR_TYPE +LEASE4_STATE +LEASE4_SUBNET_ID +LEASE4_VALID_LIFETIME +LEASE4_CLIENT_ID + +@endcode + +leases4_committed + +@code + +QUERY4_TYPE +QUERY4_TXID +QUERY4_LOCAL_ADDR +QUERY4_LOCAL_PORT +QUERY4_REMOTE_ADDR +QUERY4_REMOTE_PORT +QUERY4_IFACE_INDEX +QUERY4_IFACE_NAME +QUERY4_HOPS +QUERY4_SECS +QUERY4_FLAGS +QUERY4_CIADDR +QUERY4_SIADDR +QUERY4_YIADDR +QUERY4_GIADDR +QUERY4_RELAYED +QUERY4_HWADDR +QUERY4_HWADDR_TYPE +QUERY4_LOCAL_HWADDR +QUERY4_LOCAL_HWADDR_TYPE +QUERY4_REMOTE_HWADDR +QUERY4_REMOTE_HWADDR_TYPE +QUERY4_OPTION_82 +QUERY4_OPTION_82_SUB_OPTION_1 +QUERY4_OPTION_82_SUB_OPTION_2 +LEASES4_SIZE +DELETED_LEASES4_SIZE + +@endcode + +If LEASES4_SIZE or DELETED_LEASES4_SIZE are non zero, then each lease +will have it's own unique identifier as shown below. First index starts +at 0. + +@code + +LEASES4_AT0_ADDRESS +LEASES4_AT0_CLTT +LEASES4_AT0_HOSTNAME +LEASES4_AT0_HWADDR +LEASES4_AT0_HWADDR_TYPE +LEASES4_AT0_STATE +LEASES4_AT0_SUBNET_ID +LEASES4_AT0_VALID_LIFETIME +LEASES4_AT0_CLIENT_ID +DELETED_LEASES4_AT0_ADDRESS +DELETED_LEASES4_AT0_CLTT +DELETED_LEASES4_AT0_HOSTNAME +DELETED_LEASES4_AT0_HWADDR +DELETED_LEASES4_AT0_HWADDR_TYPE +DELETED_LEASES4_AT0_STATE +DELETED_LEASES4_AT0_SUBNET_ID +DELETED_LEASES4_AT0_VALID_LIFETIME +DELETED_LEASES4_AT0_CLIENT_ID + +@endcode + +lease4_release + +@code + +QUERY4_TYPE +QUERY4_TXID +QUERY4_LOCAL_ADDR +QUERY4_LOCAL_PORT +QUERY4_REMOTE_ADDR +QUERY4_REMOTE_PORT +QUERY4_IFACE_INDEX +QUERY4_IFACE_NAME +QUERY4_HOPS +QUERY4_SECS +QUERY4_FLAGS +QUERY4_CIADDR +QUERY4_SIADDR +QUERY4_YIADDR +QUERY4_GIADDR +QUERY4_RELAYED +QUERY4_HWADDR +QUERY4_HWADDR_TYPE +QUERY4_LOCAL_HWADDR +QUERY4_LOCAL_HWADDR_TYPE +QUERY4_REMOTE_HWADDR +QUERY4_REMOTE_HWADDR_TYPE +QUERY4_OPTION_82 +QUERY4_OPTION_82_SUB_OPTION_1 +QUERY4_OPTION_82_SUB_OPTION_2 +LEASE4_ADDRESS +LEASE4_CLTT +LEASE4_HOSTNAME +LEASE4_HWADDR +LEASE4_HWADDR_TYPE +LEASE4_STATE +LEASE4_SUBNET_ID +LEASE4_VALID_LIFETIME +LEASE4_CLIENT_ID + +@endcode + +lease4_decline + +@code + +QUERY4_TYPE +QUERY4_TXID +QUERY4_LOCAL_ADDR +QUERY4_LOCAL_PORT +QUERY4_REMOTE_ADDR +QUERY4_REMOTE_PORT +QUERY4_IFACE_INDEX +QUERY4_IFACE_NAME +QUERY4_HOPS +QUERY4_SECS +QUERY4_FLAGS +QUERY4_CIADDR +QUERY4_SIADDR +QUERY4_YIADDR +QUERY4_GIADDR +QUERY4_RELAYED +QUERY4_HWADDR +QUERY4_HWADDR_TYPE +QUERY4_LOCAL_HWADDR +QUERY4_LOCAL_HWADDR_TYPE +QUERY4_REMOTE_HWADDR +QUERY4_REMOTE_HWADDR_TYPE +QUERY4_OPTION_82 +QUERY4_OPTION_82_SUB_OPTION_1 +QUERY4_OPTION_82_SUB_OPTION_2 +LEASE4_ADDRESS +LEASE4_CLTT +LEASE4_HOSTNAME +LEASE4_HWADDR +LEASE4_HWADDR_TYPE +LEASE4_STATE +LEASE4_SUBNET_ID +LEASE4_VALID_LIFETIME +LEASE4_CLIENT_ID + +@endcode + +lease6_renew + +@code + +QUERY6_TYPE +QUERY6_TXID +QUERY6_LOCAL_ADDR +QUERY6_LOCAL_PORT +QUERY6_REMOTE_ADDR +QUERY6_REMOTE_PORT +QUERY6_IFACE_INDEX +QUERY6_IFACE_NAME +QUERY6_REMOTE_HWADDR +QUERY6_REMOTE_HWADDR_TYPE +QUERY6_PROTO +QUERY6_CLIENT_ID +LEASE6_ADDRESS +LEASE6_CLTT +LEASE6_HOSTNAME +LEASE6_HWADDR +LEASE6_HWADDR_TYPE +LEASE6_STATE +LEASE6_SUBNET_ID +LEASE6_VALID_LIFETIME +LEASE6_DUID +LEASE6_IAID +LEASE6_PREFERRED_LIFETIME +LEASE6_PREFIX_LEN +LEASE6_TYPE +PKT6_IA_IAID +PKT6_IA_IA_TYPE +PKT6_IA_IA_T1 +PKT6_IA_IA_T2 + +@endcode + +lease6_rebind + +@code + +QUERY6_TYPE +QUERY6_TXID +QUERY6_LOCAL_ADDR +QUERY6_LOCAL_PORT +QUERY6_REMOTE_ADDR +QUERY6_REMOTE_PORT +QUERY6_IFACE_INDEX +QUERY6_IFACE_NAME +QUERY6_REMOTE_HWADDR +QUERY6_REMOTE_HWADDR_TYPE +QUERY6_PROTO +QUERY6_CLIENT_ID +LEASE6_ADDRESS +LEASE6_CLTT +LEASE6_HOSTNAME +LEASE6_HWADDR +LEASE6_HWADDR_TYPE +LEASE6_STATE +LEASE6_SUBNET_ID +LEASE6_VALID_LIFETIME +LEASE6_DUID +LEASE6_IAID +LEASE6_PREFERRED_LIFETIME +LEASE6_PREFIX_LEN +LEASE6_TYPE +PKT6_IA_IAID +PKT6_IA_IA_TYPE +PKT6_IA_IA_T1 +PKT6_IA_IA_T2 + +@endcode + +lease6_expire + +@code + +LEASE6_ADDRESS +LEASE6_CLTT +LEASE6_HOSTNAME +LEASE6_HWADDR +LEASE6_HWADDR_TYPE +LEASE6_STATE +LEASE6_SUBNET_ID +LEASE6_VALID_LIFETIME +LEASE6_DUID +LEASE6_IAID +LEASE6_PREFERRED_LIFETIME +LEASE6_PREFIX_LEN +LEASE6_TYPE +REMOVE_LEASE + +@endcode + +lease6_recover + +@code + +LEASE6_ADDRESS +LEASE6_CLTT +LEASE6_HOSTNAME +LEASE6_HWADDR +LEASE6_HWADDR_TYPE +LEASE6_STATE +LEASE6_SUBNET_ID +LEASE6_VALID_LIFETIME +LEASE6_DUID +LEASE6_IAID +LEASE6_PREFERRED_LIFETIME +LEASE6_PREFIX_LEN +LEASE6_TYPE + +@endcode + +leases6_committed + +@code + +QUERY6_TYPE +QUERY6_TXID +QUERY6_LOCAL_ADDR +QUERY6_LOCAL_PORT +QUERY6_REMOTE_ADDR +QUERY6_REMOTE_PORT +QUERY6_IFACE_INDEX +QUERY6_IFACE_NAME +QUERY6_REMOTE_HWADDR +QUERY6_REMOTE_HWADDR_TYPE +QUERY6_PROTO +QUERY6_CLIENT_ID +LEASES6_SIZE +DELETED_LEASES6_SIZE + +@endcode + +If LEASES6_SIZE or DELETED_LEASES6_SIZE are non zero, then each lease +will have it's own unique identifier as shown below. First index starts +at 0. + +@code + +LEASES6_AT0_ADDRESS +LEASES6_AT0_CLTT +LEASES6_AT0_HOSTNAME +LEASES6_AT0_HWADDR +LEASES6_AT0_HWADDR_TYPE +LEASES6_AT0_STATE +LEASES6_AT0_SUBNET_ID +LEASES6_AT0_VALID_LIFETIME +LEASES6_AT0_DUID +LEASES6_AT0_IAID +LEASES6_AT0_PREFERRED_LIFETIME +LEASES6_AT0_PREFIX_LEN +LEASES6_AT0_TYPE +DELETED_LEASES6_AT0_ADDRESS +DELETED_LEASES6_AT0_CLTT +DELETED_LEASES6_AT0_HOSTNAME +DELETED_LEASES6_AT0_HWADDR +DELETED_LEASES6_AT0_HWADDR_TYPE +DELETED_LEASES6_AT0_STATE +DELETED_LEASES6_AT0_SUBNET_ID +DELETED_LEASES6_AT0_VALID_LIFETIME +DELETED_LEASES6_AT0_DUID +DELETED_LEASES6_AT0_IAID +DELETED_LEASES6_AT0_PREFERRED_LIFETIME +DELETED_LEASES6_AT0_PREFIX_LEN +DELETED_LEASES6_AT0_TYPE + +@endcode + +lease6_release + +@code + +QUERY6_TYPE +QUERY6_TXID +QUERY6_LOCAL_ADDR +QUERY6_LOCAL_PORT +QUERY6_REMOTE_ADDR +QUERY6_REMOTE_PORT +QUERY6_IFACE_INDEX +QUERY6_IFACE_NAME +QUERY6_REMOTE_HWADDR +QUERY6_REMOTE_HWADDR_TYPE +QUERY6_PROTO +QUERY6_CLIENT_ID +LEASE6_ADDRESS +LEASE6_CLTT +LEASE6_HOSTNAME +LEASE6_HWADDR +LEASE6_HWADDR_TYPE +LEASE6_STATE +LEASE6_SUBNET_ID +LEASE6_VALID_LIFETIME +LEASE6_DUID +LEASE6_IAID +LEASE6_PREFERRED_LIFETIME +LEASE6_PREFIX_LEN +LEASE6_TYPE + +@endcode + +lease6_decline + +@code + +QUERY6_TYPE +QUERY6_TXID +QUERY6_LOCAL_ADDR +QUERY6_LOCAL_PORT +QUERY6_REMOTE_ADDR +QUERY6_REMOTE_PORT +QUERY6_IFACE_INDEX +QUERY6_IFACE_NAME +QUERY6_REMOTE_HWADDR +QUERY6_REMOTE_HWADDR_TYPE +QUERY6_PROTO +QUERY6_CLIENT_ID +LEASE6_ADDRESS +LEASE6_CLTT +LEASE6_HOSTNAME +LEASE6_HWADDR +LEASE6_HWADDR_TYPE +LEASE6_STATE +LEASE6_SUBNET_ID +LEASE6_VALID_LIFETIME +LEASE6_DUID +LEASE6_IAID +LEASE6_PREFERRED_LIFETIME +LEASE6_PREFIX_LEN +LEASE6_TYPE + +@endcode + +@section libdhcp_run_scriptMTCompatibility Multi-Threading Compatibility + +The Run Script hooks library is compatible with multi-threading. + +*/ diff --git a/src/hooks/dhcp/run_script/run_script.h b/src/hooks/dhcp/run_script/run_script.h new file mode 100644 index 0000000..c66c82e --- /dev/null +++ b/src/hooks/dhcp/run_script/run_script.h @@ -0,0 +1,269 @@ +// Copyright (C) 2021 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef RUN_SCRIPT_H +#define RUN_SCRIPT_H + +#include <asiolink/process_spawn.h> +#include <dhcp/duid.h> +#include <dhcp/hwaddr.h> +#include <dhcp/option6_ia.h> +#include <dhcp/pkt4.h> +#include <dhcp/pkt6.h> +#include <dhcpsrv/lease.h> +#include <dhcpsrv/subnet.h> +#include <hooks/library_handle.h> +#include <string> + +namespace isc { +namespace run_script { + +/// @brief Run Script implementation. +class RunScriptImpl { +public: + /// @brief Constructor. + RunScriptImpl(); + + /// @brief Destructor. + ~RunScriptImpl() = default; + + /// @brief Sets IO service to be used by the @ref ProcessSpawn instance. + /// + /// @param io_service The IOService object, used for all ASIO operations. + static void setIOService(const isc::asiolink::IOServicePtr& io_service) { + io_service_ = io_service; + } + + /// @brief Gets IO service to be used by the @ref ProcessSpawn instance. + /// + /// @return The IOService object, used for all ASIO operations. + static isc::asiolink::IOServicePtr getIOService() { + return (io_service_); + } + + /// @brief Extract boolean data and append to environment. + /// + /// @param value The value to be exported to target script environment. + /// @param prefix The prefix for the name of the environment variable. + /// @param suffix The suffix for the name of the environment variable. + static void extractBoolean(isc::asiolink::ProcessEnvVars& vars, + const bool value, + const std::string& prefix = "", + const std::string& suffix = ""); + + /// @brief Extract integer data and append to environment. + /// + /// @param value The value to be exported to target script environment. + /// @param prefix The prefix for the name of the environment variable. + /// @param suffix The suffix for the name of the environment variable. + static void extractInteger(isc::asiolink::ProcessEnvVars& vars, + const uint64_t value, + const std::string& prefix = "", + const std::string& suffix = ""); + + /// @brief Extract string data and append to environment. + /// + /// @param value The value to be exported to target script environment. + /// @param prefix The prefix for the name of the environment variable. + /// @param suffix The suffix for the name of the environment variable. + static void extractString(isc::asiolink::ProcessEnvVars& vars, + const std::string& value, + const std::string& prefix = "", + const std::string& suffix = ""); + + /// @brief Extract HWAddr data and append to environment. + /// + /// @param hwaddr The hwaddr to be exported to target script environment. + /// @param prefix The prefix for the name of the environment variable. + /// @param suffix The suffix for the name of the environment variable. + static void extractHWAddr(isc::asiolink::ProcessEnvVars& vars, + const isc::dhcp::HWAddrPtr& hwaddr, + const std::string& prefix = "", + const std::string& suffix = ""); + + /// @brief Extract DUID data and append to environment. + /// + /// @param duid The duid to be exported to target script environment. + /// @param prefix The prefix for the name of the environment variable. + /// @param suffix The suffix for the name of the environment variable. + static void extractDUID(isc::asiolink::ProcessEnvVars& vars, + const isc::dhcp::DuidPtr duid, + const std::string& prefix = "", + const std::string& suffix = ""); + + /// @brief Extract Option data and append to environment. + /// + /// @param option The option to be exported to target script environment. + /// @param prefix The prefix for the name of the environment variable. + /// @param suffix The suffix for the name of the environment variable. + static void extractOption(isc::asiolink::ProcessEnvVars& vars, + const isc::dhcp::OptionPtr option, + const std::string& prefix = "", + const std::string& suffix = ""); + + /// @brief Extract Option SubOption data and append to environment. + /// + /// @param option The parent option of the suboption to be exported to + /// target script environment. + /// @param code The code of the suboption. + /// @param prefix The prefix for the name of the environment variable. + /// @param suffix The suffix for the name of the environment variable. + static void extractSubOption(isc::asiolink::ProcessEnvVars& vars, + const isc::dhcp::OptionPtr option, + uint16_t code, + const std::string& prefix = "", + const std::string& suffix = ""); + + /// @brief Extract Option6IA data and append to environment. + /// + /// @param option6IA The option6IA to be exported to target script environment. + /// @param prefix The prefix for the name of the environment variable. + /// @param suffix The suffix for the name of the environment variable. + static void extractOptionIA(isc::asiolink::ProcessEnvVars& vars, + const isc::dhcp::Option6IAPtr option6IA, + const std::string& prefix = "", + const std::string& suffix = ""); + + /// @brief Extract Subnet4 data and append to environment. + /// + /// @param subnet4 The subnet4 to be exported to target script environment. + /// @param prefix The prefix for the name of the environment variable. + /// @param suffix The suffix for the name of the environment variable. + static void extractSubnet4(isc::asiolink::ProcessEnvVars& vars, + const isc::dhcp::Subnet4Ptr subnet4, + const std::string& prefix = "", + const std::string& suffix = ""); + + /// @brief Extract Subnet6 data and append to environment. + /// + /// @param subnet6 The subnet6 to be exported to target script environment. + /// @param prefix The prefix for the name of the environment variable. + /// @param suffix The suffix for the name of the environment variable. + static void extractSubnet6(isc::asiolink::ProcessEnvVars& vars, + const isc::dhcp::Subnet6Ptr subnet6, + const std::string& prefix = "", + const std::string& suffix = ""); + + /// @brief Extract Lease4 data and append to environment. + /// + /// @param lease4 The lease4 to be exported to target script environment. + /// @param prefix The prefix for the name of the environment variable. + /// @param suffix The suffix for the name of the environment variable. + static void extractLease4(isc::asiolink::ProcessEnvVars& vars, + const isc::dhcp::Lease4Ptr& lease4, + const std::string& prefix = "", + const std::string& suffix = ""); + + /// @brief Extract Lease6 data and append to environment. + /// + /// @param lease6 The lease6 to be exported to target script environment. + /// @param prefix The prefix for the name of the environment variable. + /// @param suffix The suffix for the name of the environment variable. + static void extractLease6(isc::asiolink::ProcessEnvVars& vars, + const isc::dhcp::Lease6Ptr& lease6, + const std::string& prefix = "", + const std::string& suffix = ""); + + /// @brief Extract Lease4Collection data and append to environment. + /// + /// @param leases4 The leases4 to be exported to target script environment. + /// @param prefix The prefix for the name of the environment variable. + /// @param suffix The suffix for the name of the environment variable. + static void extractLeases4(isc::asiolink::ProcessEnvVars& vars, + const isc::dhcp::Lease4CollectionPtr& leases4, + const std::string& prefix = "", + const std::string& suffix = ""); + + /// @brief Extract Lease6Collection data and append to environment. + /// + /// @param leases6 The leases6 to be exported to target script environment. + /// @param prefix The prefix for the name of the environment variable. + /// @param suffix The suffix for the name of the environment variable. + static void extractLeases6(isc::asiolink::ProcessEnvVars& vars, + const isc::dhcp::Lease6CollectionPtr& leases6, + const std::string& prefix = "", + const std::string& suffix = ""); + + /// @brief Extract Pkt4 data and append to environment. + /// + /// @param pkt4 The pkt4 to be exported to target script environment. + /// @param prefix The prefix for the name of the environment variable. + /// @param suffix The suffix for the name of the environment variable. + static void extractPkt4(isc::asiolink::ProcessEnvVars& vars, + const isc::dhcp::Pkt4Ptr& pkt4, + const std::string& prefix = "", + const std::string& suffix = ""); + + /// @brief Extract Pkt6 data and append to environment. + /// + /// @param pkt6 The pkt6 to be exported to target script environment. + /// @param prefix The prefix for the name of the environment variable. + /// @param suffix The suffix for the name of the environment variable. + static void extractPkt6(isc::asiolink::ProcessEnvVars& vars, + const isc::dhcp::Pkt6Ptr& pkt6, + const std::string& prefix = "", + const std::string& suffix = ""); + + /// @brief Run Script with specified arguments and environment parameters. + /// + /// @param args The arguments for the target script. + /// @param vars The environment variables made available for the target + /// script. + void runScript(const isc::asiolink::ProcessArgs& args, + const isc::asiolink::ProcessEnvVars& vars); + + /// @brief Set name of the target script. + /// + /// @param name The name of the target script. + void setName(const std::string& name) { + name_ = name; + } + + /// @brief Get name of the target script. + /// + /// @return The name of the target script. + std::string getName() const { + return (name_); + } + + /// @brief Set the synchronous call mode for the target script. + /// + /// @param name The synchronous call mode for the target script. + void setSync(const bool sync) { + sync_ = sync; + } + + /// @brief Get the synchronous call mode for the target script. + /// + /// @return The synchronous call mode for the target script. + bool getSync() const { + return (sync_); + } + + /// @brief This function parses and applies configuration parameters. + void configure(isc::hooks::LibraryHandle& handle); + +private: + /// @brief Script name. + std::string name_; + + /// @brief Sync flag + /// + /// When set to true, the call to @ref runScript blocks until the script + /// exits, otherwise the call will return immediately after the script is + /// started. + bool sync_; + + /// @brief The IOService object, used for all ASIO operations. + static isc::asiolink::IOServicePtr io_service_; +}; + +/// @brief The type of shared pointers to Run Script implementations. +typedef boost::shared_ptr<RunScriptImpl> RunScriptImplPtr; + +} // namespace run_script +} // namespace isc +#endif diff --git a/src/hooks/dhcp/run_script/run_script_callouts.cc b/src/hooks/dhcp/run_script/run_script_callouts.cc new file mode 100644 index 0000000..d4f8421 --- /dev/null +++ b/src/hooks/dhcp/run_script/run_script_callouts.cc @@ -0,0 +1,431 @@ +// Copyright (C) 2021 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include <config.h> + +#include <cc/command_interpreter.h> +#include <hooks/hooks.h> +#include <run_script.h> +#include <run_script_log.h> +#include <dhcp/option6_ia.h> +#include <dhcp/pkt4.h> +#include <dhcp/pkt6.h> +#include <dhcpsrv/lease.h> +#include <dhcpsrv/subnet.h> + +namespace isc { +namespace run_script { + +RunScriptImplPtr impl; + +} // namespace run_script +} // namespace isc + +using namespace isc; +using namespace isc::asiolink; +using namespace isc::data; +using namespace isc::dhcp; +using namespace isc::hooks; +using namespace isc::run_script; +using namespace isc::util; + +// Functions accessed by the hooks framework use C linkage to avoid the name +// mangling that accompanies use of the C++ compiler as well as to avoid +// issues related to namespaces. +extern "C" { + +/// @brief This function is called when the library is loaded. +/// +/// @param handle library handle +/// @return 0 when initialization is successful, 1 otherwise +int load(LibraryHandle& handle) { + try { + impl.reset(new RunScriptImpl()); + impl->configure(handle); + } catch (const std::exception& ex) { + LOG_ERROR(run_script_logger, RUN_SCRIPT_LOAD_ERROR) + .arg(ex.what()); + return (1); + } + + LOG_INFO(run_script_logger, RUN_SCRIPT_LOAD); + return (0); +} + +/// @brief This function is called when the library is unloaded. +/// +/// @return always 0. +int unload() { + impl.reset(); + RunScriptImpl::setIOService(IOServicePtr()); + LOG_INFO(run_script_logger, RUN_SCRIPT_UNLOAD); + return (0); +} + +/// @brief dhcp4_srv_configured callout implementation. +/// +/// @param handle callout handle. +int dhcp4_srv_configured(CalloutHandle& handle) { + try { + isc::asiolink::IOServicePtr io_service; + handle.getArgument("io_context", io_service); + RunScriptImpl::setIOService(io_service); + + } catch (const std::exception& ex) { + LOG_ERROR(run_script_logger, RUN_SCRIPT_LOAD_ERROR) + .arg(ex.what()); + return (1); + } + return (0); +} + +/// @brief dhcp6_srv_configured callout implementation. +/// +/// @param handle callout handle. +int dhcp6_srv_configured(CalloutHandle& handle) { + try { + isc::asiolink::IOServicePtr io_service; + handle.getArgument("io_context", io_service); + RunScriptImpl::setIOService(io_service); + + } catch (const std::exception& ex) { + LOG_ERROR(run_script_logger, RUN_SCRIPT_LOAD_ERROR) + .arg(ex.what()); + return (1); + } + return (0); +} + +/// @brief handle @ref lease4_renew hook and set environment parameters for the +/// script. +/// IN: query4 subnet4 clientid hwaddr lease4 +/// OUT: next_step +int lease4_renew(CalloutHandle& handle) { + CalloutHandle::CalloutNextStep status = handle.getStatus(); + if (status == CalloutHandle::NEXT_STEP_DROP || + status == CalloutHandle::NEXT_STEP_SKIP) { + return (0); + } + ProcessEnvVars vars; + Pkt4Ptr pkt4; + handle.getArgument("query4", pkt4); + RunScriptImpl::extractPkt4(vars, pkt4, "QUERY4"); + Subnet4Ptr subnet4; + handle.getArgument("subnet4", subnet4); + RunScriptImpl::extractSubnet4(vars, subnet4, "SUBNET4"); + ClientIdPtr clientid; + handle.getArgument("clientid", clientid); + RunScriptImpl::extractDUID(vars, clientid, "PKT4_CLIENT_ID"); + HWAddrPtr hwaddr; + handle.getArgument("hwaddr", hwaddr); + RunScriptImpl::extractHWAddr(vars, hwaddr, "PKT4_HWADDR"); + Lease4Ptr lease4; + handle.getArgument("lease4", lease4); + RunScriptImpl::extractLease4(vars, lease4, "LEASE4"); + ProcessArgs args; + args.push_back("lease4_renew"); + impl->runScript(args, vars); + return (0); +} + +/// @brief handle @ref lease4_expire hook and set environment parameters for the +/// script. +/// IN: lease4 remove_lease +/// OUT: next_step +int lease4_expire(CalloutHandle& handle) { + CalloutHandle::CalloutNextStep status = handle.getStatus(); + if (status == CalloutHandle::NEXT_STEP_DROP || + status == CalloutHandle::NEXT_STEP_SKIP) { + return (0); + } + ProcessEnvVars vars; + Lease4Ptr lease4; + handle.getArgument("lease4", lease4); + RunScriptImpl::extractLease4(vars, lease4, "LEASE4"); + bool remove_lease; + handle.getArgument("remove_lease", remove_lease); + RunScriptImpl::extractBoolean(vars, remove_lease, "REMOVE_LEASE"); + ProcessArgs args; + args.push_back("lease4_expire"); + impl->runScript(args, vars); + return (0); +} + +/// @brief handle @ref lease4_recover hook and set environment parameters for +/// the script. +/// IN: lease4 +/// OUT: next_step +int lease4_recover(CalloutHandle& handle) { + CalloutHandle::CalloutNextStep status = handle.getStatus(); + if (status == CalloutHandle::NEXT_STEP_DROP || + status == CalloutHandle::NEXT_STEP_SKIP) { + return (0); + } + ProcessEnvVars vars; + Lease4Ptr lease4; + handle.getArgument("lease4", lease4); + RunScriptImpl::extractLease4(vars, lease4, "LEASE4"); + ProcessArgs args; + args.push_back("lease4_recover"); + impl->runScript(args, vars); + return (0); +} + +/// @brief handle @ref leases4_committed hook and set environment parameters for +/// the script. +/// IN: query4 leases4 deleted_leases4 +/// OUT: next_step +int leases4_committed(CalloutHandle& handle) { + CalloutHandle::CalloutNextStep status = handle.getStatus(); + if (status == CalloutHandle::NEXT_STEP_DROP || + status == CalloutHandle::NEXT_STEP_SKIP) { + return (0); + } + ProcessEnvVars vars; + Pkt4Ptr pkt4; + handle.getArgument("query4", pkt4); + RunScriptImpl::extractPkt4(vars, pkt4, "QUERY4"); + Lease4CollectionPtr leases4; + handle.getArgument("leases4", leases4); + RunScriptImpl::extractLeases4(vars, leases4, "LEASES4"); + Lease4CollectionPtr deleted_leases4; + handle.getArgument("deleted_leases4", deleted_leases4); + RunScriptImpl::extractLeases4(vars, deleted_leases4, "DELETED_LEASES4"); + ProcessArgs args; + args.push_back("leases4_committed"); + impl->runScript(args, vars); + return (0); +} + +/// @brief handle @ref lease4_release hook and set environment parameters for +/// the script. +/// IN: query4 lease4 +/// OUT: next_step +int lease4_release(CalloutHandle& handle) { + CalloutHandle::CalloutNextStep status = handle.getStatus(); + if (status == CalloutHandle::NEXT_STEP_DROP || + status == CalloutHandle::NEXT_STEP_SKIP) { + return (0); + } + ProcessEnvVars vars; + Pkt4Ptr pkt4; + handle.getArgument("query4", pkt4); + RunScriptImpl::extractPkt4(vars, pkt4, "QUERY4"); + Lease4Ptr lease4; + handle.getArgument("lease4", lease4); + RunScriptImpl::extractLease4(vars, lease4, "LEASE4"); + ProcessArgs args; + args.push_back("lease4_release"); + impl->runScript(args, vars); + return (0); +} + +/// @brief handle @ref lease4_decline hook and set environment parameters for +/// the script. +/// IN: query4 lease4 +/// OUT: next_step +int lease4_decline(CalloutHandle& handle) { + CalloutHandle::CalloutNextStep status = handle.getStatus(); + if (status == CalloutHandle::NEXT_STEP_DROP || + status == CalloutHandle::NEXT_STEP_SKIP) { + return (0); + } + ProcessEnvVars vars; + Pkt4Ptr pkt4; + handle.getArgument("query4", pkt4); + RunScriptImpl::extractPkt4(vars, pkt4, "QUERY4"); + Lease4Ptr lease4; + handle.getArgument("lease4", lease4); + RunScriptImpl::extractLease4(vars, lease4, "LEASE4"); + ProcessArgs args; + args.push_back("lease4_decline"); + impl->runScript(args, vars); + return (0); +} + +/// @brief handle @ref lease6_renew hook and set environment parameters for the +/// script. +/// IN: query6 lease6 ia_na/ia_pd +/// OUT: next_step +int lease6_renew(CalloutHandle& handle) { + CalloutHandle::CalloutNextStep status = handle.getStatus(); + if (status == CalloutHandle::NEXT_STEP_DROP || + status == CalloutHandle::NEXT_STEP_SKIP) { + return (0); + } + ProcessEnvVars vars; + Pkt6Ptr pkt6; + handle.getArgument("query6", pkt6); + RunScriptImpl::extractPkt6(vars, pkt6, "QUERY6"); + Lease6Ptr lease6; + handle.getArgument("lease6", lease6); + RunScriptImpl::extractLease6(vars, lease6, "LEASE6"); + Option6IAPtr option6IA; + if (lease6->type_ == Lease::TYPE_NA) { + handle.getArgument("ia_na", option6IA); + } else { + handle.getArgument("ia_pd", option6IA); + } + RunScriptImpl::extractOptionIA(vars, option6IA, "PKT6_IA"); + ProcessArgs args; + args.push_back("lease6_renew"); + impl->runScript(args, vars); + return (0); +} + +/// @brief handle @ref lease6_rebind hook and set environment parameters for the +/// script. +/// IN: query6 lease6 ia_na/ia_pd +/// OUT: next_step +int lease6_rebind(CalloutHandle& handle) { + CalloutHandle::CalloutNextStep status = handle.getStatus(); + if (status == CalloutHandle::NEXT_STEP_DROP || + status == CalloutHandle::NEXT_STEP_SKIP) { + return (0); + } + ProcessEnvVars vars; + Pkt6Ptr pkt6; + handle.getArgument("query6", pkt6); + RunScriptImpl::extractPkt6(vars, pkt6, "QUERY6"); + Lease6Ptr lease6; + handle.getArgument("lease6", lease6); + RunScriptImpl::extractLease6(vars, lease6, "LEASE6"); + Option6IAPtr option6IA; + if (lease6->type_ == Lease::TYPE_NA) { + handle.getArgument("ia_na", option6IA); + } else { + handle.getArgument("ia_pd", option6IA); + } + RunScriptImpl::extractOptionIA(vars, option6IA, "PKT6_IA"); + ProcessArgs args; + args.push_back("lease6_rebind"); + impl->runScript(args, vars); + return (0); +} + +/// @brief handle @ref lease6_expire hook and set environment parameters for the +/// script. +/// IN: lease6 remove_lease +/// OUT: next_step +int lease6_expire(CalloutHandle& handle) { + CalloutHandle::CalloutNextStep status = handle.getStatus(); + if (status == CalloutHandle::NEXT_STEP_DROP || + status == CalloutHandle::NEXT_STEP_SKIP) { + return (0); + } + ProcessEnvVars vars; + Lease6Ptr lease6; + handle.getArgument("lease6", lease6); + RunScriptImpl::extractLease6(vars, lease6, "LEASE6"); + bool remove_lease; + handle.getArgument("remove_lease", remove_lease); + RunScriptImpl::extractBoolean(vars, remove_lease, "REMOVE_LEASE"); + ProcessArgs args; + args.push_back("lease6_expire"); + impl->runScript(args, vars); + return (0); +} + +/// @brief handle @ref lease6_recover hook and set environment parameters for +/// the script. +/// IN: lease6 +/// OUT: next_step +int lease6_recover(CalloutHandle& handle) { + CalloutHandle::CalloutNextStep status = handle.getStatus(); + if (status == CalloutHandle::NEXT_STEP_DROP || + status == CalloutHandle::NEXT_STEP_SKIP) { + return (0); + } + ProcessEnvVars vars; + Lease6Ptr lease6; + handle.getArgument("lease6", lease6); + RunScriptImpl::extractLease6(vars, lease6, "LEASE6"); + ProcessArgs args; + args.push_back("lease6_recover"); + impl->runScript(args, vars); + return (0); +} + +/// @brief handle @ref leases6_committed hook and set environment parameters for +/// the script. +/// IN: query6 leases6 deleted_leases6 +/// OUT: next_step +int leases6_committed(CalloutHandle& handle) { + CalloutHandle::CalloutNextStep status = handle.getStatus(); + if (status == CalloutHandle::NEXT_STEP_DROP || + status == CalloutHandle::NEXT_STEP_SKIP) { + return (0); + } + ProcessEnvVars vars; + Pkt6Ptr pkt6; + handle.getArgument("query6", pkt6); + RunScriptImpl::extractPkt6(vars, pkt6, "QUERY6"); + Lease6CollectionPtr leases6; + handle.getArgument("leases6", leases6); + RunScriptImpl::extractLeases6(vars, leases6, "LEASES6"); + Lease6CollectionPtr deleted_leases6; + handle.getArgument("deleted_leases6", deleted_leases6); + RunScriptImpl::extractLeases6(vars, deleted_leases6, "DELETED_LEASES6"); + ProcessArgs args; + args.push_back("leases6_committed"); + impl->runScript(args, vars); + return (0); +} + +/// @brief handle @ref lease6_release hook and set environment parameters for +/// the script. +/// IN: query6 lease6 +/// OUT: next_step +int lease6_release(CalloutHandle& handle) { + CalloutHandle::CalloutNextStep status = handle.getStatus(); + if (status == CalloutHandle::NEXT_STEP_DROP || + status == CalloutHandle::NEXT_STEP_SKIP) { + return (0); + } + ProcessEnvVars vars; + Pkt6Ptr pkt6; + handle.getArgument("query6", pkt6); + RunScriptImpl::extractPkt6(vars, pkt6, "QUERY6"); + Lease6Ptr lease6; + handle.getArgument("lease6", lease6); + RunScriptImpl::extractLease6(vars, lease6, "LEASE6"); + ProcessArgs args; + args.push_back("lease6_release"); + impl->runScript(args, vars); + return (0); +} + +/// @brief handle @ref lease6_decline hook and set environment parameters for +/// the script. +/// IN: query6 lease6 +/// OUT: next_step +int lease6_decline(CalloutHandle& handle) { + CalloutHandle::CalloutNextStep status = handle.getStatus(); + if (status == CalloutHandle::NEXT_STEP_DROP || + status == CalloutHandle::NEXT_STEP_SKIP) { + return (0); + } + ProcessEnvVars vars; + Pkt6Ptr pkt6; + handle.getArgument("query6", pkt6); + RunScriptImpl::extractPkt6(vars, pkt6, "QUERY6"); + Lease6Ptr lease6; + handle.getArgument("lease6", lease6); + RunScriptImpl::extractLease6(vars, lease6, "LEASE6"); + ProcessArgs args; + args.push_back("lease6_decline"); + impl->runScript(args, vars); + return (0); +} + +/// @brief This function is called to retrieve the multi-threading compatibility. +/// +/// @return 1 which means compatible with multi-threading. +int multi_threading_compatible() { + return (1); +} + +} // end extern "C" diff --git a/src/hooks/dhcp/run_script/run_script_log.cc b/src/hooks/dhcp/run_script/run_script_log.cc new file mode 100644 index 0000000..02142e5 --- /dev/null +++ b/src/hooks/dhcp/run_script/run_script_log.cc @@ -0,0 +1,17 @@ +// Copyright (C) 2021 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include <config.h> + +#include <run_script_log.h> + +namespace isc { +namespace run_script { + +isc::log::Logger run_script_logger("run-script-hooks"); + +} // namespace run_script +} // namespace isc diff --git a/src/hooks/dhcp/run_script/run_script_log.h b/src/hooks/dhcp/run_script/run_script_log.h new file mode 100644 index 0000000..65c693a --- /dev/null +++ b/src/hooks/dhcp/run_script/run_script_log.h @@ -0,0 +1,22 @@ +// Copyright (C) 2021 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef RUN_SCRIPT_LOG_H +#define RUN_SCRIPT_LOG_H + +#include <log/logger_support.h> +#include <log/macros.h> +#include <log/log_dbglevels.h> +#include <run_script_messages.h> + +namespace isc { +namespace run_script { + +extern isc::log::Logger run_script_logger; + +} // namespace run_script +} // namespace isc +#endif diff --git a/src/hooks/dhcp/run_script/run_script_messages.cc b/src/hooks/dhcp/run_script/run_script_messages.cc new file mode 100644 index 0000000..ca99342 --- /dev/null +++ b/src/hooks/dhcp/run_script/run_script_messages.cc @@ -0,0 +1,23 @@ +// File created from ../../../../src/hooks/dhcp/run_script/run_script_messages.mes + +#include <cstddef> +#include <log/message_types.h> +#include <log/message_initializer.h> + +extern const isc::log::MessageID RUN_SCRIPT_LOAD = "RUN_SCRIPT_LOAD"; +extern const isc::log::MessageID RUN_SCRIPT_LOAD_ERROR = "RUN_SCRIPT_LOAD_ERROR"; +extern const isc::log::MessageID RUN_SCRIPT_UNLOAD = "RUN_SCRIPT_UNLOAD"; + +namespace { + +const char* values[] = { + "RUN_SCRIPT_LOAD", "Run Script hooks library has been loaded", + "RUN_SCRIPT_LOAD_ERROR", "Run Script hooks library failed: %1", + "RUN_SCRIPT_UNLOAD", "Run Script hooks library has been unloaded", + NULL +}; + +const isc::log::MessageInitializer initializer(values); + +} // Anonymous namespace + diff --git a/src/hooks/dhcp/run_script/run_script_messages.h b/src/hooks/dhcp/run_script/run_script_messages.h new file mode 100644 index 0000000..a70c8ca --- /dev/null +++ b/src/hooks/dhcp/run_script/run_script_messages.h @@ -0,0 +1,12 @@ +// File created from ../../../../src/hooks/dhcp/run_script/run_script_messages.mes + +#ifndef RUN_SCRIPT_MESSAGES_H +#define RUN_SCRIPT_MESSAGES_H + +#include <log/message_types.h> + +extern const isc::log::MessageID RUN_SCRIPT_LOAD; +extern const isc::log::MessageID RUN_SCRIPT_LOAD_ERROR; +extern const isc::log::MessageID RUN_SCRIPT_UNLOAD; + +#endif // RUN_SCRIPT_MESSAGES_H diff --git a/src/hooks/dhcp/run_script/run_script_messages.mes b/src/hooks/dhcp/run_script/run_script_messages.mes new file mode 100644 index 0000000..348b4ae --- /dev/null +++ b/src/hooks/dhcp/run_script/run_script_messages.mes @@ -0,0 +1,11 @@ +# Copyright (C) 2021 Internet Systems Consortium, Inc. ("ISC") + +% RUN_SCRIPT_LOAD Run Script hooks library has been loaded +This info message indicates that the Run Script hooks library has been loaded. + +% RUN_SCRIPT_LOAD_ERROR Run Script hooks library failed: %1 +This error message indicates an error during loading the Run Script hooks +library. The details of the error are provided as argument of the log message. + +% RUN_SCRIPT_UNLOAD Run Script hooks library has been unloaded +This info message indicates that the RunScript hooks library has been unloaded. diff --git a/src/hooks/dhcp/run_script/tests/Makefile.am b/src/hooks/dhcp/run_script/tests/Makefile.am new file mode 100644 index 0000000..acff08d --- /dev/null +++ b/src/hooks/dhcp/run_script/tests/Makefile.am @@ -0,0 +1,68 @@ +SUBDIRS = . + +SHTESTS = run_script_test.sh + +noinst_SCRIPTS = run_script_test.sh + +AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib +AM_CPPFLAGS += -I$(top_builddir)/src/hooks/dhcp/run_script -I$(top_srcdir)/src/hooks/dhcp/run_script +AM_CPPFLAGS += $(BOOST_INCLUDES) +AM_CPPFLAGS += -DRUN_SCRIPT_LIB_SO=\"$(abs_top_builddir)/src/hooks/dhcp/run_script/.libs/libdhcp_run_script.so\" +AM_CPPFLAGS += -DTEST_LOG_FILE=\"$(abs_top_builddir)/src/hooks/dhcp/run_script/tests/test.log\" +AM_CPPFLAGS += -DRUN_SCRIPT_TEST_SH=\"$(abs_top_builddir)/src/hooks/dhcp/run_script/tests/run_script_test.sh\" +AM_CPPFLAGS += -DINSTALL_PROG=\"$(abs_top_srcdir)/install-sh\" + +AM_CXXFLAGS = $(KEA_CXXFLAGS) + +if USE_STATIC_LINK +AM_LDFLAGS = -static +endif + +# Unit test data files need to get installed. +EXTRA_DIST = run_script_test.sh.in + +CLEANFILES = *.gcno *.gcda + +DISTCLEANFILES = run_script_test.sh + +# TESTS_ENVIRONMENT = $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND) +LOG_COMPILER = $(LIBTOOL) +AM_LOG_FLAGS = --mode=execute + +TESTS = +if HAVE_GTEST +TESTS += run_script_unittests + +run_script_unittests_SOURCES = run_unittests.cc +run_script_unittests_SOURCES += run_script_unittests.cc + +run_script_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES) $(LOG4CPLUS_INCLUDES) + +run_script_unittests_LDFLAGS = $(AM_LDFLAGS) $(CRYPTO_LDFLAGS) $(GTEST_LDFLAGS) + +run_script_unittests_CXXFLAGS = $(AM_CXXFLAGS) + +run_script_unittests_LDADD = $(top_builddir)/src/hooks/dhcp/run_script/librun_script.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/process/libkea-process.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/eval/libkea-eval.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/dhcp_ddns/libkea-dhcp_ddns.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/config/libkea-cfgclient.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/http/libkea-http.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/database/libkea-database.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/dns/libkea-dns++.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/log/libkea-log.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la +run_script_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la +run_script_unittests_LDADD += $(LOG4CPLUS_LIBS) +run_script_unittests_LDADD += $(CRYPTO_LIBS) +run_script_unittests_LDADD += $(BOOST_LIBS) +run_script_unittests_LDADD += $(GTEST_LDADD) +endif +noinst_PROGRAMS = $(TESTS) diff --git a/src/hooks/dhcp/run_script/tests/Makefile.in b/src/hooks/dhcp/run_script/tests/Makefile.in new file mode 100644 index 0000000..c0683ba --- /dev/null +++ b/src/hooks/dhcp/run_script/tests/Makefile.in @@ -0,0 +1,1026 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +TESTS = $(am__EXEEXT_1) +@HAVE_GTEST_TRUE@am__append_1 = run_script_unittests +noinst_PROGRAMS = $(am__EXEEXT_2) +subdir = src/hooks/dhcp/run_script/tests +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4macros/ax_boost_for_kea.m4 \ + $(top_srcdir)/m4macros/ax_cpp11.m4 \ + $(top_srcdir)/m4macros/ax_crypto.m4 \ + $(top_srcdir)/m4macros/ax_find_library.m4 \ + $(top_srcdir)/m4macros/ax_gssapi.m4 \ + $(top_srcdir)/m4macros/ax_gtest.m4 \ + $(top_srcdir)/m4macros/ax_isc_rpath.m4 \ + $(top_srcdir)/m4macros/ax_sysrepo.m4 \ + $(top_srcdir)/m4macros/libtool.m4 \ + $(top_srcdir)/m4macros/ltoptions.m4 \ + $(top_srcdir)/m4macros/ltsugar.m4 \ + $(top_srcdir)/m4macros/ltversion.m4 \ + $(top_srcdir)/m4macros/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = run_script_test.sh +CONFIG_CLEAN_VPATH_FILES = +@HAVE_GTEST_TRUE@am__EXEEXT_1 = run_script_unittests$(EXEEXT) +am__EXEEXT_2 = $(am__EXEEXT_1) +PROGRAMS = $(noinst_PROGRAMS) +am__run_script_unittests_SOURCES_DIST = run_unittests.cc \ + run_script_unittests.cc +@HAVE_GTEST_TRUE@am_run_script_unittests_OBJECTS = \ +@HAVE_GTEST_TRUE@ run_script_unittests-run_unittests.$(OBJEXT) \ +@HAVE_GTEST_TRUE@ run_script_unittests-run_script_unittests.$(OBJEXT) +run_script_unittests_OBJECTS = $(am_run_script_unittests_OBJECTS) +am__DEPENDENCIES_1 = +@HAVE_GTEST_TRUE@run_script_unittests_DEPENDENCIES = $(top_builddir)/src/hooks/dhcp/run_script/librun_script.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/process/libkea-process.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/eval/libkea-eval.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/dhcp_ddns/libkea-dhcp_ddns.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/stats/libkea-stats.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/config/libkea-cfgclient.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/http/libkea-http.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/hooks/libkea-hooks.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/database/libkea-database.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/cc/libkea-cc.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/asiolink/libkea-asiolink.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/dns/libkea-dns++.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/log/libkea-log.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/util/libkea-util.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/exceptions/libkea-exceptions.la \ +@HAVE_GTEST_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ +@HAVE_GTEST_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +run_script_unittests_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(run_script_unittests_CXXFLAGS) $(CXXFLAGS) \ + $(run_script_unittests_LDFLAGS) $(LDFLAGS) -o $@ +SCRIPTS = $(noinst_SCRIPTS) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = \ + ./$(DEPDIR)/run_script_unittests-run_script_unittests.Po \ + ./$(DEPDIR)/run_script_unittests-run_unittests.Po +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +SOURCES = $(run_script_unittests_SOURCES) +DIST_SOURCES = $(am__run_script_unittests_SOURCES_DIST) +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir distdir-am +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__tty_colors_dummy = \ + mgn= red= grn= lgn= blu= brg= std=; \ + am__color_tests=no +am__tty_colors = { \ + $(am__tty_colors_dummy); \ + if test "X$(AM_COLOR_TESTS)" = Xno; then \ + am__color_tests=no; \ + elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ + am__color_tests=yes; \ + elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ + am__color_tests=yes; \ + fi; \ + if test $$am__color_tests = yes; then \ + red='[0;31m'; \ + grn='[0;32m'; \ + lgn='[1;32m'; \ + blu='[1;34m'; \ + mgn='[0;35m'; \ + brg='[1m'; \ + std='[m'; \ + fi; \ +} +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in \ + $(srcdir)/run_script_test.sh.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +ASCIIDOC = @ASCIIDOC@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BOOST_INCLUDES = @BOOST_INCLUDES@ +BOOST_LIBS = @BOOST_LIBS@ +BOTAN_TOOL = @BOTAN_TOOL@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONTRIB_DIR = @CONTRIB_DIR@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CRYPTO_CFLAGS = @CRYPTO_CFLAGS@ +CRYPTO_INCLUDES = @CRYPTO_INCLUDES@ +CRYPTO_LDFLAGS = @CRYPTO_LDFLAGS@ +CRYPTO_LIBS = @CRYPTO_LIBS@ +CRYPTO_PACKAGE = @CRYPTO_PACKAGE@ +CRYPTO_RPATH = @CRYPTO_RPATH@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DISTCHECK_BOOST_CONFIGURE_FLAG = @DISTCHECK_BOOST_CONFIGURE_FLAG@ +DISTCHECK_CONTRIB_CONFIGURE_FLAG = @DISTCHECK_CONTRIB_CONFIGURE_FLAG@ +DISTCHECK_CRYPTO_CONFIGURE_FLAG = @DISTCHECK_CRYPTO_CONFIGURE_FLAG@ +DISTCHECK_GTEST_CONFIGURE_FLAG = @DISTCHECK_GTEST_CONFIGURE_FLAG@ +DISTCHECK_KEA_SHELL_CONFIGURE_FLAG = @DISTCHECK_KEA_SHELL_CONFIGURE_FLAG@ +DISTCHECK_LOG4CPLUS_CONFIGURE_FLAG = @DISTCHECK_LOG4CPLUS_CONFIGURE_FLAG@ +DISTCHECK_PERFDHCP_CONFIGURE_FLAG = @DISTCHECK_PERFDHCP_CONFIGURE_FLAG@ +DISTCHECK_PREMIUM_CONFIGURE_FLAG = @DISTCHECK_PREMIUM_CONFIGURE_FLAG@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GENHTML = @GENHTML@ +GREP = @GREP@ +GSSAPI_CFLAGS = @GSSAPI_CFLAGS@ +GSSAPI_LIBS = @GSSAPI_LIBS@ +GTEST_CONFIG = @GTEST_CONFIG@ +GTEST_INCLUDES = @GTEST_INCLUDES@ +GTEST_LDADD = @GTEST_LDADD@ +GTEST_LDFLAGS = @GTEST_LDFLAGS@ +GTEST_SOURCE = @GTEST_SOURCE@ +HAVE_SYSREPO = @HAVE_SYSREPO@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KEA_CXXFLAGS = @KEA_CXXFLAGS@ +KEA_SRCID = @KEA_SRCID@ +KRB5_CONFIG = @KRB5_CONFIG@ +LCOV = @LCOV@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOG4CPLUS_INCLUDES = @LOG4CPLUS_INCLUDES@ +LOG4CPLUS_LIBS = @LOG4CPLUS_LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MYSQL_CPPFLAGS = @MYSQL_CPPFLAGS@ +MYSQL_LIBS = @MYSQL_LIBS@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +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@ +PACKAGE_VERSION_TYPE = @PACKAGE_VERSION_TYPE@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PDFLATEX = @PDFLATEX@ +PERL = @PERL@ +PGSQL_CPPFLAGS = @PGSQL_CPPFLAGS@ +PGSQL_LIBS = @PGSQL_LIBS@ +PKGPYTHONDIR = @PKGPYTHONDIR@ +PKG_CONFIG = @PKG_CONFIG@ +PLANTUML = @PLANTUML@ +PREMIUM_DIR = @PREMIUM_DIR@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SEP = @SEP@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SPHINXBUILD = @SPHINXBUILD@ +SRPD_PLUGINS_PATH = @SRPD_PLUGINS_PATH@ +SR_REPO_PATH = @SR_REPO_PATH@ +STRIP = @STRIP@ +SYSREPOCPP_VERSION = @SYSREPOCPP_VERSION@ +SYSREPO_CPPFLAGS = @SYSREPO_CPPFLAGS@ +SYSREPO_INCLUDEDIR = @SYSREPO_INCLUDEDIR@ +SYSREPO_LIBS = @SYSREPO_LIBS@ +SYSREPO_VERSION = @SYSREPO_VERSION@ +USE_LCOV = @USE_LCOV@ +VALGRIND = @VALGRIND@ +VERSION = @VERSION@ +WARNING_GCC_44_STRICT_ALIASING_CFLAG = @WARNING_GCC_44_STRICT_ALIASING_CFLAG@ +YACC = @YACC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +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 = . +SHTESTS = run_script_test.sh +noinst_SCRIPTS = run_script_test.sh +AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib \ + -I$(top_builddir)/src/hooks/dhcp/run_script \ + -I$(top_srcdir)/src/hooks/dhcp/run_script $(BOOST_INCLUDES) \ + -DRUN_SCRIPT_LIB_SO=\"$(abs_top_builddir)/src/hooks/dhcp/run_script/.libs/libdhcp_run_script.so\" \ + -DTEST_LOG_FILE=\"$(abs_top_builddir)/src/hooks/dhcp/run_script/tests/test.log\" \ + -DRUN_SCRIPT_TEST_SH=\"$(abs_top_builddir)/src/hooks/dhcp/run_script/tests/run_script_test.sh\" \ + -DINSTALL_PROG=\"$(abs_top_srcdir)/install-sh\" +AM_CXXFLAGS = $(KEA_CXXFLAGS) +@USE_STATIC_LINK_TRUE@AM_LDFLAGS = -static + +# Unit test data files need to get installed. +EXTRA_DIST = run_script_test.sh.in +CLEANFILES = *.gcno *.gcda +DISTCLEANFILES = run_script_test.sh + +# TESTS_ENVIRONMENT = $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND) +LOG_COMPILER = $(LIBTOOL) +AM_LOG_FLAGS = --mode=execute +@HAVE_GTEST_TRUE@run_script_unittests_SOURCES = run_unittests.cc \ +@HAVE_GTEST_TRUE@ run_script_unittests.cc +@HAVE_GTEST_TRUE@run_script_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES) $(LOG4CPLUS_INCLUDES) +@HAVE_GTEST_TRUE@run_script_unittests_LDFLAGS = $(AM_LDFLAGS) $(CRYPTO_LDFLAGS) $(GTEST_LDFLAGS) +@HAVE_GTEST_TRUE@run_script_unittests_CXXFLAGS = $(AM_CXXFLAGS) +@HAVE_GTEST_TRUE@run_script_unittests_LDADD = $(top_builddir)/src/hooks/dhcp/run_script/librun_script.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/process/libkea-process.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/eval/libkea-eval.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/dhcp_ddns/libkea-dhcp_ddns.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/stats/libkea-stats.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/config/libkea-cfgclient.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/http/libkea-http.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/hooks/libkea-hooks.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/database/libkea-database.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/cc/libkea-cc.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/asiolink/libkea-asiolink.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/dns/libkea-dns++.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/log/libkea-log.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/util/libkea-util.la \ +@HAVE_GTEST_TRUE@ $(top_builddir)/src/lib/exceptions/libkea-exceptions.la \ +@HAVE_GTEST_TRUE@ $(LOG4CPLUS_LIBS) $(CRYPTO_LIBS) \ +@HAVE_GTEST_TRUE@ $(BOOST_LIBS) $(GTEST_LDADD) +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .cc .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/hooks/dhcp/run_script/tests/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/hooks/dhcp/run_script/tests/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__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +run_script_test.sh: $(top_builddir)/config.status $(srcdir)/run_script_test.sh.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +run_script_unittests$(EXEEXT): $(run_script_unittests_OBJECTS) $(run_script_unittests_DEPENDENCIES) $(EXTRA_run_script_unittests_DEPENDENCIES) + @rm -f run_script_unittests$(EXEEXT) + $(AM_V_CXXLD)$(run_script_unittests_LINK) $(run_script_unittests_OBJECTS) $(run_script_unittests_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run_script_unittests-run_script_unittests.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run_script_unittests-run_unittests.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.cc.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cc.lo: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< + +run_script_unittests-run_unittests.o: run_unittests.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_script_unittests_CPPFLAGS) $(CPPFLAGS) $(run_script_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_script_unittests-run_unittests.o -MD -MP -MF $(DEPDIR)/run_script_unittests-run_unittests.Tpo -c -o run_script_unittests-run_unittests.o `test -f 'run_unittests.cc' || echo '$(srcdir)/'`run_unittests.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_script_unittests-run_unittests.Tpo $(DEPDIR)/run_script_unittests-run_unittests.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='run_unittests.cc' object='run_script_unittests-run_unittests.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_script_unittests_CPPFLAGS) $(CPPFLAGS) $(run_script_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_script_unittests-run_unittests.o `test -f 'run_unittests.cc' || echo '$(srcdir)/'`run_unittests.cc + +run_script_unittests-run_unittests.obj: run_unittests.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_script_unittests_CPPFLAGS) $(CPPFLAGS) $(run_script_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_script_unittests-run_unittests.obj -MD -MP -MF $(DEPDIR)/run_script_unittests-run_unittests.Tpo -c -o run_script_unittests-run_unittests.obj `if test -f 'run_unittests.cc'; then $(CYGPATH_W) 'run_unittests.cc'; else $(CYGPATH_W) '$(srcdir)/run_unittests.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_script_unittests-run_unittests.Tpo $(DEPDIR)/run_script_unittests-run_unittests.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='run_unittests.cc' object='run_script_unittests-run_unittests.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_script_unittests_CPPFLAGS) $(CPPFLAGS) $(run_script_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_script_unittests-run_unittests.obj `if test -f 'run_unittests.cc'; then $(CYGPATH_W) 'run_unittests.cc'; else $(CYGPATH_W) '$(srcdir)/run_unittests.cc'; fi` + +run_script_unittests-run_script_unittests.o: run_script_unittests.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_script_unittests_CPPFLAGS) $(CPPFLAGS) $(run_script_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_script_unittests-run_script_unittests.o -MD -MP -MF $(DEPDIR)/run_script_unittests-run_script_unittests.Tpo -c -o run_script_unittests-run_script_unittests.o `test -f 'run_script_unittests.cc' || echo '$(srcdir)/'`run_script_unittests.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_script_unittests-run_script_unittests.Tpo $(DEPDIR)/run_script_unittests-run_script_unittests.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='run_script_unittests.cc' object='run_script_unittests-run_script_unittests.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_script_unittests_CPPFLAGS) $(CPPFLAGS) $(run_script_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_script_unittests-run_script_unittests.o `test -f 'run_script_unittests.cc' || echo '$(srcdir)/'`run_script_unittests.cc + +run_script_unittests-run_script_unittests.obj: run_script_unittests.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_script_unittests_CPPFLAGS) $(CPPFLAGS) $(run_script_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_script_unittests-run_script_unittests.obj -MD -MP -MF $(DEPDIR)/run_script_unittests-run_script_unittests.Tpo -c -o run_script_unittests-run_script_unittests.obj `if test -f 'run_script_unittests.cc'; then $(CYGPATH_W) 'run_script_unittests.cc'; else $(CYGPATH_W) '$(srcdir)/run_script_unittests.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_script_unittests-run_script_unittests.Tpo $(DEPDIR)/run_script_unittests-run_script_unittests.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='run_script_unittests.cc' object='run_script_unittests-run_script_unittests.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_script_unittests_CPPFLAGS) $(CPPFLAGS) $(run_script_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_script_unittests-run_script_unittests.obj `if test -f 'run_script_unittests.cc'; then $(CYGPATH_W) 'run_script_unittests.cc'; else $(CYGPATH_W) '$(srcdir)/run_script_unittests.cc'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + $(am__tty_colors); \ + 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 $(AM_TESTS_FD_REDIRECT); then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + col=$$red; res=XPASS; \ + ;; \ + *) \ + col=$$grn; res=PASS; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xfail=`expr $$xfail + 1`; \ + col=$$lgn; res=XFAIL; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + col=$$red; res=FAIL; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + col=$$blu; res=SKIP; \ + fi; \ + echo "$${col}$$res$${std}: $$tst"; \ + done; \ + if test "$$all" -eq 1; then \ + tests="test"; \ + All=""; \ + else \ + tests="tests"; \ + All="All "; \ + fi; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="$$All$$all $$tests passed"; \ + else \ + if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ + 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 \ + if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ + banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + if test "$$skip" -eq 1; then \ + skipped="($$skip test was not run)"; \ + else \ + skipped="($$skip tests were not run)"; \ + fi; \ + 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`; \ + if test "$$failed" -eq 0; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + fi; \ + echo "$${col}$$dashes$${std}"; \ + echo "$${col}$$banner$${std}"; \ + test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \ + test -z "$$report" || echo "$${col}$$report$${std}"; \ + echo "$${col}$$dashes$${std}"; \ + test "$$failed" -eq 0; \ + else :; fi + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-recursive +all-am: Makefile $(PROGRAMS) $(SCRIPTS) +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +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-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-recursive + -rm -f ./$(DEPDIR)/run_script_unittests-run_script_unittests.Po + -rm -f ./$(DEPDIR)/run_script_unittests-run_unittests.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f ./$(DEPDIR)/run_script_unittests-run_script_unittests.Po + -rm -f ./$(DEPDIR)/run_script_unittests-run_unittests.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(am__recursive_targets) check-am install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ + am--depfiles check check-TESTS check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS cscopelist-am ctags \ + ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool 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 mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/hooks/dhcp/run_script/tests/run_script_test.sh.in b/src/hooks/dhcp/run_script/tests/run_script_test.sh.in new file mode 100644 index 0000000..9ebb2d7 --- /dev/null +++ b/src/hooks/dhcp/run_script/tests/run_script_test.sh.in @@ -0,0 +1,531 @@ +#!/bin/sh + +# Copyright (C) 2021 Internet Systems Consortium, Inc. ("ISC") +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Exit with error if commands exit with non-zero and if undefined variables are +# used. +set -eu + +LOG_FILE="@abs_top_builddir@/src/hooks/dhcp/run_script/tests/test.log" + +ECHO_TO_FILE() { + echo "${@}" + echo "${@}" > ${LOG_FILE} +} + +ASSERT_EQ() { + EXPECTED=${1} + ACTUAL=${2} + if ! test "${EXPECTED}" = "${ACTUAL}"; then + ECHO_TO_FILE "FAILED" + ECHO_TO_FILE "Values differ:" + ECHO_TO_FILE " expected: ${EXPECTED}" + ECHO_TO_FILE " actual: ${ACTUAL}" + exit 123 + fi +} + +TEST_EQ() { + TEST_VARIABLE=${1} + TEST_EXPECTED="${1}=${2}" + TEST_ACTUAL=$(env | grep -E "^${TEST_VARIABLE}=") + ASSERT_EQ "${TEST_EXPECTED}" "${TEST_ACTUAL}" +} + +unknown_handle() { + ECHO_TO_FILE "Unhandled function call ${*}" + exit 123 +} + +lease4_renew () { + TEST_EQ "QUERY4_TYPE" "UNKNOWN" + TEST_EQ "QUERY4_TXID" "0" + TEST_EQ "QUERY4_LOCAL_ADDR" "0.0.0.0" + TEST_EQ "QUERY4_LOCAL_PORT" "67" + TEST_EQ "QUERY4_REMOTE_ADDR" "0.0.0.0" + TEST_EQ "QUERY4_REMOTE_PORT" "68" + TEST_EQ "QUERY4_IFACE_INDEX" "2" + TEST_EQ "QUERY4_IFACE_NAME" "eth1" + TEST_EQ "QUERY4_HOPS" "0" + TEST_EQ "QUERY4_SECS" "0" + TEST_EQ "QUERY4_FLAGS" "0" + TEST_EQ "QUERY4_CIADDR" "0.0.0.0" + TEST_EQ "QUERY4_SIADDR" "0.0.0.0" + TEST_EQ "QUERY4_YIADDR" "0.0.0.0" + TEST_EQ "QUERY4_GIADDR" "0.0.0.0" + TEST_EQ "QUERY4_RELAYED" "false" + TEST_EQ "QUERY4_HWADDR" "00:01:02:03" + TEST_EQ "QUERY4_HWADDR_TYPE" "1" + TEST_EQ "QUERY4_LOCAL_HWADDR" "00:01:02:03" + TEST_EQ "QUERY4_LOCAL_HWADDR_TYPE" "1" + TEST_EQ "QUERY4_REMOTE_HWADDR" "00:01:02:03" + TEST_EQ "QUERY4_REMOTE_HWADDR_TYPE" "1" + TEST_EQ "QUERY4_OPTION_82" "0x0105686F776479020587F67977EF06061A2B3C4D5E6F" + TEST_EQ "QUERY4_OPTION_82_SUB_OPTION_1" "0x686F776479" + TEST_EQ "QUERY4_OPTION_82_SUB_OPTION_2" "0x87F67977EF" + TEST_EQ "SUBNET4_ID" "6" + TEST_EQ "SUBNET4_NAME" "182.168.0.1/2" + TEST_EQ "SUBNET4_PREFIX" "182.168.0.1" + TEST_EQ "SUBNET4_PREFIX_LEN" "2" + TEST_EQ "PKT4_CLIENT_ID" "00:01:02:03:04:05:06" + TEST_EQ "PKT4_HWADDR" "00:01:02:03" + TEST_EQ "PKT4_HWADDR_TYPE" "1" + TEST_EQ "LEASE4_ADDRESS" "192.168.0.1" + TEST_EQ "LEASE4_CLTT" "3" + TEST_EQ "LEASE4_HOSTNAME" "test.hostname" + TEST_EQ "LEASE4_HWADDR" "00:01:02:03" + TEST_EQ "LEASE4_HWADDR_TYPE" "1" + TEST_EQ "LEASE4_STATE" "default" + TEST_EQ "LEASE4_SUBNET_ID" "4" + TEST_EQ "LEASE4_VALID_LIFETIME" "2" + TEST_EQ "LEASE4_CLIENT_ID" "00:01:02:03:04:05:06" + ECHO_TO_FILE "SUCCESS" +} + +lease4_expire () { + TEST_EQ "LEASE4_ADDRESS" "192.168.0.1" + TEST_EQ "LEASE4_CLTT" "3" + TEST_EQ "LEASE4_HOSTNAME" "test.hostname" + TEST_EQ "LEASE4_HWADDR" "00:01:02:03" + TEST_EQ "LEASE4_HWADDR_TYPE" "1" + TEST_EQ "LEASE4_STATE" "default" + TEST_EQ "LEASE4_SUBNET_ID" "4" + TEST_EQ "LEASE4_VALID_LIFETIME" "2" + TEST_EQ "LEASE4_CLIENT_ID" "00:01:02:03:04:05:06" + TEST_EQ "REMOVE_LEASE" "true" + ECHO_TO_FILE "SUCCESS" +} + +lease4_recover () { + TEST_EQ "LEASE4_ADDRESS" "192.168.0.1" + TEST_EQ "LEASE4_CLTT" "3" + TEST_EQ "LEASE4_HOSTNAME" "test.hostname" + TEST_EQ "LEASE4_HWADDR" "00:01:02:03" + TEST_EQ "LEASE4_HWADDR_TYPE" "1" + TEST_EQ "LEASE4_STATE" "default" + TEST_EQ "LEASE4_SUBNET_ID" "4" + TEST_EQ "LEASE4_VALID_LIFETIME" "2" + TEST_EQ "LEASE4_CLIENT_ID" "00:01:02:03:04:05:06" + ECHO_TO_FILE "SUCCESS" +} + +leases4_committed () { + TEST_EQ "QUERY4_TYPE" "UNKNOWN" + TEST_EQ "QUERY4_TXID" "0" + TEST_EQ "QUERY4_LOCAL_ADDR" "0.0.0.0" + TEST_EQ "QUERY4_LOCAL_PORT" "67" + TEST_EQ "QUERY4_REMOTE_ADDR" "0.0.0.0" + TEST_EQ "QUERY4_REMOTE_PORT" "68" + TEST_EQ "QUERY4_IFACE_INDEX" "2" + TEST_EQ "QUERY4_IFACE_NAME" "eth1" + TEST_EQ "QUERY4_HOPS" "0" + TEST_EQ "QUERY4_SECS" "0" + TEST_EQ "QUERY4_FLAGS" "0" + TEST_EQ "QUERY4_CIADDR" "0.0.0.0" + TEST_EQ "QUERY4_SIADDR" "0.0.0.0" + TEST_EQ "QUERY4_YIADDR" "0.0.0.0" + TEST_EQ "QUERY4_GIADDR" "0.0.0.0" + TEST_EQ "QUERY4_RELAYED" "false" + TEST_EQ "QUERY4_HWADDR" "00:01:02:03" + TEST_EQ "QUERY4_HWADDR_TYPE" "1" + TEST_EQ "QUERY4_LOCAL_HWADDR" "00:01:02:03" + TEST_EQ "QUERY4_LOCAL_HWADDR_TYPE" "1" + TEST_EQ "QUERY4_REMOTE_HWADDR" "00:01:02:03" + TEST_EQ "QUERY4_REMOTE_HWADDR_TYPE" "1" + TEST_EQ "QUERY4_OPTION_82" "0x0105686F776479020587F67977EF06061A2B3C4D5E6F" + TEST_EQ "QUERY4_OPTION_82_SUB_OPTION_1" "0x686F776479" + TEST_EQ "QUERY4_OPTION_82_SUB_OPTION_2" "0x87F67977EF" + TEST_EQ "LEASES4_SIZE" "2" + TEST_EQ "LEASES4_AT0_ADDRESS" "" + TEST_EQ "LEASES4_AT0_CLTT" "" + TEST_EQ "LEASES4_AT0_HOSTNAME" "" + TEST_EQ "LEASES4_AT0_HWADDR" "" + TEST_EQ "LEASES4_AT0_HWADDR_TYPE" "" + TEST_EQ "LEASES4_AT0_STATE" "" + TEST_EQ "LEASES4_AT0_SUBNET_ID" "" + TEST_EQ "LEASES4_AT0_VALID_LIFETIME" "" + TEST_EQ "LEASES4_AT0_CLIENT_ID" "" + TEST_EQ "LEASES4_AT1_ADDRESS" "192.168.0.1" + TEST_EQ "LEASES4_AT1_CLTT" "3" + TEST_EQ "LEASES4_AT1_HOSTNAME" "test.hostname" + TEST_EQ "LEASES4_AT1_HWADDR" "00:01:02:03" + TEST_EQ "LEASES4_AT1_HWADDR_TYPE" "1" + TEST_EQ "LEASES4_AT1_STATE" "default" + TEST_EQ "LEASES4_AT1_SUBNET_ID" "4" + TEST_EQ "LEASES4_AT1_VALID_LIFETIME" "2" + TEST_EQ "LEASES4_AT1_CLIENT_ID" "00:01:02:03:04:05:06" + TEST_EQ "DELETED_LEASES4_SIZE" "2" + TEST_EQ "DELETED_LEASES4_AT0_ADDRESS" "192.168.0.1" + TEST_EQ "DELETED_LEASES4_AT0_CLTT" "3" + TEST_EQ "DELETED_LEASES4_AT0_HOSTNAME" "test.hostname" + TEST_EQ "DELETED_LEASES4_AT0_HWADDR" "00:01:02:03" + TEST_EQ "DELETED_LEASES4_AT0_HWADDR_TYPE" "1" + TEST_EQ "DELETED_LEASES4_AT0_STATE" "default" + TEST_EQ "DELETED_LEASES4_AT0_SUBNET_ID" "4" + TEST_EQ "DELETED_LEASES4_AT0_VALID_LIFETIME" "2" + TEST_EQ "DELETED_LEASES4_AT0_CLIENT_ID" "00:01:02:03:04:05:06" + TEST_EQ "DELETED_LEASES4_AT1_ADDRESS" "" + TEST_EQ "DELETED_LEASES4_AT1_CLTT" "" + TEST_EQ "DELETED_LEASES4_AT1_HOSTNAME" "" + TEST_EQ "DELETED_LEASES4_AT1_HWADDR" "" + TEST_EQ "DELETED_LEASES4_AT1_HWADDR_TYPE" "" + TEST_EQ "DELETED_LEASES4_AT1_STATE" "" + TEST_EQ "DELETED_LEASES4_AT1_SUBNET_ID" "" + TEST_EQ "DELETED_LEASES4_AT1_VALID_LIFETIME" "" + TEST_EQ "DELETED_LEASES4_AT1_CLIENT_ID" "" + ECHO_TO_FILE "SUCCESS" +} + +lease4_release () { + TEST_EQ "QUERY4_TYPE" "UNKNOWN" + TEST_EQ "QUERY4_TXID" "0" + TEST_EQ "QUERY4_LOCAL_ADDR" "0.0.0.0" + TEST_EQ "QUERY4_LOCAL_PORT" "67" + TEST_EQ "QUERY4_REMOTE_ADDR" "0.0.0.0" + TEST_EQ "QUERY4_REMOTE_PORT" "68" + TEST_EQ "QUERY4_IFACE_INDEX" "2" + TEST_EQ "QUERY4_IFACE_NAME" "eth1" + TEST_EQ "QUERY4_HOPS" "0" + TEST_EQ "QUERY4_SECS" "0" + TEST_EQ "QUERY4_FLAGS" "0" + TEST_EQ "QUERY4_CIADDR" "0.0.0.0" + TEST_EQ "QUERY4_SIADDR" "0.0.0.0" + TEST_EQ "QUERY4_YIADDR" "0.0.0.0" + TEST_EQ "QUERY4_GIADDR" "0.0.0.0" + TEST_EQ "QUERY4_RELAYED" "false" + TEST_EQ "QUERY4_HWADDR" "00:01:02:03" + TEST_EQ "QUERY4_HWADDR_TYPE" "1" + TEST_EQ "QUERY4_LOCAL_HWADDR" "00:01:02:03" + TEST_EQ "QUERY4_LOCAL_HWADDR_TYPE" "1" + TEST_EQ "QUERY4_REMOTE_HWADDR" "00:01:02:03" + TEST_EQ "QUERY4_REMOTE_HWADDR_TYPE" "1" + TEST_EQ "QUERY4_OPTION_82" "0x0105686F776479020587F67977EF06061A2B3C4D5E6F" + TEST_EQ "QUERY4_OPTION_82_SUB_OPTION_1" "0x686F776479" + TEST_EQ "QUERY4_OPTION_82_SUB_OPTION_2" "0x87F67977EF" + TEST_EQ "LEASE4_ADDRESS" "192.168.0.1" + TEST_EQ "LEASE4_CLTT" "3" + TEST_EQ "LEASE4_HOSTNAME" "test.hostname" + TEST_EQ "LEASE4_HWADDR" "00:01:02:03" + TEST_EQ "LEASE4_HWADDR_TYPE" "1" + TEST_EQ "LEASE4_STATE" "default" + TEST_EQ "LEASE4_SUBNET_ID" "4" + TEST_EQ "LEASE4_VALID_LIFETIME" "2" + TEST_EQ "LEASE4_CLIENT_ID" "00:01:02:03:04:05:06" + ECHO_TO_FILE "SUCCESS" +} + +lease4_decline () { + TEST_EQ "QUERY4_TYPE" "UNKNOWN" + TEST_EQ "QUERY4_TXID" "0" + TEST_EQ "QUERY4_LOCAL_ADDR" "0.0.0.0" + TEST_EQ "QUERY4_LOCAL_PORT" "67" + TEST_EQ "QUERY4_REMOTE_ADDR" "0.0.0.0" + TEST_EQ "QUERY4_REMOTE_PORT" "68" + TEST_EQ "QUERY4_IFACE_INDEX" "2" + TEST_EQ "QUERY4_IFACE_NAME" "eth1" + TEST_EQ "QUERY4_HOPS" "0" + TEST_EQ "QUERY4_SECS" "0" + TEST_EQ "QUERY4_FLAGS" "0" + TEST_EQ "QUERY4_CIADDR" "0.0.0.0" + TEST_EQ "QUERY4_SIADDR" "0.0.0.0" + TEST_EQ "QUERY4_YIADDR" "0.0.0.0" + TEST_EQ "QUERY4_GIADDR" "0.0.0.0" + TEST_EQ "QUERY4_RELAYED" "false" + TEST_EQ "QUERY4_HWADDR" "00:01:02:03" + TEST_EQ "QUERY4_HWADDR_TYPE" "1" + TEST_EQ "QUERY4_LOCAL_HWADDR" "00:01:02:03" + TEST_EQ "QUERY4_LOCAL_HWADDR_TYPE" "1" + TEST_EQ "QUERY4_REMOTE_HWADDR" "00:01:02:03" + TEST_EQ "QUERY4_REMOTE_HWADDR_TYPE" "1" + TEST_EQ "QUERY4_OPTION_82" "0x0105686F776479020587F67977EF06061A2B3C4D5E6F" + TEST_EQ "QUERY4_OPTION_82_SUB_OPTION_1" "0x686F776479" + TEST_EQ "QUERY4_OPTION_82_SUB_OPTION_2" "0x87F67977EF" + TEST_EQ "LEASE4_ADDRESS" "192.168.0.1" + TEST_EQ "LEASE4_CLTT" "3" + TEST_EQ "LEASE4_HOSTNAME" "test.hostname" + TEST_EQ "LEASE4_HWADDR" "00:01:02:03" + TEST_EQ "LEASE4_HWADDR_TYPE" "1" + TEST_EQ "LEASE4_STATE" "default" + TEST_EQ "LEASE4_SUBNET_ID" "4" + TEST_EQ "LEASE4_VALID_LIFETIME" "2" + TEST_EQ "LEASE4_CLIENT_ID" "00:01:02:03:04:05:06" + ECHO_TO_FILE "SUCCESS" +} + +lease6_renew () { + TEST_EQ "QUERY6_TYPE" "UNKNOWN" + TEST_EQ "QUERY6_TXID" "0" + TEST_EQ "QUERY6_LOCAL_ADDR" "ff02::1:2" + TEST_EQ "QUERY6_LOCAL_PORT" "0" + TEST_EQ "QUERY6_REMOTE_ADDR" "fe80::21e:8cff:fe9b:7349" + TEST_EQ "QUERY6_REMOTE_PORT" "546" + TEST_EQ "QUERY6_IFACE_INDEX" "2" + TEST_EQ "QUERY6_IFACE_NAME" "eth1" + TEST_EQ "QUERY6_REMOTE_HWADDR" "00:01:02:03" + TEST_EQ "QUERY6_REMOTE_HWADDR_TYPE" "1" + TEST_EQ "QUERY6_PROTO" "UDP" + TEST_EQ "QUERY6_CLIENT_ID" "00:01:02:03:04:05:06" + TEST_EQ "LEASE6_ADDRESS" "2003:db8::1" + TEST_EQ "LEASE6_CLTT" "7" + TEST_EQ "LEASE6_HOSTNAME" "test.hostname" + TEST_EQ "LEASE6_HWADDR" "00:01:02:03" + TEST_EQ "LEASE6_HWADDR_TYPE" "1" + TEST_EQ "LEASE6_STATE" "default" + TEST_EQ "LEASE6_SUBNET_ID" "5" + TEST_EQ "LEASE6_VALID_LIFETIME" "4" + TEST_EQ "LEASE6_DUID" "00:01:02:03:04:05:06" + TEST_EQ "LEASE6_IAID" "2" + TEST_EQ "LEASE6_PREFERRED_LIFETIME" "3" + TEST_EQ "LEASE6_PREFIX_LEN" "128" + TEST_EQ "LEASE6_TYPE" "IA_NA" + TEST_EQ "PKT6_IA_IAID" "2711790500" + TEST_EQ "PKT6_IA_IA_TYPE" "3" + TEST_EQ "PKT6_IA_IA_T1" "2164392708" + TEST_EQ "PKT6_IA_IA_T2" "2214789633" + ECHO_TO_FILE "SUCCESS" +} + +lease6_rebind () { + TEST_EQ "QUERY6_TYPE" "UNKNOWN" + TEST_EQ "QUERY6_TXID" "0" + TEST_EQ "QUERY6_LOCAL_ADDR" "ff02::1:2" + TEST_EQ "QUERY6_LOCAL_PORT" "0" + TEST_EQ "QUERY6_REMOTE_ADDR" "fe80::21e:8cff:fe9b:7349" + TEST_EQ "QUERY6_REMOTE_PORT" "546" + TEST_EQ "QUERY6_IFACE_INDEX" "2" + TEST_EQ "QUERY6_IFACE_NAME" "eth1" + TEST_EQ "QUERY6_REMOTE_HWADDR" "00:01:02:03" + TEST_EQ "QUERY6_REMOTE_HWADDR_TYPE" "1" + TEST_EQ "QUERY6_PROTO" "UDP" + TEST_EQ "QUERY6_CLIENT_ID" "00:01:02:03:04:05:06" + TEST_EQ "LEASE6_ADDRESS" "2003:db8::1" + TEST_EQ "LEASE6_CLTT" "7" + TEST_EQ "LEASE6_HOSTNAME" "test.hostname" + TEST_EQ "LEASE6_HWADDR" "00:01:02:03" + TEST_EQ "LEASE6_HWADDR_TYPE" "1" + TEST_EQ "LEASE6_STATE" "default" + TEST_EQ "LEASE6_SUBNET_ID" "5" + TEST_EQ "LEASE6_VALID_LIFETIME" "4" + TEST_EQ "LEASE6_DUID" "00:01:02:03:04:05:06" + TEST_EQ "LEASE6_IAID" "2" + TEST_EQ "LEASE6_PREFERRED_LIFETIME" "3" + TEST_EQ "LEASE6_PREFIX_LEN" "128" + TEST_EQ "LEASE6_TYPE" "IA_NA" + TEST_EQ "PKT6_IA_IAID" "2711790500" + TEST_EQ "PKT6_IA_IA_TYPE" "3" + TEST_EQ "PKT6_IA_IA_T1" "2164392708" + TEST_EQ "PKT6_IA_IA_T2" "2214789633" + ECHO_TO_FILE "SUCCESS" +} + +lease6_expire () { + TEST_EQ "LEASE6_ADDRESS" "2003:db8::1" + TEST_EQ "LEASE6_CLTT" "7" + TEST_EQ "LEASE6_HOSTNAME" "test.hostname" + TEST_EQ "LEASE6_HWADDR" "00:01:02:03" + TEST_EQ "LEASE6_HWADDR_TYPE" "1" + TEST_EQ "LEASE6_STATE" "default" + TEST_EQ "LEASE6_SUBNET_ID" "5" + TEST_EQ "LEASE6_VALID_LIFETIME" "4" + TEST_EQ "LEASE6_DUID" "00:01:02:03:04:05:06" + TEST_EQ "LEASE6_IAID" "2" + TEST_EQ "LEASE6_PREFERRED_LIFETIME" "3" + TEST_EQ "LEASE6_PREFIX_LEN" "128" + TEST_EQ "LEASE6_TYPE" "IA_NA" + TEST_EQ "REMOVE_LEASE" "true" + ECHO_TO_FILE "SUCCESS" +} + +lease6_recover () { + TEST_EQ "LEASE6_ADDRESS" "2003:db8::1" + TEST_EQ "LEASE6_CLTT" "7" + TEST_EQ "LEASE6_HOSTNAME" "test.hostname" + TEST_EQ "LEASE6_HWADDR" "00:01:02:03" + TEST_EQ "LEASE6_HWADDR_TYPE" "1" + TEST_EQ "LEASE6_STATE" "default" + TEST_EQ "LEASE6_SUBNET_ID" "5" + TEST_EQ "LEASE6_VALID_LIFETIME" "4" + TEST_EQ "LEASE6_DUID" "00:01:02:03:04:05:06" + TEST_EQ "LEASE6_IAID" "2" + TEST_EQ "LEASE6_PREFERRED_LIFETIME" "3" + TEST_EQ "LEASE6_PREFIX_LEN" "128" + TEST_EQ "LEASE6_TYPE" "IA_NA" + ECHO_TO_FILE "SUCCESS" +} + +leases6_committed () { + TEST_EQ "QUERY6_TYPE" "UNKNOWN" + TEST_EQ "QUERY6_TXID" "0" + TEST_EQ "QUERY6_LOCAL_ADDR" "ff02::1:2" + TEST_EQ "QUERY6_LOCAL_PORT" "0" + TEST_EQ "QUERY6_REMOTE_ADDR" "fe80::21e:8cff:fe9b:7349" + TEST_EQ "QUERY6_REMOTE_PORT" "546" + TEST_EQ "QUERY6_IFACE_INDEX" "2" + TEST_EQ "QUERY6_IFACE_NAME" "eth1" + TEST_EQ "QUERY6_REMOTE_HWADDR" "00:01:02:03" + TEST_EQ "QUERY6_REMOTE_HWADDR_TYPE" "1" + TEST_EQ "QUERY6_PROTO" "UDP" + TEST_EQ "QUERY6_CLIENT_ID" "00:01:02:03:04:05:06" + TEST_EQ "LEASES6_SIZE" "2" + TEST_EQ "LEASES6_AT0_ADDRESS" "" + TEST_EQ "LEASES6_AT0_CLTT" "" + TEST_EQ "LEASES6_AT0_HOSTNAME" "" + TEST_EQ "LEASES6_AT0_HWADDR" "" + TEST_EQ "LEASES6_AT0_HWADDR_TYPE" "" + TEST_EQ "LEASES6_AT0_STATE" "" + TEST_EQ "LEASES6_AT0_SUBNET_ID" "" + TEST_EQ "LEASES6_AT0_VALID_LIFETIME" "" + TEST_EQ "LEASES6_AT0_DUID" "" + TEST_EQ "LEASES6_AT0_IAID" "" + TEST_EQ "LEASES6_AT0_PREFERRED_LIFETIME" "" + TEST_EQ "LEASES6_AT0_PREFIX_LEN" "" + TEST_EQ "LEASES6_AT0_TYPE" "" + TEST_EQ "LEASES6_AT1_ADDRESS" "2003:db8::1" + TEST_EQ "LEASES6_AT1_CLTT" "7" + TEST_EQ "LEASES6_AT1_HOSTNAME" "test.hostname" + TEST_EQ "LEASES6_AT1_HWADDR" "00:01:02:03" + TEST_EQ "LEASES6_AT1_HWADDR_TYPE" "1" + TEST_EQ "LEASES6_AT1_STATE" "default" + TEST_EQ "LEASES6_AT1_SUBNET_ID" "5" + TEST_EQ "LEASES6_AT1_VALID_LIFETIME" "4" + TEST_EQ "LEASES6_AT1_DUID" "00:01:02:03:04:05:06" + TEST_EQ "LEASES6_AT1_IAID" "2" + TEST_EQ "LEASES6_AT1_PREFERRED_LIFETIME" "3" + TEST_EQ "LEASES6_AT1_PREFIX_LEN" "128" + TEST_EQ "LEASES6_AT1_TYPE" "IA_NA" + TEST_EQ "DELETED_LEASES6_SIZE" "2" + TEST_EQ "DELETED_LEASES6_AT0_ADDRESS" "2003:db8::1" + TEST_EQ "DELETED_LEASES6_AT0_CLTT" "7" + TEST_EQ "DELETED_LEASES6_AT0_HOSTNAME" "test.hostname" + TEST_EQ "DELETED_LEASES6_AT0_HWADDR" "00:01:02:03" + TEST_EQ "DELETED_LEASES6_AT0_HWADDR_TYPE" "1" + TEST_EQ "DELETED_LEASES6_AT0_STATE" "default" + TEST_EQ "DELETED_LEASES6_AT0_SUBNET_ID" "5" + TEST_EQ "DELETED_LEASES6_AT0_VALID_LIFETIME" "4" + TEST_EQ "DELETED_LEASES6_AT0_DUID" "00:01:02:03:04:05:06" + TEST_EQ "DELETED_LEASES6_AT0_IAID" "2" + TEST_EQ "DELETED_LEASES6_AT0_PREFERRED_LIFETIME" "3" + TEST_EQ "DELETED_LEASES6_AT0_PREFIX_LEN" "128" + TEST_EQ "DELETED_LEASES6_AT0_TYPE" "IA_NA" + TEST_EQ "DELETED_LEASES6_AT1_ADDRESS" "" + TEST_EQ "DELETED_LEASES6_AT1_CLTT" "" + TEST_EQ "DELETED_LEASES6_AT1_HOSTNAME" "" + TEST_EQ "DELETED_LEASES6_AT1_HWADDR" "" + TEST_EQ "DELETED_LEASES6_AT1_HWADDR_TYPE" "" + TEST_EQ "DELETED_LEASES6_AT1_STATE" "" + TEST_EQ "DELETED_LEASES6_AT1_SUBNET_ID" "" + TEST_EQ "DELETED_LEASES6_AT1_VALID_LIFETIME" "" + TEST_EQ "DELETED_LEASES6_AT1_DUID" "" + TEST_EQ "DELETED_LEASES6_AT1_IAID" "" + TEST_EQ "DELETED_LEASES6_AT1_PREFERRED_LIFETIME" "" + TEST_EQ "DELETED_LEASES6_AT1_PREFIX_LEN" "" + TEST_EQ "DELETED_LEASES6_AT1_TYPE" "" + ECHO_TO_FILE "SUCCESS" +} + +lease6_release () { + TEST_EQ "QUERY6_TYPE" "UNKNOWN" + TEST_EQ "QUERY6_TXID" "0" + TEST_EQ "QUERY6_LOCAL_ADDR" "ff02::1:2" + TEST_EQ "QUERY6_LOCAL_PORT" "0" + TEST_EQ "QUERY6_REMOTE_ADDR" "fe80::21e:8cff:fe9b:7349" + TEST_EQ "QUERY6_REMOTE_PORT" "546" + TEST_EQ "QUERY6_IFACE_INDEX" "2" + TEST_EQ "QUERY6_IFACE_NAME" "eth1" + TEST_EQ "QUERY6_REMOTE_HWADDR" "00:01:02:03" + TEST_EQ "QUERY6_REMOTE_HWADDR_TYPE" "1" + TEST_EQ "QUERY6_PROTO" "UDP" + TEST_EQ "QUERY6_CLIENT_ID" "00:01:02:03:04:05:06" + TEST_EQ "LEASE6_ADDRESS" "2003:db8::1" + TEST_EQ "LEASE6_CLTT" "7" + TEST_EQ "LEASE6_HOSTNAME" "test.hostname" + TEST_EQ "LEASE6_HWADDR" "00:01:02:03" + TEST_EQ "LEASE6_HWADDR_TYPE" "1" + TEST_EQ "LEASE6_STATE" "default" + TEST_EQ "LEASE6_SUBNET_ID" "5" + TEST_EQ "LEASE6_VALID_LIFETIME" "4" + TEST_EQ "LEASE6_DUID" "00:01:02:03:04:05:06" + TEST_EQ "LEASE6_IAID" "2" + TEST_EQ "LEASE6_PREFERRED_LIFETIME" "3" + TEST_EQ "LEASE6_PREFIX_LEN" "128" + TEST_EQ "LEASE6_TYPE" "IA_NA" + ECHO_TO_FILE "SUCCESS" +} + +lease6_decline () { + TEST_EQ "QUERY6_TYPE" "UNKNOWN" + TEST_EQ "QUERY6_TXID" "0" + TEST_EQ "QUERY6_LOCAL_ADDR" "ff02::1:2" + TEST_EQ "QUERY6_LOCAL_PORT" "0" + TEST_EQ "QUERY6_REMOTE_ADDR" "fe80::21e:8cff:fe9b:7349" + TEST_EQ "QUERY6_REMOTE_PORT" "546" + TEST_EQ "QUERY6_IFACE_INDEX" "2" + TEST_EQ "QUERY6_IFACE_NAME" "eth1" + TEST_EQ "QUERY6_REMOTE_HWADDR" "00:01:02:03" + TEST_EQ "QUERY6_REMOTE_HWADDR_TYPE" "1" + TEST_EQ "QUERY6_PROTO" "UDP" + TEST_EQ "QUERY6_CLIENT_ID" "00:01:02:03:04:05:06" + TEST_EQ "LEASE6_ADDRESS" "2003:db8::1" + TEST_EQ "LEASE6_CLTT" "7" + TEST_EQ "LEASE6_HOSTNAME" "test.hostname" + TEST_EQ "LEASE6_HWADDR" "00:01:02:03" + TEST_EQ "LEASE6_HWADDR_TYPE" "1" + TEST_EQ "LEASE6_STATE" "default" + TEST_EQ "LEASE6_SUBNET_ID" "5" + TEST_EQ "LEASE6_VALID_LIFETIME" "4" + TEST_EQ "LEASE6_DUID" "00:01:02:03:04:05:06" + TEST_EQ "LEASE6_IAID" "2" + TEST_EQ "LEASE6_PREFERRED_LIFETIME" "3" + TEST_EQ "LEASE6_PREFIX_LEN" "128" + TEST_EQ "LEASE6_TYPE" "IA_NA" + ECHO_TO_FILE "SUCCESS" +} + +case "$1" in + "lease4_renew") + lease4_renew + ;; + "lease4_expire") + lease4_expire + ;; + "lease4_recover") + lease4_recover + ;; + "leases4_committed") + leases4_committed + ;; + "lease4_release") + lease4_release + ;; + "lease4_decline") + lease4_decline + ;; + "lease6_renew") + lease6_renew + ;; + "lease6_rebind") + lease6_rebind + ;; + "lease6_expire") + lease6_expire + ;; + "lease6_recover") + lease6_recover + ;; + "leases6_committed") + leases6_committed + ;; + "lease6_release") + lease6_release + ;; + "lease6_decline") + lease6_decline + ;; + *) + unknown_handle "${@}" + ;; +esac diff --git a/src/hooks/dhcp/run_script/tests/run_script_unittests.cc b/src/hooks/dhcp/run_script/tests/run_script_unittests.cc new file mode 100644 index 0000000..46d9c8d --- /dev/null +++ b/src/hooks/dhcp/run_script/tests/run_script_unittests.cc @@ -0,0 +1,1035 @@ +// Copyright (C) 2021 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include <config.h> + +#include <run_script.h> + +#include <asiolink/io_address.h> +#include <asiolink/io_service.h> +#include <cc/data.h> +#include <dhcp/dhcp6.h> +#include <dhcp/option.h> +#include <dhcp/option_custom.h> +#include <dhcp/option_int.h> +#include <hooks/callout_manager.h> +#include <hooks/hooks.h> +#include <hooks/hooks_manager.h> + +#include <cstdio> +#include <fstream> + +#include <gtest/gtest.h> + +using namespace isc::run_script; + +using namespace isc::asiolink; +using namespace isc::data; +using namespace isc::dhcp; +using namespace isc::hooks; +using namespace isc::util; +using namespace std; + +extern "C" { +extern int lease4_renew(CalloutHandle& handle); +extern int lease4_expire(CalloutHandle& handle); +extern int lease4_recover(CalloutHandle& handle); +extern int leases4_committed(CalloutHandle& handle); +extern int lease4_release(CalloutHandle& handle); +extern int lease4_decline(CalloutHandle& handle); +extern int lease6_renew(CalloutHandle& handle); +extern int lease6_rebind(CalloutHandle& handle); +extern int lease6_expire(CalloutHandle& handle); +extern int lease6_recover(CalloutHandle& handle); +extern int leases6_committed(CalloutHandle& handle); +extern int lease6_release(CalloutHandle& handle); +extern int lease6_decline(CalloutHandle& handle); +} + +namespace isc { +namespace run_script { + +extern RunScriptImplPtr impl; + +} // namespace run_script +} // namespace isc + +namespace { + +/// @brief This function joins all received environment variables and adds a +/// newline after each one so that a simple compare can be done in the test. +/// +/// @param vars The list of environment variables to join. +/// @return The joined environment. +string +join(const ProcessEnvVars& vars) { + string result; + for (auto var : vars) { + result += var + "\n"; + } + return (result); +} + +/// @brief Generate a valid HWAddr. +/// +/// @return The generated HWAddr. +HWAddrPtr +generateHWAddr() { + return (HWAddrPtr(new HWAddr({0, 1, 2 ,3}, HTYPE_ETHER))); +} + +/// @brief Generate a valid DUID. +/// +/// @return The generated DUID. +ClientIdPtr +generateDUID() { + return (ClientIdPtr(new ClientId({0, 1, 2, 3, 4, 5, 6}))); +} + +/// @brief Generate a valid Option. +/// +/// @param universe The option universe (V4 or V6). +/// @param code The Option code to use. +/// @return The generated Option. +OptionPtr +generateOption(Option::Universe universe, uint16_t code, OptionBuffer& data) { + OptionDefinitionPtr def = LibDHCP::getOptionDef(universe == Option::V4 ? + DHCP4_OPTION_SPACE : DHCP6_OPTION_SPACE, + code); + if (def) { + return (OptionCustomPtr(new OptionCustom(*def, universe, data))); + } + + return (OptionPtr()); +} + +/// @brief Generate a valid Option6IA. +/// +/// @return The generated Option6IA. +Option6IAPtr +generateOptionIA() { + OptionBuffer buf; + buf.resize(12); + buf[0] = 0xa1; // iaid + buf[1] = 0xa2; + buf[2] = 0xa3; + buf[3] = 0xa4; + buf[4] = 0x81; // T1 + buf[5] = 0x02; + buf[6] = 0x03; + buf[7] = 0x04; + buf[8] = 0x84; // T2 + buf[9] = 0x03; + buf[10] = 0x02; + buf[11] = 0x01; + + return (Option6IAPtr(new Option6IA(D6O_IA_NA, buf.begin(), buf.end()))); +} + +/// @brief Generate a valid Subnet4. +/// +/// @return The generated Subnet4. +Subnet4Ptr +generateSubnet4() { + return (Subnet4Ptr(new Subnet4(IOAddress("182.168.0.1"), 2, 3, 4, 5, 6))); +} + +/// @brief Generate a valid Subnet6. +/// +/// @return The generated Subnet6. +Subnet6Ptr +generateSubnet6() { + return (Subnet6Ptr(new Subnet6(IOAddress("2003:db8::1"), 2, 3, 4, 5, 6, 7))); +} + +/// @brief Generate a valid Lease4. +/// +/// @return The generated Lease4. +Lease4Ptr +generateLease4() { + HWAddrPtr hwaddr = generateHWAddr(); + ClientIdPtr clientid = generateDUID(); + + Lease4Ptr lease4(new Lease4(IOAddress("192.168.0.1"), hwaddr, clientid, + 2, 3, 4, false, false, "test.hostname")); + + return(lease4); +} + +/// @brief Generate a valid Lease6. +/// +/// @return The generated Lease6. +Lease6Ptr +generateLease6() { + HWAddrPtr hwaddr = generateHWAddr(); + DuidPtr duid = generateDUID(); + + Lease6Ptr lease6(new Lease6(Lease::TYPE_NA, IOAddress("2003:db8::1"), duid, + 2, 3, 4, 5, false, false, "test.hostname", + hwaddr)); + + lease6->cltt_ = 7; + + return (lease6); +} + +/// @brief Generate a Pkt4 with all parameters set. +/// +/// @return The generated Pkt4. +Pkt4Ptr +generatePkt4() { + // A dummy MAC address, padded with 0s + const uint8_t dummyChaddr[16] = {0, 1, 2, 3, 4, 5, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 }; + + // Let's use some creative test content here (128 chars + \0) + const uint8_t dummyFile[] = "Lorem ipsum dolor sit amet, consectetur " + "adipiscing elit. Proin mollis placerat metus, at " + "lacinia orci ornare vitae. Mauris amet."; + + // Yet another type of test content (64 chars + \0) + const uint8_t dummySname[] = "Lorem ipsum dolor sit amet, consectetur " + "adipiscing elit posuere."; + + // That is only part of the header. It contains all "short" fields, + // larger fields are constructed separately. + uint8_t hdr[] = { + 1, 6, 6, 13, // op, htype, hlen, hops, + 0x12, 0x34, 0x56, 0x78, // transaction-id + 0, 42, 0x80, 0x00, // 42 secs, BROADCAST flags + 192, 0, 2, 1, // ciaddr + 1, 2, 3, 4, // yiaddr + 192, 0, 2, 255, // siaddr + 192, 0, 2, 50, // giaddr + }; + + // Initialize the vector with the header fields defined above. + vector<uint8_t> buf(hdr, hdr + sizeof(hdr)); + + // Append the large header fields. + copy(dummyChaddr, dummyChaddr + Pkt4::MAX_CHADDR_LEN, back_inserter(buf)); + copy(dummySname, dummySname + Pkt4::MAX_SNAME_LEN, back_inserter(buf)); + copy(dummyFile, dummyFile + Pkt4::MAX_FILE_LEN, back_inserter(buf)); + + // Should now have all the header, so check. The "static_cast" is used + // to get round an odd bug whereby the linker appears not to find the + // definition of DHCPV4_PKT_HDR_LEN if it appears within an EXPECT_EQ(). + EXPECT_EQ(static_cast<size_t>(Pkt4::DHCPV4_PKT_HDR_LEN), buf.size()); + + // Add magic cookie + buf.push_back(0x63); + buf.push_back(0x82); + buf.push_back(0x53); + buf.push_back(0x63); + + // Add message type DISCOVER + buf.push_back(static_cast<uint8_t>(DHO_DHCP_MESSAGE_TYPE)); + buf.push_back(1); // length (just one byte) + buf.push_back(static_cast<uint8_t>(DHCPDISCOVER)); + + Pkt4Ptr pkt4(new Pkt4(&buf[0], buf.size())); + + pkt4->setIface("eth1"); + pkt4->setIndex(2); + + pkt4->setHWAddr(generateHWAddr()); + pkt4->setLocalHWAddr(generateHWAddr()); + pkt4->setRemoteHWAddr(generateHWAddr()); + + OptionDefinitionPtr rai_def = LibDHCP::getOptionDef(DHCP4_OPTION_SPACE, + DHO_DHCP_AGENT_OPTIONS); + + OptionCustomPtr rai(new OptionCustom(*rai_def, Option::V4)); + + uint8_t circuit_id[] = { 0x68, 0x6f, 0x77, 0x64, 0x79 }; + OptionPtr circuit_id_opt(new Option(Option::V4, RAI_OPTION_AGENT_CIRCUIT_ID, + OptionBuffer(circuit_id, + circuit_id + sizeof(circuit_id)))); + rai->addOption(circuit_id_opt); + + uint8_t subscriber_id[] = { 0x1a, 0x2b, 0x3c, 0x4d, 0x5e, 0x6f }; + OptionPtr subscriber_id_opt(new Option(Option::V4, RAI_OPTION_SUBSCRIBER_ID, + OptionBuffer(subscriber_id, + subscriber_id + sizeof(subscriber_id)))); + rai->addOption(subscriber_id_opt); + + uint8_t remote_id[] = { 0x87, 0xf6, 0x79, 0x77, 0xef }; + OptionPtr remote_id_opt(new Option(Option::V4, RAI_OPTION_REMOTE_ID, + OptionBuffer(remote_id, + remote_id + sizeof(remote_id)))); + rai->addOption(remote_id_opt); + + pkt4->addOption(rai); + + return (pkt4); +} + +/// @brief Generate a Pkt6 with all parameters set. +/// +/// @return The generated Pkt6. +Pkt6Ptr +generatePkt6() { + // That is only part of the header. It contains all "short" fields, + // larger fields are constructed separately. + uint8_t data[98]; + data[0] = 1; + data[1] = 1; data[2] = 2; data[3] = 3; data[4] = 0; + data[5] = 1; data[6] = 0; data[7] = 14; data[8] = 0; + data[9] = 1; data[10] = 0; data[11] = 1; data[12] = 21; + data[13] = 158; data[14] = 60; data[15] = 22; data[16] = 0; + data[17] = 30; data[18] = 140; data[19] = 155; data[20] = 115; + data[21] = 73; data[22] = 0; data[23] = 3; data[24] = 0; + data[25] = 40; data[26] = 0; data[27] = 0; data[28] = 0; + data[29] = 1; data[30] = 255; data[31] = 255; data[32] = 255; + data[33] = 255; data[34] = 255; data[35] = 255; data[36] = 255; + data[37] = 255; data[38] = 0; data[39] = 5; data[40] = 0; + data[41] = 24; data[42] = 32; data[43] = 1; data[44] = 13; + data[45] = 184; data[46] = 0; data[47] = 1; data[48] = 0; + data[49] = 0; data[50] = 0; data[51] = 0; data[52] = 0; + data[53] = 0; data[54] = 0; data[55] = 0; data[56] = 18; + data[57] = 52; data[58] = 255; data[59] = 255; data[60] = 255; + data[61] = 255; data[62] = 255; data[63] = 255; data[64] = 255; + data[65] = 255; data[66] = 0; data[67] = 23; data[68] = 0; + data[69] = 16; data[70] = 32; data[71] = 1; data[72] = 13; + data[73] = 184; data[74] = 0; data[75] = 1; data[76] = 0; + data[77] = 0; data[78] = 0; data[79] = 0; data[80] = 0; + data[81] = 0; data[82] = 0; data[83] = 0; data[84] = 221; + data[85] = 221; data[86] = 0; data[87] = 8; data[88] = 0; + data[89] = 2; data[90] = 0; data[91] = 100; data[92] = 0; + data[93] = 6; data[94] = 0; data[95] = 2; data[96] = 0; + data[97] = 23; + + Pkt6Ptr pkt6(new Pkt6(data, sizeof(data))); + + pkt6->setRemotePort(546); + pkt6->setRemoteAddr(IOAddress("fe80::21e:8cff:fe9b:7349")); + pkt6->setLocalPort(0); + pkt6->setLocalAddr(IOAddress("ff02::1:2")); + + pkt6->setIface("eth1"); + pkt6->setIndex(2); + + pkt6->setRemoteHWAddr(generateHWAddr()); + pkt6->addOption(OptionPtr(new Option(Option::V6, D6O_CLIENTID, + generateDUID()->getDuid()))); + + return (pkt6); +} + +/// @brief Tests the RunScript setName and getName functions. +TEST(RunScript, testSetNameGetName) { + RunScriptImpl script; + string script_name = "test"; + ASSERT_NO_THROW(script.setName(script_name)); + EXPECT_EQ(script_name, script.getName()); +} + +/// @brief Tests the RunScript setSync and getSync functions. +TEST(RunScript, testSetSyncGetSync) { + RunScriptImpl script; + bool sync = true; + ASSERT_NO_THROW(script.setSync(sync)); + EXPECT_EQ(sync, script.getSync()); +} + +/// @brief Tests the extractBoolean method works as expected. +TEST(RunScript, extractBoolean) { + ProcessEnvVars vars; + bool flag = false; + RunScriptImpl::extractBoolean(vars, flag, "FALSE_PREFIX", "_FALSE_SUFFIX"); + ASSERT_EQ(1, vars.size()); + string expected = "FALSE_PREFIX_FALSE_SUFFIX=false\n"; + EXPECT_EQ(expected, join(vars)); + flag = true; + RunScriptImpl::extractBoolean(vars, flag, "TRUE_PREFIX", "_TRUE_SUFFIX"); + ASSERT_EQ(2, vars.size()); + expected = "FALSE_PREFIX_FALSE_SUFFIX=false\n" + "TRUE_PREFIX_TRUE_SUFFIX=true\n"; + EXPECT_EQ(expected, join(vars)); +} + +/// @brief Tests the extractInteger method works as expected. +TEST(RunScript, extractInteger) { + ProcessEnvVars vars; + uint64_t value = 0; + RunScriptImpl::extractInteger(vars, value, "ZERO_PREFIX", "_ZERO_SUFFIX"); + ASSERT_EQ(1, vars.size()); + string expected = "ZERO_PREFIX_ZERO_SUFFIX=0\n"; + EXPECT_EQ(expected, join(vars)); + value = 1; + RunScriptImpl::extractInteger(vars, value, "ONE_PREFIX", "_ONE_SUFFIX"); + ASSERT_EQ(2, vars.size()); + expected = "ZERO_PREFIX_ZERO_SUFFIX=0\n" + "ONE_PREFIX_ONE_SUFFIX=1\n"; + EXPECT_EQ(expected, join(vars)); + value = 1000; + RunScriptImpl::extractInteger(vars, value, "THOUSAND_PREFIX", "_THOUSAND_SUFFIX"); + ASSERT_EQ(3, vars.size()); + expected = "ZERO_PREFIX_ZERO_SUFFIX=0\n" + "ONE_PREFIX_ONE_SUFFIX=1\n" + "THOUSAND_PREFIX_THOUSAND_SUFFIX=1000\n"; + EXPECT_EQ(expected, join(vars)); +} + +/// @brief Tests the extractString method works as expected. +TEST(RunScript, extractString) { + ProcessEnvVars vars; + string value = ""; + RunScriptImpl::extractString(vars, value, "EMPTY_PREFIX", "_EMPTY_SUFFIX"); + ASSERT_EQ(1, vars.size()); + string expected = "EMPTY_PREFIX_EMPTY_SUFFIX=\n"; + EXPECT_EQ(expected, join(vars)); + value = "SOMETHING"; + RunScriptImpl::extractString(vars, value, "NON_EMPTY_PREFIX", "_NON_EMPTY_SUFFIX"); + ASSERT_EQ(2, vars.size()); + expected = "EMPTY_PREFIX_EMPTY_SUFFIX=\n" + "NON_EMPTY_PREFIX_NON_EMPTY_SUFFIX=SOMETHING\n"; + EXPECT_EQ(expected, join(vars)); +} + +/// @brief Tests the extractHWAddr method works as expected. +TEST(RunScript, extractHWAddr) { + ProcessEnvVars vars; + HWAddrPtr hwaddr; + RunScriptImpl::extractHWAddr(vars, hwaddr, "HWADDR_PREFIX", "_HWADDR_SUFFIX"); + ASSERT_EQ(2, vars.size()); + string expected = "HWADDR_PREFIX_HWADDR_SUFFIX=\n" + "HWADDR_PREFIX_TYPE_HWADDR_SUFFIX=\n"; + EXPECT_EQ(expected, join(vars)); + vars.clear(); + hwaddr = generateHWAddr(); + RunScriptImpl::extractHWAddr(vars, hwaddr, "HWADDR_PREFIX", "_HWADDR_SUFFIX"); + ASSERT_EQ(2, vars.size()); + expected = "HWADDR_PREFIX_HWADDR_SUFFIX=00:01:02:03\n" + "HWADDR_PREFIX_TYPE_HWADDR_SUFFIX=1\n"; + EXPECT_EQ(expected, join(vars)); +} + +/// @brief Tests the extractDUID method works as expected. +TEST(RunScript, extractDUID) { + ProcessEnvVars vars; + DuidPtr duid; + RunScriptImpl::extractDUID(vars, duid, "DUID_PREFIX", "_DUID_SUFFIX"); + ASSERT_EQ(1, vars.size()); + string expected = "DUID_PREFIX_DUID_SUFFIX=\n"; + EXPECT_EQ(expected, join(vars)); + vars.clear(); + duid = generateDUID(); + RunScriptImpl::extractDUID(vars, duid, "DUID_PREFIX", "_DUID_SUFFIX"); + ASSERT_EQ(1, vars.size()); + expected = "DUID_PREFIX_DUID_SUFFIX=00:01:02:03:04:05:06\n"; + EXPECT_EQ(expected, join(vars)); +} + +/// @brief Tests the extractOption method works as expected. +TEST(RunScript, extractOption) { + ProcessEnvVars vars; + OptionPtr option; + RunScriptImpl::extractOption(vars, option, "OPTION_PREFIX", "_OPTION_SUFFIX"); + ASSERT_EQ(0, vars.size()); + OptionBuffer buffer = { 0xca, 0xfe, 0xba, 0xbe }; + option = generateOption(Option::V4, DHO_USER_CLASS, buffer); + RunScriptImpl::extractOption(vars, option, "OPTION_PREFIX", "_OPTION_SUFFIX"); + ASSERT_EQ(1, vars.size()); + string expected = "OPTION_PREFIX_OPTION_77_OPTION_SUFFIX=0xCAFEBABE\n"; + EXPECT_EQ(expected, join(vars)); +} + +/// @brief Tests the extractSubOption method works as expected. +TEST(RunScript, extractSubOption) { + ProcessEnvVars vars; + OptionPtr option; + RunScriptImpl::extractOption(vars, option, "OPTION_SUBOPTION_PREFIX", "_OPTION_SUBOPTION_SUFFIX"); + ASSERT_EQ(0, vars.size()); + OptionBuffer data; + option = generateOption(Option::V4, DHO_DHCP_AGENT_OPTIONS, data); + uint8_t subscriber_id[] = { 0x1a, 0x2b, 0x3c, 0x4d, 0x5e, 0x6f }; + OptionPtr subscriber_id_opt(new Option(Option::V4, RAI_OPTION_SUBSCRIBER_ID, + OptionBuffer(subscriber_id, + subscriber_id + sizeof(subscriber_id)))); + option->addOption(subscriber_id_opt); + RunScriptImpl::extractSubOption(vars, option, RAI_OPTION_SUBSCRIBER_ID, "OPTION_SUBOPTION_PREFIX", "_OPTION_SUBOPTION_SUFFIX"); + ASSERT_EQ(1, vars.size()); + string expected = "OPTION_SUBOPTION_PREFIX_OPTION_82_SUB_OPTION_6_OPTION_SUBOPTION_SUFFIX=0x1A2B3C4D5E6F\n"; + EXPECT_EQ(expected, join(vars)); +} + +/// @brief Tests the extractOptionIA method works as expected. +TEST(RunScript, extractOptionIA) { + ProcessEnvVars vars; + Option6IAPtr optionia; + RunScriptImpl::extractOptionIA(vars, optionia, "OPTIONIA_PREFIX", "_OPTIONIA_SUFFIX"); + ASSERT_EQ(4, vars.size()); + string expected = "OPTIONIA_PREFIX_IAID_OPTIONIA_SUFFIX=\n" + "OPTIONIA_PREFIX_IA_TYPE_OPTIONIA_SUFFIX=\n" + "OPTIONIA_PREFIX_IA_T1_OPTIONIA_SUFFIX=\n" + "OPTIONIA_PREFIX_IA_T2_OPTIONIA_SUFFIX=\n"; + EXPECT_EQ(expected, join(vars)); + vars.clear(); + optionia = generateOptionIA(); + RunScriptImpl::extractOptionIA(vars, optionia, "OPTIONIA_PREFIX", "_OPTIONIA_SUFFIX"); + ASSERT_EQ(4, vars.size()); + expected = "OPTIONIA_PREFIX_IAID_OPTIONIA_SUFFIX=2711790500\n" + "OPTIONIA_PREFIX_IA_TYPE_OPTIONIA_SUFFIX=3\n" + "OPTIONIA_PREFIX_IA_T1_OPTIONIA_SUFFIX=2164392708\n" + "OPTIONIA_PREFIX_IA_T2_OPTIONIA_SUFFIX=2214789633\n"; + EXPECT_EQ(expected, join(vars)); +} + +/// @brief Tests the extractSubnet4 method works as expected. +TEST(RunScript, extractSubnet4) { + ProcessEnvVars vars; + Subnet4Ptr subnet4; + RunScriptImpl::extractSubnet4(vars, subnet4, "SUBNET4_PREFIX", "_SUBNET4_SUFFIX"); + ASSERT_EQ(4, vars.size()); + string expected = "SUBNET4_PREFIX_ID_SUBNET4_SUFFIX=\n" + "SUBNET4_PREFIX_NAME_SUBNET4_SUFFIX=\n" + "SUBNET4_PREFIX_PREFIX_SUBNET4_SUFFIX=\n" + "SUBNET4_PREFIX_PREFIX_LEN_SUBNET4_SUFFIX=\n"; + EXPECT_EQ(expected, join(vars)); + vars.clear(); + subnet4 = generateSubnet4(); + RunScriptImpl::extractSubnet4(vars, subnet4, "SUBNET4_PREFIX", "_SUBNET4_SUFFIX"); + ASSERT_EQ(4, vars.size()); + expected = "SUBNET4_PREFIX_ID_SUBNET4_SUFFIX=6\n" + "SUBNET4_PREFIX_NAME_SUBNET4_SUFFIX=182.168.0.1/2\n" + "SUBNET4_PREFIX_PREFIX_SUBNET4_SUFFIX=182.168.0.1\n" + "SUBNET4_PREFIX_PREFIX_LEN_SUBNET4_SUFFIX=2\n"; + EXPECT_EQ(expected, join(vars)); +} + +/// @brief Tests the extractSubnet6 method works as expected. +TEST(RunScript, extractSubnet6) { + ProcessEnvVars vars; + Subnet6Ptr subnet6; + RunScriptImpl::extractSubnet6(vars, subnet6, "SUBNET6_PREFIX", "_SUBNET6_SUFFIX"); + ASSERT_EQ(4, vars.size()); + string expected = "SUBNET6_PREFIX_ID_SUBNET6_SUFFIX=\n" + "SUBNET6_PREFIX_NAME_SUBNET6_SUFFIX=\n" + "SUBNET6_PREFIX_PREFIX_SUBNET6_SUFFIX=\n" + "SUBNET6_PREFIX_PREFIX_LEN_SUBNET6_SUFFIX=\n"; + EXPECT_EQ(expected, join(vars)); + vars.clear(); + subnet6 = generateSubnet6(); + RunScriptImpl::extractSubnet6(vars, subnet6, "SUBNET6_PREFIX", "_SUBNET6_SUFFIX"); + ASSERT_EQ(4, vars.size()); + expected = "SUBNET6_PREFIX_ID_SUBNET6_SUFFIX=7\n" + "SUBNET6_PREFIX_NAME_SUBNET6_SUFFIX=2003:db8::1/2\n" + "SUBNET6_PREFIX_PREFIX_SUBNET6_SUFFIX=2003:db8::1\n" + "SUBNET6_PREFIX_PREFIX_LEN_SUBNET6_SUFFIX=2\n"; + EXPECT_EQ(expected, join(vars)); +} + +/// @brief Tests the extractLease4 method works as expected. +TEST(RunScript, extractLease4) { + ProcessEnvVars vars; + Lease4Ptr lease4; + RunScriptImpl::extractLease4(vars, lease4, "LEASE4_PREFIX", "_LEASE4_SUFFIX"); + ASSERT_EQ(9, vars.size()); + string expected = "LEASE4_PREFIX_ADDRESS_LEASE4_SUFFIX=\n" + "LEASE4_PREFIX_CLTT_LEASE4_SUFFIX=\n" + "LEASE4_PREFIX_HOSTNAME_LEASE4_SUFFIX=\n" + "LEASE4_PREFIX_HWADDR_LEASE4_SUFFIX=\n" + "LEASE4_PREFIX_HWADDR_TYPE_LEASE4_SUFFIX=\n" + "LEASE4_PREFIX_STATE_LEASE4_SUFFIX=\n" + "LEASE4_PREFIX_SUBNET_ID_LEASE4_SUFFIX=\n" + "LEASE4_PREFIX_VALID_LIFETIME_LEASE4_SUFFIX=\n" + "LEASE4_PREFIX_CLIENT_ID_LEASE4_SUFFIX=\n"; + EXPECT_EQ(expected, join(vars)); + vars.clear(); + lease4 = generateLease4(); + RunScriptImpl::extractLease4(vars, lease4, "LEASE4_PREFIX", "_LEASE4_SUFFIX"); + ASSERT_EQ(9, vars.size()); + expected = "LEASE4_PREFIX_ADDRESS_LEASE4_SUFFIX=192.168.0.1\n" + "LEASE4_PREFIX_CLTT_LEASE4_SUFFIX=3\n" + "LEASE4_PREFIX_HOSTNAME_LEASE4_SUFFIX=test.hostname\n" + "LEASE4_PREFIX_HWADDR_LEASE4_SUFFIX=00:01:02:03\n" + "LEASE4_PREFIX_HWADDR_TYPE_LEASE4_SUFFIX=1\n" + "LEASE4_PREFIX_STATE_LEASE4_SUFFIX=default\n" + "LEASE4_PREFIX_SUBNET_ID_LEASE4_SUFFIX=4\n" + "LEASE4_PREFIX_VALID_LIFETIME_LEASE4_SUFFIX=2\n" + "LEASE4_PREFIX_CLIENT_ID_LEASE4_SUFFIX=00:01:02:03:04:05:06\n"; + EXPECT_EQ(expected, join(vars)); +} + +/// @brief Tests the extractLease6 method works as expected. +TEST(RunScript, extractLease6) { + ProcessEnvVars vars; + Lease6Ptr lease6; + RunScriptImpl::extractLease6(vars, lease6, "LEASE6_PREFIX", "_LEASE6_SUFFIX"); + ASSERT_EQ(13, vars.size()); + string expected = "LEASE6_PREFIX_ADDRESS_LEASE6_SUFFIX=\n" + "LEASE6_PREFIX_CLTT_LEASE6_SUFFIX=\n" + "LEASE6_PREFIX_HOSTNAME_LEASE6_SUFFIX=\n" + "LEASE6_PREFIX_HWADDR_LEASE6_SUFFIX=\n" + "LEASE6_PREFIX_HWADDR_TYPE_LEASE6_SUFFIX=\n" + "LEASE6_PREFIX_STATE_LEASE6_SUFFIX=\n" + "LEASE6_PREFIX_SUBNET_ID_LEASE6_SUFFIX=\n" + "LEASE6_PREFIX_VALID_LIFETIME_LEASE6_SUFFIX=\n" + "LEASE6_PREFIX_DUID_LEASE6_SUFFIX=\n" + "LEASE6_PREFIX_IAID_LEASE6_SUFFIX=\n" + "LEASE6_PREFIX_PREFERRED_LIFETIME_LEASE6_SUFFIX=\n" + "LEASE6_PREFIX_PREFIX_LEN_LEASE6_SUFFIX=\n" + "LEASE6_PREFIX_TYPE_LEASE6_SUFFIX=\n"; + EXPECT_EQ(expected, join(vars)); + vars.clear(); + lease6 = generateLease6(); + RunScriptImpl::extractLease6(vars, lease6, "LEASE6_PREFIX", "_LEASE6_SUFFIX"); + ASSERT_EQ(13, vars.size()); + expected = "LEASE6_PREFIX_ADDRESS_LEASE6_SUFFIX=2003:db8::1\n" + "LEASE6_PREFIX_CLTT_LEASE6_SUFFIX=7\n" + "LEASE6_PREFIX_HOSTNAME_LEASE6_SUFFIX=test.hostname\n" + "LEASE6_PREFIX_HWADDR_LEASE6_SUFFIX=00:01:02:03\n" + "LEASE6_PREFIX_HWADDR_TYPE_LEASE6_SUFFIX=1\n" + "LEASE6_PREFIX_STATE_LEASE6_SUFFIX=default\n" + "LEASE6_PREFIX_SUBNET_ID_LEASE6_SUFFIX=5\n" + "LEASE6_PREFIX_VALID_LIFETIME_LEASE6_SUFFIX=4\n" + "LEASE6_PREFIX_DUID_LEASE6_SUFFIX=00:01:02:03:04:05:06\n" + "LEASE6_PREFIX_IAID_LEASE6_SUFFIX=2\n" + "LEASE6_PREFIX_PREFERRED_LIFETIME_LEASE6_SUFFIX=3\n" + "LEASE6_PREFIX_PREFIX_LEN_LEASE6_SUFFIX=128\n" + "LEASE6_PREFIX_TYPE_LEASE6_SUFFIX=IA_NA\n"; + EXPECT_EQ(expected, join(vars)); +} + +/// @brief Tests the extractLeases4 method works as expected. +TEST(RunScript, extractLeases4) { + ProcessEnvVars vars; + Lease4CollectionPtr leases4; + RunScriptImpl::extractLeases4(vars, leases4, "LEASES4_PREFIX", "_LEASES4_SUFFIX"); + ASSERT_EQ(1, vars.size()); + string expected = "LEASES4_PREFIX_SIZE_LEASES4_SUFFIX=0\n"; + EXPECT_EQ(expected, join(vars)); + vars.clear(); + leases4.reset(new Lease4Collection()); + leases4->push_back(generateLease4()); + leases4->push_back(generateLease4()); + RunScriptImpl::extractLeases4(vars, leases4, "LEASES4_PREFIX", "_LEASES4_SUFFIX"); + ASSERT_EQ(19, vars.size()); + expected = "LEASES4_PREFIX_SIZE_LEASES4_SUFFIX=2\n" + "LEASES4_PREFIX_AT0_ADDRESS_LEASES4_SUFFIX=192.168.0.1\n" + "LEASES4_PREFIX_AT0_CLTT_LEASES4_SUFFIX=3\n" + "LEASES4_PREFIX_AT0_HOSTNAME_LEASES4_SUFFIX=test.hostname\n" + "LEASES4_PREFIX_AT0_HWADDR_LEASES4_SUFFIX=00:01:02:03\n" + "LEASES4_PREFIX_AT0_HWADDR_TYPE_LEASES4_SUFFIX=1\n" + "LEASES4_PREFIX_AT0_STATE_LEASES4_SUFFIX=default\n" + "LEASES4_PREFIX_AT0_SUBNET_ID_LEASES4_SUFFIX=4\n" + "LEASES4_PREFIX_AT0_VALID_LIFETIME_LEASES4_SUFFIX=2\n" + "LEASES4_PREFIX_AT0_CLIENT_ID_LEASES4_SUFFIX=00:01:02:03:04:05:06\n" + "LEASES4_PREFIX_AT1_ADDRESS_LEASES4_SUFFIX=192.168.0.1\n" + "LEASES4_PREFIX_AT1_CLTT_LEASES4_SUFFIX=3\n" + "LEASES4_PREFIX_AT1_HOSTNAME_LEASES4_SUFFIX=test.hostname\n" + "LEASES4_PREFIX_AT1_HWADDR_LEASES4_SUFFIX=00:01:02:03\n" + "LEASES4_PREFIX_AT1_HWADDR_TYPE_LEASES4_SUFFIX=1\n" + "LEASES4_PREFIX_AT1_STATE_LEASES4_SUFFIX=default\n" + "LEASES4_PREFIX_AT1_SUBNET_ID_LEASES4_SUFFIX=4\n" + "LEASES4_PREFIX_AT1_VALID_LIFETIME_LEASES4_SUFFIX=2\n" + "LEASES4_PREFIX_AT1_CLIENT_ID_LEASES4_SUFFIX=00:01:02:03:04:05:06\n"; + EXPECT_EQ(expected, join(vars)); +} + +/// @brief Tests the extractLeases6 method works as expected. +TEST(RunScript, extractLeases6) { + ProcessEnvVars vars; + Lease6CollectionPtr leases6; + RunScriptImpl::extractLeases6(vars, leases6, "LEASES6_PREFIX", "_LEASES6_SUFFIX"); + ASSERT_EQ(1, vars.size()); + string expected = "LEASES6_PREFIX_SIZE_LEASES6_SUFFIX=0\n"; + EXPECT_EQ(expected, join(vars)); + vars.clear(); + leases6.reset(new Lease6Collection()); + leases6->push_back(generateLease6()); + leases6->push_back(generateLease6()); + RunScriptImpl::extractLeases6(vars, leases6, "LEASES6_PREFIX", "_LEASES6_SUFFIX"); + ASSERT_EQ(27, vars.size()); + expected = "LEASES6_PREFIX_SIZE_LEASES6_SUFFIX=2\n" + "LEASES6_PREFIX_AT0_ADDRESS_LEASES6_SUFFIX=2003:db8::1\n" + "LEASES6_PREFIX_AT0_CLTT_LEASES6_SUFFIX=7\n" + "LEASES6_PREFIX_AT0_HOSTNAME_LEASES6_SUFFIX=test.hostname\n" + "LEASES6_PREFIX_AT0_HWADDR_LEASES6_SUFFIX=00:01:02:03\n" + "LEASES6_PREFIX_AT0_HWADDR_TYPE_LEASES6_SUFFIX=1\n" + "LEASES6_PREFIX_AT0_STATE_LEASES6_SUFFIX=default\n" + "LEASES6_PREFIX_AT0_SUBNET_ID_LEASES6_SUFFIX=5\n" + "LEASES6_PREFIX_AT0_VALID_LIFETIME_LEASES6_SUFFIX=4\n" + "LEASES6_PREFIX_AT0_DUID_LEASES6_SUFFIX=00:01:02:03:04:05:06\n" + "LEASES6_PREFIX_AT0_IAID_LEASES6_SUFFIX=2\n" + "LEASES6_PREFIX_AT0_PREFERRED_LIFETIME_LEASES6_SUFFIX=3\n" + "LEASES6_PREFIX_AT0_PREFIX_LEN_LEASES6_SUFFIX=128\n" + "LEASES6_PREFIX_AT0_TYPE_LEASES6_SUFFIX=IA_NA\n" + "LEASES6_PREFIX_AT1_ADDRESS_LEASES6_SUFFIX=2003:db8::1\n" + "LEASES6_PREFIX_AT1_CLTT_LEASES6_SUFFIX=7\n" + "LEASES6_PREFIX_AT1_HOSTNAME_LEASES6_SUFFIX=test.hostname\n" + "LEASES6_PREFIX_AT1_HWADDR_LEASES6_SUFFIX=00:01:02:03\n" + "LEASES6_PREFIX_AT1_HWADDR_TYPE_LEASES6_SUFFIX=1\n" + "LEASES6_PREFIX_AT1_STATE_LEASES6_SUFFIX=default\n" + "LEASES6_PREFIX_AT1_SUBNET_ID_LEASES6_SUFFIX=5\n" + "LEASES6_PREFIX_AT1_VALID_LIFETIME_LEASES6_SUFFIX=4\n" + "LEASES6_PREFIX_AT1_DUID_LEASES6_SUFFIX=00:01:02:03:04:05:06\n" + "LEASES6_PREFIX_AT1_IAID_LEASES6_SUFFIX=2\n" + "LEASES6_PREFIX_AT1_PREFERRED_LIFETIME_LEASES6_SUFFIX=3\n" + "LEASES6_PREFIX_AT1_PREFIX_LEN_LEASES6_SUFFIX=128\n" + "LEASES6_PREFIX_AT1_TYPE_LEASES6_SUFFIX=IA_NA\n"; + EXPECT_EQ(expected, join(vars)); +} + +/// @brief Tests the extractPkt4 method works as expected. +TEST(RunScript, extractPkt4) { + ProcessEnvVars vars; + Pkt4Ptr pkt4; + RunScriptImpl::extractPkt4(vars, pkt4, "PKT4_PREFIX", "_PKT4_SUFFIX"); + ASSERT_EQ(22, vars.size()); + string expected = "PKT4_PREFIX_TYPE_PKT4_SUFFIX=\n" + "PKT4_PREFIX_TXID_PKT4_SUFFIX=\n" + "PKT4_PREFIX_LOCAL_ADDR_PKT4_SUFFIX=\n" + "PKT4_PREFIX_LOCAL_PORT_PKT4_SUFFIX=\n" + "PKT4_PREFIX_REMOTE_ADDR_PKT4_SUFFIX=\n" + "PKT4_PREFIX_REMOTE_PORT_PKT4_SUFFIX=\n" + "PKT4_PREFIX_IFACE_INDEX_PKT4_SUFFIX=\n" + "PKT4_PREFIX_IFACE_NAME_PKT4_SUFFIX=\n" + "PKT4_PREFIX_HOPS_PKT4_SUFFIX=\n" + "PKT4_PREFIX_SECS_PKT4_SUFFIX=\n" + "PKT4_PREFIX_FLAGS_PKT4_SUFFIX=\n" + "PKT4_PREFIX_CIADDR_PKT4_SUFFIX=\n" + "PKT4_PREFIX_SIADDR_PKT4_SUFFIX=\n" + "PKT4_PREFIX_YIADDR_PKT4_SUFFIX=\n" + "PKT4_PREFIX_GIADDR_PKT4_SUFFIX=\n" + "PKT4_PREFIX_RELAYED_PKT4_SUFFIX=\n" + "PKT4_PREFIX_HWADDR_PKT4_SUFFIX=\n" + "PKT4_PREFIX_HWADDR_TYPE_PKT4_SUFFIX=\n" + "PKT4_PREFIX_LOCAL_HWADDR_PKT4_SUFFIX=\n" + "PKT4_PREFIX_LOCAL_HWADDR_TYPE_PKT4_SUFFIX=\n" + "PKT4_PREFIX_REMOTE_HWADDR_PKT4_SUFFIX=\n" + "PKT4_PREFIX_REMOTE_HWADDR_TYPE_PKT4_SUFFIX=\n"; + EXPECT_EQ(expected, join(vars)); + vars.clear(); + pkt4 = generatePkt4(); + RunScriptImpl::extractPkt4(vars, pkt4, "PKT4_PREFIX", "_PKT4_SUFFIX"); + ASSERT_EQ(25, vars.size()); + expected = "PKT4_PREFIX_TYPE_PKT4_SUFFIX=UNKNOWN\n" + "PKT4_PREFIX_TXID_PKT4_SUFFIX=0\n" + "PKT4_PREFIX_LOCAL_ADDR_PKT4_SUFFIX=0.0.0.0\n" + "PKT4_PREFIX_LOCAL_PORT_PKT4_SUFFIX=67\n" + "PKT4_PREFIX_REMOTE_ADDR_PKT4_SUFFIX=0.0.0.0\n" + "PKT4_PREFIX_REMOTE_PORT_PKT4_SUFFIX=68\n" + "PKT4_PREFIX_IFACE_INDEX_PKT4_SUFFIX=2\n" + "PKT4_PREFIX_IFACE_NAME_PKT4_SUFFIX=eth1\n" + "PKT4_PREFIX_HOPS_PKT4_SUFFIX=0\n" + "PKT4_PREFIX_SECS_PKT4_SUFFIX=0\n" + "PKT4_PREFIX_FLAGS_PKT4_SUFFIX=0\n" + "PKT4_PREFIX_CIADDR_PKT4_SUFFIX=0.0.0.0\n" + "PKT4_PREFIX_SIADDR_PKT4_SUFFIX=0.0.0.0\n" + "PKT4_PREFIX_YIADDR_PKT4_SUFFIX=0.0.0.0\n" + "PKT4_PREFIX_GIADDR_PKT4_SUFFIX=0.0.0.0\n" + "PKT4_PREFIX_RELAYED_PKT4_SUFFIX=false\n" + "PKT4_PREFIX_HWADDR_PKT4_SUFFIX=00:01:02:03\n" + "PKT4_PREFIX_HWADDR_TYPE_PKT4_SUFFIX=1\n" + "PKT4_PREFIX_LOCAL_HWADDR_PKT4_SUFFIX=00:01:02:03\n" + "PKT4_PREFIX_LOCAL_HWADDR_TYPE_PKT4_SUFFIX=1\n" + "PKT4_PREFIX_REMOTE_HWADDR_PKT4_SUFFIX=00:01:02:03\n" + "PKT4_PREFIX_REMOTE_HWADDR_TYPE_PKT4_SUFFIX=1\n" + "PKT4_PREFIX_OPTION_82_PKT4_SUFFIX=0x0105686F776479020587F67977EF06061A2B3C4D5E6F\n" + "PKT4_PREFIX_OPTION_82_SUB_OPTION_1_PKT4_SUFFIX=0x686F776479\n" + "PKT4_PREFIX_OPTION_82_SUB_OPTION_2_PKT4_SUFFIX=0x87F67977EF\n"; + EXPECT_EQ(expected, join(vars)); +} + +/// @brief Tests the extractPkt6 method works as expected. +TEST(RunScript, extractPkt6) { + ProcessEnvVars vars; + Pkt6Ptr pkt6; + RunScriptImpl::extractPkt6(vars, pkt6, "PKT6_PREFIX", "_PKT6_SUFFIX"); + ASSERT_EQ(12, vars.size()); + string expected = "PKT6_PREFIX_TYPE_PKT6_SUFFIX=\n" + "PKT6_PREFIX_TXID_PKT6_SUFFIX=\n" + "PKT6_PREFIX_LOCAL_ADDR_PKT6_SUFFIX=\n" + "PKT6_PREFIX_LOCAL_PORT_PKT6_SUFFIX=\n" + "PKT6_PREFIX_REMOTE_ADDR_PKT6_SUFFIX=\n" + "PKT6_PREFIX_REMOTE_PORT_PKT6_SUFFIX=\n" + "PKT6_PREFIX_IFACE_INDEX_PKT6_SUFFIX=\n" + "PKT6_PREFIX_IFACE_NAME_PKT6_SUFFIX=\n" + "PKT6_PREFIX_REMOTE_HWADDR_PKT6_SUFFIX=\n" + "PKT6_PREFIX_REMOTE_HWADDR_TYPE_PKT6_SUFFIX=\n" + "PKT6_PREFIX_PROTO_PKT6_SUFFIX=\n" + "PKT6_PREFIX_CLIENT_ID_PKT6_SUFFIX=\n"; + EXPECT_EQ(expected, join(vars)); + vars.clear(); + pkt6 = generatePkt6(); + RunScriptImpl::extractPkt6(vars, pkt6, "PKT6_PREFIX", "_PKT6_SUFFIX"); + ASSERT_EQ(12, vars.size()); + expected = "PKT6_PREFIX_TYPE_PKT6_SUFFIX=UNKNOWN\n" + "PKT6_PREFIX_TXID_PKT6_SUFFIX=0\n" + "PKT6_PREFIX_LOCAL_ADDR_PKT6_SUFFIX=ff02::1:2\n" + "PKT6_PREFIX_LOCAL_PORT_PKT6_SUFFIX=0\n" + "PKT6_PREFIX_REMOTE_ADDR_PKT6_SUFFIX=fe80::21e:8cff:fe9b:7349\n" + "PKT6_PREFIX_REMOTE_PORT_PKT6_SUFFIX=546\n" + "PKT6_PREFIX_IFACE_INDEX_PKT6_SUFFIX=2\n" + "PKT6_PREFIX_IFACE_NAME_PKT6_SUFFIX=eth1\n" + "PKT6_PREFIX_REMOTE_HWADDR_PKT6_SUFFIX=00:01:02:03\n" + "PKT6_PREFIX_REMOTE_HWADDR_TYPE_PKT6_SUFFIX=1\n" + "PKT6_PREFIX_PROTO_PKT6_SUFFIX=UDP\n" + "PKT6_PREFIX_CLIENT_ID_PKT6_SUFFIX=00:01:02:03:04:05:06\n"; + EXPECT_EQ(expected, join(vars)); +} + +class RunScriptTest : public ::testing::Test { +public: + + /// @brief Constructor. + RunScriptTest() : + co_manager_(new CalloutManager(1)), io_service_(new IOService()) { + RunScriptImpl::setIOService(io_service_); + clearLogFile(); + } + + /// @brief Destructor. + ~RunScriptTest() { + RunScriptImpl::setIOService(IOServicePtr()); + clearLogFile(); + } + + /// @brief Clear the test file if it exists. + void clearLogFile() { + ::remove(TEST_LOG_FILE); + } + + void checkScriptResult() { + ifstream test_log; + vector<string> extracted_lines; + time_t now(time(NULL)); + while (true) { + test_log.open(TEST_LOG_FILE); + if (!test_log.fail()) { + string line; + while (getline(test_log, line)) { + extracted_lines.push_back(line) ; + } + test_log.close(); + break; + } + ASSERT_LT(time(NULL), now + 3) << "timeout"; + usleep(100000); + } + ASSERT_EQ(join(extracted_lines), "SUCCESS\n"); + } + + /// @brief Fetches the callout manager instance. + boost::shared_ptr<CalloutManager>getCalloutManager() { + return (co_manager_); + } + +private: + /// @brief Callout manager accessed by this CalloutHandle. + boost::shared_ptr<CalloutManager> co_manager_; + + /// @brief IOService instance to process IO. + isc::asiolink::IOServicePtr io_service_; +}; + +TEST_F(RunScriptTest, lease4Renew) { + impl.reset(new RunScriptImpl()); + impl->setName(RUN_SCRIPT_TEST_SH); + CalloutHandle handle(getCalloutManager()); + Pkt4Ptr pkt4 = generatePkt4(); + handle.setArgument("query4", pkt4); + Subnet4Ptr subnet4 = generateSubnet4(); + handle.setArgument("subnet4", subnet4); + ClientIdPtr clientid = generateDUID(); + handle.setArgument("clientid", clientid); + HWAddrPtr hwaddr = generateHWAddr(); + handle.setArgument("hwaddr", hwaddr); + Lease4Ptr lease4 = generateLease4(); + handle.setArgument("lease4", lease4); + int ret; + ASSERT_NO_THROW(ret = lease4_renew(handle)); + EXPECT_EQ(0, ret); + checkScriptResult(); +} + +TEST_F(RunScriptTest, lease4Expire) { + impl.reset(new RunScriptImpl()); + impl->setName(RUN_SCRIPT_TEST_SH); + CalloutHandle handle(getCalloutManager()); + Lease4Ptr lease4 = generateLease4(); + handle.setArgument("lease4", lease4); + bool remove_lease = true; + handle.setArgument("remove_lease", remove_lease); + int ret; + ASSERT_NO_THROW(ret = lease4_expire(handle)); + EXPECT_EQ(0, ret); + checkScriptResult(); +} + +TEST_F(RunScriptTest, lease4Recover) { + impl.reset(new RunScriptImpl()); + impl->setName(RUN_SCRIPT_TEST_SH); + CalloutHandle handle(getCalloutManager()); + Lease4Ptr lease4 = generateLease4(); + handle.setArgument("lease4", lease4); + int ret; + ASSERT_NO_THROW(ret = lease4_recover(handle)); + EXPECT_EQ(0, ret); + checkScriptResult(); +} + +TEST_F(RunScriptTest, lease4Committed) { + impl.reset(new RunScriptImpl()); + impl->setName(RUN_SCRIPT_TEST_SH); + CalloutHandle handle(getCalloutManager()); + Pkt4Ptr pkt4 = generatePkt4(); + handle.setArgument("query4", pkt4); + Lease4CollectionPtr leases4; + leases4.reset(new Lease4Collection()); + leases4->push_back(Lease4Ptr()); + leases4->push_back(generateLease4()); + handle.setArgument("leases4", leases4); + Lease4CollectionPtr deleted_leases4; + deleted_leases4.reset(new Lease4Collection()); + deleted_leases4->push_back(generateLease4()); + deleted_leases4->push_back(Lease4Ptr()); + handle.setArgument("deleted_leases4", deleted_leases4); + int ret; + ASSERT_NO_THROW(ret = leases4_committed(handle)); + EXPECT_EQ(0, ret); + checkScriptResult(); +} + +TEST_F(RunScriptTest, lease4Release) { + impl.reset(new RunScriptImpl()); + impl->setName(RUN_SCRIPT_TEST_SH); + CalloutHandle handle(getCalloutManager()); + Pkt4Ptr pkt4 = generatePkt4(); + handle.setArgument("query4", pkt4); + Lease4Ptr lease4 = generateLease4(); + handle.setArgument("lease4", lease4); + int ret; + ASSERT_NO_THROW(ret = lease4_release(handle)); + EXPECT_EQ(0, ret); + checkScriptResult(); +} + +TEST_F(RunScriptTest, lease4Decline) { + impl.reset(new RunScriptImpl()); + impl->setName(RUN_SCRIPT_TEST_SH); + CalloutHandle handle(getCalloutManager()); + Pkt4Ptr pkt4 = generatePkt4(); + handle.setArgument("query4", pkt4); + Lease4Ptr lease4 = generateLease4(); + handle.setArgument("lease4", lease4); + int ret; + ASSERT_NO_THROW(ret = lease4_decline(handle)); + EXPECT_EQ(0, ret); + checkScriptResult(); +} + +TEST_F(RunScriptTest, lease6Renew) { + impl.reset(new RunScriptImpl()); + impl->setName(RUN_SCRIPT_TEST_SH); + CalloutHandle handle(getCalloutManager()); + Pkt6Ptr pkt6 = generatePkt6(); + handle.setArgument("query6", pkt6); + Lease6Ptr lease6 = generateLease6(); + handle.setArgument("lease6", lease6); + Option6IAPtr option6IA = generateOptionIA(); + handle.setArgument("ia_na", option6IA); + int ret; + ASSERT_NO_THROW(ret = lease6_renew(handle)); + EXPECT_EQ(0, ret); + checkScriptResult(); +} + +TEST_F(RunScriptTest, lease6Rebind) { + impl.reset(new RunScriptImpl()); + impl->setName(RUN_SCRIPT_TEST_SH); + CalloutHandle handle(getCalloutManager()); + Pkt6Ptr pkt6 = generatePkt6(); + handle.setArgument("query6", pkt6); + Lease6Ptr lease6 = generateLease6(); + handle.setArgument("lease6", lease6); + Option6IAPtr option6IA = generateOptionIA(); + handle.setArgument("ia_na", option6IA); + int ret; + ASSERT_NO_THROW(ret = lease6_rebind(handle)); + EXPECT_EQ(0, ret); + checkScriptResult(); +} + +TEST_F(RunScriptTest, lease6Expire) { + impl.reset(new RunScriptImpl()); + impl->setName(RUN_SCRIPT_TEST_SH); + CalloutHandle handle(getCalloutManager()); + Lease6Ptr lease6 = generateLease6(); + handle.setArgument("lease6", lease6); + bool remove_lease = true; + handle.setArgument("remove_lease", remove_lease); + int ret; + ASSERT_NO_THROW(ret = lease6_expire(handle)); + EXPECT_EQ(0, ret); + checkScriptResult(); +} + +TEST_F(RunScriptTest, lease6Recover) { + impl.reset(new RunScriptImpl()); + impl->setName(RUN_SCRIPT_TEST_SH); + CalloutHandle handle(getCalloutManager()); + Lease6Ptr lease6 = generateLease6(); + handle.setArgument("lease6", lease6); + int ret; + ASSERT_NO_THROW(ret = lease6_recover(handle)); + EXPECT_EQ(0, ret); + checkScriptResult(); +} + +TEST_F(RunScriptTest, lease6Committed) { + impl.reset(new RunScriptImpl()); + impl->setName(RUN_SCRIPT_TEST_SH); + CalloutHandle handle(getCalloutManager()); + Pkt6Ptr pkt6 = generatePkt6(); + handle.setArgument("query6", pkt6); + Lease6CollectionPtr leases6; + leases6.reset(new Lease6Collection()); + leases6->push_back(Lease6Ptr()); + leases6->push_back(generateLease6()); + handle.setArgument("leases6", leases6); + Lease6CollectionPtr deleted_leases6; + deleted_leases6.reset(new Lease6Collection()); + deleted_leases6->push_back(generateLease6()); + deleted_leases6->push_back(Lease6Ptr()); + handle.setArgument("deleted_leases6", deleted_leases6); + int ret; + ASSERT_NO_THROW(ret = leases6_committed(handle)); + EXPECT_EQ(0, ret); + checkScriptResult(); +} + +TEST_F(RunScriptTest, lease6Release) { + impl.reset(new RunScriptImpl()); + impl->setName(RUN_SCRIPT_TEST_SH); + CalloutHandle handle(getCalloutManager()); + Pkt6Ptr pkt6 = generatePkt6(); + handle.setArgument("query6", pkt6); + Lease6Ptr lease6 = generateLease6(); + handle.setArgument("lease6", lease6); + int ret; + ASSERT_NO_THROW(ret = lease6_release(handle)); + EXPECT_EQ(0, ret); + checkScriptResult(); +} + +TEST_F(RunScriptTest, lease6Decline) { + impl.reset(new RunScriptImpl()); + impl->setName(RUN_SCRIPT_TEST_SH); + CalloutHandle handle(getCalloutManager()); + Pkt6Ptr pkt6 = generatePkt6(); + handle.setArgument("query6", pkt6); + Lease6Ptr lease6 = generateLease6(); + handle.setArgument("lease6", lease6); + int ret; + ASSERT_NO_THROW(ret = lease6_decline(handle)); + EXPECT_EQ(0, ret); + checkScriptResult(); +} + +} // end of anonymous namespace diff --git a/src/hooks/dhcp/run_script/tests/run_unittests.cc b/src/hooks/dhcp/run_script/tests/run_unittests.cc new file mode 100644 index 0000000..1b4d40c --- /dev/null +++ b/src/hooks/dhcp/run_script/tests/run_unittests.cc @@ -0,0 +1,19 @@ +// Copyright (C) 2021 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include <config.h> + +#include <log/logger_support.h> +#include <gtest/gtest.h> + +int +main(int argc, char* argv[]) { + ::testing::InitGoogleTest(&argc, argv); + isc::log::initLogger(); + int result = RUN_ALL_TESTS(); + + return (result); +} diff --git a/src/hooks/dhcp/run_script/version.cc b/src/hooks/dhcp/run_script/version.cc new file mode 100644 index 0000000..a5b8d8c --- /dev/null +++ b/src/hooks/dhcp/run_script/version.cc @@ -0,0 +1,17 @@ +// Copyright (C) 2021 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include <config.h> +#include <hooks/hooks.h> + +extern "C" { + +/// @brief returns Kea hooks version. +int version() { + return (KEA_HOOKS_VERSION); +} + +} |