Commit fd0aa336 authored by Likun Zhang's avatar Likun Zhang
Browse files

Merge trunk back to this branch

git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac364@3374 e5f2f494-b856-4b98-b285-d166d9295462
parents e7b430cc f8b62f49
105. [func]* zhanglikun 113. [func]* zhanglikun
Folder name 'utils'(the folder in /src/lib/python/isc/) has been Folder name 'utils'(the folder in /src/lib/python/isc/) has been
renamed to 'util'. Programs that used 'import isc.utils.process' renamed to 'util'. Programs that used 'import isc.utils.process'
now need to use 'import isc.util.process'. The folder now need to use 'import isc.util.process'. The folder
/src/lib/python/isc/Util is removed since it isn't used by any /src/lib/python/isc/Util is removed since it isn't used by any
program. (Trac #364, rTBD) program. (Trac #364, rTBD)
112. [func] zhang likun
Add one mixin class to override the naive serve_forever() provided
in python library socketserver. Instead of polling for shutdwon
every poll_interval seconds, one socketpair is used to wake up
the waiting server.(Trac #352, svn r3366)
111. [bug]* zhanglikun, Michal Vaner
Make sure process xfrin/xfrout/zonemgr/cmdctl can be stoped
properly when user enter "ctrl+c" or 'Boss shutdown' command
through bindctl.
The ZonemgrRefresh.run_timer and NotifyOut.dispatcher spawn
a thread themselves.
(Trac #335, svn r3273)
110. [func] Michal Vaner
Added isc.net.check module to check ip addresses and ports for
correctness and isc.net.addr to hold IP address. The bind10, xfrin
and cmdctl programs are modified to use it.
(Trac #353, svn r3240)
109. [func] naokikambe
Added the initial version of the stats module for the statistics
feature of BIND 10, which supports the restricted features and
items and reports via bindctl command (Trac #191, r3218)
Added the document of the stats module, which is about how stats
module collects the data (Trac #170, [wiki:StatsModule])
108. [func] jerry
src/bin/zonemgr: Provide customizable configurations for
lowerbound_refresh, lowerbound_retry, max_transfer_timeout and
jitter_scope. (Trac #340, r3205)
107. [func] zhang likun
Remove the parameter 'db_file' for command 'retransfer' of
xfrin module. xfrin.spec will not be generated by script.
(Trac #329, r3171)
106. [bug] zhang likun
When xfrin can't connect with one zone's master, it should tell
the bad news to zonemgr, so that zonemgr can reset the timer for
that zone. (Trac #329, r3170)
105. [bug] Michal Vaner
Python processes: they no longer take 100% CPU while idle
due to a busy loop in reading command session in a nonblocking way.
(Trac #349, svn r3153), (Trac #382, svn r3294)
104. [bug] jerry 104. [bug] jerry
bin/zonemgr: zonemgr should be attempting to refresh expired zones. bin/zonemgr: zonemgr should be attempting to refresh expired zones.
(Trac #336, r3139) (Trac #336, r3139)
103. [bug] jerry 103. [bug] jerry
lib/python/isc/log: Fixed an issue with python logging, lib/python/isc/log: Fixed an issue with python logging,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script. # Process this file with autoconf to produce a configure script.
AC_PREREQ([2.59]) AC_PREREQ([2.59])
AC_INIT(bind10-devel, 20100701, bind10-dev@isc.org) AC_INIT(bind10-devel, 20101013, bind10-dev@isc.org)
AC_CONFIG_SRCDIR(README) AC_CONFIG_SRCDIR(README)
AM_INIT_AUTOMAKE AM_INIT_AUTOMAKE
AC_CONFIG_HEADERS([config.h]) AC_CONFIG_HEADERS([config.h])
...@@ -261,7 +261,6 @@ AC_ARG_WITH(gtest, ...@@ -261,7 +261,6 @@ AC_ARG_WITH(gtest,
[ --with-gtest=PATH specify a path to gtest header files (PATH/include) and library (PATH/lib)], [ --with-gtest=PATH specify a path to gtest header files (PATH/include) and library (PATH/lib)],
gtest_path="$withval", gtest_path="no") gtest_path="$withval", gtest_path="no")
USE_LCOV="no" USE_LCOV="no"
if test "$lcov" != "no"; then if test "$lcov" != "no"; then
# force gtest if not set # force gtest if not set
...@@ -435,7 +434,7 @@ if test "X$ac_cv_have_devpoll" = "Xyes" -a "X$GXX" = "Xyes"; then ...@@ -435,7 +434,7 @@ if test "X$ac_cv_have_devpoll" = "Xyes" -a "X$GXX" = "Xyes"; then
fi fi
AC_ARG_ENABLE(man, [AC_HELP_STRING([--enable-man], AC_ARG_ENABLE(man, [AC_HELP_STRING([--enable-man],
[regenerate man pages [default=no]])] ,enable_man=yes, enable_man=no) [regenerate man pages [default=no]])], enable_man=yes, enable_man=no)
AM_CONDITIONAL(ENABLE_MAN, test x$enable_man != xno) AM_CONDITIONAL(ENABLE_MAN, test x$enable_man != xno)
...@@ -472,6 +471,13 @@ AC_CONFIG_FILES([Makefile ...@@ -472,6 +471,13 @@ AC_CONFIG_FILES([Makefile
src/bin/xfrout/tests/Makefile src/bin/xfrout/tests/Makefile
src/bin/zonemgr/Makefile src/bin/zonemgr/Makefile
src/bin/zonemgr/tests/Makefile src/bin/zonemgr/tests/Makefile
src/bin/stats/Makefile
src/bin/stats/tests/Makefile
src/bin/stats/tests/isc/Makefile
src/bin/stats/tests/isc/cc/Makefile
src/bin/stats/tests/isc/config/Makefile
src/bin/stats/tests/isc/util/Makefile
src/bin/stats/tests/testdata/Makefile
src/bin/usermgr/Makefile src/bin/usermgr/Makefile
src/bin/tests/Makefile src/bin/tests/Makefile
src/lib/Makefile src/lib/Makefile
...@@ -491,6 +497,8 @@ AC_CONFIG_FILES([Makefile ...@@ -491,6 +497,8 @@ AC_CONFIG_FILES([Makefile
src/lib/python/isc/config/tests/Makefile src/lib/python/isc/config/tests/Makefile
src/lib/python/isc/log/Makefile src/lib/python/isc/log/Makefile
src/lib/python/isc/log/tests/Makefile src/lib/python/isc/log/tests/Makefile
src/lib/python/isc/net/Makefile
src/lib/python/isc/net/tests/Makefile
src/lib/python/isc/notify/Makefile src/lib/python/isc/notify/Makefile
src/lib/python/isc/notify/tests/Makefile src/lib/python/isc/notify/tests/Makefile
src/lib/config/Makefile src/lib/config/Makefile
...@@ -515,7 +523,6 @@ AC_OUTPUT([src/bin/cfgmgr/b10-cfgmgr.py ...@@ -515,7 +523,6 @@ AC_OUTPUT([src/bin/cfgmgr/b10-cfgmgr.py
src/bin/cmdctl/cmdctl.spec.pre src/bin/cmdctl/cmdctl.spec.pre
src/bin/xfrin/tests/xfrin_test src/bin/xfrin/tests/xfrin_test
src/bin/xfrin/xfrin.py src/bin/xfrin/xfrin.py
src/bin/xfrin/xfrin.spec.pre
src/bin/xfrin/run_b10-xfrin.sh src/bin/xfrin/run_b10-xfrin.sh
src/bin/xfrout/xfrout.py src/bin/xfrout/xfrout.py
src/bin/xfrout/xfrout.spec.pre src/bin/xfrout/xfrout.spec.pre
...@@ -525,6 +532,12 @@ AC_OUTPUT([src/bin/cfgmgr/b10-cfgmgr.py ...@@ -525,6 +532,12 @@ AC_OUTPUT([src/bin/cfgmgr/b10-cfgmgr.py
src/bin/zonemgr/zonemgr.spec.pre src/bin/zonemgr/zonemgr.spec.pre
src/bin/zonemgr/tests/zonemgr_test src/bin/zonemgr/tests/zonemgr_test
src/bin/zonemgr/run_b10-zonemgr.sh src/bin/zonemgr/run_b10-zonemgr.sh
src/bin/stats/stats.py
src/bin/stats/stats_stub.py
src/bin/stats/stats.spec.pre
src/bin/stats/run_b10-stats.sh
src/bin/stats/run_b10-stats_stub.sh
src/bin/stats/tests/stats_test
src/bin/bind10/bind10.py src/bin/bind10/bind10.py
src/bin/bind10/tests/bind10_test src/bin/bind10/tests/bind10_test
src/bin/bind10/run_bind10.sh src/bin/bind10/run_bind10.sh
...@@ -558,6 +571,9 @@ AC_OUTPUT([src/bin/cfgmgr/b10-cfgmgr.py ...@@ -558,6 +571,9 @@ AC_OUTPUT([src/bin/cfgmgr/b10-cfgmgr.py
chmod +x src/bin/xfrin/run_b10-xfrin.sh chmod +x src/bin/xfrin/run_b10-xfrin.sh
chmod +x src/bin/xfrout/run_b10-xfrout.sh chmod +x src/bin/xfrout/run_b10-xfrout.sh
chmod +x src/bin/zonemgr/run_b10-zonemgr.sh chmod +x src/bin/zonemgr/run_b10-zonemgr.sh
chmod +x src/bin/stats/tests/stats_test
chmod +x src/bin/stats/run_b10-stats.sh
chmod +x src/bin/stats/run_b10-stats_stub.sh
chmod +x src/bin/bind10/run_bind10.sh chmod +x src/bin/bind10/run_bind10.sh
chmod +x src/bin/cmdctl/tests/cmdctl_test chmod +x src/bin/cmdctl/tests/cmdctl_test
chmod +x src/bin/xfrin/tests/xfrin_test chmod +x src/bin/xfrin/tests/xfrin_test
......
SUBDIRS = bind10 bindctl cfgmgr loadzone msgq host cmdctl auth xfrin xfrout \ SUBDIRS = bind10 bindctl cfgmgr loadzone msgq host cmdctl auth xfrin xfrout \
usermgr zonemgr tests usermgr zonemgr stats tests
check-recursive: all-recursive check-recursive: all-recursive
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
using namespace std; using namespace std;
using namespace isc; using namespace isc;
using namespace isc::data;
using namespace isc::dns; using namespace isc::dns;
using namespace isc::xfr; using namespace isc::xfr;
using namespace isc::bench; using namespace isc::bench;
......
...@@ -4,7 +4,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib ...@@ -4,7 +4,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
AM_CPPFLAGS += -I$(top_builddir)/src/lib/dns -I$(top_srcdir)/src/bin AM_CPPFLAGS += -I$(top_builddir)/src/lib/dns -I$(top_srcdir)/src/bin
AM_CPPFLAGS += -I$(top_builddir)/src/lib/cc AM_CPPFLAGS += -I$(top_builddir)/src/lib/cc
AM_CPPFLAGS += -DTEST_DATA_DIR=\"$(srcdir)/testdata\" AM_CPPFLAGS += -DTEST_DATA_DIR=\"$(srcdir)/testdata\"
AM_CPPFLAGS += -DTEST_DATA_BUILDDIR=\"$(top_builddir)/src/bin/auth/tests/testdata\" AM_CPPFLAGS += -DTEST_DATA_BUILDDIR=\"$(abs_top_builddir)/src/bin/auth/tests/testdata\"
AM_CXXFLAGS = $(B10_CXXFLAGS) AM_CXXFLAGS = $(B10_CXXFLAGS)
......
...@@ -19,8 +19,7 @@ ...@@ -19,8 +19,7 @@
#include <dns/tests/unittest_util.h> #include <dns/tests/unittest_util.h>
int int
main(int argc, char* argv[]) main(int argc, char* argv[]) {
{
::testing::InitGoogleTest(&argc, argv); ::testing::InitGoogleTest(&argc, argv);
isc::UnitTestUtil::addDataPath(TEST_DATA_DIR); isc::UnitTestUtil::addDataPath(TEST_DATA_DIR);
isc::UnitTestUtil::addDataPath(TEST_DATA_BUILDDIR); isc::UnitTestUtil::addDataPath(TEST_DATA_BUILDDIR);
......
...@@ -64,6 +64,7 @@ import posix ...@@ -64,6 +64,7 @@ import posix
import isc.cc import isc.cc
import isc.util.process import isc.util.process
import isc.net.parse
# Assign this process some longer name # Assign this process some longer name
isc.util.process.rename(sys.argv[0]) isc.util.process.rename(sys.argv[0])
...@@ -73,6 +74,9 @@ isc.util.process.rename(sys.argv[0]) ...@@ -73,6 +74,9 @@ isc.util.process.rename(sys.argv[0])
# number, and the overall BIND 10 version number (set in configure.ac). # number, and the overall BIND 10 version number (set in configure.ac).
VERSION = "bind10 20100916 (BIND 10 @PACKAGE_VERSION@)" VERSION = "bind10 20100916 (BIND 10 @PACKAGE_VERSION@)"
# This is for bind10.boottime of stats module
_BASETIME = time.gmtime()
class RestartSchedule: class RestartSchedule:
""" """
Keeps state when restarting something (in this case, a process). Keeps state when restarting something (in this case, a process).
...@@ -180,35 +184,10 @@ class ProcessInfo: ...@@ -180,35 +184,10 @@ class ProcessInfo:
def respawn(self): def respawn(self):
self._spawn() self._spawn()
class IPAddr:
"""Stores an IPv4 or IPv6 address."""
family = None
addr = None
def __init__(self, addr):
try:
a = socket.inet_pton(socket.AF_INET, addr)
self.family = socket.AF_INET
self.addr = a
return
except:
pass
try:
a = socket.inet_pton(socket.AF_INET6, addr)
self.family = socket.AF_INET6
self.addr = a
return
except Exception as e:
raise e
def __str__(self):
return socket.inet_ntop(self.family, self.addr)
class BoB: class BoB:
"""Boss of BIND class.""" """Boss of BIND class."""
def __init__(self, msgq_socket_file=None, auth_port=5300, address='', def __init__(self, msgq_socket_file=None, auth_port=5300, address=None,
nocache=False, verbose=False, setuid=None, username=None): nocache=False, verbose=False, setuid=None, username=None):
"""Initialize the Boss of BIND. This is a singleton (only one """Initialize the Boss of BIND. This is a singleton (only one
can run). can run).
...@@ -222,7 +201,7 @@ class BoB: ...@@ -222,7 +201,7 @@ class BoB:
self.auth_port = auth_port self.auth_port = auth_port
self.address = None self.address = None
if address: if address:
self.address = IPAddr(address) self.address = address
self.cc_session = None self.cc_session = None
self.ccs = None self.ccs = None
self.processes = {} self.processes = {}
...@@ -424,6 +403,27 @@ class BoB: ...@@ -424,6 +403,27 @@ class BoB:
sys.stdout.write("[bind10] Started b10-zonemgr(PID %d)\n" % sys.stdout.write("[bind10] Started b10-zonemgr(PID %d)\n" %
zonemgr.pid) zonemgr.pid)
# start b10-stats
stats_args = ['b10-stats']
if self.verbose:
sys.stdout.write("[bind10] Starting b10-stats\n")
stats_args += ['-v']
try:
statsd = ProcessInfo("b10-stats", stats_args,
c_channel_env)
except Exception as e:
c_channel.process.kill()
bind_cfgd.process.kill()
xfrout.process.kill()
auth.process.kill()
xfrind.process.kill()
zonemgr.process.kill()
return "Unable to start b10-stats; " + str(e)
self.processes[statsd.pid] = statsd
if self.verbose:
sys.stdout.write("[bind10] Started b10-stats (PID %d)\n" % statsd.pid)
# start the b10-cmdctl # start the b10-cmdctl
# XXX: we hardcode port 8080 # XXX: we hardcode port 8080
cmdctl_args = ['b10-cmdctl'] cmdctl_args = ['b10-cmdctl']
...@@ -440,6 +440,7 @@ class BoB: ...@@ -440,6 +440,7 @@ class BoB:
auth.process.kill() auth.process.kill()
xfrind.process.kill() xfrind.process.kill()
zonemgr.process.kill() zonemgr.process.kill()
statsd.process.kill()
return "Unable to start b10-cmdctl; " + str(e) return "Unable to start b10-cmdctl; " + str(e)
self.processes[cmd_ctrld.pid] = cmd_ctrld self.processes[cmd_ctrld.pid] = cmd_ctrld
if self.verbose: if self.verbose:
...@@ -453,12 +454,13 @@ class BoB: ...@@ -453,12 +454,13 @@ class BoB:
def stop_all_processes(self): def stop_all_processes(self):
"""Stop all processes.""" """Stop all processes."""
cmd = { "command": ['shutdown']} cmd = { "command": ['shutdown']}
self.cc_session.group_sendmsg(cmd, 'Boss', 'Cmdctl') self.cc_session.group_sendmsg(cmd, 'Cmdctl', 'Cmdctl')
self.cc_session.group_sendmsg(cmd, "Boss", "ConfigManager") self.cc_session.group_sendmsg(cmd, "ConfigManager", "ConfigManager")
self.cc_session.group_sendmsg(cmd, "Boss", "Auth") self.cc_session.group_sendmsg(cmd, "Auth", "Auth")
self.cc_session.group_sendmsg(cmd, "Boss", "Xfrout") self.cc_session.group_sendmsg(cmd, "Xfrout", "Xfrout")
self.cc_session.group_sendmsg(cmd, "Boss", "Xfrin") self.cc_session.group_sendmsg(cmd, "Xfrin", "Xfrin")
self.cc_session.group_sendmsg(cmd, "Boss", "Zonemgr") self.cc_session.group_sendmsg(cmd, "Zonemgr", "Zonemgr")
self.cc_session.group_sendmsg(cmd, "Boss", "Stats")
def stop_process(self, process): def stop_process(self, process):
"""Stop the given process, friendly-like.""" """Stop the given process, friendly-like."""
...@@ -475,7 +477,9 @@ class BoB: ...@@ -475,7 +477,9 @@ class BoB:
except: except:
pass pass
# XXX: some delay probably useful... how much is uncertain # XXX: some delay probably useful... how much is uncertain
time.sleep(0.5) # I have changed the delay from 0.5 to 1, but sometime it's
# still not enough.
time.sleep(1)
self.reap_children() self.reap_children()
# next try sending a SIGTERM # next try sending a SIGTERM
processes_to_stop = list(self.processes.values()) processes_to_stop = list(self.processes.values())
...@@ -582,7 +586,7 @@ def reaper(signal_number, stack_frame): ...@@ -582,7 +586,7 @@ def reaper(signal_number, stack_frame):
# the Python signal handler has been set up to write # the Python signal handler has been set up to write
# down a pipe, waking up our select() bit # down a pipe, waking up our select() bit
pass pass
def get_signame(signal_number): def get_signame(signal_number):
"""Return the symbolic name for a signal.""" """Return the symbolic name for a signal."""
for sig in dir(signal): for sig in dir(signal):
...@@ -604,26 +608,24 @@ def fatal_signal(signal_number, stack_frame): ...@@ -604,26 +608,24 @@ def fatal_signal(signal_number, stack_frame):
def check_port(option, opt_str, value, parser): def check_port(option, opt_str, value, parser):
"""Function to insure that the port we are passed is actually """Function to insure that the port we are passed is actually
a valid port number. Used by OptionParser() on startup.""" a valid port number. Used by OptionParser() on startup."""
if not re.match('^(6553[0-5]|655[0-2]\d|65[0-4]\d\d|6[0-4]\d{3}|[1-5]\d{4}|[1-9]\d{0,3}|0)$', value): try:
raise OptionValueError("%s requires a port number (0-65535)" % opt_str) if opt_str in ['-p', '--port']:
if (opt_str == '-m' or opt_str == '--msgq-port'): parser.values.auth_port = isc.net.parse.port_parse(value)
parser.values.msgq_port = value else:
elif (opt_str == '-p' or opt_str == '--port'): raise OptionValueError("Unknown option " + opt_str)
parser.values.auth_port = value except ValueError as e:
else: raise OptionValueError(str(e))
raise OptionValueError("Unknown option " + opt_str)
def check_addr(option, opt_str, value, parser): def check_addr(option, opt_str, value, parser):
"""Function to insure that the address we are passed is actually """Function to insure that the address we are passed is actually
a valid address. Used by OptionParser() on startup.""" a valid address. Used by OptionParser() on startup."""
try: try:
IPAddr(value) if opt_str in ['-a', '--address']:
except: parser.values.address = isc.net.parse.addr_parse(value)
else:
raise OptionValueError("Unknown option " + opt_str)
except ValueError:
raise OptionValueError("%s requires a valid IPv4 or IPv6 address" % opt_str) raise OptionValueError("%s requires a valid IPv4 or IPv6 address" % opt_str)
if (opt_str == '-a' or opt_str == '--address'):
parser.values.address = value
else:
raise OptionValueError("Unknown option " + opt_str)
def process_rename(option, opt_str, value, parser): def process_rename(option, opt_str, value, parser):
"""Function that renames the process if it is requested by a option.""" """Function that renames the process if it is requested by a option."""
...@@ -646,8 +648,8 @@ def main(): ...@@ -646,8 +648,8 @@ def main():
help="UNIX domain socket file the b10-msgq daemon will use") help="UNIX domain socket file the b10-msgq daemon will use")
parser.add_option("-n", "--no-cache", action="store_true", dest="nocache", parser.add_option("-n", "--no-cache", action="store_true", dest="nocache",
default=False, help="disable hot-spot cache in b10-auth") default=False, help="disable hot-spot cache in b10-auth")
parser.add_option("-p", "--port", dest="auth_port", type="string", parser.add_option("-p", "--port", dest="auth_port", type="int",
action="callback", callback=check_port, default="5300", action="callback", callback=check_port, default=5300,
help="port the b10-auth daemon will use (default 5300)") help="port the b10-auth daemon will use (default 5300)")
parser.add_option("-u", "--user", dest="user", parser.add_option("-u", "--user", dest="user",
type="string", default=None, type="string", default=None,
...@@ -710,8 +712,11 @@ def main(): ...@@ -710,8 +712,11 @@ def main():
signal.signal(signal.SIGINT, fatal_signal) signal.signal(signal.SIGINT, fatal_signal)
signal.signal(signal.SIGTERM, fatal_signal) signal.signal(signal.SIGTERM, fatal_signal)
# Block SIGPIPE, as we don't want it to end this process
signal.signal(signal.SIGPIPE, signal.SIG_IGN)
# Go bob! # Go bob!
boss_of_bind = BoB(options.msgq_socket_file, int(options.auth_port), boss_of_bind = BoB(options.msgq_socket_file, options.auth_port,
options.address, options.nocache, options.verbose, options.address, options.nocache, options.verbose,
setuid, username) setuid, username)
startup_result = boss_of_bind.startup() startup_result = boss_of_bind.startup()
...@@ -720,6 +725,17 @@ def main(): ...@@ -720,6 +725,17 @@ def main():
sys.exit(1) sys.exit(1)
sys.stdout.write("[bind10] BIND 10 started\n") sys.stdout.write("[bind10] BIND 10 started\n")
# send "bind10.boot_time" to b10-stats
time.sleep(1) # wait a second
if options.verbose:
sys.stdout.write("[bind10] send \"bind10.boot_time\" to b10-stats\n")
cmd = isc.config.ccsession.create_command('set',
{ "stats_data": {
'bind10.boot_time': time.strftime('%Y-%m-%dT%H:%M:%SZ', _BASETIME)
}
})
boss_of_bind.cc_session.group_sendmsg(cmd, 'Stats')
# In our main loop, we check for dead processes or messages # In our main loop, we check for dead processes or messages
# on the c-channel. # on the c-channel.
wakeup_fd = wakeup_pipe[0] wakeup_fd = wakeup_pipe[0]
......
...@@ -20,7 +20,7 @@ export PYTHON_EXEC ...@@ -20,7 +20,7 @@ export PYTHON_EXEC
BIND10_PATH=@abs_top_builddir@/src/bin/bind10 BIND10_PATH=@abs_top_builddir@/src/bin/bind10
PATH=@abs_top_builddir@/src/bin/msgq:@abs_top_builddir@/src/bin/auth:@abs_top_builddir@/src/bin/cfgmgr:@abs_top_builddir@/src/bin/cmdctl:@abs_top_builddir@/src/bin/xfrin:@abs_top_builddir@/src/bin/xfrout:@abs_top_builddir@/src/bin/zonemgr:$PATH PATH=@abs_top_builddir@/src/bin/msgq:@abs_top_builddir@/src/bin/auth:@abs_top_builddir@/src/bin/cfgmgr:@abs_top_builddir@/src/bin/cmdctl:@abs_top_builddir@/src/bin/stats:@abs_top_builddir@/src/bin/xfrin:@abs_top_builddir@/src/bin/xfrout:@abs_top_builddir@/src/bin/zonemgr:$PATH
export PATH export PATH
PYTHONPATH=@abs_top_builddir@/src/lib/python:@abs_top_builddir@/src/lib/dns/python/.libs:@abs_top_builddir@/src/lib/xfr/.libs PYTHONPATH=@abs_top_builddir@/src/lib/python:@abs_top_builddir@/src/lib/dns/python/.libs:@abs_top_builddir@/src/lib/xfr/.libs
......
from bind10 import ProcessInfo, BoB, IPAddr from bind10 import ProcessInfo, BoB
# XXX: environment tests are currently disabled, due to the preprocessor # XXX: environment tests are currently disabled, due to the preprocessor
# setup that we have now complicating the environment # setup that we have now complicating the environment
...@@ -8,6 +8,7 @@ import sys ...@@ -8,6 +8,7 @@ import sys
import os import os
import signal import signal
import socket import socket
from isc.net.addr import IPAddr
class TestProcessInfo(unittest.TestCase): class TestProcessInfo(unittest.TestCase):
def setUp(self): def setUp(self):
...@@ -72,28 +73,6 @@ class TestProcessInfo(unittest.TestCase): ...@@ -72,28 +73,6 @@ class TestProcessInfo(unittest.TestCase):
self.assertTrue(type(pi.pid) is int) self.assertTrue(type(pi.pid) is int)
self.assertNotEqual(pi.pid, old_pid) self.assertNotEqual(pi.pid, old_pid)
class TestIPAddr(unittest.TestCase):
def test_v6ok(self):
addr = IPAddr('2001:4f8::1')
self.assertEqual(addr.family, socket.AF_INET6)
self.assertEqual(addr.addr, socket.inet_pton(socket.AF_INET6, '2001:4f8::1'))
def test_v4ok(self):
addr = IPAddr('127.127.127.127')
self.assertEqual(addr.family, socket.AF_INET)
self.assertEqual(addr.addr, socket.inet_aton('127.127.127.127'))
def test_badaddr(self):
self.assertRaises(socket.error, IPAddr, 'foobar')
self.assertRaises(socket.error, IPAddr, 'foo::bar')
self.assertRaises(socket.error, IPAddr, '123')
self.assertRaises(socket.error, IPAddr, '123.456.789.0')
self.assertRaises(socket.error, IPAddr, '127/8')
self.assertRaises(socket.error, IPAddr, '0/0')
self.assertRaises(socket.error, IPAddr, '1.2.3.4/32')
self.assertRaises(socket.error, IPAddr, '0')
self.assertRaises(socket.error, IPAddr, '')
class TestBoB(unittest.TestCase): class TestBoB(unittest.TestCase):
def test_init(self): def test_init(self):
bob = BoB() bob = BoB()
...@@ -127,7 +106,7 @@ class TestBoB(unittest.TestCase): ...@@ -127,7 +106,7 @@ class TestBoB(unittest.TestCase):
self.assertEqual(bob.runnable, False) self.assertEqual(bob.runnable, False)
def test_init_alternate_address(self): def test_init_alternate_address(self):
bob = BoB(None, 5300, '127.127.127.127') bob = BoB(None, 5300, IPAddr('127.127.127.127'))
self.assertEqual(bob.verbose, False) self.assertEqual(bob.verbose, False)
self.assertEqual(bob.auth_port, 5300) self.assertEqual(bob.auth_port, 5300)
self.assertEqual(bob.msgq_socket_file, None) self.assertEqual(bob.msgq_socket_file, None)
......
...@@ -15,7 +15,7 @@ CMDCTL_CONFIGURATIONS += cmdctl-keyfile.pem cmdctl-certfile.pem ...@@ -15,7 +15,7 @@ CMDCTL_CONFIGURATIONS += cmdctl-keyfile.pem cmdctl-certfile.pem
b10_cmdctl_DATA = $(CMDCTL_CONFIGURATIONS) b10_cmdctl_DATA = $(CMDCTL_CONFIGURATIONS)
b10_cmdctl_DATA += cmdctl.spec b10_cmdctl_DATA += cmdctl.spec
EXTRA_DIST = $(CMDCTL_CONFIGURATIONS) EXTRA_DIST = $(CMDCTL_CONFIGURATIONS)
CLEANFILES= b10-cmdctl cmdctl.pyc cmdctl.spec CLEANFILES= b10-cmdctl cmdctl.pyc cmdctl.spec
......
#!@PYTHON@ #!@PYTHON@
# Copyright (C) 2010 Internet Systems Consortium. # Copyright (C) 2010 Internet Systems Consortium.
# Copyright (C) 2010 CZ NIC
# #
# Permission to use, copy, modify, and distribute this software for any # Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above # purpose with or without fee is hereby granted, provided that the above
...@@ -43,8 +44,11 @@ import time ...@@ -43,8 +44,11 @@ import time
import signal import signal
from isc.config import ccsession from isc.config import ccsession
import isc.util.process import isc.util.process
import isc.net.parse
from optparse import OptionParser, OptionValueError from optparse import OptionParser, OptionValueError
from hashlib import sha1