From: Tomek Mrugalski Date: Wed, 25 Jun 2014 12:15:49 +0000 (+0200) Subject: [3413] Changes after review: X-Git-Tag: trac3473_base~11^2~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0365f657ceac104f373fe4af91736183709391dd;p=thirdparty%2Fkea.git [3413] Changes after review: - dhcp6_test.py removed - src/lib/testuitls/testdata/*.wire files are now in repo, no longer need python3 script to generate - src/lib/cc/proto_defs.h added to repo, no longer autogenerated - Added comment to get-rdatacode.py - removed LIBRARY_PATH_PLACEHOLDER hacks from several Makefiles. - ChangeLog entry added. --- diff --git a/ChangeLog b/ChangeLog index d2ee0fe725..ce03b9c4ef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +7XX. [build] tomek + Removed a lot of remaining BIND10 framework: bind10, bindctl, + cfgmgr, cmdctl, msgq, stats, sysinfo, tests, usermgr from src/bin + directory, also src/lib/python directory. There are still some + components that require Python3, but they are expected to be + removed in the near future. + (Trac #3413, git abcd) + 788. [func] tomek DHCPv4 server: New parameter added to configure.ac: --with-kea-config. It allows selecting configuration backend and accepts one of two diff --git a/src/bin/d2/tests/Makefile.am b/src/bin/d2/tests/Makefile.am index 35a80b0afa..9a95e44c12 100644 --- a/src/bin/d2/tests/Makefile.am +++ b/src/bin/d2/tests/Makefile.am @@ -1,11 +1,3 @@ -# Explicitly specify paths to dynamic libraries required by loadable python -# modules. That is required on Mac OS systems. Otherwise we will get exception -# about python not being able to load liblog library. -LIBRARY_PATH_PLACEHOLDER = -if SET_ENV_LIBRARY_PATH -LIBRARY_PATH_PLACEHOLDER += $(ENV_LIBRARY_PATH)=$(abs_top_builddir)/src/lib/cryptolink/.libs:$(abs_top_builddir)/src/lib/dns/.libs:$(abs_top_builddir)/src/lib/dns/python/.libs:$(abs_top_builddir)/src/lib/cc/.libs:$(abs_top_builddir)/src/lib/config/.libs:$(abs_top_builddir)/src/lib/log/.libs:$(abs_top_builddir)/src/lib/util/.libs:$(abs_top_builddir)/src/lib/util/threads/.libs:$(abs_top_builddir)/src/lib/exceptions/.libs:$(abs_top_builddir)/src/lib/util/io/.libs:$(abs_top_builddir)/src/lib/datasrc/.libs:$$$(ENV_LIBRARY_PATH) -endif - AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib AM_CPPFLAGS += -I$(top_builddir)/src/bin # for generated spec_config.h header AM_CPPFLAGS += -I$(top_srcdir)/src/bin diff --git a/src/bin/d2/tests/d2_test.py b/src/bin/d2/tests/d2_test.py deleted file mode 100644 index 7548672941..0000000000 --- a/src/bin/d2/tests/d2_test.py +++ /dev/null @@ -1,168 +0,0 @@ -# Copyright (C) 2013 Internet Systems Consortium. -# -# Permission to use, copy, modify, and distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SYSTEMS CONSORTIUM -# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL -# INTERNET SYSTEMS CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING -# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, -# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION -# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -from init import ProcessInfo, parse_args, dump_pid, unlink_pid_file, _BASETIME - -import unittest -import sys -import os -import signal -import socket -from isc.net.addr import IPAddr -import time -import isc -import fcntl - -class TestD2Daemon(unittest.TestCase): - def setUp(self): - # Don't redirect stdout/stderr here as we want to print out things - # during the test - # - # However, we do want to set the logging lock directory to somewhere - # to which we can write - use the current working directory. We then - # set the appropriate environment variable. os.putenv() may be not - # supported on some platforms as suggested in - # http://docs.python.org/release/3.2/library/os.html?highlight=putenv#os.environ: - # "If the platform supports the putenv() function...". It was checked - # that it does not work on Ubuntu. To overcome this problem we access - # os.environ directly. - lockdir_envvar = "B10_LOCKFILE_DIR_FROM_BUILD" - if lockdir_envvar not in os.environ: - os.environ[lockdir_envvar] = os.getcwd() - - def tearDown(self): - pass - - def readPipe(self, pipe_fd): - """ - Reads bytes from a pipe and returns a character string. If nothing is - read, or if there is an error, an empty string is returned. - - pipe_fd - Pipe file descriptor to read - """ - try: - data = os.read(pipe_fd, 16384) - # Make sure we have a string - if (data is None): - data = "" - else: - data = str(data) - except OSError: - data = "" - - return data - - def runCommand(self, params, wait=1): - """ - This method runs a command and returns a tuple: (returncode, stdout, stderr) - """ - ## @todo: Convert this into generic method and reuse it in dhcp4 and dhcp6 - - print("Running command: %s" % (" ".join(params))) - - # redirect stdout to a pipe so we can check that our - # process spawning is doing the right thing with stdout - self.stdout_old = os.dup(sys.stdout.fileno()) - self.stdout_pipes = os.pipe() - os.dup2(self.stdout_pipes[1], sys.stdout.fileno()) - os.close(self.stdout_pipes[1]) - - # do the same trick for stderr: - self.stderr_old = os.dup(sys.stderr.fileno()) - self.stderr_pipes = os.pipe() - os.dup2(self.stderr_pipes[1], sys.stderr.fileno()) - os.close(self.stderr_pipes[1]) - - # note that we use dup2() to restore the original stdout - # to the main program ASAP in each test... this prevents - # hangs reading from the child process (as the pipe is only - # open in the child), and also insures nice pretty output - - pi = ProcessInfo('Test Process', params) - pi.spawn() - time.sleep(wait) - os.dup2(self.stdout_old, sys.stdout.fileno()) - os.dup2(self.stderr_old, sys.stderr.fileno()) - self.assertNotEqual(pi.process, None) - self.assertTrue(type(pi.pid) is int) - - # Set non-blocking read on pipes. Process may not print anything - # on specific output and the we would hang without this. - fd = self.stdout_pipes[0] - fl = fcntl.fcntl(fd, fcntl.F_GETFL) - fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NONBLOCK) - - fd = self.stderr_pipes[0] - fl = fcntl.fcntl(fd, fcntl.F_GETFL) - fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NONBLOCK) - - # As we don't know how long the subprocess will take to start and - # produce output, we'll loop and sleep for 250 ms between each - # iteration. To avoid an infinite loop, we'll loop for a maximum - # of five seconds: that should be enough. - for count in range(20): - # Read something from stderr and stdout (these reads don't block). - output = self.readPipe(self.stdout_pipes[0]) - error = self.readPipe(self.stderr_pipes[0]) - - # If the process has already exited, or if it has output something, - # quit the loop now. - if pi.process.poll() is not None or len(error) > 0 or len(output) > 0: - break - - # Process still running, try again in 250 ms. - time.sleep(0.25) - - # Exited loop, kill the process if it is still running - if pi.process.poll() is None: - try: - pi.process.terminate() - except OSError: - print("Ignoring failed kill attempt. Process is dead already.") - - # call this to get returncode, process should be dead by now - rc = pi.process.wait() - - # Clean up our stdout/stderr munging. - os.dup2(self.stdout_old, sys.stdout.fileno()) - os.close(self.stdout_old) - os.close(self.stdout_pipes[0]) - - os.dup2(self.stderr_old, sys.stderr.fileno()) - os.close(self.stderr_old) - os.close(self.stderr_pipes[0]) - - # Free up resources (file descriptors) from the ProcessInfo object - # TODO: For some reason, this gives an error if the process has ended, - # although it does cause all descriptors still allocated to the - # object to be freed. - pi = None - - print ("Process finished, return code=%d, stdout=%d bytes, stderr=%d bytes" - % (rc, len(output), len(error)) ) - - return (rc, output, error) - - def test_alive(self): - print("Note: Simple test to verify that D2 server can be started.") - # note that "-s" for stand alone is necessary in order to flush the log output - # soon enough to catch it. - (returncode, output, error) = self.runCommand(["../b10-dhcp-ddns", - "-s", "-v"]) - output_text = str(output) + str(error) - self.assertEqual(output_text.count("DCTL_STARTING"), 1) - -if __name__ == '__main__': - unittest.main() diff --git a/src/bin/dhcp4/tests/Makefile.am b/src/bin/dhcp4/tests/Makefile.am index 67b849e2d2..70fac63944 100644 --- a/src/bin/dhcp4/tests/Makefile.am +++ b/src/bin/dhcp4/tests/Makefile.am @@ -1,12 +1,3 @@ - -# Explicitly specify paths to dynamic libraries required by loadable python -# modules. That is required on Mac OS systems. Otherwise we will get exception -# about python not being able to load liblog library. -LIBRARY_PATH_PLACEHOLDER = -if SET_ENV_LIBRARY_PATH -LIBRARY_PATH_PLACEHOLDER += $(ENV_LIBRARY_PATH)=$(abs_top_builddir)/src/lib/cryptolink/.libs:$(abs_top_builddir)/src/lib/dns/.libs:$(abs_top_builddir)/src/lib/dns/python/.libs:$(abs_top_builddir)/src/lib/cc/.libs:$(abs_top_builddir)/src/lib/config/.libs:$(abs_top_builddir)/src/lib/log/.libs:$(abs_top_builddir)/src/lib/util/.libs:$(abs_top_builddir)/src/lib/util/threads/.libs:$(abs_top_builddir)/src/lib/exceptions/.libs:$(abs_top_builddir)/src/lib/util/io/.libs:$(abs_top_builddir)/src/lib/datasrc/.libs:$$$(ENV_LIBRARY_PATH) -endif - AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib AM_CPPFLAGS += -I$(top_builddir)/src/bin # for generated spec_config.h header AM_CPPFLAGS += -I$(top_srcdir)/src/bin diff --git a/src/bin/dhcp6/tests/Makefile.am b/src/bin/dhcp6/tests/Makefile.am index 5a7ec0de3b..b46c987331 100644 --- a/src/bin/dhcp6/tests/Makefile.am +++ b/src/bin/dhcp6/tests/Makefile.am @@ -8,14 +8,6 @@ SHTESTS += dhcp6_sigint_test.sh endif EXTRA_DIST = $(SHTESTS) dhcp6_shutdown_test.sh -# Explicitly specify paths to dynamic libraries required by loadable python -# modules. That is required on Mac OS systems. Otherwise we will get exception -# about python not being able to load liblog library. -LIBRARY_PATH_PLACEHOLDER = -if SET_ENV_LIBRARY_PATH -LIBRARY_PATH_PLACEHOLDER += $(ENV_LIBRARY_PATH)=$(abs_top_builddir)/src/lib/cryptolink/.libs:$(abs_top_builddir)/src/lib/dns/.libs:$(abs_top_builddir)/src/lib/dns/python/.libs:$(abs_top_builddir)/src/lib/cc/.libs:$(abs_top_builddir)/src/lib/config/.libs:$(abs_top_builddir)/src/lib/log/.libs:$(abs_top_builddir)/src/lib/util/.libs:$(abs_top_builddir)/src/lib/util/threads/.libs:$(abs_top_builddir)/src/lib/exceptions/.libs:$(abs_top_builddir)/src/lib/util/io/.libs:$(abs_top_builddir)/src/lib/datasrc/.libs:$$$(ENV_LIBRARY_PATH) -endif - # test using command-line arguments, so use check-local target instead of TESTS check-local: for shtest in $(SHTESTS) ; do \ diff --git a/src/bin/dhcp6/tests/dhcp6_test.py b/src/bin/dhcp6/tests/dhcp6_test.py deleted file mode 100644 index 9b4af4791e..0000000000 --- a/src/bin/dhcp6/tests/dhcp6_test.py +++ /dev/null @@ -1,214 +0,0 @@ -# copyright (C) 2011,2012 Internet Systems Consortium. -# -# Permission to use, copy, modify, and distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SYSTEMS CONSORTIUM -# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL -# INTERNET SYSTEMS CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING -# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, -# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION -# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -from init import ProcessInfo, parse_args, dump_pid, unlink_pid_file, _BASETIME - -import unittest -import sys -import os -import signal -import socket -from isc.net.addr import IPAddr -import time -import isc -import fcntl - -class TestDhcpv6Daemon(unittest.TestCase): - def setUp(self): - # Don't redirect stdout/stderr here as we want to print out things - # during the test - # - # However, we do want to set the logging lock directory to somewhere - # to which we can write - use the current working directory. We then - # set the appropriate environment variable. os.putenv() may be not - # supported on some platforms as suggested in - # http://docs.python.org/release/3.2/library/os.html?highlight=putenv#os.environ: - # "If the platform supports the putenv() function...". It was checked - # that it does not work on Ubuntu. To overcome this problem we access - # os.environ directly. - lockdir_envvar = "B10_LOCKFILE_DIR_FROM_BUILD" - if lockdir_envvar not in os.environ: - os.environ[lockdir_envvar] = os.getcwd() - - def tearDown(self): - pass - - def readPipe(self, pipe_fd): - """ - Reads bytes from a pipe and returns a character string. If nothing is - read, or if there is an error, an empty string is returned. - - pipe_fd - Pipe file descriptor to read - """ - try: - data = os.read(pipe_fd, 16384) - # Make sure we have a string - if (data is None): - data = "" - else: - data = str(data) - except OSError: - data = "" - - return data - - def runCommand(self, params, wait=1): - """ - This method runs a command and returns a tuple: (returncode, stdout, stderr) - """ - ## @todo: Convert this into generic method and reuse it in dhcp4 and dhcp6 - - print("Running command: %s" % (" ".join(params))) - - # redirect stdout to a pipe so we can check that our - # process spawning is doing the right thing with stdout - self.stdout_old = os.dup(sys.stdout.fileno()) - self.stdout_pipes = os.pipe() - os.dup2(self.stdout_pipes[1], sys.stdout.fileno()) - os.close(self.stdout_pipes[1]) - - # do the same trick for stderr: - self.stderr_old = os.dup(sys.stderr.fileno()) - self.stderr_pipes = os.pipe() - os.dup2(self.stderr_pipes[1], sys.stderr.fileno()) - os.close(self.stderr_pipes[1]) - - # note that we use dup2() to restore the original stdout - # to the main program ASAP in each test... this prevents - # hangs reading from the child process (as the pipe is only - # open in the child), and also insures nice pretty output - - pi = ProcessInfo('Test Process', params) - pi.spawn() - time.sleep(wait) - os.dup2(self.stdout_old, sys.stdout.fileno()) - os.dup2(self.stderr_old, sys.stderr.fileno()) - self.assertNotEqual(pi.process, None) - self.assertTrue(type(pi.pid) is int) - - # Set non-blocking read on pipes. Process may not print anything - # on specific output and the we would hang without this. - fd = self.stdout_pipes[0] - fl = fcntl.fcntl(fd, fcntl.F_GETFL) - fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NONBLOCK) - - fd = self.stderr_pipes[0] - fl = fcntl.fcntl(fd, fcntl.F_GETFL) - fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NONBLOCK) - - # As we don't know how long the subprocess will take to start and - # produce output, we'll loop and sleep for 250 ms between each - # iteration. To avoid an infinite loop, we'll loop for a maximum - # of five seconds: that should be enough. - for count in range(20): - # Read something from stderr and stdout (these reads don't block). - output = self.readPipe(self.stdout_pipes[0]) - error = self.readPipe(self.stderr_pipes[0]) - - # If the process has already exited, or if it has output something, - # quit the loop now. - if pi.process.poll() is not None or len(error) > 0 or len(output) > 0: - break - - # Process still running, try again in 250 ms. - time.sleep(0.25) - - # Exited loop, kill the process if it is still running - if pi.process.poll() is None: - try: - pi.process.terminate() - except OSError: - print("Ignoring failed kill attempt. Process is dead already.") - - # call this to get returncode, process should be dead by now - rc = pi.process.wait() - - # Clean up our stdout/stderr munging. - os.dup2(self.stdout_old, sys.stdout.fileno()) - os.close(self.stdout_old) - os.close(self.stdout_pipes[0]) - - os.dup2(self.stderr_old, sys.stderr.fileno()) - os.close(self.stderr_old) - os.close(self.stderr_pipes[0]) - - # Free up resources (file descriptors) from the ProcessInfo object - # TODO: For some reason, this gives an error if the process has ended, - # although it does cause all descriptors still allocated to the - # object to be freed. - pi = None - - print ("Process finished, return code=%d, stdout=%d bytes, stderr=%d bytes" - % (rc, len(output), len(error)) ) - - return (rc, output, error) - - def test_alive(self): - """ - Simple test. Checks that b10-dhcp6 can be started and prints out info - about starting DHCPv6 operation. - """ - print("Note: Purpose of some of the tests is to check if DHCPv6 server can be started,") - print(" not that is can bind sockets correctly. Please ignore binding errors.") - (returncode, output, error) = self.runCommand(["../b10-dhcp6", "-v"]) - output_text = str(output) + str(error) - self.assertEqual(output_text.count("DHCP6_STARTING"), 1) - - def test_portnumber_0(self): - print("Check that specifying port number 0 is not allowed.") - - (returncode, output, error) = self.runCommand(['../b10-dhcp6', '-p', '0']) - - # When invalid port number is specified, return code must not be success - self.assertTrue(returncode != 0) - - # Check that there is an error message about invalid port number printed on stderr - self.assertEqual( str(error).count("Failed to parse port number"), 1) - - def test_portnumber_missing(self): - print("Check that -p option requires a parameter.") - - (returncode, output, error) = self.runCommand(['../b10-dhcp6', '-p']) - - # When invalid port number is specified, return code must not be success - self.assertTrue(returncode != 0) - - # Check that there is an error message about invalid port number printed on stderr - self.assertEqual( str(error).count("option requires an argument"), 1) - - def test_portnumber_invalid1(self): - print("Check that -p option is check against bogus port number (999999).") - - (returncode, output, error) = self.runCommand(['../b10-dhcp6', '-p','999999']) - - # When invalid port number is specified, return code must not be success - self.assertTrue(returncode != 0) - - # Check that there is an error message about invalid port number printed on stderr - self.assertEqual( str(error).count("Failed to parse port number"), 1) - - def test_portnumber_invalid2(self): - print("Check that -p option is check against bogus port number (123garbage).") - - (returncode, output, error) = self.runCommand(['../b10-dhcp6', '-p','123garbage']) - - # When invalid port number is specified, return code must not be success - self.assertTrue(returncode != 0) - - # Check that there is an error message about invalid port number printed on stderr - self.assertEqual( str(error).count("Failed to parse port number"), 1) - -if __name__ == '__main__': - unittest.main() diff --git a/src/lib/cc/.gitignore b/src/lib/cc/.gitignore index d375181484..50439e6a6b 100644 --- a/src/lib/cc/.gitignore +++ b/src/lib/cc/.gitignore @@ -1,6 +1,5 @@ /cc_messages.cc /cc_messages.h -/proto_defs.h /session_config.h /session_config.h.pre /s-messages diff --git a/src/lib/cc/Makefile.am b/src/lib/cc/Makefile.am index dad638cfdf..68c8547be6 100644 --- a/src/lib/cc/Makefile.am +++ b/src/lib/cc/Makefile.am @@ -23,7 +23,7 @@ nodist_libkea_cc_la_SOURCES += proto_defs.h libkea_cc_la_LIBADD = $(top_builddir)/src/lib/log/libkea-log.la CLEANFILES = *.gcno *.gcda session_config.h cc_messages.cc cc_messages.h \ - proto_defs.h s-messages + s-messages session_config.h: session_config.h.pre $(SED) -e "s|@@LOCALSTATEDIR@@|$(localstatedir)|" session_config.h.pre >$@ @@ -36,6 +36,8 @@ s-messages: cc_messages.mes BUILT_SOURCES = session_config.h cc_messages.cc cc_messages.h proto_defs.h +# This rule is here, but we added proto_defs.h to the git repo, +# so the script is no longer needed. proto_defs.h: $(top_srcdir)/src/lib/util/python/const2hdr.py proto_defs.cc $(PYTHON) $(top_srcdir)/src/lib/util/python/const2hdr.py $(srcdir)/proto_defs.cc $@ diff --git a/src/lib/cc/proto_defs.h b/src/lib/cc/proto_defs.h new file mode 100644 index 0000000000..d4f18ec40e --- /dev/null +++ b/src/lib/cc/proto_defs.h @@ -0,0 +1,73 @@ +// This file is generated from ./proto_defs.cc +// by the const2hdr.py script. +// Do not edit, all changes will be lost. + +// Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC") +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH +// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, +// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +// PERFORMANCE OF THIS SOFTWARE. + +#ifndef BIND10_COMMON_DEFS_H +#define BIND10_COMMON_DEFS_H + +// \file proto_defs.h +// \brief Common shared constants + +// This file contains common definitions of constasts used across the sources. +// It includes, but is not limited to the definitions of messages sent from +// one process to another. Since the names should be self-explanatory and +// the variables here are used mostly to synchronize the same values across +// multiple programs, separate documentation for each variable is not provided. + +namespace isc { +namespace cc { + +// Aside from defining the values for the C++ library, this file is also +// used as direct input of the generator of the python counterpart. Please, +// keep the syntax here simple and check the generated file +// (lib/python/isc/cc/proto_defs.py) is correct and sane. + +// The constants used in the CC protocol +// First the header names +extern const char* const CC_HEADER_TYPE; +extern const char* const CC_HEADER_FROM; +extern const char* const CC_HEADER_TO; +extern const char* const CC_HEADER_GROUP; +extern const char* const CC_HEADER_INSTANCE; +extern const char* const CC_HEADER_SEQ; +extern const char* const CC_HEADER_WANT_ANSWER; +extern const char* const CC_HEADER_REPLY; +// The commands in the "type" header +extern const char* const CC_COMMAND_SEND; +extern const char* const CC_COMMAND_SUBSCRIBE; +extern const char* const CC_COMMAND_UNSUBSCRIBE; +extern const char* const CC_COMMAND_GET_LNAME; +extern const char* const CC_COMMAND_PING; +extern const char* const CC_COMMAND_PONG; +extern const char* const CC_COMMAND_STOP; +// The wildcards of some headers +extern const char* const CC_TO_WILDCARD; +extern const char* const CC_INSTANCE_WILDCARD; +// Prefixes for groups +extern const char* const CC_GROUP_NOTIFICATION_PREFIX; +// Reply codes +extern const int CC_REPLY_NO_RECPT; +extern const int CC_REPLY_SUCCESS; +// Payload in the message +extern const char *const CC_PAYLOAD_LNAME; +extern const char *const CC_PAYLOAD_RESULT; +extern const char *const CC_PAYLOAD_COMMAND; +extern const char *const CC_PAYLOAD_NOTIFICATION; + +} +} +#endif diff --git a/src/lib/dns/gen-rdatacode.py.in b/src/lib/dns/gen-rdatacode.py.in index 1cb1e37da1..69e6f90e2f 100755 --- a/src/lib/dns/gen-rdatacode.py.in +++ b/src/lib/dns/gen-rdatacode.py.in @@ -19,6 +19,11 @@ This is a supplemental script to (half) auto-generate DNS Rdata related classes and constants. """ +# This script should be used every time existing RR data changes or when new +# RR types are added or existing are removed. Since DHCP uses only four +# (A,AAAA,PTR,DHCID) RR types, its usage is expected to be an uncommon event. +# The only envisaged use case is if/when we decide to trim down libdns++. + import os from os.path import getmtime import re diff --git a/src/lib/dns/tests/testdata/Makefile.am b/src/lib/dns/tests/testdata/Makefile.am index 88f8e06d68..0920e10a0a 100644 --- a/src/lib/dns/tests/testdata/Makefile.am +++ b/src/lib/dns/tests/testdata/Makefile.am @@ -195,5 +195,9 @@ EXTRA_DIST += tsig_verify4.wire tsig_verify5.wire tsig_verify6.wire EXTRA_DIST += tsig_verify7.wire tsig_verify8.wire tsig_verify9.wire EXTRA_DIST += tsig_verify10.wire -.spec.wire: - $(PYTHON) $(top_builddir)/src/lib/util/python/gen_wiredata.py -o $@ $< +# We no longer use gen_wiredata.py during build process, so the +# dependency is no longer needed. However, we'll keep this dependency +# commented till the gen_wiredata.py script is removed. + +#.spec.wire: +# $(PYTHON) $(top_builddir)/src/lib/util/python/gen_wiredata.py -o $@ $< diff --git a/src/lib/testutils/testdata/.gitignore b/src/lib/testutils/testdata/.gitignore index b2bb76ab08..eccc6a757f 100644 --- a/src/lib/testutils/testdata/.gitignore +++ b/src/lib/testutils/testdata/.gitignore @@ -1,16 +1,4 @@ /auth_test.sqlite3.copied -/badExampleQuery_fromWire.wire /does-not-exist.sqlite3 -/examplequery_fromWire.wire -/iquery_fromWire.wire -/iquery_response_fromWire.wire -/iqueryresponse_fromWire.wire -/multiquestion_fromWire.wire -/nsec3query_fromWire.wire -/nsec3query_nodnssec_fromWire.wire -/queryBadEDNS_fromWire.wire -/shortanswer_fromWire.wire -/simplequery_fromWire.wire -/simpleresponse_fromWire.wire /test1.zone.copied /test2.zone.copied diff --git a/src/lib/testutils/testdata/Makefile.am b/src/lib/testutils/testdata/Makefile.am index b9ef53f9f1..27a2439e9d 100644 --- a/src/lib/testutils/testdata/Makefile.am +++ b/src/lib/testutils/testdata/Makefile.am @@ -1,15 +1,18 @@ -CLEANFILES = *.wire *.copied +CLEANFILES = *.copied -BUILT_SOURCES = badExampleQuery_fromWire.wire examplequery_fromWire.wire -BUILT_SOURCES += iqueryresponse_fromWire.wire multiquestion_fromWire.wire -BUILT_SOURCES += queryBadEDNS_fromWire.wire shortanswer_fromWire.wire -BUILT_SOURCES += simplequery_fromWire.wire simpleresponse_fromWire.wire -BUILT_SOURCES += iquery_fromWire.wire iquery_response_fromWire.wire -BUILT_SOURCES += nsec3query_nodnssec_fromWire.wire nsec3query_fromWire.wire +# The following files used to be auto-generated using gen_wiredata.py, +# but #3413 removed python3 dependency and those files are now part +# of the git repo. +EXTRA_DIST = badExampleQuery_fromWire.wire examplequery_fromWire.wire +EXTRA_DIST += iqueryresponse_fromWire.wire multiquestion_fromWire.wire +EXTRA_DIST += queryBadEDNS_fromWire.wire shortanswer_fromWire.wire +EXTRA_DIST += simplequery_fromWire.wire simpleresponse_fromWire.wire +EXTRA_DIST += iquery_fromWire.wire iquery_response_fromWire.wire +EXTRA_DIST += nsec3query_nodnssec_fromWire.wire nsec3query_fromWire.wire # NOTE: keep this in sync with real file listing # so is included in tarball -EXTRA_DIST = badExampleQuery_fromWire.spec +EXTRA_DIST += badExampleQuery_fromWire.spec EXTRA_DIST += examplequery_fromWire.spec EXTRA_DIST += iqueryresponse_fromWire.spec EXTRA_DIST += multiquestion_fromWire.spec @@ -35,5 +38,6 @@ EXTRA_DIST += test1-broken.zone.in EXTRA_DIST += test2.zone.in EXTRA_DIST += test2-new.zone.in -.spec.wire: - $(PYTHON) $(top_builddir)/src/lib/util/python/gen_wiredata.py -o $@ $< +# We no longer require gen_wiredata.py script during builds. +#.spec.wire: +# $(PYTHON) $(top_builddir)/src/lib/util/python/gen_wiredata.py -o $@ $< diff --git a/src/lib/testutils/testdata/badExampleQuery_fromWire.wire b/src/lib/testutils/testdata/badExampleQuery_fromWire.wire new file mode 100644 index 0000000000..8ac642a085 --- /dev/null +++ b/src/lib/testutils/testdata/badExampleQuery_fromWire.wire @@ -0,0 +1,13 @@ +### +### This data file was auto-generated from badExampleQuery_fromWire.spec +### + +# Header Section +# ID=4149 QR=Query Opcode=QUERY(0) Rcode=NOERROR(0) +1035 0000 +# QDCNT=1, ANCNT=0, NSCNT=0, ARCNT=0 +0001 0000 0000 0000 + +# Question Section +# QNAME=broken.example.com QTYPE=AAAA(28) QCLASS=IN(1) +0662726f6b656e076578616d706c6503636f6d00 001c 0001 diff --git a/src/lib/testutils/testdata/examplequery_fromWire.wire b/src/lib/testutils/testdata/examplequery_fromWire.wire new file mode 100644 index 0000000000..52c64daea0 --- /dev/null +++ b/src/lib/testutils/testdata/examplequery_fromWire.wire @@ -0,0 +1,13 @@ +### +### This data file was auto-generated from examplequery_fromWire.spec +### + +# Header Section +# ID=4149 QR=Query Opcode=QUERY(0) Rcode=NOERROR(0) +1035 0000 +# QDCNT=1, ANCNT=0, NSCNT=0, ARCNT=0 +0001 0000 0000 0000 + +# Question Section +# QNAME=ns.example.com QTYPE=A(1) QCLASS=IN(1) +026e73076578616d706c6503636f6d00 0001 0001 diff --git a/src/lib/testutils/testdata/iquery_fromWire.wire b/src/lib/testutils/testdata/iquery_fromWire.wire new file mode 100644 index 0000000000..e5e3be8c5d --- /dev/null +++ b/src/lib/testutils/testdata/iquery_fromWire.wire @@ -0,0 +1,13 @@ +### +### This data file was auto-generated from iquery_fromWire.spec +### + +# Header Section +# ID=4149 QR=Query Opcode=IQUERY(1) Rcode=NOERROR(0) +1035 4000 +# QDCNT=1, ANCNT=0, NSCNT=0, ARCNT=0 +0001 0000 0000 0000 + +# Question Section +# QNAME=example.com. QTYPE=A(1) QCLASS=IN(1) +076578616d706c6503636f6d00 0001 0001 diff --git a/src/lib/testutils/testdata/iquery_response_fromWire.wire b/src/lib/testutils/testdata/iquery_response_fromWire.wire new file mode 100644 index 0000000000..d6312a7c0c --- /dev/null +++ b/src/lib/testutils/testdata/iquery_response_fromWire.wire @@ -0,0 +1,9 @@ +### +### This data file was auto-generated from iquery_response_fromWire.spec +### + +# Header Section +# ID=4149 QR=Response Opcode=IQUERY(1) Rcode=NOTIMP(4) +1035 c004 +# QDCNT=0, ANCNT=0, NSCNT=0, ARCNT=0 +0000 0000 0000 0000 diff --git a/src/lib/testutils/testdata/iqueryresponse_fromWire.wire b/src/lib/testutils/testdata/iqueryresponse_fromWire.wire new file mode 100644 index 0000000000..c322425460 --- /dev/null +++ b/src/lib/testutils/testdata/iqueryresponse_fromWire.wire @@ -0,0 +1,13 @@ +### +### This data file was auto-generated from iqueryresponse_fromWire.spec +### + +# Header Section +# ID=4149 QR=Response Opcode=IQUERY(1) Rcode=NOERROR(0) +1035 c000 +# QDCNT=1, ANCNT=0, NSCNT=0, ARCNT=0 +0001 0000 0000 0000 + +# Question Section +# QNAME=example.com. QTYPE=A(1) QCLASS=IN(1) +076578616d706c6503636f6d00 0001 0001 diff --git a/src/lib/testutils/testdata/multiquestion_fromWire.wire b/src/lib/testutils/testdata/multiquestion_fromWire.wire new file mode 100644 index 0000000000..f1710f6740 --- /dev/null +++ b/src/lib/testutils/testdata/multiquestion_fromWire.wire @@ -0,0 +1,17 @@ +### +### This data file was auto-generated from multiquestion_fromWire.spec +### + +# Header Section +# ID=4149 QR=Query Opcode=QUERY(0) Rcode=NOERROR(0) +1035 0000 +# QDCNT=2, ANCNT=0, NSCNT=0, ARCNT=0 +0002 0000 0000 0000 + +# Question Section +# QNAME=example.com. QTYPE=A(1) QCLASS=IN(1) +076578616d706c6503636f6d00 0001 0001 + +# Question Section +# QNAME=example.com. QTYPE=AAAA(28) QCLASS=IN(1) +076578616d706c6503636f6d00 001c 0001 diff --git a/src/lib/testutils/testdata/nsec3query_fromWire.wire b/src/lib/testutils/testdata/nsec3query_fromWire.wire new file mode 100644 index 0000000000..ec15780938 --- /dev/null +++ b/src/lib/testutils/testdata/nsec3query_fromWire.wire @@ -0,0 +1,19 @@ +### +### This data file was auto-generated from nsec3query_fromWire.spec +### + +# Header Section +# ID=4149 QR=Query Opcode=QUERY(0) Rcode=NOERROR(0) +1035 0000 +# QDCNT=1, ANCNT=0, NSCNT=0, ARCNT=1 +0001 0000 0000 0001 + +# Question Section +# QNAME=ns2.example QTYPE=A(1) QCLASS=IN(1) +036e7332076578616d706c6500 0001 0001 + +# EDNS OPT RR +# NAME=. TYPE=OPT(41) UDPSize=4096 ExtRcode=0 Version=0 DO=1 +00 0029 1000 0000 8000 +# RDLEN=0 +0000 diff --git a/src/lib/testutils/testdata/nsec3query_nodnssec_fromWire.wire b/src/lib/testutils/testdata/nsec3query_nodnssec_fromWire.wire new file mode 100644 index 0000000000..c8f0414a37 --- /dev/null +++ b/src/lib/testutils/testdata/nsec3query_nodnssec_fromWire.wire @@ -0,0 +1,13 @@ +### +### This data file was auto-generated from nsec3query_nodnssec_fromWire.spec +### + +# Header Section +# ID=4149 QR=Query Opcode=QUERY(0) Rcode=NOERROR(0) +1035 0000 +# QDCNT=1, ANCNT=0, NSCNT=0, ARCNT=0 +0001 0000 0000 0000 + +# Question Section +# QNAME=ns2.example QTYPE=A(1) QCLASS=IN(1) +036e7332076578616d706c6500 0001 0001 diff --git a/src/lib/testutils/testdata/queryBadEDNS_fromWire.wire b/src/lib/testutils/testdata/queryBadEDNS_fromWire.wire new file mode 100644 index 0000000000..a19858067f --- /dev/null +++ b/src/lib/testutils/testdata/queryBadEDNS_fromWire.wire @@ -0,0 +1,19 @@ +### +### This data file was auto-generated from queryBadEDNS_fromWire.spec +### + +# Header Section +# ID=4149 QR=Query Opcode=QUERY(0) Rcode=NOERROR(0) +1035 0000 +# QDCNT=1, ANCNT=0, NSCNT=0, ARCNT=1 +0001 0000 0000 0001 + +# Question Section +# QNAME=example.com. QTYPE=A(1) QCLASS=IN(1) +076578616d706c6503636f6d00 0001 0001 + +# EDNS OPT RR +# NAME=. TYPE=OPT(41) UDPSize=4096 ExtRcode=0 Version=1 DO=1 +00 0029 1000 0001 8000 +# RDLEN=0 +0000 diff --git a/src/lib/testutils/testdata/shortanswer_fromWire.wire b/src/lib/testutils/testdata/shortanswer_fromWire.wire new file mode 100644 index 0000000000..9f3624c5fd --- /dev/null +++ b/src/lib/testutils/testdata/shortanswer_fromWire.wire @@ -0,0 +1,13 @@ +### +### This data file was auto-generated from shortanswer_fromWire.spec +### + +# Header Section +# ID=4149 QR=Query Opcode=QUERY(0) Rcode=NOERROR(0) +1035 0000 +# QDCNT=1, ANCNT=0, NSCNT=0, ARCNT=1 +0001 0000 0000 0001 + +# Question Section +# QNAME=example.com. QTYPE=A(1) QCLASS=IN(1) +076578616d706c6503636f6d00 0001 0001 diff --git a/src/lib/testutils/testdata/simplequery_fromWire.wire b/src/lib/testutils/testdata/simplequery_fromWire.wire new file mode 100644 index 0000000000..e5e7b946f0 --- /dev/null +++ b/src/lib/testutils/testdata/simplequery_fromWire.wire @@ -0,0 +1,13 @@ +### +### This data file was auto-generated from simplequery_fromWire.spec +### + +# Header Section +# ID=4149 QR=Query Opcode=QUERY(0) Rcode=NOERROR(0) +1035 0000 +# QDCNT=1, ANCNT=0, NSCNT=0, ARCNT=0 +0001 0000 0000 0000 + +# Question Section +# QNAME=example.com. QTYPE=A(1) QCLASS=IN(1) +076578616d706c6503636f6d00 0001 0001 diff --git a/src/lib/testutils/testdata/simpleresponse_fromWire.wire b/src/lib/testutils/testdata/simpleresponse_fromWire.wire new file mode 100644 index 0000000000..ac3c2e5c4b --- /dev/null +++ b/src/lib/testutils/testdata/simpleresponse_fromWire.wire @@ -0,0 +1,13 @@ +### +### This data file was auto-generated from simpleresponse_fromWire.spec +### + +# Header Section +# ID=4149 QR=Response Opcode=QUERY(0) Rcode=NOERROR(0) +1035 8000 +# QDCNT=1, ANCNT=0, NSCNT=0, ARCNT=0 +0001 0000 0000 0000 + +# Question Section +# QNAME=example.com. QTYPE=A(1) QCLASS=IN(1) +076578616d706c6503636f6d00 0001 0001